--- a/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -394,3 +394,5 @@
cf139f925da04c8bd7efd33270a0315d72b338d3 jdk-9+149
17469f16fbb406ec9f0dd262ce776ab6efbc38f1 jdk-9+150
37b95df0042ae0687324e1f7dc4a2519e230e704 jdk-9+151
+ab2c8b03c3284fcbdd157551a66f807e3a182d9b jdk-9+152
+d7034ff7f8e257e81c9f95c7785dd4eaaa3c2afc jdk-9+153
--- a/.hgtags-top-repo Mon Jan 23 19:58:06 2017 +0300
+++ b/.hgtags-top-repo Mon Jan 23 10:27:58 2017 -0800
@@ -394,3 +394,5 @@
b119012d1c2ab2570fe8718633840d0c1f1f441d jdk-9+149
6234069ff9789f7582e1faa32cb6283cbd1a5a2d jdk-9+150
71a766d4c18041a7f833ee22823125b02e1a7f1e jdk-9+151
+ef056360ddf3977d7d2ddbeb456a4d612d19ea05 jdk-9+152
+816a6d03a7c44edfbd8780110529f1bdc3964fb9 jdk-9+153
--- a/common/autoconf/basics.m4 Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/basics.m4 Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -1011,6 +1011,8 @@
# Test which kind of tar was found
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
TAR_TYPE="gnu"
+ elif test "x$($TAR --version | $GREP "bsdtar")" != "x"; then
+ TAR_TYPE="bsd"
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
TAR_TYPE="bsd"
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
@@ -1038,12 +1040,36 @@
AC_SUBST(TAR_SUPPORTS_TRANSFORM)
])
+AC_DEFUN([BASIC_CHECK_GREP],
+[
+ # Test that grep supports -Fx with a list of pattern which includes null pattern.
+ # This is a problem for the grep resident on AIX.
+ AC_MSG_CHECKING([that grep ($GREP) -Fx handles empty lines in the pattern list correctly])
+ # Multiple subsequent spaces..
+ STACK_SPACES='aaa bbb ccc'
+ # ..converted to subsequent newlines, causes STACK_LIST to be a list with some empty
+ # patterns in it.
+ STACK_LIST=${STACK_SPACES// /$'\n'}
+ NEEDLE_SPACES='ccc bbb aaa'
+ NEEDLE_LIST=${NEEDLE_SPACES// /$'\n'}
+ RESULT="$($GREP -Fvx "$STACK_LIST" <<< "$NEEDLE_LIST")"
+ if test "x$RESULT" == "x"; then
+ AC_MSG_RESULT([yes])
+ else
+ if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+ ADDINFO="Please make sure you use GNU grep, usually found at /opt/freeware/bin."
+ fi
+ AC_MSG_ERROR([grep does not handle -Fx correctly. ${ADDINFO}])
+ fi
+])
+
AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
[
BASIC_CHECK_GNU_MAKE
BASIC_CHECK_FIND_DELETE
BASIC_CHECK_TAR
+ BASIC_CHECK_GREP
# These tools might not be installed by default,
# need hint on how to install them.
--- a/common/autoconf/buildjdk-spec.gmk.in Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/buildjdk-spec.gmk.in Mon Jan 23 10:27:58 2017 -0800
@@ -68,7 +68,6 @@
CFLAGS_JDKEXE := @OPENJDK_BUILD_CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
-OPENJDK_TARGET_CPU_JLI_CFLAGS := @OPENJDK_BUILD_CPU_JLI_CFLAGS@
JVM_CFLAGS := @OPENJDK_BUILD_JVM_CFLAGS@
JVM_LDFLAGS := @OPENJDK_BUILD_JVM_LDFLAGS@
--- a/common/autoconf/flags.m4 Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/flags.m4 Mon Jan 23 10:27:58 2017 -0800
@@ -815,11 +815,6 @@
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
fi
- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
- $2CFLAGS_JDK="${$2CFLAGS_JDK} -D__solaris__"
- $2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} -D__solaris__"
- fi
-
$2CFLAGS_JDK="${$2CFLAGS_JDK} ${$2EXTRA_CFLAGS}"
$2CXXFLAGS_JDK="${$2CXXFLAGS_JDK} ${$2EXTRA_CXXFLAGS}"
$2LDFLAGS_JDK="${$2LDFLAGS_JDK} ${$2EXTRA_LDFLAGS}"
--- a/common/autoconf/generated-configure.sh Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/generated-configure.sh Mon Jan 23 10:27:58 2017 -0800
@@ -3564,7 +3564,7 @@
# Include these first...
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -3731,6 +3731,8 @@
+
+
# Check if build directory is on local disk. If not possible to determine,
# we prefer to claim it's local.
# Argument 1: directory to test
@@ -4122,7 +4124,7 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -4237,6 +4239,17 @@
esac
}
+brew_help() {
+ case $1 in
+ openjdk)
+ PKGHANDLER_COMMAND="brew cask install java" ;;
+ freetype)
+ PKGHANDLER_COMMAND="brew install freetype" ;;
+ ccache)
+ PKGHANDLER_COMMAND="brew install ccache" ;;
+ esac
+}
+
port_help() {
PKGHANDLER_COMMAND=""
}
@@ -4362,7 +4375,7 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -4667,7 +4680,7 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -5167,7 +5180,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1483542685
+DATE_WHEN_GENERATED=1484571183
###############################################################################
#
@@ -17544,7 +17557,7 @@
# Must be done before we can call HELP_MSG_MISSING_DEPENDENCY.
- for ac_prog in apt-get yum port pkgutil pkgadd
+ for ac_prog in apt-get yum brew port pkgutil pkgadd
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
@@ -21209,6 +21222,8 @@
# Test which kind of tar was found
if test "x$($TAR --version | $GREP "GNU tar")" != "x"; then
TAR_TYPE="gnu"
+ elif test "x$($TAR --version | $GREP "bsdtar")" != "x"; then
+ TAR_TYPE="bsd"
elif test "x$($TAR -v | $GREP "bsdtar")" != "x"; then
TAR_TYPE="bsd"
elif test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
@@ -21238,6 +21253,29 @@
+ # Test that grep supports -Fx with a list of pattern which includes null pattern.
+ # This is a problem for the grep resident on AIX.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking that grep ($GREP) -Fx handles empty lines in the pattern list correctly" >&5
+$as_echo_n "checking that grep ($GREP) -Fx handles empty lines in the pattern list correctly... " >&6; }
+ # Multiple subsequent spaces..
+ STACK_SPACES='aaa bbb ccc'
+ # ..converted to subsequent newlines, causes STACK_LIST to be a list with some empty
+ # patterns in it.
+ STACK_LIST=${STACK_SPACES// /$'\n'}
+ NEEDLE_SPACES='ccc bbb aaa'
+ NEEDLE_LIST=${NEEDLE_SPACES// /$'\n'}
+ RESULT="$($GREP -Fvx "$STACK_LIST" <<< "$NEEDLE_LIST")"
+ if test "x$RESULT" == "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+ ADDINFO="Please make sure you use GNU grep, usually found at /opt/freeware/bin."
+ fi
+ as_fn_error $? "grep does not handle -Fx correctly. ${ADDINFO}" "$LINENO" 5
+ fi
+
+
# These tools might not be installed by default,
# need hint on how to install them.
@@ -24359,15 +24397,13 @@
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
+$as_echo_n "checking if packaged modules are kept... " >&6; }
if test "x$enable_keep_packaged_modules" = "xyes"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
-$as_echo_n "checking if packaged modules are kept... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
JLINK_KEEP_PACKAGED_MODULES=true
elif test "x$enable_keep_packaged_modules" = "xno"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if packaged modules are kept" >&5
-$as_echo_n "checking if packaged modules are kept... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
JLINK_KEEP_PACKAGED_MODULES=false
@@ -24376,6 +24412,8 @@
$as_echo "yes (default)" >&6; }
JLINK_KEEP_PACKAGED_MODULES=true
else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5
+$as_echo "error" >&6; }
as_fn_error $? "--enable-keep-packaged-modules accepts no argument" "$LINENO" 5
fi
@@ -29942,6 +29980,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -33235,6 +33275,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -34534,6 +34576,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -48601,6 +48645,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -48762,6 +48808,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -49897,11 +49945,6 @@
CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
fi
- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
- CFLAGS_JDK="${CFLAGS_JDK} -D__solaris__"
- CXXFLAGS_JDK="${CXXFLAGS_JDK} -D__solaris__"
- fi
-
CFLAGS_JDK="${CFLAGS_JDK} ${EXTRA_CFLAGS}"
CXXFLAGS_JDK="${CXXFLAGS_JDK} ${EXTRA_CXXFLAGS}"
LDFLAGS_JDK="${LDFLAGS_JDK} ${EXTRA_LDFLAGS}"
@@ -50720,11 +50763,6 @@
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
fi
- if test "x$OPENJDK_TARGET_OS" = xsolaris; then
- OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} -D__solaris__"
- OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} -D__solaris__"
- fi
-
OPENJDK_BUILD_CFLAGS_JDK="${OPENJDK_BUILD_CFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CFLAGS}"
OPENJDK_BUILD_CXXFLAGS_JDK="${OPENJDK_BUILD_CXXFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_CXXFLAGS}"
OPENJDK_BUILD_LDFLAGS_JDK="${OPENJDK_BUILD_LDFLAGS_JDK} ${OPENJDK_BUILD_EXTRA_LDFLAGS}"
@@ -52844,6 +52882,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -56649,6 +56689,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -56721,6 +56763,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -56864,6 +56908,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -60741,6 +60787,345 @@
fi
fi
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$SYSROOT/usr/local"
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
+ METHOD="well-known location"
+
+ # Let's start with an optimistic view of the world :-)
+ FOUND_FREETYPE=yes
+
+ # First look for the canonical freetype main include file ft2build.h.
+ if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # Oh no! Let's try in the freetype2 directory. This is needed at least at Mac OS X Yosemite.
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH/freetype2"
+ if ! test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # Fail.
+ FOUND_FREETYPE=no
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+ # Include file found, let's continue the sanity check.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+
+ # Reset to default value
+ FREETYPE_BASE_NAME=freetype
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ if test "x$OPENJDK_TARGET_OS" = xmacosx \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH/${LIBRARY_PREFIX}freetype.6${SHARED_LIBRARY_SUFFIX}"; then
+ # On Mac OS X Yosemite, the symlink from libfreetype.dylib to libfreetype.6.dylib disappeared. Check
+ # for the .6 version explicitly.
+ FREETYPE_BASE_NAME=freetype.6
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}${FREETYPE_BASE_NAME}${SHARED_LIBRARY_SUFFIX}"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Compensating for missing symlink by using version 6 explicitly" >&5
+$as_echo "$as_me: Compensating for missing symlink by using version 6 explicitly" >&6;}
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/${FREETYPE_BASE_NAME}.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+ && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+ # Found lib in isa dir, use that instead.
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&5
+$as_echo "$as_me: Rewriting to use $POTENTIAL_FREETYPE_LIB_PATH instead" >&6;}
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ # Only process if variable expands to non-empty
+
+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x; then
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-style (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a unix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ if test -d "$path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ else
+ dir="`$DIRNAME "$path"`"
+ base="`$BASENAME "$path"`"
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
+ fi
+ fi
+ fi
+
+
+ # Only process if variable expands to non-empty
+
+ if test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-style (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a unix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ if test -d "$path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ else
+ dir="`$DIRNAME "$path"`"
+ base="`$BASENAME "$path"`"
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$dir"; $THEPWDCMD -L`/$base"
+ fi
+ fi
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
if test "x$FOUND_FREETYPE" != xyes; then
@@ -62122,6 +62507,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -62477,6 +62864,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -62682,6 +63071,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -62870,6 +63261,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -62949,6 +63342,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -64058,6 +64453,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -64142,6 +64539,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
--- a/common/autoconf/help.m4 Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/help.m4 Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
AC_DEFUN_ONCE([HELP_SETUP_DEPENDENCY_HELP],
[
- AC_CHECK_PROGS(PKGHANDLER, apt-get yum port pkgutil pkgadd)
+ AC_CHECK_PROGS(PKGHANDLER, apt-get yum brew port pkgutil pkgadd)
])
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
@@ -46,6 +46,8 @@
apt_help $MISSING_DEPENDENCY ;;
yum)
yum_help $MISSING_DEPENDENCY ;;
+ brew)
+ brew_help $MISSING_DEPENDENCY ;;
port)
port_help $MISSING_DEPENDENCY ;;
pkgutil)
@@ -147,6 +149,17 @@
esac
}
+brew_help() {
+ case $1 in
+ openjdk)
+ PKGHANDLER_COMMAND="brew cask install java" ;;
+ freetype)
+ PKGHANDLER_COMMAND="brew install freetype" ;;
+ ccache)
+ PKGHANDLER_COMMAND="brew install ccache" ;;
+ esac
+}
+
port_help() {
PKGHANDLER_COMMAND=""
}
--- a/common/autoconf/jdk-options.m4 Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/jdk-options.m4 Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -382,18 +382,18 @@
AC_ARG_ENABLE([keep-packaged-modules], [AS_HELP_STRING([--disable-keep-packaged-modules],
[Do not keep packaged modules in jdk image @<:@enable@:>@])])
+ AC_MSG_CHECKING([if packaged modules are kept])
if test "x$enable_keep_packaged_modules" = "xyes"; then
- AC_MSG_CHECKING([if packaged modules are kept])
AC_MSG_RESULT([yes])
JLINK_KEEP_PACKAGED_MODULES=true
elif test "x$enable_keep_packaged_modules" = "xno"; then
- AC_MSG_CHECKING([if packaged modules are kept])
AC_MSG_RESULT([no])
JLINK_KEEP_PACKAGED_MODULES=false
elif test "x$enable_keep_packaged_modules" = "x"; then
AC_MSG_RESULT([yes (default)])
JLINK_KEEP_PACKAGED_MODULES=true
else
+ AC_MSG_RESULT([error])
AC_MSG_ERROR([--enable-keep-packaged-modules accepts no argument])
fi
--- a/common/autoconf/lib-freetype.m4 Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/lib-freetype.m4 Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -348,6 +348,10 @@
FREETYPE_BASE_DIR="$SYSROOT/usr/X11"
LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
fi
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$SYSROOT/usr/local"
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
+ fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
if test "x$FOUND_FREETYPE" != xyes; then
--- a/common/autoconf/spec.gmk.in Mon Jan 23 19:58:06 2017 +0300
+++ b/common/autoconf/spec.gmk.in Mon Jan 23 10:27:58 2017 -0800
@@ -274,8 +274,6 @@
CONFIGURESUPPORT_OUTPUTDIR:=@CONFIGURESUPPORT_OUTPUTDIR@
BUILDJDK_OUTPUTDIR=$(BUILD_OUTPUT)/buildjdk
-BUILD_HOTSPOT=@BUILD_HOTSPOT@
-
BUILD_FAILURE_HANDLER := @BUILD_FAILURE_HANDLER@
ENABLE_GENERATE_CLASSLIST := @ENABLE_GENERATE_CLASSLIST@
@@ -642,7 +640,6 @@
NICE:=@NICE@
PATCH:=@PATCH@
PRINTF:=@PRINTF@
-PWD:=@THEPWDCMD@
RM:=@RM@
RMDIR:=@RMDIR@
SED:=@SED@
@@ -778,11 +775,18 @@
# Images directory definitions
JDK_IMAGE_SUBDIR:=jdk
JRE_IMAGE_SUBDIR:=jre
+JRE_COMPACT1_IMAGE_SUBDIR := jre-compact1
+JRE_COMPACT2_IMAGE_SUBDIR := jre-compact2
+JRE_COMPACT3_IMAGE_SUBDIR := jre-compact3
# Colon left out to be able to override output dir for bootcycle-images
JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
+JRE_COMPACT1_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT1_IMAGE_SUBDIR)
+JRE_COMPACT2_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT2_IMAGE_SUBDIR)
+JRE_COMPACT3_IMAGE_DIR := $(IMAGES_OUTPUTDIR)/$(JRE_COMPACT3_IMAGE_SUBDIR)
+
# Test image, as above
TEST_IMAGE_SUBDIR:=test
TEST_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(TEST_IMAGE_SUBDIR)
@@ -818,6 +822,12 @@
endif
JDK_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
JRE_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART).tar.gz
+JRE_COMPACT1_BUNDLE_NAME := \
+ jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact1_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
+JRE_COMPACT2_BUNDLE_NAME := \
+ jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact2_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
+JRE_COMPACT3_BUNDLE_NAME := \
+ jre-$(VERSION_SHORT)+$(VERSION_BUILD)-compact3_$(OPENJDK_TARGET_BUNDLE_PLATFORM)_bin$(DEBUG_PART).tar.gz
JDK_SYMBOLS_BUNDLE_NAME := jdk-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
JRE_SYMBOLS_BUNDLE_NAME := jre-$(BASE_NAME)_bin$(DEBUG_PART)-symbols.tar.gz
ifeq ($(OPENJDK_TARGET_OS), windows)
--- a/common/conf/jib-profiles.js Mon Jan 23 19:58:06 2017 +0300
+++ b/common/conf/jib-profiles.js Mon Jan 23 10:27:58 2017 -0800
@@ -501,7 +501,7 @@
// extra default target.
var openOnlyProfilesExtra = {
"linux-x86-open": {
- default_make_targets: "profiles",
+ default_make_targets: "profiles-bundles",
configure_args: "--with-jvm-variants=client,server"
}
};
@@ -587,6 +587,7 @@
],
work_dir: input.get("src.full", "install_path") + "/test",
environment: {
+ "JT_JAVA": common.boot_jdk_home,
"PRODUCT_HOME": input.get(testedProfile + ".jdk", "home_path"),
"TEST_IMAGE_DIR": input.get(testedProfile + ".test", "home_path"),
"TEST_OUTPUT_DIR": input.src_top_dir
@@ -710,10 +711,15 @@
local: "bundles/\\(jdk.*bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
},
+ jdk_symbols: {
+ local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
+ remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
+ },
jre: {
- local: "bundles/\\(jre.*[0-9]_linux-x86_bin.tar.gz\\)",
+ // This regexp needs to not match the compact* files below
+ local: "bundles/\\(jre.*[+][0-9]\\{1,\\}_linux-x86_bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
- },/* The build does not create these
+ },
jre_compact1: {
local: "bundles/\\(jre.*-compact1_linux-x86_bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
@@ -725,7 +731,7 @@
jre_compact3: {
local: "bundles/\\(jre.*-compact3_linux-x86_bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
- },*/
+ },
}
},
@@ -864,7 +870,7 @@
jtreg: {
server: "javare",
revision: "4.2",
- build_number: "b04",
+ build_number: "b05",
checksum_file: "MD5_VALUES",
file: "jtreg_bin-4.2.zip",
environment_name: "JT_HOME",
--- a/corba/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/corba/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -394,3 +394,5 @@
00b19338e505690abe93d5995ed74a473d969c2c jdk-9+149
9205e980062a5c4530b51021c6e274025f4ccbdf jdk-9+150
77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
+ff8cb43c07c069b1debdee44cb88ca22db1ec757 jdk-9+152
+68a8e8658511093b322a46ed04b2a321e1da2a43 jdk-9+153
--- a/hotspot/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/hotspot/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -554,3 +554,5 @@
30e1996bd55da36183434f24ed964adebf9ca71e jdk-9+149
98fe046473c90204cbc9b34c512b9fc10dfb8479 jdk-9+150
2a2ac7d9f52c8cb2b80077e515b5840b947e640c jdk-9+151
+31f1d26c60df7b2e516a4f84160d76ba017d4e09 jdk-9+152
+217ba81b9a4ce8698200370175aa2db86a39f66c jdk-9+153
--- a/jaxp/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -394,3 +394,5 @@
5978df8bfa3894f2b3d07b7256f25f78dffb1f9c jdk-9+149
f85154af719f99a3b4d81b67a8b4c18a650d10f9 jdk-9+150
13c6906bfc861d99dc35a19c80b7a99f0b0ac58d jdk-9+151
+7e3da313b1746578da648155e37dd8526e83153d jdk-9+152
+1384504d2cd0e55c5e0becaeaf40ab05cae959d6 jdk-9+153
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2SAX.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2SAX.java Mon Jan 23 10:27:58 2017 -0800
@@ -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.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,20 +17,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: DOM2SAX.java,v 1.2.4.1 2005/09/06 11:52:46 pvedula Exp $
- */
-
package com.sun.org.apache.xalan.internal.xsltc.trax;
import com.sun.org.apache.xalan.internal.xsltc.dom.SAXImpl;
import com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
-import java.util.Vector;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.xml.sax.ContentHandler;
@@ -58,7 +54,7 @@
private ContentHandler _sax = null;
private LexicalHandler _lex = null;
private SAXImpl _saxImpl = null;
- private Map<String, Stack> _nsPrefixes = new HashMap<>();
+ private Map<String, Stack<String>> _nsPrefixes = new HashMap<>();
public DOM2SAX(Node root) {
_dom = root;
@@ -73,7 +69,7 @@
{
_sax = handler;
if (handler instanceof LexicalHandler) {
- _lex = (LexicalHandler) handler;
+ _lex = (LexicalHandler)handler;
}
if (handler instanceof SAXImpl) {
@@ -90,25 +86,22 @@
throws SAXException
{
boolean pushed = true;
- Stack uriStack = _nsPrefixes.get(prefix);
+ Stack<String> uriStack = _nsPrefixes.get(prefix);
if (uriStack != null) {
if (uriStack.isEmpty()) {
_sax.startPrefixMapping(prefix, uri);
uriStack.push(uri);
- }
- else {
- final String lastUri = (String) uriStack.peek();
+ } else {
+ final String lastUri = uriStack.peek();
if (!lastUri.equals(uri)) {
_sax.startPrefixMapping(prefix, uri);
uriStack.push(uri);
- }
- else {
+ } else {
pushed = false;
}
}
- }
- else {
+ } else {
_sax.startPrefixMapping(prefix, uri);
_nsPrefixes.put(prefix, uriStack = new Stack());
uriStack.push(uri);
@@ -123,7 +116,7 @@
private void endPrefixMapping(String prefix)
throws SAXException
{
- final Stack uriStack = _nsPrefixes.get(prefix);
+ final Stack<String> uriStack = _nsPrefixes.get(prefix);
if (uriStack != null) {
_sax.endPrefixMapping(prefix);
@@ -131,22 +124,6 @@
}
}
- /**
- * If the DOM was created using a DOM 1.0 API, the local name may be
- * null. If so, get the local name from the qualified name before
- * generating the SAX event.
- */
- private static String getLocalName(Node node) {
- final String localName = node.getLocalName();
-
- if (localName == null) {
- final String qname = node.getNodeName();
- final int col = qname.lastIndexOf(':');
- return (col > 0) ? qname.substring(col + 1) : qname;
- }
- return localName;
- }
-
public void parse(InputSource unused) throws IOException, SAXException {
parse(_dom);
}
@@ -173,8 +150,8 @@
* declarations.
*/
private void parse(Node node) throws IOException, SAXException {
- Node first = null;
- if (node == null) return;
+ if (node == null)
+ return;
switch (node.getNodeType()) {
case Node.ATTRIBUTE_NODE: // handled by ELEMENT_NODE
@@ -198,7 +175,6 @@
_sax.characters(cdata.toCharArray(), 0, cdata.length());
}
break;
-
case Node.COMMENT_NODE: // should be handled!!!
if (_lex != null) {
final String value = node.getNodeValue();
@@ -216,10 +192,9 @@
}
_sax.endDocument();
break;
-
case Node.ELEMENT_NODE:
String prefix;
- Vector pushedPrefixes = new Vector();
+ ArrayList<String> pushedPrefixes = new ArrayList<>();
final AttributesImpl attrs = new AttributesImpl();
final NamedNodeMap map = node.getAttributes();
final int length = map.getLength();
@@ -235,7 +210,7 @@
final int colon = qnameAttr.lastIndexOf(':');
prefix = (colon > 0) ? qnameAttr.substring(colon + 1) : EMPTYSTRING;
if (startPrefixMapping(prefix, uriAttr)) {
- pushedPrefixes.addElement(prefix);
+ pushedPrefixes.add(prefix);
}
}
}
@@ -248,27 +223,25 @@
// Ignore NS declarations here
if (!qnameAttr.startsWith(XMLNS_PREFIX)) {
final String uriAttr = attr.getNamespaceURI();
- final String localNameAttr = getLocalName(attr);
// Uri may be implicitly declared
if (uriAttr != null) {
final int colon = qnameAttr.lastIndexOf(':');
if (colon > 0) {
prefix = qnameAttr.substring(0, colon);
- }
- else {
+ } else {
// If no prefix for this attr, we need to create
// one because we cannot use the default ns
prefix = BasisLibrary.generatePrefix();
qnameAttr = prefix + ':' + qnameAttr;
}
if (startPrefixMapping(prefix, uriAttr)) {
- pushedPrefixes.addElement(prefix);
+ pushedPrefixes.add(prefix);
}
}
// Add attribute to list
- attrs.addAttribute(attr.getNamespaceURI(), getLocalName(attr),
+ attrs.addAttribute(attr.getNamespaceURI(), attr.getLocalName(),
qnameAttr, "CDATA", attr.getNodeValue());
}
}
@@ -276,22 +249,21 @@
// Now process the element itself
final String qname = node.getNodeName();
final String uri = node.getNamespaceURI();
- final String localName = getLocalName(node);
+ final String localName = node.getLocalName();
- // Uri may be implicitly declared
+ // URI may be implicitly declared
if (uri != null) {
final int colon = qname.lastIndexOf(':');
prefix = (colon > 0) ? qname.substring(0, colon) : EMPTYSTRING;
if (startPrefixMapping(prefix, uri)) {
- pushedPrefixes.addElement(prefix);
+ pushedPrefixes.add(prefix);
}
}
// Generate SAX event to start element
if (_saxImpl != null) {
_saxImpl.startElement(uri, localName, qname, attrs, node);
- }
- else {
+ } else {
_sax.startElement(uri, localName, qname, attrs);
}
@@ -308,15 +280,13 @@
// Generate endPrefixMapping() for all pushed prefixes
final int nPushedPrefixes = pushedPrefixes.size();
for (int i = 0; i < nPushedPrefixes; i++) {
- endPrefixMapping((String) pushedPrefixes.elementAt(i));
+ endPrefixMapping(pushedPrefixes.get(i));
}
break;
-
case Node.PROCESSING_INSTRUCTION_NODE:
_sax.processingInstruction(node.getNodeName(),
node.getNodeValue());
break;
-
case Node.TEXT_NODE:
final String data = node.getNodeValue();
_sax.characters(data.toCharArray(), 0, data.length());
@@ -449,36 +419,4 @@
public String getSystemId() {
return null;
}
-
- // Debugging
- private String getNodeTypeFromCode(short code) {
- String retval = null;
- switch (code) {
- case Node.ATTRIBUTE_NODE :
- retval = "ATTRIBUTE_NODE"; break;
- case Node.CDATA_SECTION_NODE :
- retval = "CDATA_SECTION_NODE"; break;
- case Node.COMMENT_NODE :
- retval = "COMMENT_NODE"; break;
- case Node.DOCUMENT_FRAGMENT_NODE :
- retval = "DOCUMENT_FRAGMENT_NODE"; break;
- case Node.DOCUMENT_NODE :
- retval = "DOCUMENT_NODE"; break;
- case Node.DOCUMENT_TYPE_NODE :
- retval = "DOCUMENT_TYPE_NODE"; break;
- case Node.ELEMENT_NODE :
- retval = "ELEMENT_NODE"; break;
- case Node.ENTITY_NODE :
- retval = "ENTITY_NODE"; break;
- case Node.ENTITY_REFERENCE_NODE :
- retval = "ENTITY_REFERENCE_NODE"; break;
- case Node.NOTATION_NODE :
- retval = "NOTATION_NODE"; break;
- case Node.PROCESSING_INSTRUCTION_NODE :
- retval = "PROCESSING_INSTRUCTION_NODE"; break;
- case Node.TEXT_NODE:
- retval = "TEXT_NODE"; break;
- }
- return retval;
- }
}
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -17,14 +17,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: SAX2DTM.java,v 1.2.4.1 2005/09/15 08:15:11 suresh_emailid Exp $
- */
+
package com.sun.org.apache.xml.internal.dtm.ref.sax2dtm;
-
-import com.sun.org.apache.xml.internal.dtm.*;
-import com.sun.org.apache.xml.internal.dtm.ref.*;
+import com.sun.org.apache.xml.internal.dtm.DTM;
+import com.sun.org.apache.xml.internal.dtm.DTMManager;
+import com.sun.org.apache.xml.internal.dtm.DTMWSFilter;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBaseIterators;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMManagerDefault;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMStringPool;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMTreeWalker;
+import com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource;
+import com.sun.org.apache.xml.internal.dtm.ref.NodeLocator;
import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.res.XMLMessages;
import com.sun.org.apache.xml.internal.utils.FastStringBuffer;
@@ -36,13 +40,23 @@
import com.sun.org.apache.xml.internal.utils.WrappedRuntimeException;
import com.sun.org.apache.xml.internal.utils.XMLString;
import com.sun.org.apache.xml.internal.utils.XMLStringFactory;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import javax.xml.transform.Source;
import javax.xml.transform.SourceLocator;
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
/**
* This class implements a DTM that tends to be optimized more for speed than
@@ -82,7 +96,6 @@
*
* Made protected rather than private so SAX2RTFDTM can access it.
*/
- //private FastStringBuffer m_chars = new FastStringBuffer(13, 13);
protected FastStringBuffer m_chars;
/** This vector holds offset and length data.
@@ -102,8 +115,7 @@
/** Namespace support, only relevent at construction time.
* Made protected rather than private so SAX2RTFDTM can access it.
*/
- transient protected java.util.Vector m_prefixMappings =
- new java.util.Vector();
+ transient protected Vector<String> m_prefixMappings = new Vector<>();
/** Namespace support, only relevent at construction time.
* Made protected rather than private so SAX2RTFDTM can access it.
@@ -164,7 +176,7 @@
* Vector of entities. Each record is composed of four Strings:
* publicId, systemID, notationName, and name.
*/
- private Vector m_entities = null;
+ private ArrayList<String> m_entities = null;
/** m_entities public ID offset. */
private static final int ENTITY_FIELD_PUBLICID = 0;
@@ -196,13 +208,15 @@
*/
protected boolean m_useSourceLocationProperty = false;
- /** Made protected for access by SAX2RTFDTM.
+ /** Made protected for access by SAX2RTFDTM.
*/
protected StringVector m_sourceSystemId;
- /** Made protected for access by SAX2RTFDTM.
+
+ /** Made protected for access by SAX2RTFDTM.
*/
protected IntVector m_sourceLine;
- /** Made protected for access by SAX2RTFDTM.
+
+ /** Made protected for access by SAX2RTFDTM.
*/
protected IntVector m_sourceColumn;
@@ -252,23 +266,19 @@
boolean usePrevsib,
boolean newNameTable)
{
-
super(mgr, source, dtmIdentity, whiteSpaceFilter,
xstringfactory, doIndexing, blocksize, usePrevsib, newNameTable);
// %OPT% Use smaller sizes for all internal storage units when
// the blocksize is small. This reduces the cost of creating an RTF.
- if (blocksize <= 64)
- {
+ if (blocksize <= 64) {
m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL);
m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS_SMALL);
m_valuesOrPrefixes = new DTMStringPool(16);
m_chars = new FastStringBuffer(7, 10);
m_contextIndexes = new IntStack(4);
m_parents = new IntStack(4);
- }
- else
- {
+ } else {
m_data = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS);
m_dataOrQName = new SuballocatedIntVector(blocksize, DEFAULT_NUMBLOCKS);
m_valuesOrPrefixes = new DTMStringPool();
@@ -289,7 +299,7 @@
// m_useSourceLocationProperty=com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.m_source_location;
m_useSourceLocationProperty = mgr.getSource_location();
m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector() : null;
- m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null;
+ m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null;
m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null;
}
@@ -297,8 +307,7 @@
* Set whether information about document source location
* should be maintained or not.
*/
- public void setUseSourceLocation(boolean useSourceLocation)
- {
+ public void setUseSourceLocation(boolean useSourceLocation) {
m_useSourceLocationProperty = useSourceLocation;
}
@@ -309,17 +318,14 @@
*
* @return The data or qualified name, or DTM.NULL.
*/
- protected int _dataOrQName(int identity)
- {
-
+ protected int _dataOrQName(int identity) {
if (identity < m_size)
return m_dataOrQName.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
- while (true)
- {
+ while (true) {
boolean isMore = nextNode();
if (!isMore)
@@ -332,8 +338,7 @@
/**
* Ask the CoRoutine parser to doTerminate and clear the reference.
*/
- public void clearCoRoutine()
- {
+ public void clearCoRoutine() {
clearCoRoutine(true);
}
@@ -344,11 +349,8 @@
* @param callDoTerminate true of doTerminate should be called on the
* coRoutine parser.
*/
- public void clearCoRoutine(boolean callDoTerminate)
- {
-
- if (null != m_incrementalSAXSource)
- {
+ public void clearCoRoutine(boolean callDoTerminate) {
+ if (null != m_incrementalSAXSource) {
if (callDoTerminate)
m_incrementalSAXSource.deliverMoreNodes(false);
@@ -368,9 +370,7 @@
* @param incrementalSAXSource The parser that we want to recieve events from
* on demand.
*/
- public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource)
- {
-
+ public void setIncrementalSAXSource(IncrementalSAXSource incrementalSAXSource) {
// Establish coroutine link so we can request more data
//
// Note: It's possible that some versions of IncrementalSAXSource may
@@ -406,11 +406,9 @@
* Note that IncrementalSAXSource_Filter is package private, hence
* it can be statically referenced using instanceof (CR 6537912).
*/
- public ContentHandler getContentHandler()
- {
-
- if (m_incrementalSAXSource.getClass()
- .getName().equals("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Filter"))
+ public ContentHandler getContentHandler() {
+ if (m_incrementalSAXSource.getClass().getName()
+ .equals("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Filter"))
return (ContentHandler) m_incrementalSAXSource;
else
return this;
@@ -429,11 +427,9 @@
* Note that IncrementalSAXSource_Filter is package private, hence
* it can be statically referenced using instanceof (CR 6537912).
*/
- public LexicalHandler getLexicalHandler()
- {
-
- if (m_incrementalSAXSource.getClass()
- .getName().equals("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Filter"))
+ public LexicalHandler getLexicalHandler() {
+ if (m_incrementalSAXSource.getClass().getName()
+ .equals("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Filter"))
return (LexicalHandler) m_incrementalSAXSource;
else
return this;
@@ -444,8 +440,7 @@
*
* @return null if this model doesn't respond to SAX entity ref events.
*/
- public EntityResolver getEntityResolver()
- {
+ public EntityResolver getEntityResolver() {
return this;
}
@@ -454,8 +449,7 @@
*
* @return null if this model doesn't respond to SAX dtd events.
*/
- public DTDHandler getDTDHandler()
- {
+ public DTDHandler getDTDHandler() {
return this;
}
@@ -464,8 +458,7 @@
*
* @return null if this model doesn't respond to SAX error events.
*/
- public ErrorHandler getErrorHandler()
- {
+ public ErrorHandler getErrorHandler() {
return this;
}
@@ -474,8 +467,7 @@
*
* @return null if this model doesn't respond to SAX Decl events.
*/
- public DeclHandler getDeclHandler()
- {
+ public DeclHandler getDeclHandler() {
return this;
}
@@ -485,8 +477,7 @@
* transformation and the parse run simultaneously. Guidance to the
* DTMManager.
*/
- public boolean needsTwoThreads()
- {
+ public boolean needsTwoThreads() {
return null != m_incrementalSAXSource;
}
@@ -509,9 +500,8 @@
*/
public void dispatchCharactersEvents(int nodeHandle, ContentHandler ch,
boolean normalize)
- throws SAXException
+ throws SAXException
{
-
int identity = makeNodeIdentity(nodeHandle);
if (identity == DTM.NULL)
@@ -519,8 +509,7 @@
int type = _type(identity);
- if (isTextType(type))
- {
+ if (isTextType(type)) {
int dataIndex = m_dataOrQName.elementAt(identity);
int offset = m_data.elementAt(dataIndex);
int length = m_data.elementAt(dataIndex + 1);
@@ -529,13 +518,10 @@
m_chars.sendNormalizedSAXcharacters(ch, offset, length);
else
m_chars.sendSAXcharacters(ch, offset, length);
- }
- else
- {
+ } else {
int firstChild = _firstch(identity);
- if (DTM.NULL != firstChild)
- {
+ if (DTM.NULL != firstChild) {
int offset = -1;
int length = 0;
int startNode = identity;
@@ -545,12 +531,10 @@
do {
type = _type(identity);
- if (isTextType(type))
- {
+ if (isTextType(type)) {
int dataIndex = _dataOrQName(identity);
- if (-1 == offset)
- {
+ if (-1 == offset) {
offset = m_data.elementAt(dataIndex);
}
@@ -560,36 +544,31 @@
identity = getNextNodeIdentity(identity);
} while (DTM.NULL != identity && (_parent(identity) >= startNode));
- if (length > 0)
- {
+ if (length > 0) {
if(normalize)
m_chars.sendNormalizedSAXcharacters(ch, offset, length);
else
m_chars.sendSAXcharacters(ch, offset, length);
}
- }
- else if(type != DTM.ELEMENT_NODE)
- {
+ } else if(type != DTM.ELEMENT_NODE) {
int dataIndex = _dataOrQName(identity);
- if (dataIndex < 0)
- {
+ if (dataIndex < 0) {
dataIndex = -dataIndex;
dataIndex = m_data.elementAt(dataIndex + 1);
}
String str = m_valuesOrPrefixes.indexToString(dataIndex);
- if(normalize)
- FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(),
- 0, str.length(), ch);
- else
- ch.characters(str.toCharArray(), 0, str.length());
+ if(normalize)
+ FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(),
+ 0, str.length(), ch);
+ else
+ ch.characters(str.toCharArray(), 0, str.length());
}
}
}
-
/**
* Given a node handle, return its DOM-style node name. This will
* include names such as #text or #document.
@@ -599,39 +578,29 @@
* %REVIEW% Document when empty string is possible...
* %REVIEW-COMMENT% It should never be empty, should it?
*/
- public String getNodeName(int nodeHandle)
- {
-
+ public String getNodeName(int nodeHandle) {
int expandedTypeID = getExpandedTypeID(nodeHandle);
// If just testing nonzero, no need to shift...
int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID);
- if (0 == namespaceID)
- {
+ if (0 == namespaceID) {
// Don't retrieve name until/unless needed
// String name = m_expandedNameTable.getLocalName(expandedTypeID);
int type = getNodeType(nodeHandle);
- if (type == DTM.NAMESPACE_NODE)
- {
+ if (type == DTM.NAMESPACE_NODE) {
if (null == m_expandedNameTable.getLocalName(expandedTypeID))
return "xmlns";
else
return "xmlns:" + m_expandedNameTable.getLocalName(expandedTypeID);
- }
- else if (0 == m_expandedNameTable.getLocalNameID(expandedTypeID))
- {
+ } else if (0 == m_expandedNameTable.getLocalNameID(expandedTypeID)) {
return m_fixednames[type];
- }
- else
+ } else
return m_expandedNameTable.getLocalName(expandedTypeID);
- }
- else
- {
+ } else {
int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle));
- if (qnameIndex < 0)
- {
+ if (qnameIndex < 0) {
qnameIndex = -qnameIndex;
qnameIndex = m_data.elementAt(qnameIndex);
}
@@ -648,27 +617,21 @@
* @param nodeHandle the id of the node.
* @return String Name of this node, which may be an empty string.
*/
- public String getNodeNameX(int nodeHandle)
- {
-
+ public String getNodeNameX(int nodeHandle) {
int expandedTypeID = getExpandedTypeID(nodeHandle);
int namespaceID = m_expandedNameTable.getNamespaceID(expandedTypeID);
- if (0 == namespaceID)
- {
+ if (namespaceID == 0) {
String name = m_expandedNameTable.getLocalName(expandedTypeID);
if (name == null)
return "";
else
return name;
- }
- else
- {
+ } else {
int qnameIndex = m_dataOrQName.elementAt(makeNodeIdentity(nodeHandle));
- if (qnameIndex < 0)
- {
+ if (qnameIndex < 0) {
qnameIndex = -qnameIndex;
qnameIndex = m_data.elementAt(qnameIndex);
}
@@ -686,11 +649,9 @@
* @return <code>true</code> if the attribute was specified;
* <code>false</code> if it was defaulted.
*/
- public boolean isAttributeSpecified(int attributeHandle)
- {
-
+ public boolean isAttributeSpecified(int attributeHandle) {
// I'm not sure if I want to do anything with this...
- return true; // ??
+ return true; // ??
}
/**
@@ -701,9 +662,7 @@
*
* @return the system identifier String object, or null if there is none.
*/
- public String getDocumentTypeDeclarationSystemIdentifier()
- {
-
+ public String getDocumentTypeDeclarationSystemIdentifier() {
/** @todo: implement this com.sun.org.apache.xml.internal.dtm.DTMDefaultBase abstract method */
error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"Not yet supported!");
@@ -717,14 +676,11 @@
* @param identity The node identity (index).
* @return identity+1, or DTM.NULL.
*/
- protected int getNextNodeIdentity(int identity)
- {
-
+ protected int getNextNodeIdentity(int identity) {
identity += 1;
- while (identity >= m_size)
- {
- if (null == m_incrementalSAXSource)
+ while (identity >= m_size) {
+ if (m_incrementalSAXSource == null)
return DTM.NULL;
nextNode();
@@ -739,10 +695,10 @@
* @param nodeHandle The node ID.
* @param ch A non-null reference to a ContentHandler.
*
- * @throws org.xml.sax.SAXException
+ * @throws SAXException
*/
- public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch)
- throws org.xml.sax.SAXException
+ public void dispatchToEvents(int nodeHandle, ContentHandler ch)
+ throws SAXException
{
DTMTreeWalker treeWalker = m_walker;
@@ -1087,28 +1043,22 @@
* @return String containing the URI of the Unparsed Entity, or an
* empty string if no such entity exists.
*/
- public String getUnparsedEntityURI(String name)
- {
-
+ public String getUnparsedEntityURI(String name) {
String url = "";
- if (null == m_entities)
+ if (null == m_entities) {
return url;
+ }
int n = m_entities.size();
- for (int i = 0; i < n; i += ENTITY_FIELDS_PER)
- {
- String ename = (String) m_entities.elementAt(i + ENTITY_FIELD_NAME);
+ for (int i = 0; i < n; i += ENTITY_FIELDS_PER) {
+ String ename = m_entities.get(i + ENTITY_FIELD_NAME);
- if (null != ename && ename.equals(name))
- {
- String nname = (String) m_entities.elementAt(i
- + ENTITY_FIELD_NOTATIONNAME);
+ if (null != ename && ename.equals(name)) {
+ String nname = m_entities.get(i + ENTITY_FIELD_NOTATIONNAME);
- if (null != nname)
- {
-
+ if (null != nname) {
// The draft says: "The XSLT processor may use the public
// identifier to generate a URI for the entity instead of the URI
// specified in the system identifier. If the XSLT processor does
@@ -1118,11 +1068,10 @@
// the resource containing the entity declaration as the base
// URI [RFC2396]."
// So I'm falling a bit short here.
- url = (String) m_entities.elementAt(i + ENTITY_FIELD_SYSTEMID);
+ url = m_entities.get(i + ENTITY_FIELD_SYSTEMID);
- if (null == url)
- {
- url = (String) m_entities.elementAt(i + ENTITY_FIELD_PUBLICID);
+ if (null == url) {
+ url = m_entities.get(i + ENTITY_FIELD_PUBLICID);
}
}
@@ -1400,26 +1349,18 @@
*
* @return The prefix if there is one, or null.
*/
- public String getPrefix(String qname, String uri)
- {
-
+ public String getPrefix(String qname, String uri) {
String prefix;
int uriIndex = -1;
- if (null != uri && uri.length() > 0)
- {
-
- do
- {
+ if (null != uri && uri.length() > 0) {
+ do {
uriIndex = m_prefixMappings.indexOf(uri, ++uriIndex);
- } while ( (uriIndex & 0x01) == 0);
+ } while ((uriIndex & 0x01) == 0);
- if (uriIndex >= 0)
- {
- prefix = (String) m_prefixMappings.elementAt(uriIndex - 1);
- }
- else if (null != qname)
- {
+ if (uriIndex >= 0) {
+ prefix = m_prefixMappings.elementAt(uriIndex - 1);
+ } else if (null != qname) {
int indexOfNSSep = qname.indexOf(':');
if (qname.equals("xmlns"))
@@ -1429,33 +1370,24 @@
else
prefix = (indexOfNSSep > 0)
? qname.substring(0, indexOfNSSep) : null;
- }
- else
- {
+ } else {
prefix = null;
}
- }
- else if (null != qname)
- {
+ } else if (null != qname) {
int indexOfNSSep = qname.indexOf(':');
- if (indexOfNSSep > 0)
- {
+ if (indexOfNSSep > 0) {
if (qname.startsWith("xmlns:"))
prefix = qname.substring(indexOfNSSep + 1);
else
prefix = qname.substring(0, indexOfNSSep);
- }
- else
- {
+ } else {
if (qname.equals("xmlns"))
prefix = "";
else
prefix = null;
}
- }
- else
- {
+ } else {
prefix = null;
}
@@ -1470,38 +1402,31 @@
*
* @return The prefix if there is one, or null.
*/
- public int getIdForNamespace(String uri)
- {
-
+ public int getIdForNamespace(String uri) {
return m_valuesOrPrefixes.stringToIndex(uri);
-
}
- /**
+ /**
* Get a prefix either from the qname or from the uri mapping, or just make
* one up!
*
* @return The prefix if there is one, or null.
*/
- public String getNamespaceURI(String prefix)
- {
-
+ public String getNamespaceURI(String prefix) {
String uri = "";
int prefixIndex = m_contextIndexes.peek() - 1 ;
- if(null == prefix)
+ if (null == prefix) {
prefix = "";
+ }
- do
- {
- prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex);
- } while ( (prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01);
+ do {
+ prefixIndex = m_prefixMappings.indexOf(prefix, ++prefixIndex);
+ } while ((prefixIndex >= 0) && (prefixIndex & 0x01) == 0x01);
- if (prefixIndex > -1)
- {
- uri = (String) m_prefixMappings.elementAt(prefixIndex + 1);
- }
-
+ if (prefixIndex > -1) {
+ uri = m_prefixMappings.elementAt(prefixIndex + 1);
+ }
return uri;
}
@@ -1578,7 +1503,7 @@
* default behaviour.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.EntityResolver#resolveEntity
+ * @see EntityResolver#resolveEntity
*
* @throws SAXException
*/
@@ -1605,7 +1530,7 @@
* @param systemId The notation system identifier.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.DTDHandler#notationDecl
+ * @see DTDHandler#notationDecl
*
* @throws SAXException
*/
@@ -1630,41 +1555,35 @@
* @param notationName The name of the associated notation.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ * @see DTDHandler#unparsedEntityDecl
*
* @throws SAXException
*/
- public void unparsedEntityDecl(
- String name, String publicId, String systemId, String notationName)
- throws SAXException
+ public void unparsedEntityDecl(String name, String publicId, String systemId,
+ String notationName) throws SAXException
{
-
- if (null == m_entities)
- {
- m_entities = new Vector();
+ if (null == m_entities) {
+ m_entities = new ArrayList<>();
}
- try
- {
+ try {
systemId = SystemIDResolver.getAbsoluteURI(systemId,
getDocumentBaseURI());
- }
- catch (Exception e)
- {
- throw new org.xml.sax.SAXException(e);
+ } catch (Exception e) {
+ throw new SAXException(e);
}
// private static final int ENTITY_FIELD_PUBLICID = 0;
- m_entities.addElement(publicId);
+ m_entities.add(publicId);
// private static final int ENTITY_FIELD_SYSTEMID = 1;
- m_entities.addElement(systemId);
+ m_entities.add(systemId);
// private static final int ENTITY_FIELD_NOTATIONNAME = 2;
- m_entities.addElement(notationName);
+ m_entities.add(notationName);
// private static final int ENTITY_FIELD_NAME = 3;
- m_entities.addElement(name);
+ m_entities.add(name);
}
////////////////////////////////////////////////////////////////////
@@ -1679,8 +1598,8 @@
* with other document events.</p>
*
* @param locator A locator for all SAX document events.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
+ * @see ContentHandler#setDocumentLocator
+ * @see Locator
*/
public void setDocumentLocator(Locator locator)
{
@@ -1693,7 +1612,7 @@
*
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#startDocument
+ * @see ContentHandler#startDocument
*/
public void startDocument() throws SAXException
{
@@ -1716,7 +1635,7 @@
*
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#endDocument
+ * @see ContentHandler#endDocument
*/
public void endDocument() throws SAXException
{
@@ -1754,7 +1673,7 @@
* @param uri The Namespace URI mapped to the prefix.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
+ * @see ContentHandler#startPrefixMapping
*/
public void startPrefixMapping(String prefix, String uri)
throws SAXException
@@ -1780,7 +1699,7 @@
* @param prefix The Namespace prefix being declared.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
+ * @see ContentHandler#endPrefixMapping
*/
public void endPrefixMapping(String prefix) throws SAXException
{
@@ -1815,16 +1734,13 @@
* @return true if the declaration has already been declared in the
* current context.
*/
- protected boolean declAlreadyDeclared(String prefix)
- {
-
+ protected boolean declAlreadyDeclared(String prefix) {
int startDecls = m_contextIndexes.peek();
- java.util.Vector prefixMappings = m_prefixMappings;
+ Vector<String> prefixMappings = m_prefixMappings;
int nDecls = prefixMappings.size();
- for (int i = startDecls; i < nDecls; i += 2)
- {
- String prefixDecl = (String) prefixMappings.elementAt(i);
+ for (int i = startDecls; i < nDecls; i += 2) {
+ String prefixDecl = prefixMappings.elementAt(i);
if (prefixDecl == null)
continue;
@@ -1836,7 +1752,7 @@
return false;
}
- boolean m_pastFirstElement=false;
+ boolean m_pastFirstElement=false;
/**
* Receive notification of the start of an element.
@@ -1857,35 +1773,38 @@
* @param attributes The specified or defaulted attributes.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#startElement
+ * @see ContentHandler#startElement
*/
- public void startElement(
- String uri, String localName, String qName, Attributes attributes)
- throws SAXException
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException
{
- if (DEBUG)
- {
- System.out.println("startElement: uri: " + uri + ", localname: "
- + localName + ", qname: "+qName+", atts: " + attributes);
+ if (DEBUG) {
+ System.out.println("startElement: uri: " + uri +
+ ", localname: " + localName +
+ ", qname: "+qName+", atts: " + attributes);
- boolean DEBUG_ATTRS=true;
- if(DEBUG_ATTRS & attributes!=null)
- {
- int n = attributes.getLength();
- if(n==0)
- System.out.println("\tempty attribute list");
- else for (int i = 0; i < n; i++)
- System.out.println("\t attr: uri: " + attributes.getURI(i) +
- ", localname: " + attributes.getLocalName(i) +
- ", qname: " + attributes.getQName(i) +
- ", type: " + attributes.getType(i) +
- ", value: " + attributes.getValue(i)
- );
- }
- }
+ boolean DEBUG_ATTRS=true;
+ if (DEBUG_ATTRS & attributes!=null) {
+ int n = attributes.getLength();
+ if (n==0) {
+ System.out.println("\tempty attribute list");
+ } else for (int i = 0; i < n; i++) {
+ System.out.println("\t attr: uri: " + attributes.getURI(i) +
+ ", localname: " + attributes.getLocalName(i) +
+ ", qname: " + attributes.getQName(i) +
+ ", type: " + attributes.getType(i) +
+ ", value: " + attributes.getValue(i));
+ }
+ }
+ }
charactersFlush();
+ if ((localName == null || localName.isEmpty()) &&
+ (uri == null || uri.isEmpty())) {
+ localName = qName;
+ }
+
int exName = m_expandedNameTable.getExpandedTypeID(uri, localName, DTM.ELEMENT_NODE);
String prefix = getPrefix(qName, uri);
int prefixIndex = (null != prefix)
@@ -1894,20 +1813,18 @@
int elemNode = addNode(DTM.ELEMENT_NODE, exName,
m_parents.peek(), m_previous, prefixIndex, true);
- if(m_indexing)
+ if (m_indexing)
indexNode(exName, elemNode);
-
m_parents.push(elemNode);
int startDecls = m_contextIndexes.peek();
int nDecls = m_prefixMappings.size();
int prev = DTM.NULL;
- if(!m_pastFirstElement)
- {
+ if (!m_pastFirstElement) {
// SPECIAL CASE: Implied declaration at root element
- prefix="xml";
+ prefix = "xml";
String declURL = "http://www.w3.org/XML/1998/namespace";
exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE);
int val = m_valuesOrPrefixes.stringToIndex(declURL);
@@ -1916,14 +1833,13 @@
m_pastFirstElement=true;
}
- for (int i = startDecls; i < nDecls; i += 2)
- {
- prefix = (String) m_prefixMappings.elementAt(i);
+ for (int i = startDecls; i < nDecls; i += 2) {
+ prefix = m_prefixMappings.elementAt(i);
if (prefix == null)
continue;
- String declURL = (String) m_prefixMappings.elementAt(i + 1);
+ String declURL = m_prefixMappings.elementAt(i + 1);
exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE);
@@ -1935,8 +1851,7 @@
int n = attributes.getLength();
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
String attrUri = attributes.getURI(i);
String attrQName = attributes.getQName(i);
String valString = attributes.getValue(i);
@@ -1947,17 +1862,13 @@
String attrLocalName = attributes.getLocalName(i);
- if ((null != attrQName)
- && (attrQName.equals("xmlns")
- || attrQName.startsWith("xmlns:")))
- {
+ if ((null != attrQName) &&
+ (attrQName.equals("xmlns") || attrQName.startsWith("xmlns:"))) {
if (declAlreadyDeclared(prefix))
continue; // go to the next attribute.
nodeType = DTM.NAMESPACE_NODE;
- }
- else
- {
+ } else {
nodeType = DTM.ATTRIBUTE_NODE;
if (attributes.getType(i).equalsIgnoreCase("ID"))
@@ -1966,15 +1877,13 @@
// Bit of a hack... if somehow valString is null, stringToIndex will
// return -1, which will make things very unhappy.
- if(null == valString)
+ if (null == valString)
valString = "";
int val = m_valuesOrPrefixes.stringToIndex(valString);
//String attrLocalName = attributes.getLocalName(i);
- if (null != prefix)
- {
-
+ if (null != prefix) {
prefixIndex = m_valuesOrPrefixes.stringToIndex(attrQName);
int dataIndex = m_data.size();
@@ -1993,8 +1902,7 @@
if (DTM.NULL != prev)
m_nextsib.setElementAt(DTM.NULL,prev);
- if (null != m_wsfilter)
- {
+ if (null != m_wsfilter) {
short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode), this);
boolean shouldStrip = (DTMWSFilter.INHERIT == wsv)
? getShouldStripWhitespace()
@@ -2026,7 +1934,7 @@
* empty string if qualified names are not available.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#endElement
+ * @see ContentHandler#endElement
*/
public void endElement(String uri, String localName, String qName)
throws SAXException
@@ -2074,7 +1982,7 @@
* character array.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#characters
+ * @see ContentHandler#characters
*/
public void characters(char ch[], int start, int length) throws SAXException
{
@@ -2109,7 +2017,7 @@
* character array.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
+ * @see ContentHandler#ignorableWhitespace
*/
public void ignorableWhitespace(char ch[], int start, int length)
throws SAXException
@@ -2133,7 +2041,7 @@
* none is supplied.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
+ * @see ContentHandler#processingInstruction
*/
public void processingInstruction(String target, String data)
throws SAXException
@@ -2163,7 +2071,7 @@
* @param name The name of the skipped entity.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
+ * @see ContentHandler#processingInstruction
*/
public void skippedEntity(String name) throws SAXException
{
@@ -2187,8 +2095,8 @@
* @param e The warning information encoded as an exception.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
+ * @see ErrorHandler#warning
+ * @see SAXParseException
*/
public void warning(SAXParseException e) throws SAXException
{
@@ -2208,8 +2116,8 @@
* @param e The warning information encoded as an exception.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
+ * @see ErrorHandler#warning
+ * @see SAXParseException
*/
public void error(SAXParseException e) throws SAXException
{
@@ -2230,8 +2138,8 @@
* @param e The error information encoded as an exception.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ErrorHandler#fatalError
- * @see org.xml.sax.SAXParseException
+ * @see ErrorHandler#fatalError
+ * @see SAXParseException
*/
public void fatalError(SAXParseException e) throws SAXException
{
@@ -2299,7 +2207,7 @@
* @param value The replacement text of the entity.
* @throws SAXException The application may raise an exception.
* @see #externalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ * @see DTDHandler#unparsedEntityDecl
*/
public void internalEntityDecl(String name, String value)
throws SAXException
@@ -2321,7 +2229,7 @@
* @param systemId The declared system identifier of the entity.
* @throws SAXException The application may raise an exception.
* @see #internalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
+ * @see DTDHandler#unparsedEntityDecl
*/
public void externalEntityDecl(
String name, String publicId, String systemId) throws SAXException
@@ -2386,15 +2294,15 @@
* properly nested within start/end entity events.</p>
*
* <p>Note that skipped entities will be reported through the
- * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
+ * {@link ContentHandler#skippedEntity skippedEntity}
* event, which is part of the ContentHandler interface.</p>
*
* @param name The name of the entity. If it is a parameter
* entity, the name will begin with '%'.
* @throws SAXException The application may raise an exception.
* @see #endEntity
- * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
- * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
+ * @see DeclHandler#internalEntityDecl
+ * @see DeclHandler#externalEntityDecl
*/
public void startEntity(String name) throws SAXException
{
@@ -2419,7 +2327,7 @@
* Report the start of a CDATA section.
*
* <p>The contents of the CDATA section will be reported through
- * the regular {@link org.xml.sax.ContentHandler#characters
+ * the regular {@link ContentHandler#characters
* characters} event.</p>
*
* @throws SAXException The application may raise an exception.
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xml/internal/dtm/ref/sax2dtm/SAX2DTM2.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,13 +1,13 @@
/*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
- * Copyright 1999-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@@ -17,13 +17,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/*
- * $Id: SAX2DTM2.java,v 1.2.4.1 2005/09/15 08:15:12 suresh_emailid Exp $
- */
+
package com.sun.org.apache.xml.internal.dtm.ref.sax2dtm;
-import com.sun.org.apache.xml.internal.dtm.*;
-import com.sun.org.apache.xml.internal.dtm.ref.*;
+import com.sun.org.apache.xml.internal.dtm.DTM;
+import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator;
+import com.sun.org.apache.xml.internal.dtm.DTMException;
+import com.sun.org.apache.xml.internal.dtm.DTMManager;
+import com.sun.org.apache.xml.internal.dtm.DTMWSFilter;
+import com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase;
+import com.sun.org.apache.xml.internal.dtm.ref.ExpandedNameTable;
+import com.sun.org.apache.xml.internal.dtm.ref.ExtendedType;
import com.sun.org.apache.xml.internal.utils.FastStringBuffer;
import com.sun.org.apache.xml.internal.utils.XMLString;
import com.sun.org.apache.xml.internal.utils.XMLStringDefault;
@@ -31,11 +35,12 @@
import com.sun.org.apache.xml.internal.res.XMLMessages;
import com.sun.org.apache.xml.internal.res.XMLErrorResources;
import com.sun.org.apache.xml.internal.serializer.SerializationHandler;
-
+import com.sun.org.apache.xml.internal.utils.SuballocatedIntVector;
+import java.util.ArrayList;
import javax.xml.transform.Source;
-import java.util.Vector;
-import com.sun.org.apache.xml.internal.utils.SuballocatedIntVector;
-import org.xml.sax.*;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
/**
* SAX2DTM2 is an optimized version of SAX2DTM which is used in non-incremental situation.
@@ -53,10 +58,6 @@
* The design of SAX2DTM2 may limit its extensibilty. If you have a reason to extend the
* SAX2DTM model, please extend from SAX2DTM instead of this class.
* <p>
- * TODO: This class is currently only used by XSLTC. We need to investigate the possibility
- * of also using it in Xalan-J Interpretive. Xalan's performance is likely to get an instant
- * boost if we use SAX2DTM2 instead of SAX2DTM in non-incremental case.
- * <p>
* %MK% The code in this class is critical to the XSLTC_DTM performance. Be very careful
* when making changes here!
*/
@@ -87,11 +88,10 @@
*/
public DTMAxisIterator setStartNode(int node)
{
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
_currentNode = (node == DTM.NULL) ? DTM.NULL
: _firstch2(makeNodeIdentity(node));
@@ -108,8 +108,7 @@
* @return The next node handle in the iteration, or END if no more
* are available.
*/
- public int next()
- {
+ public int next() {
if (_currentNode != NULL) {
int node = _currentNode;
_currentNode = _nextsib2(node);
@@ -139,13 +138,11 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ public DTMAxisIterator setStartNode(int node) {
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
if (node != DTM.NULL)
@@ -229,8 +226,7 @@
*
* @param nodeType The extended type ID being requested.
*/
- public TypedChildrenIterator(int nodeType)
- {
+ public TypedChildrenIterator(int nodeType) {
_nodeType = nodeType;
}
@@ -242,17 +238,14 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ public DTMAxisIterator setStartNode(int node) {
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
- _currentNode = (node == DTM.NULL)
- ? DTM.NULL
- : _firstch2(makeNodeIdentity(_startNode));
+ _currentNode = (node == DTM.NULL) ? DTM.NULL :
+ _firstch2(makeNodeIdentity(_startNode));
return resetPosition();
}
@@ -265,8 +258,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
+ public int next() {
int node = _currentNode;
if (node == DTM.NULL)
return DTM.NULL;
@@ -301,14 +293,12 @@
_currentNode = _nextsib2(node);
return returnNode(makeNodeHandle(node));
}
-
}
/**
* Return the node at the given position.
*/
- public int getNodeByPosition(int position)
- {
+ public int getNodeByPosition(int position) {
if (position <= 0)
return DTM.NULL;
@@ -327,8 +317,7 @@
node = _nextsib2(node);
}
return NULL;
- }
- else {
+ } else {
while (node != DTM.NULL) {
if (_exptype2(node) >= DTM.NTYPES) {
pos++;
@@ -415,13 +404,11 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ public DTMAxisIterator setStartNode(int node) {
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
_currentNode = makeNodeIdentity(node);
@@ -436,8 +423,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
+ public int next() {
_currentNode = (_currentNode == DTM.NULL) ? DTM.NULL
: _nextsib2(_currentNode);
return returnNode(makeNodeHandle(_currentNode));
@@ -460,8 +446,7 @@
*
* @param type The extended type ID being requested.
*/
- public TypedFollowingSiblingIterator(int type)
- {
+ public TypedFollowingSiblingIterator(int type) {
_nodeType = type;
}
@@ -470,8 +455,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
+ public int next() {
if (_currentNode == DTM.NULL) {
return DTM.NULL;
}
@@ -481,8 +465,7 @@
if (nodeType != DTM.ELEMENT_NODE) {
while ((node = _nextsib2(node)) != DTM.NULL && _exptype2(node) != nodeType) {}
- }
- else {
+ } else {
while ((node = _nextsib2(node)) != DTM.NULL && _exptype2(node) < DTM.NTYPES) {}
}
@@ -498,8 +481,7 @@
/**
* Iterator that returns attribute nodes (of what nodes?)
*/
- public final class AttributeIterator extends InternalAxisIteratorBase
- {
+ public final class AttributeIterator extends InternalAxisIteratorBase {
// assumes caller will pass element nodes
@@ -511,13 +493,11 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ public DTMAxisIterator setStartNode(int node) {
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
_currentNode = getFirstAttributeIdentity(makeNodeIdentity(node));
@@ -532,9 +512,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
-
+ public int next() {
final int node = _currentNode;
if (node != NULL) {
@@ -561,8 +539,7 @@
*
* @param nodeType The extended type ID that is requested.
*/
- public TypedAttributeIterator(int nodeType)
- {
+ public TypedAttributeIterator(int nodeType) {
_nodeType = nodeType;
}
@@ -576,14 +553,10 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
- if (_isRestartable)
- {
+ public DTMAxisIterator setStartNode(int node) {
+ if (_isRestartable) {
_startNode = node;
-
_currentNode = getTypedAttribute(node, _nodeType);
-
return resetPosition();
}
@@ -595,9 +568,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
-
+ public int next() {
final int node = _currentNode;
// singleton iterator, since there can only be one attribute of
@@ -624,8 +595,7 @@
*
* @return true.
*/
- public boolean isReverse()
- {
+ public boolean isReverse() {
return true;
}
@@ -637,30 +607,25 @@
*
* @return A DTMAxisIterator set to the start of the iteration.
*/
- public DTMAxisIterator setStartNode(int node)
- {
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ public DTMAxisIterator setStartNode(int node) {
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
- if (_isRestartable)
- {
+ if (_isRestartable) {
_startNode = node;
node = _startNodeID = makeNodeIdentity(node);
- if(node == NULL)
- {
+ if(node == NULL) {
_currentNode = node;
return resetPosition();
}
int type = _type2(node);
- if(ExpandedNameTable.ATTRIBUTE == type
- || ExpandedNameTable.NAMESPACE == type )
+ if (ExpandedNameTable.ATTRIBUTE == type ||
+ ExpandedNameTable.NAMESPACE == type)
{
_currentNode = node;
- }
- else
- {
+ } else {
// Be careful to handle the Document node properly
_currentNode = _parent2(node);
if(NULL!=_currentNode)
@@ -680,18 +645,12 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
-
- if (_currentNode == _startNodeID || _currentNode == DTM.NULL)
- {
+ public int next() {
+ if (_currentNode == _startNodeID || _currentNode == DTM.NULL) {
return NULL;
- }
- else
- {
+ } else {
final int node = _currentNode;
_currentNode = _nextsib2(node);
-
return returnNode(makeNodeHandle(node));
}
}
@@ -714,8 +673,7 @@
*
* @param type The extended type ID being requested.
*/
- public TypedPrecedingSiblingIterator(int type)
- {
+ public TypedPrecedingSiblingIterator(int type) {
_nodeType = type;
}
@@ -724,8 +682,7 @@
*
* @return The next node handle in the iteration, or END.
*/
- public int next()
- {
+ public int next() {
int node = _currentNode;
final int nodeType = _nodeType;
@@ -735,8 +692,7 @@
while (node != NULL && node != startNodeID && _exptype2(node) != nodeType) {
node = _nextsib2(node);
}
- }
- else {
+ } else {
while (node != NULL && node != startNodeID && _exptype2(node) < DTM.NTYPES) {
node = _nextsib2(node);
}
@@ -745,8 +701,7 @@
if (node == DTM.NULL || node == startNodeID) {
_currentNode = NULL;
return NULL;
- }
- else {
+ } else {
_currentNode = _nextsib2(node);
return returnNode(makeNodeHandle(node));
}
@@ -755,8 +710,7 @@
/**
* Return the index of the last node in this iterator.
*/
- public int getLast()
- {
+ public int getLast() {
if (_last != -1)
return _last;
@@ -774,8 +728,7 @@
}
node = _nextsib2(node);
}
- }
- else {
+ } else {
while (node != NULL && node != startNodeID) {
if (_exptype2(node) >= DTM.NTYPES) {
last++;
@@ -860,7 +813,7 @@
*/
public DTMAxisIterator setStartNode(int node)
{
-//%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
+ //%HZ%: Added reference to DTMDefaultBase.ROOTNODE back in, temporarily
if (node == DTMDefaultBase.ROOTNODE)
node = getDocument();
if (_isRestartable)
@@ -1799,9 +1752,7 @@
// %OPT% These values are unlikely to be equal. Storing
// them in a plain Vector is more efficient than storing in the
// DTMStringPool because we can save the cost for hash calculation.
- //
- // %REVISIT% Do we need a custom class (e.g. StringVector) here?
- protected Vector m_values;
+ protected ArrayList<String> m_values;
// The current index into the m_values Vector.
private int m_valueIndex = 0;
@@ -1881,9 +1832,8 @@
m_buildIdIndex = buildIdIndex;
// Some documents do not have attribute nodes. That is why
- // we set the initial size of this Vector to be small and set
- // the increment to a bigger number.
- m_values = new Vector(32, 512);
+ // we set the initial size of this ArrayList to be small.
+ m_values = new ArrayList<>(32);
m_maxNodeIndex = 1 << DTMManager.IDENT_DTM_NODE_BITS;
@@ -1953,10 +1903,7 @@
* @param identity A node identity, which <em>must not</em> be equal to
* <code>DTM.NULL</code>
*/
- public final int _firstch2(int identity)
- {
- //return m_firstch.elementAt(identity);
-
+ public final int _firstch2(int identity) {
if (identity < m_blocksize)
return m_firstch_map0[identity];
else
@@ -1969,10 +1916,7 @@
* @param identity A node identity, which <em>must not</em> be equal to
* <code>DTM.NULL</code>
*/
- public final int _parent2(int identity)
- {
- //return m_parent.elementAt(identity);
-
+ public final int _parent2(int identity) {
if (identity < m_blocksize)
return m_parent_map0[identity];
else
@@ -1985,9 +1929,7 @@
* @param identity A node identity, which <em>must not</em> be equal to
* <code>DTM.NULL</code>
*/
- public final int _type2(int identity)
- {
- //int eType = _exptype2(identity);
+ public final int _type2(int identity) {
int eType;
if (identity < m_blocksize)
eType = m_exptype_map0[identity];
@@ -2006,12 +1948,9 @@
* <p>This one is only used by DOMAdapter.getExpandedTypeID(int), which
* is mostly called from the compiled translets.
*/
- public final int getExpandedTypeID2(int nodeHandle)
- {
+ public final int getExpandedTypeID2(int nodeHandle) {
int nodeID = makeNodeIdentity(nodeHandle);
- //return (nodeID != NULL) ? _exptype2(nodeID) : NULL;
-
if (nodeID != NULL) {
if (nodeID < m_blocksize)
return m_exptype_map0[nodeID];
@@ -2026,12 +1965,10 @@
* END of DTM base accessor interfaces
*************************************************************************/
-
/**
* Return the node type from the expanded type
*/
- public final int _exptype2Type(int exptype)
- {
+ public final int _exptype2Type(int exptype) {
if (NULL != exptype)
return m_extendedTypes[exptype].getNodeType();
else
@@ -2046,16 +1983,14 @@
*
* @return The prefix if there is one, or null.
*/
- public int getIdForNamespace(String uri)
- {
+ public int getIdForNamespace(String uri) {
int index = m_values.indexOf(uri);
- if (index < 0)
- {
- m_values.addElement(uri);
+ if (index < 0) {
+ m_values.add(uri);
return m_valueIndex++;
+ } else {
+ return index;
}
- else
- return index;
}
/**
@@ -2079,15 +2014,25 @@
* @param attributes The specified or defaulted attributes.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#startElement
+ * @see ContentHandler#startElement
*/
- public void startElement(String uri, String localName, String qName, Attributes attributes)
- throws SAXException
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException
{
-
charactersFlush();
- int exName = m_expandedNameTable.getExpandedTypeID(uri, localName, DTM.ELEMENT_NODE);
+ // in case URI and localName are empty, the input is not using the
+ // namespaces feature. Then we should take the part after the last
+ // colon of qName as localName (strip all namespace prefixes)
+ if ((uri == null || uri.isEmpty()) &&
+ (localName == null || localName.isEmpty()))
+ {
+ final int colon = qName.lastIndexOf(':');
+ localName = (colon > -1) ? qName.substring(colon + 1) : qName;
+ }
+
+ int exName = m_expandedNameTable.getExpandedTypeID(uri, localName,
+ DTM.ELEMENT_NODE);
int prefixIndex = (qName.length() != localName.length())
? m_valuesOrPrefixes.stringToIndex(qName) : 0;
@@ -2095,7 +2040,7 @@
int elemNode = addNode(DTM.ELEMENT_NODE, exName,
m_parents.peek(), m_previous, prefixIndex, true);
- if(m_indexing)
+ if (m_indexing)
indexNode(exName, elemNode);
m_parents.push(elemNode);
@@ -2104,31 +2049,31 @@
int nDecls = m_prefixMappings.size();
String prefix;
- if(!m_pastFirstElement)
- {
+ if (!m_pastFirstElement) {
// SPECIAL CASE: Implied declaration at root element
- prefix="xml";
+ prefix = "xml";
String declURL = "http://www.w3.org/XML/1998/namespace";
- exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE);
- m_values.addElement(declURL);
+ exName = m_expandedNameTable.getExpandedTypeID(null, prefix,
+ DTM.NAMESPACE_NODE);
+ m_values.add(declURL);
int val = m_valueIndex++;
addNode(DTM.NAMESPACE_NODE, exName, elemNode,
DTM.NULL, val, false);
m_pastFirstElement=true;
}
- for (int i = startDecls; i < nDecls; i += 2)
- {
- prefix = (String) m_prefixMappings.elementAt(i);
+ for (int i = startDecls; i < nDecls; i += 2) {
+ prefix = m_prefixMappings.elementAt(i);
if (prefix == null)
continue;
- String declURL = (String) m_prefixMappings.elementAt(i + 1);
-
- exName = m_expandedNameTable.getExpandedTypeID(null, prefix, DTM.NAMESPACE_NODE);
-
- m_values.addElement(declURL);
+ String declURL = m_prefixMappings.elementAt(i + 1);
+
+ exName = m_expandedNameTable.getExpandedTypeID(null, prefix,
+ DTM.NAMESPACE_NODE);
+
+ m_values.add(declURL);
int val = m_valueIndex++;
addNode(DTM.NAMESPACE_NODE, exName, elemNode, DTM.NULL, val, false);
@@ -2136,28 +2081,37 @@
int n = attributes.getLength();
- for (int i = 0; i < n; i++)
- {
+ for (int i = 0; i < n; i++) {
String attrUri = attributes.getURI(i);
+ String attrLocalName = attributes.getLocalName(i);
String attrQName = attributes.getQName(i);
String valString = attributes.getValue(i);
+ // in case URI and localName are empty, the input is not using the
+ // namespaces feature. Then we should take the part after the last
+ // colon of qName as localName (strip all namespace prefixes)
+ // When the URI is empty but localName has colons then we can also
+ // assume non namespace aware and prefixes can be stripped
+ if (attrUri == null || attrUri.isEmpty()) {
+ if (attrLocalName == null || attrLocalName.isEmpty()) {
+ final int colon = attrQName.lastIndexOf(':');
+ attrLocalName = (colon > -1) ? attrQName.substring(colon + 1) : attrQName;
+ } else {
+ final int colon = attrLocalName.lastIndexOf(':');
+ attrLocalName = (colon > -1) ? attrLocalName.substring(colon + 1) : attrLocalName;
+ }
+ }
+
int nodeType;
-
- String attrLocalName = attributes.getLocalName(i);
-
- if ((null != attrQName)
- && (attrQName.equals("xmlns")
- || attrQName.startsWith("xmlns:")))
+ if ((null != attrQName) &&
+ (attrQName.equals("xmlns") || attrQName.startsWith("xmlns:")))
{
prefix = getPrefix(attrQName, attrUri);
if (declAlreadyDeclared(prefix))
continue; // go to the next attribute.
nodeType = DTM.NAMESPACE_NODE;
- }
- else
- {
+ } else {
nodeType = DTM.ATTRIBUTE_NODE;
if (m_buildIdIndex && attributes.getType(i).equalsIgnoreCase("ID"))
@@ -2166,36 +2120,31 @@
// Bit of a hack... if somehow valString is null, stringToIndex will
// return -1, which will make things very unhappy.
- if(null == valString)
+ if (null == valString)
valString = "";
- m_values.addElement(valString);
+ m_values.add(valString);
int val = m_valueIndex++;
- if (attrLocalName.length() != attrQName.length())
- {
-
+ if (attrLocalName.length() != attrQName.length()) {
prefixIndex = m_valuesOrPrefixes.stringToIndex(attrQName);
-
int dataIndex = m_data.size();
-
m_data.addElement(prefixIndex);
m_data.addElement(val);
-
val = -dataIndex;
}
- exName = m_expandedNameTable.getExpandedTypeID(attrUri, attrLocalName, nodeType);
- addNode(nodeType, exName, elemNode, DTM.NULL, val,
- false);
+ exName = m_expandedNameTable.getExpandedTypeID(attrUri, attrLocalName,
+ nodeType);
+ addNode(nodeType, exName, elemNode, DTM.NULL, val, false);
}
- if (null != m_wsfilter)
- {
- short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode), this);
- boolean shouldStrip = (DTMWSFilter.INHERIT == wsv)
- ? getShouldStripWhitespace()
- : (DTMWSFilter.STRIP == wsv);
+ if (null != m_wsfilter) {
+ short wsv = m_wsfilter.getShouldStripSpace(makeNodeHandle(elemNode),
+ this);
+ boolean shouldStrip = (DTMWSFilter.INHERIT == wsv) ?
+ getShouldStripWhitespace() :
+ (DTMWSFilter.STRIP == wsv);
pushShouldStripWhitespace(shouldStrip);
}
@@ -2223,7 +2172,7 @@
* empty string if qualified names are not available.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#endElement
+ * @see ContentHandler#endElement
*/
public void endElement(String uri, String localName, String qName)
throws SAXException
@@ -2257,9 +2206,7 @@
* @param length The number of characters to use from the array.
* @throws SAXException The application may raise an exception.
*/
- public void comment(char ch[], int start, int length) throws SAXException
- {
-
+ public void comment(char ch[], int start, int length) throws SAXException {
if (m_insideDTD) // ignore comments if we're inside the DTD
return;
@@ -2267,7 +2214,7 @@
// %OPT% Saving the comment string in a Vector has a lower cost than
// saving it in DTMStringPool.
- m_values.addElement(new String(ch, start, length));
+ m_values.add(new String(ch, start, length));
int dataIndex = m_valueIndex++;
m_previous = addNode(DTM.COMMENT_NODE, DTM.COMMENT_NODE,
@@ -2279,13 +2226,10 @@
*
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#startDocument
+ * @see ContentHandler#startDocument
*/
- public void startDocument() throws SAXException
- {
-
- int doc = addNode(DTM.DOCUMENT_NODE,
- DTM.DOCUMENT_NODE,
+ public void startDocument() throws SAXException {
+ int doc = addNode(DTM.DOCUMENT_NODE, DTM.DOCUMENT_NODE,
DTM.NULL, DTM.NULL, 0, true);
m_parents.push(doc);
@@ -2299,10 +2243,9 @@
*
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#endDocument
+ * @see ContentHandler#endDocument
*/
- public void endDocument() throws SAXException
- {
+ public void endDocument() throws SAXException {
super.endDocument();
// Add a NULL entry to the end of the node arrays as
@@ -2334,16 +2277,15 @@
* @return The index identity of the node that was added.
*/
protected final int addNode(int type, int expandedTypeID,
- int parentIndex, int previousSibling,
- int dataOrPrefix, boolean canHaveFirstChild)
+ int parentIndex, int previousSibling,
+ int dataOrPrefix, boolean canHaveFirstChild)
{
// Common to all nodes:
int nodeIndex = m_size++;
// Have we overflowed a DTM Identity's addressing range?
//if(m_dtmIdent.size() == (nodeIndex>>>DTMManager.IDENT_DTM_NODE_BITS))
- if (nodeIndex == m_maxNodeIndex)
- {
+ if (nodeIndex == m_maxNodeIndex) {
addNewDTMID(nodeIndex);
m_maxNodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS);
}
@@ -2366,8 +2308,7 @@
// is called, to handle successive characters() events.
// Special handling by type: Declare namespaces, attach first child
- switch(type)
- {
+ switch(type) {
case DTM.NAMESPACE_NODE:
declareNamespaceInContext(parentIndex,nodeIndex);
break;
@@ -2376,8 +2317,7 @@
default:
if (DTM.NULL != previousSibling) {
m_nextsib.setElementAt(nodeIndex,previousSibling);
- }
- else if (DTM.NULL != parentIndex) {
+ } else if (DTM.NULL != parentIndex) {
m_firstch.setElementAt(nodeIndex,parentIndex);
}
break;
@@ -2390,16 +2330,12 @@
* Check whether accumulated text should be stripped; if not,
* append the appropriate flavor of text/cdata node.
*/
- protected final void charactersFlush()
- {
-
- if (m_textPendingStart >= 0) // -1 indicates no-text-in-progress
- {
+ protected final void charactersFlush() {
+ if (m_textPendingStart >= 0) { // -1 indicates no-text-in-progress
int length = m_chars.size() - m_textPendingStart;
boolean doStrip = false;
- if (getShouldStripWhitespace())
- {
+ if (getShouldStripWhitespace()) {
doStrip = m_chars.isWhitespace(m_textPendingStart, length);
}
@@ -2412,19 +2348,19 @@
// If the offset and length do not exceed the given limits
// (offset < 2^21 and length < 2^10), then save both the offset
// and length in a bitwise encoded value.
- if (length <= TEXT_LENGTH_MAX
- && m_textPendingStart <= TEXT_OFFSET_MAX) {
+ if (length <= TEXT_LENGTH_MAX &&
+ m_textPendingStart <= TEXT_OFFSET_MAX) {
m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE,
- m_parents.peek(), m_previous,
- length + (m_textPendingStart << TEXT_LENGTH_BITS),
- false);
+ m_parents.peek(), m_previous,
+ length + (m_textPendingStart << TEXT_LENGTH_BITS),
+ false);
} else {
// Store offset and length in the m_data array if one exceeds
// the given limits. Use a negative dataIndex as an indication.
int dataIndex = m_data.size();
m_previous = addNode(m_coalescedTextType, DTM.TEXT_NODE,
- m_parents.peek(), m_previous, -dataIndex, false);
+ m_parents.peek(), m_previous, -dataIndex, false);
m_data.addElement(m_textPendingStart);
m_data.addElement(length);
@@ -2452,7 +2388,7 @@
* none is supplied.
* @throws SAXException Any SAX exception, possibly
* wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
+ * @see ContentHandler#processingInstruction
*/
public void processingInstruction(String target, String data)
throws SAXException
@@ -2467,7 +2403,7 @@
-dataIndex, false);
m_data.addElement(m_valuesOrPrefixes.stringToIndex(target));
- m_values.addElement(data);
+ m_values.add(data);
m_data.addElement(m_valueIndex++);
}
@@ -2865,9 +2801,9 @@
}
if (m_xstrf != null)
- return m_xstrf.newstr((String)m_values.elementAt(dataIndex));
+ return m_xstrf.newstr(m_values.get(dataIndex));
else
- return new XMLStringDefault((String)m_values.elementAt(dataIndex));
+ return new XMLStringDefault(m_values.get(dataIndex));
}
}
@@ -2966,7 +2902,7 @@
dataIndex = m_data.elementAt(dataIndex + 1);
}
- return (String)m_values.elementAt(dataIndex);
+ return m_values.get(dataIndex);
}
}
@@ -3106,7 +3042,7 @@
dataIndex = m_data.elementAt(dataIndex + 1);
}
- String str = (String)m_values.elementAt(dataIndex);
+ String str = m_values.get(dataIndex);
if(normalize)
FastStringBuffer.sendNormalizedSAXcharacters(str.toCharArray(),
@@ -3160,7 +3096,7 @@
dataIndex = m_data.elementAt(dataIndex + 1);
}
- return (String)m_values.elementAt(dataIndex);
+ return m_values.get(dataIndex);
}
}
@@ -3202,8 +3138,7 @@
if (uri.length() == 0) {
handler.startElement(name);
return name;
- }
- else {
+ } else {
int qnameIndex = m_dataOrQName.elementAt(nodeID);
if (qnameIndex == 0) {
@@ -3223,14 +3158,12 @@
String prefix;
if (prefixIndex > 0) {
prefix = qName.substring(0, prefixIndex);
- }
- else {
+ } else {
prefix = null;
}
handler.namespaceAfterStartElement(prefix, uri);
return qName;
}
-
}
/**
@@ -3285,7 +3218,7 @@
dataIndex = m_data.elementAt(dataIndex + 1);
}
- String nodeValue = (String)m_values.elementAt(dataIndex);
+ String nodeValue = m_values.get(dataIndex);
handler.namespaceAfterStartElement(nodeName, nodeValue);
@@ -3335,7 +3268,6 @@
}
-
/**
* Copy an Attribute node to a SerializationHandler
*
@@ -3347,14 +3279,6 @@
SerializationHandler handler)
throws SAXException
{
- /*
- final String uri = getNamespaceName(node);
- if (uri.length() != 0) {
- final String prefix = getPrefix(node);
- handler.namespaceAfterStartElement(prefix, uri);
- }
- handler.addAttribute(getNodeName(node), getNodeValue(node));
- */
final ExtendedType extType = m_extendedTypes[exptype];
final String uri = extType.getNamespace();
final String localName = extType.getLocalName();
@@ -3377,7 +3301,7 @@
}
String nodeName = (prefix != null) ? qname : localName;
- String nodeValue = (String)m_values.elementAt(valueIndex);
+ String nodeValue = m_values.get(valueIndex);
handler.addAttribute(uri, localName, nodeName, "CDATA", nodeValue);
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/AltCatalog.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/AltCatalog.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
}
/**
- * Returns the catalog attribute as an URI String.
+ * Returns the catalog attribute as a URI String.
* @return The value of the catalog attribute
*/
String getCatalogId() {
@@ -66,7 +66,7 @@
}
/**
- * Returns the catalog attribute as an URI.
+ * Returns the catalog attribute as a URI.
* @return The value of the catalog attribute
*/
URI getCatalogURI() {
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/BaseEntry.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/BaseEntry.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Objects;
+import static javax.xml.catalog.CatalogMessages.ERR_INVALID_ARGUMENT;
/**
* Represents a general Catalog entry.
@@ -210,13 +211,12 @@
* @param arg The name of the argument
* @param uri The URI to be verified
* @return The URI created from the specified uri
- * @throws IllegalArgumentException if the specified uri is null,
- * or an URL can not be created based on the specified base and uri
+ * @throws NullPointerException if the specified uri is null
+ * @throws IllegalArgumentException if a URL can not be created based on
+ * the specified base and uri
*/
URL verifyURI(String arg, URL base, String uri) {
- if (uri == null) {
- CatalogMessages.reportIAE(new Object[]{uri, arg}, null);
- }
+ CatalogMessages.reportNPEOnNull(arg, uri);
URL url = null;
uri = Normalizer.normalizeURI(uri);
@@ -228,32 +228,9 @@
url = new URL(uri);
}
} catch (MalformedURLException e) {
- CatalogMessages.reportIAE(new Object[]{uri, arg}, e);
+ CatalogMessages.reportIAE(ERR_INVALID_ARGUMENT,
+ new Object[]{uri, arg}, e);
}
return url;
}
-
- /**
- * Construct an absolute URI from a relative one, using the current base
- * URI.
- *
- * @param sysid The (possibly relative) system identifier
- * @return The system identifier made absolute with respect to the current
- * {@link #base}.
- */
- protected String makeAbsolute(String sysid) {
- URL local = null;
-
- sysid = Util.fixSlashes(sysid);
- /**
- * try { local = new URL(base, sysid); } catch (MalformedURLException e)
- * { catalogManager.debug.message(1, "Malformed URL on system
- * identifier", sysid); }
- */
- if (local != null) {
- return local.toString();
- } else {
- return sysid;
- }
- }
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/Catalog.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/Catalog.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
* <ul>
* <li>Locate the external resources with a public or system identifier;
* </li>
- * <li>Locate an alternate URI reference with an URI.
+ * <li>Locate an alternate URI reference with a URI.
* </li>
* </ul>
* <p>
@@ -84,7 +84,7 @@
*
* @param systemId the system identifier of the entity to be matched
*
- * @return an URI string if a mapping is found, or null otherwise
+ * @return a URI string if a mapping is found, or null otherwise
*/
public String matchSystem(String systemId);
@@ -108,7 +108,7 @@
*
* @param publicId the public identifier of the entity to be matched
* @see CatalogFeatures.Feature
- * @return an URI string if a mapping is found, or null otherwise
+ * @return a URI string if a mapping is found, or null otherwise
*/
public String matchPublic(String publicId);
@@ -134,7 +134,7 @@
*
* @param uri the URI reference of the entity to be matched
*
- * @return an URI string if a mapping is found, or null otherwise
+ * @return a URI string if a mapping is found, or null otherwise
*/
public String matchURI(String uri);
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,14 +56,14 @@
*
* <tr>
* <td><a name="FILES">FILES</a></td>
- * <td>A semicolon-delimited list of catalog files. Relative file paths are
- * considered relative to ${user.dir}.
+ * <td>A semicolon-delimited list of URIs to locate the catalog files.
+ * The URIs must be absolute and have a URL protocol handler for the URI scheme.
* </td>
* <td>javax.xml.catalog.files</td>
* <td>javax.xml.catalog.files</td>
* <td>javax.xml.catalog.files</td>
* <td>String</td>
- * <td>File paths</td>
+ * <td>URIs</td>
* <td>
* Reads the first catalog as the current catalog; Loads others if no match
* is found in the current catalog including delegate catalogs if any.
@@ -170,7 +170,7 @@
* Properties set through the Catalog API override those that may have been set
* by system properties and/or in {@code jaxp.properties}. In case of multiple
* interfaces, the latest in a procedure shall take preference. For
- * {@link Feature#FILES}, this means that the path(s) specified through the methods
+ * {@link Feature#FILES}, this means that the URI(s) specified through the methods
* of the {@link CatalogManager} will override any that may have been entered
* through the {@link Builder}.
*
@@ -188,7 +188,7 @@
* in the following sample code:
* <pre>{@code
CatalogFeatures f = CatalogFeatures.builder()
- .with(Feature.FILES, "catalog.xml")
+ .with(Feature.FILES, "file:///etc/xml/catalog")
.with(Feature.PREFER, "public")
.with(Feature.DEFER, "true")
.with(Feature.RESOLVE, "ignore")
@@ -202,14 +202,14 @@
* Schema Validation ({@link javax.xml.validation}), and XML Transformation
* ({@link javax.xml.transform}). The features described above can be set through JAXP
* factories or processors that define a setProperty or setAttribute interface.
- * For example, the following code snippet sets a path to a catalog file on a SAX
+ * For example, the following code snippet sets a URI to a catalog file on a SAX
* parser through the {@code javax.xml.catalog.files} property:
* <p>
* <pre>{@code
* SAXParserFactory spf = SAXParserFactory.newInstance();
* spf.setFeature(XMLConstants.USE_CATALOG, true); [1]
* SAXParser parser = spf.newSAXParser();
- * parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "catalog.xml");
+ * parser.setProperty(CatalogFeatures.Feature.FILES.getPropertyName(), "file:///etc/xml/catalog");
* }</pre>
* <p>
* [1] Note that this statement is not required since the default value of
@@ -275,7 +275,7 @@
The following XInclude element:
<xi:include href="http://openjdk.java.net/xml/disclaimer.xml"/>
- can be resolved using an uri entry:
+ can be resolved using a URI entry:
<uri name="http://openjdk.java.net/xml/disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/>
or
<uriSuffix uriSuffix="disclaimer.xml" uri="file:///pathto/local/disclaimer.xml"/>
@@ -291,7 +291,7 @@
<xsd:import namespace="http://openjdk.java.net/xsd/XSDImport_person"
schemaLocation="http://openjdk.java.net/xsd/XSDImport_person.xsd"/>
- can be resolved using an uri entry:
+ can be resolved using a URI entry:
<uri name="http://openjdk.java.net/xsd/XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/>
or
<uriSuffix uriSuffix="XSDImport_person.xsd" uri="file:///pathto/local/XSDImport_person.xsd"/>
@@ -308,7 +308,7 @@
The following include element:
<xsd:include schemaLocation="http://openjdk.java.net/xsd/XSDInclude_person.xsd"/>
- can be resolved using an uri entry:
+ can be resolved using a URI entry:
<uri name="http://openjdk.java.net/xsd/XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/>
or
<uriSuffix uriSuffix="XSDInclude_person.xsd" uri="file:///pathto/local/XSDInclude_person.xsd"/>
@@ -323,7 +323,7 @@
The following include element:
<xsl:include href="http://openjdk.java.net/xsl/include.xsl"/>
- can be resolved using an uri entry:
+ can be resolved using a URI entry:
<uri name="http://openjdk.java.net/xsl/include.xsl" uri="file:///pathto/local/include.xsl"/>
or
<uriSuffix uriSuffix="include.xsl" uri="file:///pathto/local/include.xsl"/>
@@ -338,7 +338,7 @@
The document in the following element:
<xsl:variable name="dummy" select="document('http://openjdk.java.net/xsl/list.xml')"/>
- can be resolved using an uri entry:
+ can be resolved using a URI entry:
<uri name="http://openjdk.java.net/xsl/list.xml" uri="file:///pathto/local/list.xml"/>
or
<uriSuffix uriSuffix="list.xml" uri="file:///pathto/local/list.xml"/>
@@ -559,7 +559,7 @@
values = new String[Feature.values().length];
states = new State[Feature.values().length];
for (Feature cf : Feature.values()) {
- setProperty(cf.ordinal(), State.DEFAULT, cf.defaultValue());
+ setProperty(cf, State.DEFAULT, cf.defaultValue());
}
//read system properties or jaxp.properties
readSystemProperties();
@@ -571,52 +571,27 @@
*/
private void setProperties(Builder builder) {
builder.values.entrySet().stream().forEach((entry) -> {
- setProperty(entry.getKey().ordinal(), State.APIPROPERTY, entry.getValue());
+ setProperty(entry.getKey(), State.APIPROPERTY, entry.getValue());
});
}
/**
- * Sets the value of a property by its index, updates only if it shall override.
+ * Sets the value of a property, updates only if it shall override.
*
* @param index the index of the property
* @param state the state of the property
* @param value the value of the property
* @throws IllegalArgumentException if the value is invalid
*/
- private void setProperty(int index, State state, String value) {
+ private void setProperty(Feature feature, State state, String value) {
+ int index = feature.ordinal();
if (value != null && value.length() != 0) {
- if (index == Feature.PREFER.ordinal()) {
- if (!value.equals(PREFER_SYSTEM) && !value.equals(PREFER_PUBLIC)) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.PREFER.name()}, null);
- }
- } else if (index == Feature.DEFER.ordinal()) {
- if (!value.equals(DEFER_TRUE) && !value.equals(DEFER_FALSE)) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.DEFER.name()}, null);
- }
- } else if (index == Feature.RESOLVE.ordinal()) {
- if (!value.equals(RESOLVE_STRICT) && !value.equals(RESOLVE_CONTINUE)
- && !value.equals(RESOLVE_IGNORE)) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.RESOLVE.name()}, null);
- }
- } else if (index == Feature.FILES.ordinal()) {
- try {
- String[] catalogFile = value.split(";[ ]*");
- for (String temp : catalogFile) {
- if (Util.verifyAndGetURI(temp, null) == null) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null);
- }
- }
- }catch (MalformedURLException | URISyntaxException | IllegalArgumentException ex) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, ex);
- }
+ if (state != State.APIPROPERTY) {
+ Util.validateFeatureInput(feature, value);
}
if (states[index] == null || state.compareTo(states[index]) >= 0) {
values[index] = value;
states[index] = state;
}
- } else {
- if (state == State.SYSTEMPROPERTY || state == State.JAXPDOTPROPERTIES) {
- CatalogMessages.reportIAE(new Object[]{value, Feature.values()[index].name()}, null);
- }
}
}
@@ -639,13 +614,13 @@
if (cf.hasSystemProperty()) {
String value = SecuritySupport.getSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) {
- setProperty(cf.ordinal(), State.SYSTEMPROPERTY, value);
+ setProperty(cf, State.SYSTEMPROPERTY, value);
return true;
}
value = SecuritySupport.readJAXPProperty(sysPropertyName);
if (value != null && !value.equals("")) {
- setProperty(cf.ordinal(), State.JAXPDOTPROPERTIES, value);
+ setProperty(cf, State.JAXPDOTPROPERTIES, value);
return true;
}
}
@@ -685,9 +660,7 @@
* property
*/
public Builder with(Feature feature, String value) {
- if (value == null || value.length() == 0) {
- CatalogMessages.reportIAE(new Object[]{value, feature.name()}, null);
- }
+ Util.validateFeatureInput(feature, value);
values.put(feature, value);
return this;
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
/*
A list of catalog entry files from the input, excluding the current catalog.
- Paths in the List are normalized.
+ URIs in the List are verified during input validation or property retrieval.
*/
List<String> inputFiles;
@@ -86,43 +86,44 @@
SAXParser parser;
/**
- * Construct a Catalog with specified path.
+ * Construct a Catalog with specified URI.
*
- * @param file The path to a catalog file.
+ * @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
*/
- public CatalogImpl(CatalogFeatures f, String... file) throws CatalogException {
- this(null, f, file);
+ public CatalogImpl(CatalogFeatures f, URI... uris) throws CatalogException {
+ this(null, f, uris);
}
/**
- * Construct a Catalog with specified path.
+ * Construct a Catalog with specified URI.
*
* @param parent The parent catalog
- * @param file The path to a catalog file.
+ * @param uris the uri(s) to one or more catalogs
* @throws CatalogException If an error happens while parsing the specified
* catalog file.
*/
- public CatalogImpl(CatalogImpl parent, CatalogFeatures f, String... file) throws CatalogException {
+ public CatalogImpl(CatalogImpl parent, CatalogFeatures f, URI... uris) throws CatalogException {
super(CatalogEntryType.CATALOG, parent);
if (f == null) {
throw new NullPointerException(
formatMessage(CatalogMessages.ERR_NULL_ARGUMENT, new Object[]{"CatalogFeatures"}));
}
- if (file.length > 0) {
- CatalogMessages.reportNPEOnNull("The path to the catalog file", file[0]);
- }
-
init(f);
//Path of catalog files
- String[] catalogFile = file;
- if (level == 0 && file.length == 0) {
+ String[] catalogFile = null;
+ if (level == 0 && uris.length == 0) {
String files = features.get(Feature.FILES);
if (files != null) {
- catalogFile = files.split(";[ ]*");
+ catalogFile = files.split(";");
+ }
+ } else {
+ catalogFile = new String[uris.length];
+ for (int i=0; i<uris.length; i++) {
+ catalogFile[i] = uris[i].toASCIIString();
}
}
@@ -134,10 +135,10 @@
int start = 0;
URI uri = null;
for (String temp : catalogFile) {
- uri = getSystemId(temp);
+ uri = URI.create(temp);
start++;
if (verifyCatalogFile(uri)) {
- systemId = uri.toASCIIString();
+ systemId = temp;
try {
baseURI = new URL(systemId);
} catch (MalformedURLException e) {
@@ -294,29 +295,6 @@
}
/**
- * Resolves the specified file path to an absolute systemId. If it is
- * relative, it shall be resolved using the base or user.dir property if
- * base is not specified.
- *
- * @param file The specified file path
- * @return The systemId of the file
- * @throws CatalogException if the specified file path can not be converted
- * to a system id
- */
- private URI getSystemId(String file) {
- URI temp = null;
-
- try {
- temp = Util.verifyAndGetURI(file, baseURI);
- } catch (MalformedURLException | URISyntaxException | IllegalArgumentException e) {
- CatalogMessages.reportRunTimeError(CatalogMessages.ERR_INVALID_PATH,
- new Object[]{file}, e);
- }
-
- return temp;
- }
-
- /**
* Returns a SAXParser instance
* @return a SAXParser instance
* @throws CatalogException if constructing a SAXParser failed
@@ -394,7 +372,7 @@
//Check the input list
if (c == null && inputFiles != null) {
while (c == null && inputFilesIndex < inputFiles.size()) {
- c = getCatalog(getSystemId(inputFiles.get(inputFilesIndex++)));
+ c = getCatalog(URI.create(inputFiles.get(inputFilesIndex++)));
}
}
@@ -436,8 +414,8 @@
//loads catalogs from the input list
if (inputFiles != null) {
- inputFiles.stream().forEach((file) -> {
- getCatalog(getSystemId(file));
+ inputFiles.stream().forEach((uri) -> {
+ getCatalog(URI.create(uri));
});
}
}
@@ -454,12 +432,11 @@
}
CatalogImpl c = null;
- String path = uri.toASCIIString();
if (verifyCatalogFile(uri)) {
- c = getLoadedCatalog(path);
+ c = getLoadedCatalog(uri.toASCIIString());
if (c == null) {
- c = new CatalogImpl(this, features, path);
+ c = new CatalogImpl(this, features, uri);
c.load();
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogManager.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
*/
package javax.xml.catalog;
+import java.net.URI;
/**
* The Catalog Manager manages the creation of XML Catalogs and Catalog Resolvers.
@@ -39,30 +40,36 @@
/**
* Creates a {@code Catalog} object using the specified feature settings and
- * path to one or more catalog files.
+ * uri(s) to one or more catalog files.
* <p>
- * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
- * will be read to locate the initial list of catalog files.
+ * If {@code uris} is empty, system property {@code javax.xml.catalog.files},
+ * as defined in {@link CatalogFeatures}, will be read to locate the initial
+ * list of catalog files.
* <p>
- * If more than one catalog files are specified through the paths argument or
+ * If multiple catalog files are specified through the {@code uris} 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.
* <p>
* As specified in
* <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
- * XML Catalogs, OASIS Standard V1.1</a>, 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.
+ * XML Catalogs, OASIS Standard V1.1</a>, if a catalog entry is invalid, it
+ * is ignored. In case all entries are invalid, the resulting Catalog object
+ * will contain no Catalog elements. Any matching operation using the Catalog
+ * will return null.
*
* @param features the catalog features
- * @param paths path(s) to one or more catalogs.
+ * @param uris uri(s) to one or more catalogs.
*
* @return an instance of a {@code Catalog}
+ * @throws IllegalArgumentException if either the URIs are not absolute
+ * or do not have a URL protocol handler for the URI scheme
* @throws CatalogException If an error occurs while parsing the catalog
+ * @throws SecurityException if access to the resource is denied by the security manager
*/
- public static Catalog catalog(CatalogFeatures features, String... paths) {
- CatalogImpl catalog = new CatalogImpl(features, paths);
+ public static Catalog catalog(CatalogFeatures features, URI... uris) {
+ Util.validateUrisSyntax(uris);
+ CatalogImpl catalog = new CatalogImpl(features, uris);
catalog.load();
return catalog;
}
@@ -80,30 +87,36 @@
/**
* Creates an instance of a {@code CatalogResolver} using the specified feature
- * settings and path to one or more catalog files.
+ * settings and uri(s) to one or more catalog files.
* <p>
- * If {@code paths} is empty, system property {@code javax.xml.catalog.files}
- * will be read to locate the initial list of catalog files.
+ * If {@code uris} is empty, system property {@code javax.xml.catalog.files},
+ * as defined in {@link CatalogFeatures}, will be read to locate the initial
+ * list of catalog files.
* <p>
- * If more than one catalog files are specified through the paths argument or
+ * If multiple catalog files are specified through the {@code uris} 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.
* <p>
* As specified in
* <a href="https://www.oasis-open.org/committees/download.php/14809/xml-catalogs.html#s.res.fail">
- * XML Catalogs, OASIS Standard V1.1</a>, 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.
+ * XML Catalogs, OASIS Standard V1.1</a>, if a catalog entry is invalid, it
+ * is ignored. In case all entries are invalid, the resulting CatalogResolver
+ * object will contain no valid catalog. Any resolution operation using the
+ * resolver therefore will return as no mapping is found. See {@link CatalogResolver}
+ * for the behavior when no mapping is found.
*
* @param features the catalog features
- * @param paths the path(s) to one or more catalogs
+ * @param uris the uri(s) to one or more catalogs
*
* @return an instance of a {@code CatalogResolver}
+ * @throws IllegalArgumentException if either the URIs are not absolute
+ * or do not have a URL protocol handler for the URI scheme
* @throws CatalogException If an error occurs while parsing the catalog
+ * @throws SecurityException if access to the resource is denied by the security manager
*/
- public static CatalogResolver catalogResolver(CatalogFeatures features, String... paths) {
- Catalog catalog = catalog(features, paths);
+ public static CatalogResolver catalogResolver(CatalogFeatures features, URI... uris) {
+ Catalog catalog = catalog(features, uris);
return new CatalogResolverImpl(catalog);
}
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,10 +24,11 @@
*/
package javax.xml.catalog;
-import jdk.xml.internal.SecuritySupport;
+import java.net.URI;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import jdk.xml.internal.SecuritySupport;
/**
* Catalog Error messages
@@ -38,6 +39,8 @@
public static final String ERR_INVALID_CATALOG = "InvalidCatalog";
public static final String ERR_INVALID_ENTRY_TYPE = "InvalidEntryType";
+ public static final String ERR_URI_NOTABSOLUTE = "UriNotAbsolute";
+ public static final String ERR_URI_NOTVALIDURL = "UriNotValidUrl";
public static final String ERR_INVALID_ARGUMENT = "InvalidArgument";
public static final String ERR_NULL_ARGUMENT = "NullArgument";
public static final String ERR_CIRCULAR_REFERENCE = "CircularReference";
@@ -120,7 +123,7 @@
* @param name the name of the argument
* @param value the value of the argument
*/
- static void reportNPEOnNull(String name, String value) {
+ static void reportNPEOnNull(String name, Object value) {
if (value == null) {
throw new NullPointerException(
formatMessage(ERR_NULL_ARGUMENT, new Object[]{name}));
@@ -132,9 +135,9 @@
* @param arguments the arguments for formating the error message
* @param cause the cause if any
*/
- static void reportIAE(Object[] arguments, Throwable cause) {
+ static void reportIAE(String key, Object[] arguments, Throwable cause) {
throw new IllegalArgumentException(
- formatMessage(ERR_INVALID_ARGUMENT, arguments), cause);
+ formatMessage(key, arguments), cause);
}
/**
@@ -174,7 +177,7 @@
/**
* Returns sanitized URI.
- * @param uri an URI to be sanitized
+ * @param uri a URI to be sanitized
*/
static String sanitize(String uri) {
if (uri == null) {
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogMessages.properties Mon Jan 23 10:27:58 2017 -0800
@@ -31,6 +31,8 @@
CircularReference = Circular reference is not allowed: ''{0}''.
#errors
+UriNotAbsolute = The specified URI ''{0}'' is not absolute.
+UriNotValidUrl = The specified URI ''{0}'' is not a valid URL.
InvalidArgument = The specified argument ''{0}'' (case sensitive) for ''{1}'' is not valid.
NullArgument = The argument ''{0}'' can not be null.
InvalidPath = The path ''{0}'' is invalid.
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogReader.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogReader.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,6 @@
package javax.xml.catalog;
import java.io.StringReader;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import javax.xml.catalog.BaseEntry.CatalogEntryType;
import javax.xml.parsers.SAXParser;
import javax.xml.transform.Source;
@@ -94,25 +90,6 @@
this.parser = parser;
}
- /**
- * Returns when the specified path is valid.
- * @param path a path
- * @return true if the path is valid, false otherwise
- */
- boolean isValidPath(String path) {
- boolean valid = true;
- try {
- Path p = Paths.get(new URI(path));
- if (!p.toFile().exists()) {
- valid = false;
- }
- } catch (URISyntaxException ex) {
- valid = false;
- }
-
- return valid;
- }
-
@Override
public void startElement(String namespaceURI,
String localName,
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolver.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
* {@link javax.xml.stream.XMLResolver} and {@link org.w3c.dom.ls.LSResourceResolver}
* however, make no such distinction.
* In consistent with the existing Java API, this CatalogResolver recognizes a
- * system identifier as an URI and will search both {@code system} and {@code uri}
+ * system identifier as a URI and will search both {@code system} and {@code uri}
* entries in a catalog in order to find a matching entry.
* <p>
* The search is started in the current catalog. If a match is found,
@@ -137,9 +137,9 @@
* with the specified {@code href} attribute. The {@code href} attribute will
* be used literally, with no attempt to be made absolute to the {@code base}.
* <p>
- * If the value is an URN, the {@code href} attribute is recognized as a
+ * If the value is a URN, the {@code href} attribute is recognized as a
* {@code publicId}, and used to search {@code public} entries.
- * If the value is an URI, it is taken as a {@code systemId}, and used to
+ * If the value is a URI, it is taken as a {@code systemId}, and used to
* search both {@code system} and {@code uri} entries.
*
*
@@ -219,7 +219,7 @@
* @param publicId the public identifier of the external entity being
* referenced, or {@code null} if no public identifier was
* supplied or if the resource is not an entity.
- * @param systemId the system identifier, an URI reference of the
+ * @param systemId the system identifier, a URI reference of the
* external resource being referenced
* @param baseUri the absolute base URI, not used by the CatalogResolver
*
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolverImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/CatalogResolverImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -73,7 +73,7 @@
systemId = Normalizer.normalizeURI(Util.getNotNullOrEmpty(systemId));
publicId = Normalizer.normalizePublicId(Normalizer.decodeURN(Util.getNotNullOrEmpty(publicId)));
- //check whether systemId is an urn
+ //check whether systemId is a urn
if (systemId != null && systemId.startsWith(Util.URN)) {
systemId = Normalizer.decodeURN(systemId);
if (publicId != null && !publicId.equals(systemId)) {
@@ -123,7 +123,7 @@
return null;
}
- //check whether uri is an urn
+ //check whether uri is a urn
if (uri != null && uri.startsWith(Util.URN)) {
String publicId = Normalizer.decodeURN(uri);
if (publicId != null) {
@@ -131,7 +131,7 @@
}
}
- //if no match with a public id, continue search for an URI
+ //if no match with a public id, continue search for a URI
if (result == null) {
//remove fragment if any.
int hashPos = uri.indexOf("#");
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/GroupEntry.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
package javax.xml.catalog;
import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -217,7 +215,7 @@
* @param systemId The system identifier of the external entity being
* referenced.
*
- * @return An URI string if a mapping is found, or null otherwise.
+ * @return a URI string if a mapping is found, or null otherwise.
*/
public String matchSystem(String systemId) {
systemEntrySearched = true;
@@ -285,7 +283,7 @@
* @param publicId The public identifier of the external entity being
* referenced.
*
- * @return An URI string if a mapping is found, or null otherwise.
+ * @return a URI string if a mapping is found, or null otherwise.
*/
public String matchPublic(String publicId) {
/*
@@ -329,7 +327,7 @@
*
* @param uri The URI reference of a resource.
*
- * @return An URI string if a mapping is found, or null otherwise.
+ * @return a URI string if a mapping is found, or null otherwise.
*/
public String matchURI(String uri) {
String match = null;
@@ -455,7 +453,7 @@
delegateCatalog = getLoadedCatalog(catalogId);
if (delegateCatalog == null) {
if (verifyCatalogFile(catalogURI)) {
- delegateCatalog = new CatalogImpl(catalog, features, catalogId);
+ delegateCatalog = new CatalogImpl(catalog, features, catalogURI);
delegateCatalog.load();
delegateCatalogs.put(catalogId, delegateCatalog);
}
@@ -504,7 +502,8 @@
}
//Ignore it if it doesn't exist
- if (!Files.exists(Paths.get(catalogURI))) {
+ if (Util.isFileUri(catalogURI) &&
+ !Util.isFileUriExist(catalogURI, false)) {
return false;
}
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/UriEntry.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/UriEntry.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
import java.net.URL;
/**
- * Represents an uriEntry entry.
+ * Represents a uri entry.
*
* @since 9
*/
@@ -36,7 +36,7 @@
URL uri;
/**
- * Construct a group entry.
+ * Construct a uri entry.
* @param name The name attribute.
* @param uri The uri attribute.
*/
--- a/jaxp/src/java.xml/share/classes/javax/xml/catalog/Util.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/src/java.xml/share/classes/javax/xml/catalog/Util.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,20 @@
package javax.xml.catalog;
import java.io.File;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Iterator;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import static javax.xml.catalog.CatalogFeatures.DEFER_FALSE;
+import static javax.xml.catalog.CatalogFeatures.DEFER_TRUE;
+import javax.xml.catalog.CatalogFeatures.Feature;
+import static javax.xml.catalog.CatalogFeatures.PREFER_PUBLIC;
+import static javax.xml.catalog.CatalogFeatures.PREFER_SYSTEM;
+import static javax.xml.catalog.CatalogFeatures.RESOLVE_CONTINUE;
+import static javax.xml.catalog.CatalogFeatures.RESOLVE_IGNORE;
+import static javax.xml.catalog.CatalogFeatures.RESOLVE_STRICT;
import jdk.xml.internal.SecuritySupport;
/**
@@ -39,22 +46,25 @@
* @since 9
*/
class Util {
+
final static String URN = "urn:publicid:";
final static String PUBLICID_PREFIX = "-//";
final static String PUBLICID_PREFIX_ALT = "+//";
+ final static String SCHEME_FILE = "file";
+ final static String SCHEME_JAR = "jar";
+ final static String SCHEME_JARFILE = "jar:file:";
/**
* Finds an entry in the catalog that matches with the publicId or systemId.
*
- * The resolution follows the following rules determined by the prefer setting:
+ * The resolution follows the following rules determined by the prefer
+ * setting:
*
- * prefer "system": attempts to resolve with a system entry;
- * attempts to resolve with a public entry when only
- * publicId is specified.
+ * prefer "system": attempts to resolve with a system entry; attempts to
+ * resolve with a public entry when only publicId is specified.
*
- * prefer "public": attempts to resolve with a system entry;
- * attempts to resolve with a public entry if no matching
- * system entry is found.
+ * prefer "public": attempts to resolve with a system entry; attempts to
+ * resolve with a public entry if no matching system entry is found.
*
* If no match is found, continue searching uri entries
*
@@ -70,9 +80,9 @@
catalog.reset();
if (systemId != null) {
/*
- If a system identifier is specified, it is used no matter how
- prefer is set.
- */
+ If a system identifier is specified, it is used no matter how
+ prefer is set.
+ */
resolvedSystemId = catalog.matchSystem(systemId);
}
@@ -91,7 +101,7 @@
if (resolvedSystemId == null) {
Iterator<Catalog> iter = catalog.catalogs().iterator();
while (iter.hasNext()) {
- resolvedSystemId = resolve((CatalogImpl)iter.next(), publicId, systemId);
+ resolvedSystemId = resolve((CatalogImpl) iter.next(), publicId, systemId);
if (resolvedSystemId != null) {
break;
}
@@ -102,73 +112,112 @@
return resolvedSystemId;
}
+ static void validateUrisSyntax(URI... uris) {
+ for (URI uri : uris) {
+ validateUriSyntax(uri);
+ }
+ }
+
+ static void validateUrisSyntax(String... uris) {
+ for (String uri : uris) {
+ validateUriSyntax(URI.create(uri));
+ }
+ }
+
/**
- * Resolves the specified file path to an absolute systemId. If it is
- * relative, it shall be resolved using the base or user.dir property if
- * base is not specified.
+ * Validate that the URI must be absolute and a valid URL.
*
- * @param file The specified file path
- * @param baseURI the base URI
- * @return The URI
- * @throws CatalogException if the specified file path can not be converted
- * to a system id
+ * Note that this method does not verify the existence of the resource. The
+ * Catalog standard requires that such resources be ignored.
+ *
+ * @param uri
+ * @throws IllegalArgumentException if the uri is not absolute and a valid
+ * URL
*/
- static URI verifyAndGetURI(String file, URL baseURI)
- throws MalformedURLException, URISyntaxException, IllegalArgumentException {
- URL filepath;
- URI temp;
- if (file != null && file.length() > 0) {
- File f = new File(file);
+ static void validateUriSyntax(URI uri) {
+ CatalogMessages.reportNPEOnNull("URI input", uri);
+
+ if (!uri.isAbsolute()) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_URI_NOTABSOLUTE,
+ new Object[]{uri}, null);
+ }
- if (baseURI != null && !f.isAbsolute()) {
- filepath = new URL(baseURI, fixSlashes(file));
- temp = filepath.toURI();
- } else {
- temp = resolveURI(file);
- }
- //Paths.get may throw IllegalArgumentException
- Path path = Paths.get(temp);
- if (path.toFile().isFile()) {
- return temp;
+ try {
+ // check if the scheme was valid
+ uri.toURL();
+ } catch (MalformedURLException ex) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_URI_NOTVALIDURL,
+ new Object[]{uri}, null);
+ }
+
+ // verify the resource exists where possible
+ if (isFileUri(uri)) {
+ if (!isFileUriExist(uri, false)) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_URI_NOTVALIDURL,
+ new Object[]{uri}, null);
}
}
- return null;
}
/**
- * Resolves the specified uri. If the uri is relative, makes it absolute by
- * the user.dir directory.
+ * Checks whether the URI is a file URI, including JAR file.
*
- * @param uri The specified URI.
- * @return The resolved URI
+ * @param uri the specified URI.
+ * @return true if it is a file or JAR file URI, false otherwise
*/
- static URI resolveURI(String uri) throws MalformedURLException {
- if (uri == null) {
- uri = "";
+ static boolean isFileUri(URI uri) {
+ if (SCHEME_FILE.equals(uri.getScheme())
+ || SCHEME_JAR.equals(uri.getScheme())) {
+ return true;
}
-
- URI temp = null;
- try {
- URL url = new URL(uri);
- temp = url.toURI();
- } catch (MalformedURLException | URISyntaxException mue) {
- File file = new File(uri);
- temp = file.toURI();
- }
-
- return temp;
+ return false;
}
/**
- * Replace backslashes with forward slashes. (URLs always use forward
- * slashes.)
+ * Verifies whether the file resource exists.
*
- * @param sysid The input system identifier.
- * @return The same system identifier with backslashes turned into forward
- * slashes.
+ * @param uri the URI to locate the resource
+ * @param openJarFile a flag to indicate whether a JAR file should be
+ * opened. This operation may be expensive.
+ * @return true if the resource exists, false otherwise.
*/
- static String fixSlashes(String sysid) {
- return sysid.replace('\\', '/');
+ static boolean isFileUriExist(URI uri, boolean openJarFile) {
+ if (uri != null && uri.isAbsolute()) {
+ if (null != uri.getScheme()) {
+ switch (uri.getScheme()) {
+ case SCHEME_FILE:
+ String path = uri.getPath();
+ File f1 = new File(path);
+ if (f1.isFile()) {
+ return true;
+ }
+ break;
+ case SCHEME_JAR:
+ String tempUri = uri.toString();
+ int pos = tempUri.indexOf("!");
+ if (pos < 0) {
+ return false;
+ }
+ if (openJarFile) {
+ String jarFile = tempUri.substring(SCHEME_JARFILE.length(), pos);
+ String entryName = tempUri.substring(pos + 2);
+ try {
+ JarFile jf = new JarFile(jarFile);
+ JarEntry je = jf.getJarEntry(entryName);
+ if (je != null) {
+ return true;
+ }
+ } catch (IOException ex) {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ break;
+ }
+ }
+ }
+ return false;
}
/**
@@ -187,11 +236,12 @@
}
/**
- * Checks whether the specified string is null or empty, returns the original
- * string with leading and trailing spaces removed if not.
+ * Checks whether the specified string is null or empty, returns the
+ * original string with leading and trailing spaces removed if not.
+ *
* @param test the string to be tested
- * @return the original string with leading and trailing spaces removed,
- * or null if it is null or empty
+ * @return the original string with leading and trailing spaces removed, or
+ * null if it is null or empty
*
*/
static String getNotNullOrEmpty(String test) {
@@ -206,4 +256,39 @@
}
}
}
+
+ /**
+ * Validates the input for features.
+ *
+ * @param f the feature
+ * @param value the value
+ * @throws IllegalArgumentException if the value is invalid for the feature
+ */
+ static void validateFeatureInput(Feature f, String value) {
+ CatalogMessages.reportNPEOnNull(f.name(), value);
+ if (value.length() == 0) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_INVALID_ARGUMENT,
+ new Object[]{value, f.name()}, null);
+ }
+
+ if (f == Feature.PREFER) {
+ if (!value.equals(PREFER_SYSTEM) && !value.equals(PREFER_PUBLIC)) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_INVALID_ARGUMENT,
+ new Object[]{value, Feature.PREFER.name()}, null);
+ }
+ } else if (f == Feature.DEFER) {
+ if (!value.equals(DEFER_TRUE) && !value.equals(DEFER_FALSE)) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_INVALID_ARGUMENT,
+ new Object[]{value, Feature.DEFER.name()}, null);
+ }
+ } else if (f == Feature.RESOLVE) {
+ if (!value.equals(RESOLVE_STRICT) && !value.equals(RESOLVE_CONTINUE)
+ && !value.equals(RESOLVE_IGNORE)) {
+ CatalogMessages.reportIAE(CatalogMessages.ERR_INVALID_ARGUMENT,
+ new Object[]{value, Feature.RESOLVE.name()}, null);
+ }
+ } else if (f == Feature.FILES) {
+ Util.validateUrisSyntax(value.split(";"));
+ }
+ }
}
--- a/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/SpecifyCatalogTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -81,7 +81,7 @@
@Test
public void specifyCatalogViaSysProps() {
setSystemProperty(FEATURE_FILES,
- getCatalogPath("specifyCatalog-sysProps.xml"));
+ getCatalogPath("specifyCatalog-sysProps.xml").toASCIIString());
checkResolutionOnEntityResolver(catalogResolver((String[]) null),
"http://local/base/dtd/docSysPropsSys.dtd");
@@ -107,6 +107,6 @@
}
private static CatalogFeatures createFeature(String catalogName) {
- return builder().with(FILES, getCatalogPath(catalogName)).build();
+ return builder().with(FILES, getCatalogPath(catalogName).toASCIIString()).build();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/functional/catalog/catalogFiles/dummy.xml Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,1 @@
+<dummy />
--- a/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/libs/catalog/CatalogTestUtils.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,17 +25,16 @@
import java.io.File;
import java.io.IOException;
+import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogManager;
import javax.xml.catalog.CatalogResolver;
-
import jaxp.library.JAXPTestUtilities;
/*
@@ -115,20 +114,20 @@
}
// Gets the paths of the specified catalogs.
- private static String[] getCatalogPaths(String... catalogNames) {
+ private static URI[] getCatalogPaths(String... catalogNames) {
return catalogNames == null
? null
: Stream.of(catalogNames).map(
catalogName -> getCatalogPath(catalogName)).collect(
- Collectors.toList()).toArray(new String[0]);
+ Collectors.toList()).toArray(new URI[0]);
}
// Gets the paths of the specified catalogs.
- static String getCatalogPath(String catalogName) {
+ static URI getCatalogPath(String catalogName) {
return catalogName == null
? null
- : JAXPTestUtilities.getPathByClassName(CatalogTestUtils.class, "catalogFiles")
- + catalogName;
+ : Paths.get(JAXPTestUtilities.getPathByClassName(CatalogTestUtils.class, "catalogFiles")
+ + catalogName).toUri();
}
/* ********** jaxp.properties ********** */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/JarUtils.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 jaxp.library;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * This class consists exclusively of static utility methods that are useful
+ * for creating and manipulating JAR files.
+ */
+
+public final class JarUtils {
+ private JarUtils() { }
+
+ /**
+ * Creates a JAR file.
+ *
+ * Equivalent to {@code jar cfm <jarfile> <manifest> -C <dir> file...}
+ *
+ * The input files are resolved against the given directory. Any input
+ * files that are directories are processed recursively.
+ */
+ public static void createJarFile(Path jarfile, Manifest man, Path dir, Path... file)
+ throws IOException
+ {
+ // create the target directory
+ Path parent = jarfile.getParent();
+ if (parent != null)
+ Files.createDirectories(parent);
+
+ List<Path> entries = new ArrayList<>();
+ for (Path entry : file) {
+ Files.find(dir.resolve(entry), Integer.MAX_VALUE,
+ (p, attrs) -> attrs.isRegularFile())
+ .map(e -> dir.relativize(e))
+ .forEach(entries::add);
+ }
+
+ try (OutputStream out = Files.newOutputStream(jarfile);
+ JarOutputStream jos = new JarOutputStream(out))
+ {
+ if (man != null) {
+ JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
+ jos.putNextEntry(je);
+ man.write(jos);
+ jos.closeEntry();
+ }
+
+ for (Path entry : entries) {
+ String name = toJarEntryName(entry);
+ jos.putNextEntry(new JarEntry(name));
+ Files.copy(dir.resolve(entry), jos);
+ jos.closeEntry();
+ }
+ }
+ }
+
+ /**
+ * Creates a JAR file.
+ *
+ * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
+ *
+ * The input files are resolved against the given directory. Any input
+ * files that are directories are processed recursively.
+ */
+ public static void createJarFile(Path jarfile, Path dir, Path... file)
+ throws IOException
+ {
+ createJarFile(jarfile, null, dir, file);
+ }
+
+ /**
+ * Creates a JAR file.
+ *
+ * Equivalent to {@code jar cf <jarfile> -C <dir> file...}
+ *
+ * The input files are resolved against the given directory. Any input
+ * files that are directories are processed recursively.
+ */
+ public static void createJarFile(Path jarfile, Path dir, String... input)
+ throws IOException
+ {
+ Path[] paths = Stream.of(input).map(Paths::get).toArray(Path[]::new);
+ createJarFile(jarfile, dir, paths);
+ }
+
+ /**
+ * Creates a JAR file from the contents of a directory.
+ *
+ * Equivalent to {@code jar cf <jarfile> -C <dir> .}
+ */
+ public static void createJarFile(Path jarfile, Path dir) throws IOException {
+ createJarFile(jarfile, dir, Paths.get("."));
+ }
+
+ /**
+ * Map a file path to the equivalent name in a JAR file
+ */
+ private static String toJarEntryName(Path file) {
+ Path normalized = file.normalize();
+ return normalized.subpath(0, normalized.getNameCount()) // drop root
+ .toString()
+ .replace(File.separatorChar, '/');
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/libs/jaxp/library/SimpleHttpServer.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 jaxp.library;
+
+import com.sun.net.httpserver.Headers;
+import com.sun.net.httpserver.HttpContext;
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * A simple HTTP Server
+ */
+public class SimpleHttpServer {
+ HttpServer _httpserver;
+ ExecutorService _executor;
+
+ String _address;
+
+ String _context, _docroot;
+ int _port;
+
+ public SimpleHttpServer(String context, String docroot) {
+ //let the system pick up an ephemeral port in a bind operation
+ this(0, context, docroot);
+ }
+
+ public SimpleHttpServer(int port, String context, String docroot) {
+ _port = port;
+ _context = context;
+ _docroot = docroot;
+ }
+
+ public void start() {
+ MyHttpHandler handler = new MyHttpHandler(_docroot);
+ InetSocketAddress addr = new InetSocketAddress(_port);
+ try {
+ _httpserver = HttpServer.create(addr, 0);
+ } catch (IOException ex) {
+ throw new RuntimeException("cannot create httpserver", ex);
+ }
+
+ //TestHandler is mapped to /test
+ HttpContext ctx = _httpserver.createContext(_context, handler);
+
+ _executor = Executors.newCachedThreadPool();
+ _httpserver.setExecutor(_executor);
+ _httpserver.start();
+
+ _address = "http://localhost:" + _httpserver.getAddress().getPort();
+ }
+
+ public void stop() {
+ _httpserver.stop(2);
+ _executor.shutdown();
+ }
+
+ public String getAddress() {
+ return _address;
+ }
+
+ static class MyHttpHandler implements HttpHandler {
+
+ String _docroot;
+
+ public MyHttpHandler(String docroot) {
+ _docroot = docroot;
+ }
+
+ public void handle(HttpExchange t)
+ throws IOException {
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ Headers rmap = t.getResponseHeaders();
+ OutputStream os = t.getResponseBody();
+ URI uri = t.getRequestURI();
+ String path = uri.getPath();
+
+
+ while (is.read() != -1) ;
+ is.close();
+
+ File f = new File(_docroot, path);
+ if (!f.exists()) {
+ notfound(t, path);
+ return;
+ }
+
+ String method = t.getRequestMethod();
+ if (method.equals("HEAD")) {
+ rmap.set("Content-Length", Long.toString(f.length()));
+ t.sendResponseHeaders(200, -1);
+ t.close();
+ } else if (!method.equals("GET")) {
+ t.sendResponseHeaders(405, -1);
+ t.close();
+ return;
+ }
+
+ if (path.endsWith(".html") || path.endsWith(".htm")) {
+ rmap.set("Content-Type", "text/html");
+ } else {
+ rmap.set("Content-Type", "text/plain");
+ }
+
+ t.sendResponseHeaders (200, f.length());
+
+ FileInputStream fis = new FileInputStream(f);
+ int count = 0;
+ try {
+ byte[] buf = new byte[16 * 1024];
+ int len;
+ while ((len = fis.read(buf)) != -1) {
+ os.write(buf, 0, len);
+ count += len;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ fis.close();
+ os.close();
+ }
+
+ void moved(HttpExchange t) throws IOException {
+ Headers req = t.getRequestHeaders();
+ Headers map = t.getResponseHeaders();
+ URI uri = t.getRequestURI();
+ String host = req.getFirst("Host");
+ String location = "http://" + host + uri.getPath() + "/";
+ map.set("Content-Type", "text/html");
+ map.set("Location", location);
+ t.sendResponseHeaders(301, -1);
+ t.close();
+ }
+
+ void notfound(HttpExchange t, String p) throws IOException {
+ t.getResponseHeaders().set("Content-Type", "text/html");
+ t.sendResponseHeaders(404, 0);
+ OutputStream os = t.getResponseBody();
+ String s = "<h2>File not found</h2>";
+ s = s + p + "<p>";
+ os.write(s.getBytes());
+ os.close();
+ t.close();
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogAccessTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 catalog;
+
+import java.net.URI;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import static jaxp.library.JAXPTestUtilities.tryRunWithAllPerm;
+
+/*
+ * @test
+ * @bug 8171243
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true catalog.CatalogAccessTest
+ * @summary the Catalog API grants no privilege to external resources. This test
+ * verifies that SecurityException will be thrown if access to resources is denied
+ * by the security manager.
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class CatalogAccessTest {
+ static final CatalogFeatures FEATURES = CatalogFeatures.builder().
+ with(CatalogFeatures.Feature.PREFER, "system").build();
+
+ /*
+ * Verifies that the SecurityException is thrown if access to the resource is
+ * denied by the security manager.
+ */
+ @Test(dataProvider = "accessTest", expectedExceptions = SecurityException.class)
+ public void testSecurity(String cfile, String sysId, String pubId) throws Exception {
+ CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, URI.create(cfile));
+ InputSource is = cr.resolveEntity(pubId, sysId);
+ Assert.fail("Failed to throw SecurityException");
+ }
+
+ /*
+ DataProvider: used for SecurityException testing
+ Data columns:
+ catalog uri, systemId, publicId
+ */
+ @DataProvider(name = "accessTest")
+ Object[][] getDataForAccessTest() throws Exception {
+ String systemId = "http://www.sys00test.com/rewrite.dtd";
+ String publicId = "PUB-404";
+ String urlFile = tryRunWithAllPerm(() ->
+ getClass().getResource("rewriteSystem_id.xml").toExternalForm());
+ return new Object[][]{
+ {urlFile, systemId, publicId}
+ };
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogFileInputTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 catalog;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import static java.nio.file.StandardOpenOption.APPEND;
+import static java.nio.file.StandardOpenOption.CREATE;
+import javax.xml.catalog.Catalog;
+import javax.xml.catalog.CatalogException;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import static jaxp.library.JAXPTestUtilities.getSystemProperty;
+import jaxp.library.JarUtils;
+import jaxp.library.SimpleHttpServer;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @test
+ * @bug 8151154 8171243
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm catalog.CatalogFileInputTest
+ * @summary Verifies that the Catalog API accepts valid URIs only;
+ Verifies that the CatalogFeatures' builder throws
+ * IllegalArgumentException on invalid file inputs.
+ * This test was splitted from CatalogTest.java due to
+ * JDK-8168968, it has to only run without SecurityManager
+ * because an ACE will be thrown for invalid path.
+ */
+@Listeners({jaxp.library.FilePolicy.class, jaxp.library.NetAccessPolicy.class})
+public class CatalogFileInputTest extends CatalogSupportBase {
+
+ static final CatalogFeatures FEATURES = CatalogFeatures.builder().
+ with(CatalogFeatures.Feature.PREFER, "system").build();
+ static String USER_DIR = getSystemProperty("user.dir");
+ static String CLS_DIR = getSystemProperty("test.classes");
+ static String SRC_DIR = System.getProperty("test.src");
+ static String JAR_CONTENT = "META-INF";
+ final static String SCHEME_JARFILE = "jar:";
+ static final String REMOTE_FILE_LOCATION = "/jar/META-INF";
+ static final String DOCROOT = SRC_DIR;
+ static final String TESTCONTEXT = REMOTE_FILE_LOCATION; //mapped to local file path
+ SimpleHttpServer _httpserver;
+ String _remoteFilePath;
+
+ /*
+ * Initializing fields
+ */
+ @BeforeClass
+ public void setUpClass() throws Exception {
+ super.setUp();
+
+ // set up HttpServer
+ _httpserver = new SimpleHttpServer(TESTCONTEXT, DOCROOT);
+ _httpserver.start();
+ _remoteFilePath = _httpserver.getAddress() + REMOTE_FILE_LOCATION;
+
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ if (_httpserver != null) {
+ _httpserver.stop();
+ }
+ }
+
+ /*
+ * Verifies that the Catalog can be created with file system paths including JAR
+ * and http URL, and used to resolve a systemId as expected.
+ */
+ @Test(dataProvider = "acceptedURI")
+ public void testMatch(String uri, String sysId, String pubId,
+ String expectedId, String msg) throws Exception {
+ CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, URI.create(uri));
+ InputSource is = cr.resolveEntity(pubId, sysId);
+ Assert.assertNotNull(is, msg);
+ Assert.assertEquals(expectedId, is.getSystemId(), msg);
+ }
+
+ @Test(dataProvider = "invalidCatalog")
+ public void testEmptyCatalog(String uri, String publicId, String msg) {
+ Catalog c = CatalogManager.catalog(FEATURES, uri != null? URI.create(uri) : null);
+ Assert.assertNull(c.matchSystem(publicId), msg);
+ }
+
+ @Test(dataProvider = "invalidCatalog", expectedExceptions = CatalogException.class)
+ public void testCatalogResolverWEmptyCatalog(String uri, String publicId, String msg) {
+ CatalogResolver cr = CatalogManager.catalogResolver(
+ CatalogFeatures.builder().with(CatalogFeatures.Feature.RESOLVE, "strict").build(),
+ uri != null? URI.create(uri) : null);
+ InputSource is = cr.resolveEntity(publicId, "");
+ }
+
+ @Test(dataProvider = "invalidCatalog")
+ public void testCatalogResolverWEmptyCatalog1(String uri, String publicId, String msg) {
+ CatalogResolver cr = CatalogManager.catalogResolver(
+ CatalogFeatures.builder().with(CatalogFeatures.Feature.RESOLVE, "continue").build(),
+ uri != null? URI.create(uri) : null);
+ Assert.assertNull(cr.resolveEntity(publicId, ""), msg);
+ }
+
+ @Test(dataProvider = "invalidInput", expectedExceptions = IllegalArgumentException.class)
+ public void testFileInput(String file) {
+ CatalogFeatures features = CatalogFeatures.builder()
+ .with(CatalogFeatures.Feature.FILES, file)
+ .build();
+ }
+
+ @Test(dataProvider = "invalidInput", expectedExceptions = IllegalArgumentException.class)
+ public void testInvalidUri(String file) {
+ CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, file != null? URI.create(file) : null);
+ }
+
+ @Test(dataProvider = "invalidInput", expectedExceptions = IllegalArgumentException.class)
+ public void testInvalidUri1(String file) {
+ Catalog c = CatalogManager.catalog(FEATURES, file != null? URI.create(file) : null);
+ System.err.println("Catalog =" + c);
+ }
+
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullFileInput() {
+ CatalogFeatures features = CatalogFeatures.builder()
+ .with(CatalogFeatures.Feature.FILES, null)
+ .build();
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullUri() {
+ URI uri = null;
+ CatalogResolver cr = CatalogManager.catalogResolver(FEATURES, uri);
+ }
+
+ @Test(expectedExceptions = NullPointerException.class)
+ public void testNullUri1() {
+ URI uri = null;
+ Catalog c = CatalogManager.catalog(FEATURES, uri);
+ }
+
+ String systemId = "http://www.sys00test.com/rewrite.dtd";
+ String publicId = "PUB-404";
+ String expected = "http://www.groupxmlbase.com/dtds/rewrite.dtd";
+ String errMsg = "Relative rewriteSystem with xml:base at group level failed";
+
+ /*
+ DataProvider: used to verify CatalogResolver's resolveEntity function.
+ Data columns:
+ catalog, systemId, publicId, expectedUri, msg
+ */
+ @DataProvider(name = "acceptedURI")
+ Object[][] getData() throws Exception {
+ String filename = "rewriteSystem_id.xml";
+ String urlFile = getClass().getResource(filename).toExternalForm();
+ String urlHttp = _remoteFilePath + "/jax-ws-catalog.xml";
+ String remoteXSD = _remoteFilePath + "/catalog/ws-addr.xsd";
+ File file = new File(CLS_DIR + "/JDK8171243.jar!/META-INF/jax-ws-catalog.xml");
+ String jarPath = SCHEME_JARFILE + file.toURI().toString();
+ String xsd = jarPath.substring(0, jarPath.lastIndexOf("/")) + "/catalog/ws-addr.xsd";
+
+ // create JAR file
+ try {
+ JarUtils.createJarFile(Paths.get(CLS_DIR + "/JDK8171243.jar"),
+ Paths.get(SRC_DIR + "/jar"), JAR_CONTENT);
+ } catch (IOException ex) {
+ Assert.fail("Failed to create JAR: " + ex.getMessage());
+ }
+
+ return new Object[][]{
+ // URL
+ {urlFile, systemId, publicId, expected, errMsg},
+ {urlHttp, "http://www.w3.org/2006/03/addressing/ws-addr.xsd", "", remoteXSD, "http test failed."},
+ // JAR file
+ {jarPath, "http://www.w3.org/2006/03/addressing/ws-addr.xsd", "", xsd, "jar file test failed."},
+ };
+ }
+
+ /*
+ * DataProvider: invalid catalog result in empty catalog
+ * Note: the difference from invalidInput is that invalidInput is syntactically
+ * rejected with an IAE.
+ */
+ @DataProvider(name = "invalidCatalog")
+ public Object[][] getInvalidCatalog() throws Exception {
+ String catalogUri = getClass().getResource("catalog_invalid.xml").toExternalForm();
+ return new Object[][]{
+ {catalogUri, "-//W3C//DTD XHTML 1.0 Strict//EN",
+ "The catalog is invalid, attempting to match the public entry shall return null."}
+ };
+ }
+
+ /*
+ * DataProvider: a list of invalid inputs, expects IAE
+ * Note: exclude null since NPE would have been expected
+ */
+ @DataProvider(name = "invalidInput")
+ public Object[][] getFiles() throws Exception {
+ String filename = "rewriteSystem_id.xml";
+ copyFile(Paths.get(SRC_DIR + "/" + filename), Paths.get(filename));
+ String absolutePath = getClass().getResource(filename).getFile();
+
+ return new Object[][]{
+ {""},
+ {"file:a/b\\c"},
+ {"file:/../../.."},
+ {"c:/te:t"},
+ {"c:/te?t"},
+ {"c/te*t"},
+ {"in|valid.txt"},
+ {"shema:invalid.txt"},
+ // relative file path
+ {filename},
+ // absolute file path
+ {absolutePath}
+ };
+ }
+
+ /*
+ DataProvider: a list of invalid inputs
+ */
+ @DataProvider(name = "nullTest")
+ public Object[][] getNull() throws Exception {
+
+ return new Object[][]{
+ {null},
+ };
+ }
+
+ void copyFile(Path src, Path target) throws Exception {
+
+ try (InputStream in = Files.newInputStream(src);
+ BufferedReader reader
+ = new BufferedReader(new InputStreamReader(in));
+ OutputStream out = new BufferedOutputStream(
+ Files.newOutputStream(target, CREATE, APPEND));
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out))) {
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ bw.write(line);
+ }
+ } catch (IOException x) {
+ throw new Exception(x.getMessage());
+ }
+ }
+}
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogInvalidPathTest.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * 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 catalog;
-
-import javax.xml.catalog.CatalogFeatures;
-
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/*
- * @test
- * @bug 8151154
- * @run testng/othervm catalog.CatalogInvalidPathTest
- * @summary Verifies that the CatalogFeatures' builder throws
- * IllegalArgumentException on invalid file inputs.
- * This test was splitted from CatalogTest.java due to
- * JDK-8168968, it has to only run without SecurityManager
- * because an ACE will be thrown for invalid path.
- */
-public class CatalogInvalidPathTest {
- /*
- DataProvider: for testing the verification of file paths by
- the CatalogFeatures builder
- */
- @DataProvider(name = "invalidPaths")
- public Object[][] getFiles() {
- return new Object[][]{
- {null},
- {""},
- {"file:a/b\\c"},
- {"file:/../../.."},
- {"c:/te:t"},
- {"c:/te?t"},
- {"c/te*t"},
- {"in|valid.txt"},
- {"shema:invalid.txt"},
- };
- }
-
- @Test(dataProvider = "invalidPaths", expectedExceptions = IllegalArgumentException.class)
- public void testFileInput(String file) {
- CatalogFeatures features = CatalogFeatures.builder()
- .with(CatalogFeatures.Feature.FILES, file)
- .build();
- }
-}
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogSupportBase.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,13 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
+import java.nio.file.Paths;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
import javax.xml.XMLConstants;
import javax.xml.catalog.CatalogFeatures;
import javax.xml.catalog.CatalogResolver;
@@ -133,8 +140,8 @@
dtd_system = filepath + "system.dtd";
dtd_systemResolved = "<!ENTITY system \"resolved by an EntityHandler, rather than a Catalog\">";
- xml_catalog = filepath + "CatalogSupport.xml";
- xml_bogus_catalog = filepath + "CatalogSupport_bogus.xml";
+ xml_catalog = Paths.get(filepath + "CatalogSupport.xml").toUri().toASCIIString();
+ xml_bogus_catalog = Paths.get(filepath + "CatalogSupport_bogus.xml").toUri().toASCIIString();
xml_xInclude = "<?xml version=\"1.0\"?>\n" +
"<xinclude:include xmlns:xinclude=\"http://www.w3.org/2001/XInclude\"\n" +
@@ -997,4 +1004,35 @@
return null;
}
}
+
+ /**
+ * Simple policy implementation that grants a set of permissions to all code
+ * sources and protection domains.
+ */
+ static class SimplePolicy extends Policy {
+
+ private final Permissions perms;
+
+ public SimplePolicy(Permission... permissions) {
+ perms = new Permissions();
+ for (Permission permission : permissions) {
+ perms.add(permission);
+ }
+ }
+
+ @Override
+ public PermissionCollection getPermissions(CodeSource cs) {
+ return perms;
+ }
+
+ @Override
+ public PermissionCollection getPermissions(ProtectionDomain pd) {
+ return perms;
+ }
+
+ @Override
+ public boolean implies(ProtectionDomain pd, Permission p) {
+ return perms.implies(p);
+ }
+ }
}
--- a/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/CatalogTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -22,17 +22,14 @@
*/
package catalog;
-import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
-import static jaxp.library.JAXPTestUtilities.setSystemProperty;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
+import java.net.URI;
import java.nio.file.Paths;
-
import javax.xml.XMLConstants;
import javax.xml.catalog.Catalog;
import javax.xml.catalog.CatalogException;
@@ -55,7 +52,8 @@
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
-
+import static jaxp.library.JAXPTestUtilities.clearSystemProperty;
+import static jaxp.library.JAXPTestUtilities.setSystemProperty;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -95,10 +93,10 @@
* CatalogException is thrown.
*/
@Test(dataProvider = "getFeatures", expectedExceptions = CatalogException.class)
- public void testCircularRef(CatalogFeatures cf, String xml) {
+ public void testCircularRef(CatalogFeatures cf, String xml) throws Exception {
CatalogResolver catalogResolver = CatalogManager.catalogResolver(
cf,
- getClass().getResource(xml).getFile());
+ getClass().getResource(xml).toURI());
catalogResolver.resolve("anyuri", "");
}
@@ -108,14 +106,14 @@
*/
@DataProvider(name = "getFeatures")
public Object[][] getFeatures() {
-
+ String self = "catalogReferCircle-itself.xml";
+ String left = "catalogReferCircle-left.xml";
return new Object[][]{
- {CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "false").build(),
- "catalogReferCircle-itself.xml"},
- {CatalogFeatures.defaults(), "catalogReferCircle-itself.xml"},
- {CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "false").build(),
- "catalogReferCircle-left.xml"},
- {CatalogFeatures.defaults(), "catalogReferCircle-left.xml"},};
+ {CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "false").build(), self},
+ {CatalogFeatures.defaults(), self},
+ {CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "false").build(), left},
+ {CatalogFeatures.defaults(), left}
+ };
}
/*
@@ -134,7 +132,7 @@
* Expected: the parser returns the expected string.
*/
@Test(dataProvider = "supportXMLResolver")
- public void supportEntityResolver(String catalogFile, String xml, String expected) throws Exception {
+ public void supportEntityResolver(URI catalogFile, String xml, String expected) throws Exception {
String xmlSource = getClass().getResource(xml).getFile();
CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
@@ -150,7 +148,7 @@
* Expected: the parser returns the expected string.
*/
@Test(dataProvider = "supportXMLResolver")
- public void supportXMLResolver(String catalogFile, String xml, String expected) throws Exception {
+ public void supportXMLResolver(URI catalogFile, String xml, String expected) throws Exception {
String xmlSource = getClass().getResource(xml).getFile();
CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
@@ -159,7 +157,7 @@
xifactory.setProperty(XMLInputFactory.IS_COALESCING, true);
xifactory.setProperty(XMLInputFactory.RESOLVER, cr);
File file = new File(xmlSource);
- String systemId = file.toURI().toString();
+ String systemId = file.toURI().toASCIIString();
InputStream entityxml = new FileInputStream(file);
XMLStreamReader streamReader = xifactory.createXMLStreamReader(systemId, entityxml);
String result = null;
@@ -183,7 +181,7 @@
* Fail: throws Exception if references are not resolved (by the CatalogResolver)
*/
@Test(dataProvider = "supportLSResourceResolver")
- public void supportLSResourceResolver(String catalogFile, Source schemaSource) throws SAXException {
+ public void supportLSResourceResolver(URI catalogFile, Source schemaSource) throws SAXException {
CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
@@ -199,7 +197,7 @@
* Fail: throws Exception if references are not resolved (by the CatalogResolver)
*/
@Test(dataProvider = "supportLSResourceResolver1")
- public void supportLSResourceResolver1(String catalogFile, Source source) throws Exception {
+ public void supportLSResourceResolver1(URI catalogFile, Source source) throws Exception {
CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
@@ -215,7 +213,7 @@
* Fail: throws Exception if references are not resolved (by the CatalogResolver)
*/
@Test(dataProvider = "supportURIResolver")
- public void supportURIResolver(String catalogFile, Source xsl, Source xml, String expected) throws Exception {
+ public void supportURIResolver(URI catalogFile, Source xsl, Source xml, String expected) throws Exception {
CatalogResolver cr = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
@@ -235,9 +233,9 @@
catalog filepath, xml source file, expected result
*/
@DataProvider(name = "supportXMLResolver")
- public Object[][] supportXMLResolver() {
- String catalogFile = getClass().getResource("catalog.xml").getFile();
- String catalogFileUri = getClass().getResource("catalog_uri.xml").getFile();
+ public Object[][] supportXMLResolver() throws Exception {
+ URI catalogFile = getClass().getResource("catalog.xml").toURI();
+ URI catalogFileUri = getClass().getResource("catalog_uri.xml").toURI();
return new Object[][]{
{catalogFile, "system.xml", "Test system entry"},
@@ -263,9 +261,9 @@
catalog filepath, schema source file
*/
@DataProvider(name = "supportLSResourceResolver")
- public Object[][] supportLSResourceResolver() {
- String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
- String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+ public Object[][] supportLSResourceResolver() throws Exception {
+ URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
+ URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
/*
* XMLSchema.xsd has a reference to XMLSchema.dtd which in turn refers to
@@ -287,9 +285,9 @@
catalog filepath, source file
*/
@DataProvider(name = "supportLSResourceResolver1")
- public Object[][] supportLSResourceResolver1() {
- String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
- String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+ public Object[][] supportLSResourceResolver1() throws Exception {
+ URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
+ URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
/*
* val_test.xml has a reference to system.dtd and val_test.xsd
@@ -310,9 +308,9 @@
catalog filepath, xsl source, xml source file
*/
@DataProvider(name = "supportURIResolver")
- public Object[][] supportURIResolver() {
- String catalogFile = getClass().getResource("CatalogSupport.xml").getFile();
- String catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").getFile();
+ public Object[][] supportURIResolver() throws Exception {
+ URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
+ URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
SAXSource xslSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
/*
@@ -353,8 +351,9 @@
* other cases in that test.
*/
@Test(dataProvider = "resolveUri")
- public void testMatch1(String cFile, String href, String expectedFile, String expectedUri, String msg) {
- String catalogFile = getClass().getResource(cFile).getFile();
+ public void testMatch1(String cFile, String href, String expectedFile,
+ String expectedUri, String msg) throws Exception {
+ URI catalogFile = getClass().getResource(cFile).toURI();
CatalogResolver cur = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalogFile);
Source source = cur.resolve(href, null);
Assert.assertNotNull(source, "Source returned is null");
@@ -368,15 +367,16 @@
*/
@Test(dataProvider = "hierarchyOfCatFilesData")
public void hierarchyOfCatFiles2(String systemId, String expectedUri) {
- String file1 = getClass().getResource("first_cat.xml").getFile();
- String file2 = getClass().getResource("second_cat.xml").getFile();
+ String file1 = getClass().getResource("first_cat.xml").toExternalForm();
+ String file2 = getClass().getResource("second_cat.xml").toExternalForm();
String files = file1 + ";" + file2;
try {
setSystemProperty(KEY_FILES, files);
CatalogResolver catalogResolver = CatalogManager.catalogResolver(CatalogFeatures.defaults());
String sysId = catalogResolver.resolveEntity(null, systemId).getSystemId();
- Assert.assertEquals(sysId, Paths.get(filepath + expectedUri).toUri().toString().replace("///", "/"), "System ID match not right");
+ Assert.assertEquals(sysId, Paths.get(filepath + expectedUri).toUri().toString().replace("///", "/"),
+ "System ID match not right");
} finally {
clearSystemProperty(KEY_FILES);
}
@@ -390,8 +390,9 @@
* expected.
*/
@Test(dataProvider = "resolveEntity")
- public void testMatch1(String cfile, String prefer, String sysId, String pubId, String expectedUri, String expectedFile, String msg) {
- String catalogFile = getClass().getResource(cfile).getFile();
+ public void testMatch1(String cfile, String prefer, String sysId, String pubId,
+ String expectedUri, String expectedFile, String msg) throws Exception {
+ URI catalogFile = getClass().getResource(cfile).toURI();
CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build();
CatalogResolver catalogResolver = CatalogManager.catalogResolver(features, catalogFile);
InputSource is = catalogResolver.resolveEntity(pubId, sysId);
@@ -406,9 +407,12 @@
* results as expected.
*/
@Test(dataProvider = "matchWithPrefer")
- public void matchWithPrefer(String prefer, String cfile, String publicId, String systemId, String expected) {
- String catalogFile = getClass().getResource(cfile).getFile();
- Catalog c = CatalogManager.catalog(CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build(), catalogFile);
+ public void matchWithPrefer(String prefer, String cfile, String publicId,
+ String systemId, String expected) throws Exception {
+ URI catalogFile = getClass().getResource(cfile).toURI();
+ Catalog c = CatalogManager.catalog(
+ CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).build(),
+ catalogFile);
String result;
if (publicId != null && publicId.length() > 0) {
result = c.matchPublic(publicId);
@@ -430,8 +434,9 @@
* system entry is found.
*/
@Test(dataProvider = "resolveWithPrefer")
- public void resolveWithPrefer(String prefer, String cfile, String publicId, String systemId, String expected) {
- String catalogFile = getClass().getResource(cfile).getFile();
+ public void resolveWithPrefer(String prefer, String cfile, String publicId,
+ String systemId, String expected) throws Exception {
+ URI catalogFile = getClass().getResource(cfile).toURI();
CatalogFeatures f = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, prefer).with(CatalogFeatures.Feature.RESOLVE, "ignore").build();
CatalogResolver catalogResolver = CatalogManager.catalogResolver(f, catalogFile);
String result = catalogResolver.resolveEntity(publicId, systemId).getSystemId();
@@ -445,8 +450,8 @@
* be loaded is determined by the defer attribute.
*/
@Test(dataProvider = "invalidAltCatalogs", expectedExceptions = CatalogException.class)
- public void testDeferAltCatalogs(String file) {
- String catalogFile = getClass().getResource(file).getFile();
+ public void testDeferAltCatalogs(String file) throws Exception {
+ URI catalogFile = getClass().getResource(file).toURI();
CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.DEFER, "true").build();
/*
Since the defer attribute is set to false in the specified catalog file,
@@ -462,8 +467,8 @@
* PREFER from Features API taking precedence over catalog file
*/
@Test
- public void testJDK8146237() {
- String catalogFile = getClass().getResource("JDK8146237_catalog.xml").getFile();
+ public void testJDK8146237() throws Exception {
+ URI catalogFile = getClass().getResource("JDK8146237_catalog.xml").toURI();
try {
CatalogFeatures features = CatalogFeatures.builder().with(CatalogFeatures.Feature.PREFER, "system").build();
@@ -482,8 +487,8 @@
Verifies that the resulting systemId does not contain duplicate slashes
*/
@Test
- public void testRewriteSystem() {
- String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+ public void testRewriteSystem() throws Exception {
+ URI catalog = getClass().getResource("rewriteCatalog.xml").toURI();
try {
CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), catalog);
@@ -500,8 +505,8 @@
Verifies that the resulting systemId does not contain duplicate slashes
*/
@Test
- public void testRewriteUri() {
- String catalog = getClass().getResource("rewriteCatalog.xml").getFile();
+ public void testRewriteUri() throws Exception {
+ URI catalog = getClass().getResource("rewriteCatalog.xml").toURI();
try {
@@ -519,18 +524,18 @@
*/
@Test(expectedExceptions = NullPointerException.class)
public void testFeatureNull() {
- CatalogResolver resolver = CatalogManager.catalogResolver(null, "");
+ CatalogResolver resolver = CatalogManager.catalogResolver(null, null);
}
/*
@bug 8144966
- Verifies that passing null as the path will result in a NPE.
+ Verifies that passing null as the URI will result in a NPE.
*/
@Test(expectedExceptions = NullPointerException.class)
public void testPathNull() {
- String path = null;
- CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), path);
+ URI uri = null;
+ CatalogResolver resolver = CatalogManager.catalogResolver(CatalogFeatures.defaults(), uri);
}
/*
@@ -540,10 +545,11 @@
that matches the expected value.
*/
@Test(dataProvider = "catalog")
- public void testCatalogResolver(String test, String expected, String catalogFile, String xml, SAXParser saxParser) {
- String catalog = null;
+ public void testCatalogResolver(String test, String expected, String catalogFile,
+ String xml, SAXParser saxParser) throws Exception {
+ URI catalog = null;
if (catalogFile != null) {
- catalog = getClass().getResource(catalogFile).getFile();
+ catalog = getClass().getResource(catalogFile).toURI();
}
String url = getClass().getResource(xml).getFile();
try {
@@ -565,8 +571,8 @@
catalog is provided, the resolver will throw an exception by default.
*/
@Test
- public void testInvalidCatalog() {
- String catalog = getClass().getResource("catalog_invalid.xml").getFile();
+ public void testInvalidCatalog() throws Exception {
+ URI catalog = getClass().getResource("catalog_invalid.xml").toURI();
String test = "testInvalidCatalog";
try {
@@ -590,7 +596,7 @@
*/
@Test
public void testIgnoreInvalidCatalog() {
- String catalog = getClass().getResource("catalog_invalid.xml").getFile();
+ String catalog = getClass().getResource("catalog_invalid.xml").toExternalForm();
CatalogFeatures f = CatalogFeatures.builder()
.with(Feature.FILES, catalog)
.with(Feature.PREFER, "public")
@@ -600,7 +606,7 @@
String test = "testInvalidCatalog";
try {
- CatalogResolver resolver = CatalogManager.catalogResolver(f, "");
+ CatalogResolver resolver = CatalogManager.catalogResolver(f);
String actualSystemId = resolver.resolveEntity(null, "http://remote/xml/dtd/sys/alice/docAlice.dtd").getSystemId();
System.out.println("testIgnoreInvalidCatalog: expected [null]");
System.out.println("testIgnoreInvalidCatalog: expected [null]");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/jar/META-INF/MANIFEST.MF Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 9-ea (Oracle Corporation)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/jar/META-INF/catalog/ws-addr.xsd Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ W3C XML Schema defined in the Web Services Addressing 1.0 specification
+ http://www.w3.org/TR/ws-addr-core
+
+ Copyright © 2005 World Wide Web Consortium,
+
+ (Massachusetts Institute of Technology, European Research Consortium for
+ Informatics and Mathematics, Keio University). All Rights Reserved. This
+ work is distributed under the W3C® Software License [1] 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.
+
+ [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+ $Id: ws-addr.xsd,v 1.2 2008/07/23 13:38:16 plehegar Exp $
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
+
+ <!-- Constructs from the WS-Addressing Core -->
+
+ <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
+ <xs:complexType name="EndpointReferenceType" mixed="false">
+ <xs:sequence>
+ <xs:element name="Address" type="tns:AttributedURIType"/>
+ <xs:element ref="tns:ReferenceParameters" minOccurs="0"/>
+ <xs:element ref="tns:Metadata" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType"/>
+ <xs:complexType name="ReferenceParametersType" mixed="false">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="Metadata" type="tns:MetadataType"/>
+ <xs:complexType name="MetadataType" mixed="false">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="MessageID" type="tns:AttributedURIType"/>
+ <xs:element name="RelatesTo" type="tns:RelatesToType"/>
+ <xs:complexType name="RelatesToType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www.w3.org/2005/08/addressing/reply"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="RelationshipTypeOpenEnum">
+ <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="RelationshipType">
+ <xs:restriction base="xs:anyURI">
+ <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
+ <xs:element name="From" type="tns:EndpointReferenceType"/>
+ <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
+ <xs:element name="To" type="tns:AttributedURIType"/>
+ <xs:element name="Action" type="tns:AttributedURIType"/>
+
+ <xs:complexType name="AttributedURIType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- Constructs from the WS-Addressing SOAP binding -->
+
+ <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
+
+ <xs:simpleType name="FaultCodesOpenEnumType">
+ <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="FaultCodesType">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="tns:InvalidAddressingHeader"/>
+ <xs:enumeration value="tns:InvalidAddress"/>
+ <xs:enumeration value="tns:InvalidEPR"/>
+ <xs:enumeration value="tns:InvalidCardinality"/>
+ <xs:enumeration value="tns:MissingAddressInEPR"/>
+ <xs:enumeration value="tns:DuplicateMessageID"/>
+ <xs:enumeration value="tns:ActionMismatch"/>
+ <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
+ <xs:enumeration value="tns:DestinationUnreachable"/>
+ <xs:enumeration value="tns:ActionNotSupported"/>
+ <xs:enumeration value="tns:EndpointUnavailable"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
+ <xs:complexType name="AttributedUnsignedLongType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:unsignedLong">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
+ <xs:complexType name="AttributedQNameType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
+
+ <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
+ <xs:complexType name="ProblemActionType" mixed="false">
+ <xs:sequence>
+ <xs:element ref="tns:Action" minOccurs="0"/>
+ <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+</xs:schema>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/catalog/jar/META-INF/jax-ws-catalog.xml Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,4 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+ <system systemId="http://www.w3.org/2006/03/addressing/ws-addr.xsd" uri="./catalog/ws-addr.xsd"/>
+</catalog>
\ No newline at end of file
--- a/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxp/test/javax/xml/jaxp/unittest/transform/TransformerTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -37,6 +37,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
@@ -74,11 +75,30 @@
* @run testng/othervm -DrunSecMngr=true transform.TransformerTest
* @run testng/othervm transform.TransformerTest
* @summary Transformer Tests
- * @bug 6272879 6305029 6505031 8150704 8162598 8169112 8169772
+ * @bug 6272879 6305029 6505031 8150704 8162598 8169112 8169631 8169772
*/
@Listeners({jaxp.library.FilePolicy.class})
public class TransformerTest {
+ // some global constants
+ private static final String LINE_SEPARATOR =
+ getSystemProperty("line.separator");
+
+ private static final String NAMESPACES =
+ "http://xml.org/sax/features/namespaces";
+
+ private static final String NAMESPACE_PREFIXES =
+ "http://xml.org/sax/features/namespace-prefixes";
+
+ private static abstract class TestTemplate {
+ protected void printSnippet(String title, String snippet) {
+ StringBuilder div = new StringBuilder();
+ for (int i = 0; i < title.length(); i++)
+ div.append("=");
+ System.out.println(title + "\n" + div + "\n" + snippet + "\n");
+ }
+ }
+
/**
* Reads the contents of the given file into a string.
* WARNING: this method adds a final line feed even if the last line of the file doesn't contain one.
@@ -101,44 +121,7 @@
}
}
- /**
- * Utility method for testBug8162598().
- * Provides a convenient way to check/assert the expected namespaces
- * of a Node and its siblings.
- *
- * @param test
- * The node to check
- * @param nstest
- * Expected namespace of the node
- * @param nsb
- * Expected namespace of the first sibling
- * @param nsc
- * Expected namespace of the first sibling of the first sibling
- */
- private void checkNodeNS8162598(Node test, String nstest, String nsb, String nsc) {
- String testNodeName = test.getNodeName();
- if (nstest == null) {
- Assert.assertNull(test.getNamespaceURI(), "unexpected namespace for " + testNodeName);
- } else {
- Assert.assertEquals(test.getNamespaceURI(), nstest, "unexpected namespace for " + testNodeName);
- }
- Node b = test.getChildNodes().item(0);
- if (nsb == null) {
- Assert.assertNull(b.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b");
- } else {
- Assert.assertEquals(b.getNamespaceURI(), nsb, "unexpected namespace for " + testNodeName + "->b");
- }
- Node c = b.getChildNodes().item(0);
- if (nsc == null) {
- Assert.assertNull(c.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b->c");
- } else {
- Assert.assertEquals(c.getNamespaceURI(), nsc, "unexpected namespace for " + testNodeName + "->b->c");
- }
- }
-
private class XMLReaderFor6305029 implements XMLReader {
- private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
- private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
private boolean namespaces = true;
private boolean namespacePrefixes = false;
private EntityResolver resolver;
@@ -235,8 +218,6 @@
*/
@Test
public final void testBug6272879() throws IOException, TransformerException {
- final String LINE_SEPARATOR = getSystemProperty("line.separator");
-
final String xsl =
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + LINE_SEPARATOR +
"<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + LINE_SEPARATOR +
@@ -349,9 +330,125 @@
Assert.assertTrue(s.contains("map1key1value") && s.contains("map2key1value"));
}
+ private static class Test8169631 extends TestTemplate {
+ private final static String xsl =
+ "<?xml version=\"1.0\"?>" + LINE_SEPARATOR +
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" + LINE_SEPARATOR +
+ " <xsl:template match=\"/\">" + LINE_SEPARATOR +
+ " <xsl:variable name=\"Counter\" select=\"count(//row)\"/>" + LINE_SEPARATOR +
+ " <xsl:variable name=\"AttribCounter\" select=\"count(//@attrib)\"/>" + LINE_SEPARATOR +
+ " <Counter><xsl:value-of select=\"$Counter\"/></Counter>" + LINE_SEPARATOR +
+ " <AttribCounter><xsl:value-of select=\"$AttribCounter\"/></AttribCounter>" + LINE_SEPARATOR +
+ " </xsl:template>" + LINE_SEPARATOR +
+ "</xsl:stylesheet>" + LINE_SEPARATOR;
+
+ private final static String sourceXml =
+ "<?xml version=\"1.0\"?>" + LINE_SEPARATOR +
+ "<envelope xmlns=\"http://www.sap.com/myns\" xmlns:sap=\"http://www.sap.com/myns\">" + LINE_SEPARATOR +
+ " <sap:row sap:attrib=\"a\">1</sap:row>" + LINE_SEPARATOR +
+ " <row attrib=\"b\">2</row>" + LINE_SEPARATOR +
+ " <row sap:attrib=\"c\">3</row>" + LINE_SEPARATOR +
+ "</envelope>" + LINE_SEPARATOR;
+
+ /**
+ * Utility method to print out transformation result and check values.
+ *
+ * @param type
+ * Text describing type of transformation
+ * @param result
+ * Resulting output of transformation
+ * @param elementCount
+ * Counter of elements to check
+ * @param attribCount
+ * Counter of attributes to check
+ */
+ private void verifyResult(String type, String result, int elementCount,
+ int attribCount)
+ {
+ printSnippet("Result of transformation from " + type + ":",
+ result);
+ Assert.assertEquals(
+ result.contains("<Counter>" + elementCount + "</Counter>"),
+ true, "Result of transformation from " + type +
+ " should have count of " + elementCount + " elements.");
+ Assert.assertEquals(
+ result.contains("<AttribCounter>" + attribCount +
+ "</AttribCounter>"), true, "Result of transformation from " +
+ type + " should have count of "+ attribCount + " attributes.");
+ }
+
+ public void run() throws IOException, TransformerException,
+ SAXException, ParserConfigurationException
+ {
+ printSnippet("Source:", sourceXml);
+
+ printSnippet("Stylesheet:", xsl);
+
+ // create default transformer (namespace aware)
+ TransformerFactory tf1 = TransformerFactory.newInstance();
+ ByteArrayInputStream bais = new ByteArrayInputStream(xsl.getBytes());
+ Transformer t1 = tf1.newTransformer(new StreamSource(bais));
+
+ // test transformation from stream source with namespace support
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ bais = new ByteArrayInputStream(sourceXml.getBytes());
+ t1.transform(new StreamSource(bais), new StreamResult(baos));
+ verifyResult("StreamSource with namespace support", baos.toString(), 0, 1);
+
+ // test transformation from DOM source with namespace support
+ bais.reset();
+ baos.reset();
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(true);
+ Document doc = dbf.newDocumentBuilder().parse(new InputSource(bais));
+ t1.transform(new DOMSource(doc), new StreamResult(baos));
+ verifyResult("DOMSource with namespace support", baos.toString(), 0, 1);
+
+ // test transformation from DOM source without namespace support
+ bais.reset();
+ baos.reset();
+ dbf.setNamespaceAware(false);
+ doc = dbf.newDocumentBuilder().parse(new InputSource(bais));
+ t1.transform(new DOMSource(doc), new StreamResult(baos));
+ verifyResult("DOMSource without namespace support", baos.toString(), 3, 3);
+
+ // test transformation from SAX source with namespace support
+ bais.reset();
+ baos.reset();
+ SAXParserFactory spf = SAXParserFactory.newInstance();
+ spf.setNamespaceAware(true);
+ XMLReader xmlr = spf.newSAXParser().getXMLReader();
+ SAXSource saxS = new SAXSource(xmlr, new InputSource(bais));
+ t1.transform(saxS, new StreamResult(baos));
+ verifyResult("SAXSource with namespace support", baos.toString(), 0, 1);
+
+ // test transformation from SAX source without namespace support
+ bais.reset();
+ baos.reset();
+ spf.setNamespaceAware(false);
+ xmlr = spf.newSAXParser().getXMLReader();
+ saxS = new SAXSource(xmlr, new InputSource(bais));
+ t1.transform(saxS, new StreamResult(baos));
+ verifyResult("SAXSource without namespace support", baos.toString(), 3, 3);
+ }
+ }
+
+ /*
+ * @bug 8169631
+ * @summary Test combinations of namespace awareness settings on
+ * XSL transformations
+ */
+ @Test
+ public final void testBug8169631() throws IOException, SAXException,
+ TransformerException, ParserConfigurationException
+ {
+ new Test8169631().run();
+ }
+
/*
* @bug 8150704
- * @summary Test that XSL transformation with lots of temporary result trees will not run out of DTM IDs.
+ * @summary Test that XSL transformation with lots of temporary result
+ * trees will not run out of DTM IDs.
*/
@Test
public final void testBug8150704() throws TransformerException, IOException {
@@ -375,16 +472,8 @@
System.out.println("Passed.");
}
- /*
- * @bug 8162598
- * @summary Test XSLTC handling of namespaces, especially empty namespace definitions to reset the
- * default namespace
- */
- @Test
- public final void testBug8162598() throws IOException, TransformerException {
- final String LINE_SEPARATOR = getSystemProperty("line.separator");
-
- final String xsl =
+ private static class Test8162598 extends TestTemplate {
+ private static final String xsl =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + LINE_SEPARATOR +
"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" + LINE_SEPARATOR +
" <xsl:template match=\"/\">" + LINE_SEPARATOR +
@@ -402,39 +491,85 @@
" </xsl:template>" + LINE_SEPARATOR +
"</xsl:stylesheet>";
-
- final String sourceXml =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?><aaa></aaa>" + LINE_SEPARATOR;
+ private static final String sourceXml =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><aaa></aaa>" + LINE_SEPARATOR;
+ /**
+ * Utility method for testBug8162598().
+ * Provides a convenient way to check/assert the expected namespaces
+ * of a Node and its siblings.
+ *
+ * @param test
+ * The node to check
+ * @param nstest
+ * Expected namespace of the node
+ * @param nsb
+ * Expected namespace of the first sibling
+ * @param nsc
+ * Expected namespace of the first sibling of the first sibling
+ */
- System.out.println("Stylesheet:");
- System.out.println("=============================");
- System.out.println(xsl);
- System.out.println();
-
- System.out.println("Source before transformation:");
- System.out.println("=============================");
- System.out.println(sourceXml);
- System.out.println();
+ private void checkNodeNS(Node test, String nstest, String nsb, String nsc) {
+ String testNodeName = test.getNodeName();
+ if (nstest == null) {
+ Assert.assertNull(test.getNamespaceURI(), "unexpected namespace for " + testNodeName);
+ } else {
+ Assert.assertEquals(test.getNamespaceURI(), nstest, "unexpected namespace for " + testNodeName);
+ }
+ Node b = test.getChildNodes().item(0);
+ if (nsb == null) {
+ Assert.assertNull(b.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b");
+ } else {
+ Assert.assertEquals(b.getNamespaceURI(), nsb, "unexpected namespace for " + testNodeName + "->b");
+ }
+ Node c = b.getChildNodes().item(0);
+ if (nsc == null) {
+ Assert.assertNull(c.getNamespaceURI(), "unexpected namespace for " + testNodeName + "->b->c");
+ } else {
+ Assert.assertEquals(c.getNamespaceURI(), nsc, "unexpected namespace for " + testNodeName + "->b->c");
+ }
+ }
- // transform to DOM result
- TransformerFactory tf = TransformerFactory.newInstance();
- Transformer t = tf.newTransformer(new StreamSource(new ByteArrayInputStream(xsl.getBytes())));
- DOMResult result = new DOMResult();
- t.transform(new StreamSource(new ByteArrayInputStream(sourceXml.getBytes())), result);
- Document document = (Document)result.getNode();
+ public void run() throws IOException, TransformerException {
+ printSnippet("Source:", sourceXml);
+
+ printSnippet("Stylesheet:", xsl);
+
+ // transform to DOM result
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayInputStream bais = new ByteArrayInputStream(xsl.getBytes());
+ Transformer t = tf.newTransformer(new StreamSource(bais));
+ DOMResult result = new DOMResult();
+ bais = new ByteArrayInputStream(sourceXml.getBytes());
+ t.transform(new StreamSource(bais), result);
+ Document document = (Document)result.getNode();
+
+ System.out.println("Result after transformation:");
+ System.out.println("============================");
+ OutputFormat format = new OutputFormat();
+ format.setIndenting(true);
+ new XMLSerializer(System.out, format).serialize(document);
+ System.out.println();
- System.out.println("Result after transformation:");
- System.out.println("============================");
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- new XMLSerializer(System.out, format).serialize(document);
- System.out.println();
- checkNodeNS8162598(document.getElementsByTagName("test1").item(0), "ns2", "ns2", null);
- checkNodeNS8162598(document.getElementsByTagName("test2").item(0), "ns1", "ns2", null);
- checkNodeNS8162598(document.getElementsByTagName("test3").item(0), null, null, null);
- checkNodeNS8162598(document.getElementsByTagName("test4").item(0), null, null, null);
- checkNodeNS8162598(document.getElementsByTagName("test5").item(0), "ns1", "ns1", null);
- Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(), "unexpected namespace for test6");
+ checkNodeNS(document.getElementsByTagName("test1").item(0), "ns2", "ns2", null);
+ checkNodeNS(document.getElementsByTagName("test2").item(0), "ns1", "ns2", null);
+ checkNodeNS(document.getElementsByTagName("test3").item(0), null, null, null);
+ checkNodeNS(document.getElementsByTagName("test4").item(0), null, null, null);
+ checkNodeNS(document.getElementsByTagName("test5").item(0), "ns1", "ns1", null);
+ Assert.assertNull(document.getElementsByTagName("test6").item(0).getNamespaceURI(),
+ "unexpected namespace for test6");
+ }
+ }
+
+ /*
+ * @bug 8162598
+ * @summary Test XSLTC handling of namespaces, especially empty namespace
+ * definitions to reset the default namespace
+ */
+ @Test
+ public final void testBug8162598() throws IOException,
+ TransformerException
+ {
+ new Test8162598().run();
}
/**
--- a/jaxws/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -397,3 +397,5 @@
72554d319b474b3636c7d02fe3c110254d111b1a jdk-9+149
77e4e30d9d111272cd4a45a2203e8f570d40b12e jdk-9+150
c48b4d4768b1c2b8fe5d1a844ca13732e5dfbe2a jdk-9+151
+6f8fb1cf7e5f61c40dcc3654f9a623c505f6de1f jdk-9+152
+7a532a9a227137155b905341d4b99939db51220e jdk-9+153
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/DetailImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,13 +47,13 @@
public DetailEntry addDetailEntry(Name name) throws SOAPException {
DetailEntry entry = createDetailEntry(name);
addNode(entry);
- return (DetailEntry) circumventBug5034339(entry);
+ return entry;
}
public DetailEntry addDetailEntry(QName qname) throws SOAPException {
DetailEntry entry = createDetailEntry(qname);
addNode(entry);
- return (DetailEntry) circumventBug5034339(entry);
+ return entry;
}
protected SOAPElement addElement(Name name) throws SOAPException {
@@ -119,28 +119,4 @@
return true;
}
- //overriding this method since the only two uses of this method
- // are in ElementImpl and DetailImpl
- //whereas the original base impl does the correct job for calls to it inside ElementImpl
- // But it would not work for DetailImpl.
- protected SOAPElement circumventBug5034339(SOAPElement element) {
-
- Name elementName = element.getElementName();
- if (!isNamespaceQualified(elementName)) {
- String prefix = elementName.getPrefix();
- String defaultNamespace = getNamespaceURI(prefix);
- if (defaultNamespace != null) {
- Name newElementName =
- NameImpl.create(
- elementName.getLocalName(),
- elementName.getPrefix(),
- defaultNamespace);
- SOAPElement newElement = createDetailEntry(newElementName);
- replaceChild(newElement, element);
- return newElement;
- }
- }
- return element;
- }
-
}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -127,8 +127,11 @@
}
public SOAPElement addChildElement(String localName) throws SOAPException {
- return (SOAPElement) addChildElement(
- NameImpl.createFromUnqualifiedName(localName));
+ String nsUri = getNamespaceURI("");
+ Name name = (nsUri == null || nsUri.isEmpty())
+ ? NameImpl.createFromUnqualifiedName(localName)
+ : NameImpl.createFromQualifiedName(localName, nsUri);
+ return addChildElement(name);
}
public SOAPElement addChildElement(String localName, String prefix)
@@ -372,13 +375,13 @@
protected SOAPElement addElement(Name name) throws SOAPException {
SOAPElement newElement = createElement(name);
addNode(newElement);
- return circumventBug5034339(newElement);
+ return newElement;
}
protected SOAPElement addElement(QName name) throws SOAPException {
SOAPElement newElement = createElement(name);
addNode(newElement);
- return circumventBug5034339(newElement);
+ return newElement;
}
protected SOAPElement createElement(Name name) {
@@ -1226,26 +1229,6 @@
return !"".equals(name.getNamespaceURI());
}
- protected SOAPElement circumventBug5034339(SOAPElement element) {
-
- Name elementName = element.getElementName();
- if (!isNamespaceQualified(elementName)) {
- String prefix = elementName.getPrefix();
- String defaultNamespace = getNamespaceURI(prefix);
- if (defaultNamespace != null) {
- Name newElementName =
- NameImpl.create(
- elementName.getLocalName(),
- elementName.getPrefix(),
- defaultNamespace);
- SOAPElement newElement = createElement(newElementName);
- replaceChild(newElement, element);
- return newElement;
- }
- }
- return element;
- }
-
//TODO: This is a temporary SAAJ workaround for optimizing XWS
// should be removed once the corresponding JAXP bug is fixed
// It appears the bug will be fixed in JAXP 1.4 (not by Appserver 9 timeframe)
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,10 @@
package com.sun.xml.internal.messaging.saaj.util.stax;
+import java.util.Iterator;
import java.util.Arrays;
-import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
@@ -42,6 +44,17 @@
/**
* SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
*
+ * <p>
+ * Defers creation of SOAPElement until all the aspects of the name of the element are known.
+ * In some cases, the namespace uri is indicated only by the {@link #writeNamespace(String, String)} call.
+ * After opening an element ({@code writeStartElement}, {@code writeEmptyElement} methods), all attributes
+ * and namespace assignments are retained within {@link DeferredElement} object ({@code deferredElement} field).
+ * As soon as any other method than {@code writeAttribute}, {@code writeNamespace}, {@code writeDefaultNamespace}
+ * or {@code setNamespace} is called, the contents of {@code deferredElement} is transformed into new SOAPElement
+ * (which is appropriately inserted into the SOAPMessage under construction).
+ * This mechanism is necessary to fix JDK-8159058 issue.
+ * </p>
+ *
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxWriter implements XMLStreamWriter {
@@ -49,6 +62,7 @@
protected SOAPMessage soap;
protected String envURI;
protected SOAPElement currentElement;
+ protected DeferredElement deferredElement;
static final protected String Envelope = "Envelope";
static final protected String Header = "Header";
@@ -58,6 +72,7 @@
public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
soap = msg;
this.envURI = uri;
+ this.deferredElement = new DeferredElement();
}
public SOAPMessage getSOAPMessage() {
@@ -70,11 +85,8 @@
@Override
public void writeStartElement(final String localName) throws XMLStreamException {
- try {
- currentElement = currentElement.addChildElement(localName);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
- }
+ currentElement = deferredElement.flushTo(currentElement);
+ deferredElement.setLocalName(localName);
}
@Override
@@ -84,8 +96,10 @@
@Override
public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
- try {
- if (envURI.equals(ns)) {
+ currentElement = deferredElement.flushTo(currentElement);
+
+ if (envURI.equals(ns)) {
+ try {
if (Envelope.equals(ln)) {
currentElement = getEnvelope();
fixPrefix(prefix);
@@ -99,13 +113,16 @@
fixPrefix(prefix);
return;
}
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
}
- currentElement = (prefix == null) ?
- currentElement.addChildElement(new QName(ns, ln)) :
- currentElement.addChildElement(ln, prefix, ns);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+
}
+
+ deferredElement.setLocalName(ln);
+ deferredElement.setNamespaceUri(ns);
+ deferredElement.setPrefix(prefix);
+
}
private void fixPrefix(final String prfx) throws XMLStreamException {
@@ -136,11 +153,13 @@
@Override
public void writeEndElement() throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
if (currentElement != null) currentElement = currentElement.getParentElement();
}
@Override
public void writeEndDocument() throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
}
@Override
@@ -158,19 +177,14 @@
@Override
public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
- try {
- if (ns == null) {
- if (prefix == null && xmlns.equals(ln)) {
- currentElement.addNamespaceDeclaration("", value);
- } else {
- currentElement.setAttributeNS("", ln, value);
- }
+ if (ns == null && prefix == null && xmlns.equals(ln)) {
+ writeNamespace("", value);
+ } else {
+ if (deferredElement.isInitialized()) {
+ deferredElement.addAttribute(prefix, ns, ln, value);
} else {
- QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
- currentElement.addAttribute(name, value);
+ addAttibuteToElement(currentElement, prefix, ns, ln, value);
}
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
}
}
@@ -181,16 +195,16 @@
@Override
public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
-
// make prefix default if null or "xmlns" (according to javadoc)
- if (prefix == null || "xmlns".equals(prefix)) {
- prefix = "";
- }
-
- try {
- currentElement.addNamespaceDeclaration(prefix, uri);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+ String thePrefix = prefix == null || "xmlns".equals(prefix) ? "" : prefix;
+ if (deferredElement.isInitialized()) {
+ deferredElement.addNamespaceDeclaration(thePrefix, uri);
+ } else {
+ try {
+ currentElement.addNamespaceDeclaration(thePrefix, uri);
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
}
}
@@ -201,35 +215,40 @@
@Override
public void writeComment(final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Comment c = soap.getSOAPPart().createComment(data);
currentElement.appendChild(c);
}
@Override
public void writeProcessingInstruction(final String target) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
currentElement.appendChild(n);
}
@Override
public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
currentElement.appendChild(n);
}
@Override
public void writeCData(final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createCDATASection(data);
currentElement.appendChild(n);
}
@Override
public void writeDTD(final String dtd) throws XMLStreamException {
- //TODO ... Don't do anything here
+ currentElement = deferredElement.flushTo(currentElement);
}
@Override
public void writeEntityRef(final String name) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createEntityReference(name);
currentElement.appendChild(n);
}
@@ -257,6 +276,7 @@
@Override
public void writeCharacters(final String text) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
try {
currentElement.addTextNode(text);
} catch (SOAPException e) {
@@ -266,6 +286,7 @@
@Override
public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
try {
currentElement.addTextNode(new String(chr));
@@ -281,10 +302,16 @@
@Override
public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
- try {
- this.currentElement.addNamespaceDeclaration(prefix, uri);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+ // TODO: this in fact is not what would be expected from XMLStreamWriter
+ // (e.g. XMLStreamWriter for writing to output stream does not write anything as result of
+ // this method, it just rememebers that given prefix is associated with the given uri
+ // for the scope; to actually declare the prefix assignment in the resulting XML, one
+ // needs to call writeNamespace(...) method
+ // Kept for backwards compatibility reasons - this might be worth of further investigation.
+ if (deferredElement.isInitialized()) {
+ deferredElement.addNamespaceDeclaration(prefix, uri);
+ } else {
+ throw new XMLStreamException("Namespace not associated with any element");
}
}
@@ -331,4 +358,209 @@
}
};
}
+
+ static void addAttibuteToElement(SOAPElement element, String prefix, String ns, String ln, String value)
+ throws XMLStreamException {
+ try {
+ if (ns == null) {
+ element.setAttributeNS("", ln, value);
+ } else {
+ QName name = prefix == null ? new QName(ns, ln) : new QName(ns, ln, prefix);
+ element.addAttribute(name, value);
+ }
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ /**
+ * Holds details of element that needs to be deferred in order to manage namespace assignments correctly.
+ *
+ * <p>
+ * An instance of can be set with all the aspects of the element name (local name, prefix, namespace uri).
+ * Attributes and namespace declarations (special case of attribute) can be added.
+ * Namespace declarations are handled so that the element namespace is updated if it is implied by the namespace
+ * declaration and the namespace was not set to non-{@code null} value previously.
+ * </p>
+ *
+ * <p>
+ * The state of this object can be {@link #flushTo(SOAPElement) flushed} to SOAPElement - new SOAPElement will
+ * be added a child element; the new element will have exactly the shape as represented by the state of this
+ * object. Note that the {@link #flushTo(SOAPElement)} method does nothing
+ * (and returns the argument immediately) if the state of this object is not initialized
+ * (i.e. local name is null).
+ * </p>
+ *
+ * @author ondrej.cerny@oracle.com
+ */
+ static class DeferredElement {
+ private String prefix;
+ private String localName;
+ private String namespaceUri;
+ private final List<NamespaceDeclaration> namespaceDeclarations;
+ private final List<AttributeDeclaration> attributeDeclarations;
+
+ DeferredElement() {
+ this.namespaceDeclarations = new LinkedList<NamespaceDeclaration>();
+ this.attributeDeclarations = new LinkedList<AttributeDeclaration>();
+ reset();
+ }
+
+
+ /**
+ * Set prefix of the element.
+ * @param prefix namespace prefix
+ */
+ public void setPrefix(final String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * Set local name of the element.
+ *
+ * <p>
+ * This method initializes the element.
+ * </p>
+ *
+ * @param localName local name {@code not null}
+ */
+ public void setLocalName(final String localName) {
+ if (localName == null) {
+ throw new IllegalArgumentException("localName can not be null");
+ }
+ this.localName = localName;
+ }
+
+ /**
+ * Set namespace uri.
+ *
+ * @param namespaceUri namespace uri
+ */
+ public void setNamespaceUri(final String namespaceUri) {
+ this.namespaceUri = namespaceUri;
+ }
+
+ /**
+ * Adds namespace prefix assignment to the element.
+ *
+ * @param prefix prefix (not {@code null})
+ * @param namespaceUri namespace uri
+ */
+ public void addNamespaceDeclaration(final String prefix, final String namespaceUri) {
+ if (null == this.namespaceUri && null != namespaceUri && prefix.equals(emptyIfNull(this.prefix))) {
+ this.namespaceUri = namespaceUri;
+ }
+ this.namespaceDeclarations.add(new NamespaceDeclaration(prefix, namespaceUri));
+ }
+
+ /**
+ * Adds attribute to the element.
+ * @param prefix prefix
+ * @param ns namespace
+ * @param ln local name
+ * @param value value
+ */
+ public void addAttribute(final String prefix, final String ns, final String ln, final String value) {
+ if (ns == null && prefix == null && xmlns.equals(ln)) {
+ this.addNamespaceDeclaration(prefix, value);
+ } else {
+ this.attributeDeclarations.add(new AttributeDeclaration(prefix, ns, ln, value));
+ }
+ }
+
+ /**
+ * Flushes state of this element to the {@code target} element.
+ *
+ * <p>
+ * If this element is initialized then it is added with all the namespace declarations and attributes
+ * to the {@code target} element as a child. The state of this element is reset to uninitialized.
+ * The newly added element object is returned.
+ * </p>
+ * <p>
+ * If this element is not initialized then the {@code target} is returned immediately, nothing else is done.
+ * </p>
+ *
+ * @param target target element
+ * @return {@code target} or new element
+ * @throws XMLStreamException on error
+ */
+ public SOAPElement flushTo(final SOAPElement target) throws XMLStreamException {
+ try {
+ if (this.localName != null) {
+ // add the element appropriately (based on namespace declaration)
+ final SOAPElement newElement;
+ if (this.namespaceUri == null) {
+ // add element with inherited scope
+ newElement = target.addChildElement(this.localName);
+ } else if (prefix == null) {
+ newElement = target.addChildElement(new QName(this.namespaceUri, this.localName));
+ } else {
+ newElement = target.addChildElement(this.localName, this.prefix, this.namespaceUri);
+ }
+ // add namespace declarations
+ for (NamespaceDeclaration namespace : this.namespaceDeclarations) {
+ target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
+ }
+ // add attribute declarations
+ for (AttributeDeclaration attribute : this.attributeDeclarations) {
+ addAttibuteToElement(newElement,
+ attribute.prefix, attribute.namespaceUri, attribute.localName, attribute.value);
+ }
+ // reset state
+ this.reset();
+
+ return newElement;
+ } else {
+ return target;
+ }
+ // else after reset state -> not initialized
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ /**
+ * Is the element initialized?
+ * @return boolean indicating whether it was initialized after last flush
+ */
+ public boolean isInitialized() {
+ return this.localName != null;
+ }
+
+ private void reset() {
+ this.localName = null;
+ this.prefix = null;
+ this.namespaceUri = null;
+ this.namespaceDeclarations.clear();
+ this.attributeDeclarations.clear();
+ }
+
+ private static String emptyIfNull(String s) {
+ return s == null ? "" : s;
+ }
+ }
+
+ static class NamespaceDeclaration {
+ final String prefix;
+ final String namespaceUri;
+
+ NamespaceDeclaration(String prefix, String namespaceUri) {
+ this.prefix = prefix;
+ this.namespaceUri = namespaceUri;
+ }
+ }
+
+ static class AttributeDeclaration {
+ final String prefix;
+ final String namespaceUri;
+ final String localName;
+ final String value;
+
+ AttributeDeclaration(String prefix, String namespaceUri, String localName, String value) {
+ this.prefix = prefix;
+ this.namespaceUri = namespaceUri;
+ this.localName = localName;
+ this.value = value;
+ }
+ }
}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,10 @@
package com.sun.xml.internal.ws.api.message.saaj;
+import java.util.Iterator;
import java.util.Arrays;
-import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
@@ -42,6 +44,17 @@
/**
* SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
*
+ * <p>
+ * Defers creation of SOAPElement until all the aspects of the name of the element are known.
+ * In some cases, the namespace uri is indicated only by the {@link #writeNamespace(String, String)} call.
+ * After opening an element ({@code writeStartElement}, {@code writeEmptyElement} methods), all attributes
+ * and namespace assignments are retained within {@link DeferredElement} object ({@code deferredElement} field).
+ * As soon as any other method than {@code writeAttribute}, {@code writeNamespace}, {@code writeDefaultNamespace}
+ * or {@code setNamespace} is called, the contents of {@code deferredElement} is transformed into new SOAPElement
+ * (which is appropriately inserted into the SOAPMessage under construction).
+ * This mechanism is necessary to fix JDK-8159058 issue.
+ * </p>
+ *
* @author shih-chang.chen@oracle.com
*/
public class SaajStaxWriter implements XMLStreamWriter {
@@ -49,6 +62,7 @@
protected SOAPMessage soap;
protected String envURI;
protected SOAPElement currentElement;
+ protected DeferredElement deferredElement;
static final protected String Envelope = "Envelope";
static final protected String Header = "Header";
@@ -58,6 +72,7 @@
public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
soap = msg;
this.envURI = uri;
+ this.deferredElement = new DeferredElement();
}
public SOAPMessage getSOAPMessage() {
@@ -70,11 +85,8 @@
@Override
public void writeStartElement(final String localName) throws XMLStreamException {
- try {
- currentElement = currentElement.addChildElement(localName);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
- }
+ currentElement = deferredElement.flushTo(currentElement);
+ deferredElement.setLocalName(localName);
}
@Override
@@ -84,8 +96,10 @@
@Override
public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
- try {
- if (envURI.equals(ns)) {
+ currentElement = deferredElement.flushTo(currentElement);
+
+ if (envURI.equals(ns)) {
+ try {
if (Envelope.equals(ln)) {
currentElement = getEnvelope();
fixPrefix(prefix);
@@ -99,13 +113,16 @@
fixPrefix(prefix);
return;
}
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
}
- currentElement = (prefix == null) ?
- currentElement.addChildElement(new QName(ns, ln)) :
- currentElement.addChildElement(ln, prefix, ns);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+
}
+
+ deferredElement.setLocalName(ln);
+ deferredElement.setNamespaceUri(ns);
+ deferredElement.setPrefix(prefix);
+
}
private void fixPrefix(final String prfx) throws XMLStreamException {
@@ -136,11 +153,13 @@
@Override
public void writeEndElement() throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
if (currentElement != null) currentElement = currentElement.getParentElement();
}
@Override
public void writeEndDocument() throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
}
@Override
@@ -158,19 +177,14 @@
@Override
public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
- try {
- if (ns == null) {
- if (prefix == null && xmlns.equals(ln)) {
- currentElement.addNamespaceDeclaration("", value);
- } else {
- currentElement.setAttributeNS("", ln, value);
- }
+ if (ns == null && prefix == null && xmlns.equals(ln)) {
+ writeNamespace("", value);
+ } else {
+ if (deferredElement.isInitialized()) {
+ deferredElement.addAttribute(prefix, ns, ln, value);
} else {
- QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
- currentElement.addAttribute(name, value);
+ addAttibuteToElement(currentElement, prefix, ns, ln, value);
}
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
}
}
@@ -181,16 +195,16 @@
@Override
public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
-
// make prefix default if null or "xmlns" (according to javadoc)
- if (prefix == null || "xmlns".equals(prefix)) {
- prefix = "";
- }
-
- try {
- currentElement.addNamespaceDeclaration(prefix, uri);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+ String thePrefix = prefix == null || "xmlns".equals(prefix) ? "" : prefix;
+ if (deferredElement.isInitialized()) {
+ deferredElement.addNamespaceDeclaration(thePrefix, uri);
+ } else {
+ try {
+ currentElement.addNamespaceDeclaration(thePrefix, uri);
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
}
}
@@ -201,35 +215,40 @@
@Override
public void writeComment(final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Comment c = soap.getSOAPPart().createComment(data);
currentElement.appendChild(c);
}
@Override
public void writeProcessingInstruction(final String target) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
currentElement.appendChild(n);
}
@Override
public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
currentElement.appendChild(n);
}
@Override
public void writeCData(final String data) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createCDATASection(data);
currentElement.appendChild(n);
}
@Override
public void writeDTD(final String dtd) throws XMLStreamException {
- //TODO ... Don't do anything here
+ currentElement = deferredElement.flushTo(currentElement);
}
@Override
public void writeEntityRef(final String name) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
Node n = soap.getSOAPPart().createEntityReference(name);
currentElement.appendChild(n);
}
@@ -257,6 +276,7 @@
@Override
public void writeCharacters(final String text) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
try {
currentElement.addTextNode(text);
} catch (SOAPException e) {
@@ -266,6 +286,7 @@
@Override
public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
+ currentElement = deferredElement.flushTo(currentElement);
char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
try {
currentElement.addTextNode(new String(chr));
@@ -281,10 +302,16 @@
@Override
public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
- try {
- this.currentElement.addNamespaceDeclaration(prefix, uri);
- } catch (SOAPException e) {
- throw new XMLStreamException(e);
+ // TODO: this in fact is not what would be expected from XMLStreamWriter
+ // (e.g. XMLStreamWriter for writing to output stream does not write anything as result of
+ // this method, it just rememebers that given prefix is associated with the given uri
+ // for the scope; to actually declare the prefix assignment in the resulting XML, one
+ // needs to call writeNamespace(...) method
+ // Kept for backwards compatibility reasons - this might be worth of further investigation.
+ if (deferredElement.isInitialized()) {
+ deferredElement.addNamespaceDeclaration(prefix, uri);
+ } else {
+ throw new XMLStreamException("Namespace not associated with any element");
}
}
@@ -315,12 +342,12 @@
return currentElement.lookupPrefix(namespaceURI);
}
public Iterator getPrefixes(final String namespaceURI) {
- return new Iterator() {
+ return new Iterator<String>() {
String prefix = getPrefix(namespaceURI);
public boolean hasNext() {
return (prefix != null);
}
- public Object next() {
+ public String next() {
if (!hasNext()) throw new java.util.NoSuchElementException();
String next = prefix;
prefix = null;
@@ -331,4 +358,209 @@
}
};
}
+
+ static void addAttibuteToElement(SOAPElement element, String prefix, String ns, String ln, String value)
+ throws XMLStreamException {
+ try {
+ if (ns == null) {
+ element.setAttributeNS("", ln, value);
+ } else {
+ QName name = prefix == null ? new QName(ns, ln) : new QName(ns, ln, prefix);
+ element.addAttribute(name, value);
+ }
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ /**
+ * Holds details of element that needs to be deferred in order to manage namespace assignments correctly.
+ *
+ * <p>
+ * An instance of can be set with all the aspects of the element name (local name, prefix, namespace uri).
+ * Attributes and namespace declarations (special case of attribute) can be added.
+ * Namespace declarations are handled so that the element namespace is updated if it is implied by the namespace
+ * declaration and the namespace was not set to non-{@code null} value previously.
+ * </p>
+ *
+ * <p>
+ * The state of this object can be {@link #flushTo(SOAPElement) flushed} to SOAPElement - new SOAPElement will
+ * be added a child element; the new element will have exactly the shape as represented by the state of this
+ * object. Note that the {@link #flushTo(SOAPElement)} method does nothing
+ * (and returns the argument immediately) if the state of this object is not initialized
+ * (i.e. local name is null).
+ * </p>
+ *
+ * @author ondrej.cerny@oracle.com
+ */
+ static class DeferredElement {
+ private String prefix;
+ private String localName;
+ private String namespaceUri;
+ private final List<NamespaceDeclaration> namespaceDeclarations;
+ private final List<AttributeDeclaration> attributeDeclarations;
+
+ DeferredElement() {
+ this.namespaceDeclarations = new LinkedList<NamespaceDeclaration>();
+ this.attributeDeclarations = new LinkedList<AttributeDeclaration>();
+ reset();
+ }
+
+
+ /**
+ * Set prefix of the element.
+ * @param prefix namespace prefix
+ */
+ public void setPrefix(final String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * Set local name of the element.
+ *
+ * <p>
+ * This method initializes the element.
+ * </p>
+ *
+ * @param localName local name {@code not null}
+ */
+ public void setLocalName(final String localName) {
+ if (localName == null) {
+ throw new IllegalArgumentException("localName can not be null");
+ }
+ this.localName = localName;
+ }
+
+ /**
+ * Set namespace uri.
+ *
+ * @param namespaceUri namespace uri
+ */
+ public void setNamespaceUri(final String namespaceUri) {
+ this.namespaceUri = namespaceUri;
+ }
+
+ /**
+ * Adds namespace prefix assignment to the element.
+ *
+ * @param prefix prefix (not {@code null})
+ * @param namespaceUri namespace uri
+ */
+ public void addNamespaceDeclaration(final String prefix, final String namespaceUri) {
+ if (null == this.namespaceUri && null != namespaceUri && prefix.equals(emptyIfNull(this.prefix))) {
+ this.namespaceUri = namespaceUri;
+ }
+ this.namespaceDeclarations.add(new NamespaceDeclaration(prefix, namespaceUri));
+ }
+
+ /**
+ * Adds attribute to the element.
+ * @param prefix prefix
+ * @param ns namespace
+ * @param ln local name
+ * @param value value
+ */
+ public void addAttribute(final String prefix, final String ns, final String ln, final String value) {
+ if (ns == null && prefix == null && xmlns.equals(ln)) {
+ this.addNamespaceDeclaration(prefix, value);
+ } else {
+ this.attributeDeclarations.add(new AttributeDeclaration(prefix, ns, ln, value));
+ }
+ }
+
+ /**
+ * Flushes state of this element to the {@code target} element.
+ *
+ * <p>
+ * If this element is initialized then it is added with all the namespace declarations and attributes
+ * to the {@code target} element as a child. The state of this element is reset to uninitialized.
+ * The newly added element object is returned.
+ * </p>
+ * <p>
+ * If this element is not initialized then the {@code target} is returned immediately, nothing else is done.
+ * </p>
+ *
+ * @param target target element
+ * @return {@code target} or new element
+ * @throws XMLStreamException on error
+ */
+ public SOAPElement flushTo(final SOAPElement target) throws XMLStreamException {
+ try {
+ if (this.localName != null) {
+ // add the element appropriately (based on namespace declaration)
+ final SOAPElement newElement;
+ if (this.namespaceUri == null) {
+ // add element with inherited scope
+ newElement = target.addChildElement(this.localName);
+ } else if (prefix == null) {
+ newElement = target.addChildElement(new QName(this.namespaceUri, this.localName));
+ } else {
+ newElement = target.addChildElement(this.localName, this.prefix, this.namespaceUri);
+ }
+ // add namespace declarations
+ for (NamespaceDeclaration namespace : this.namespaceDeclarations) {
+ target.addNamespaceDeclaration(namespace.prefix, namespace.namespaceUri);
+ }
+ // add attribute declarations
+ for (AttributeDeclaration attribute : this.attributeDeclarations) {
+ addAttibuteToElement(newElement,
+ attribute.prefix, attribute.namespaceUri, attribute.localName, attribute.value);
+ }
+ // reset state
+ this.reset();
+
+ return newElement;
+ } else {
+ return target;
+ }
+ // else after reset state -> not initialized
+ } catch (SOAPException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ /**
+ * Is the element initialized?
+ * @return boolean indicating whether it was initialized after last flush
+ */
+ public boolean isInitialized() {
+ return this.localName != null;
+ }
+
+ private void reset() {
+ this.localName = null;
+ this.prefix = null;
+ this.namespaceUri = null;
+ this.namespaceDeclarations.clear();
+ this.attributeDeclarations.clear();
+ }
+
+ private static String emptyIfNull(String s) {
+ return s == null ? "" : s;
+ }
+ }
+
+ static class NamespaceDeclaration {
+ final String prefix;
+ final String namespaceUri;
+
+ NamespaceDeclaration(String prefix, String namespaceUri) {
+ this.prefix = prefix;
+ this.namespaceUri = namespaceUri;
+ }
+ }
+
+ static class AttributeDeclaration {
+ final String prefix;
+ final String namespaceUri;
+ final String localName;
+ final String value;
+
+ AttributeDeclaration(String prefix, String namespaceUri, String localName, String value) {
+ this.prefix = prefix;
+ this.namespaceUri = namespaceUri;
+ this.localName = localName;
+ this.value = value;
+ }
+ }
}
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.reflect.Method;
+import java.net.URI;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
@@ -332,13 +333,13 @@
* (com.sun.org.apache.xml.internal) for modular runtime.
*/
private static EntityResolver createCatalogResolver(ArrayList<URL> urls) throws Exception {
- // Prepare array of catalog paths
- String[] paths = urls.stream()
- .map(u -> u.toExternalForm())
- .toArray(c -> new String[c]);
+ // Prepare array of catalog URIs
+ URI[] uris = urls.stream()
+ .map(u -> URI.create(u.toExternalForm()))
+ .toArray(URI[]::new);
//Create CatalogResolver with new JDK9+ API
- return (EntityResolver) CatalogManager.catalogResolver(catalogFeatures, paths);
+ return (EntityResolver) CatalogManager.catalogResolver(catalogFeatures, uris);
}
// Cache CatalogFeatures instance for future usages.
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/Options.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/Options.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -777,13 +777,13 @@
* Adds a new catalog file.
*/
public void addCatalog(File catalogFile) throws IOException {
- String newUrl = catalogFile.getPath();
+ URI newUrl = catalogFile.toURI();
if (!catalogUrls.contains(newUrl)) {
catalogUrls.add(newUrl);
}
try {
entityResolver = CatalogManager.catalogResolver(catalogFeatures,
- catalogUrls.toArray(new String[0]));
+ catalogUrls.stream().toArray(URI[]::new));
} catch (Exception ex) {
entityResolver = null;
}
@@ -791,7 +791,7 @@
// Since javax.xml.catalog is unmodifiable we need to track catalog
// URLs added and create new catalog each time addCatalog is called
- private final ArrayList<String> catalogUrls = new ArrayList<String>();
+ private final ArrayList<URI> catalogUrls = new ArrayList<>();
// Cache CatalogFeatures instance for future usages.
// Resolve feature is set to "continue" value for backward compatibility.
--- a/jdk/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -395,3 +395,4 @@
71e198ef3839045e829a879af1d709be16ab0f88 jdk-9+150
d27bab22ff62823902d93d1d35ca397cfd50d059 jdk-9+151
a20f2cf90762673e1bc4980fd6597e70a2578045 jdk-9+152
+1c4411322327aea3f91011ec3977a12a05b09629 jdk-9+153
--- a/jdk/src/java.base/share/classes/module-info.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/classes/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -310,7 +310,6 @@
// JDK-internal service types
uses jdk.internal.logger.DefaultLoggerFinder;
uses sun.security.ssl.ClientKeyExchangeService;
- uses sun.security.util.AuthResourcesProvider;
uses sun.text.spi.JavaTimeDateTimePatternProvider;
uses sun.util.spi.CalendarProvider;
uses sun.util.locale.provider.LocaleDataMetaInfo;
@@ -322,6 +321,4 @@
provides java.nio.file.spi.FileSystemProvider with
jdk.internal.jrtfs.JrtFileSystemProvider;
- provides sun.security.util.AuthResourcesProvider with
- sun.security.util.AuthResourcesProviderImpl;
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java Mon Jan 23 10:27:58 2017 -0800
@@ -331,9 +331,8 @@
if (debugConfig != null) {
debugConfig.println(fnfe.toString());
}
- throw new IOException(ResourcesMgr.getString
- ("Configuration.Error.No.such.file.or.directory",
- "sun.security.util.AuthResources"));
+ throw new IOException(ResourcesMgr.getAuthResourceString
+ ("Configuration.Error.No.such.file.or.directory"));
}
}
@@ -661,8 +660,8 @@
}
private IOException ioException(String resourceKey, Object... args) {
- MessageFormat form = new MessageFormat(ResourcesMgr.getString
- (resourceKey, "sun.security.util.AuthResources"));
+ MessageFormat form = new MessageFormat(
+ ResourcesMgr.getAuthResourceString(resourceKey));
return new IOException(form.format(args));
}
}
--- a/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SubjectCodeSource.java Mon Jan 23 10:27:58 2017 -0800
@@ -34,6 +34,7 @@
import javax.security.auth.Subject;
import sun.security.provider.PolicyParser.PrincipalEntry;
+import sun.security.util.ResourcesMgr;
/**
* <p> This <code>SubjectCodeSource</code> class contains
@@ -47,15 +48,6 @@
private static final long serialVersionUID = 6039418085604715275L;
- private static final java.util.ResourceBundle rb =
- java.security.AccessController.doPrivileged
- (new java.security.PrivilegedAction<java.util.ResourceBundle>() {
- public java.util.ResourceBundle run() {
- return (java.util.ResourceBundle.getBundle
- ("sun.security.util.AuthResources"));
- }
- });
-
private Subject subject;
private LinkedList<PrincipalEntry> principals;
private static final Class<?>[] PARAMS = { String.class };
@@ -391,7 +383,7 @@
ListIterator<PrincipalEntry> li = principals.listIterator();
while (li.hasNext()) {
PrincipalEntry pppe = li.next();
- returnMe = returnMe + rb.getString("NEWLINE") +
+ returnMe = returnMe + ResourcesMgr.getAuthResourceString("NEWLINE") +
pppe.getPrincipalClass() + " " +
pppe.getPrincipalName();
}
--- a/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/classes/sun/security/tools/keytool/Main.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3522,7 +3522,8 @@
System.err.flush();
reply = (new BufferedReader(new InputStreamReader
(System.in))).readLine();
- if (collator.compare(reply, "") == 0 ||
+ if (reply == null ||
+ collator.compare(reply, "") == 0 ||
collator.compare(reply, rb.getString("n")) == 0 ||
collator.compare(reply, rb.getString("no")) == 0) {
reply = "NO";
--- a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProvider.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.util;
-
-public interface AuthResourcesProvider extends java.util.spi.ResourceBundleProvider {
-}
--- a/jdk/src/java.base/share/classes/sun/security/util/AuthResourcesProviderImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.security.util;
-
-import java.util.spi.AbstractResourceBundleProvider;
-
-public final class AuthResourcesProviderImpl extends AbstractResourceBundleProvider
- implements AuthResourcesProvider {
- public AuthResourcesProviderImpl() {
- super("java.class");
- }
-}
\ No newline at end of file
--- a/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/classes/sun/security/util/ResourcesMgr.java Mon Jan 23 10:27:58 2017 -0800
@@ -25,18 +25,22 @@
package sun.security.util;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import jdk.internal.misc.VM;
+
/**
*/
public class ResourcesMgr {
+ // intended for java.security, javax.security and sun.security resources
+ private final static String RESOURCES = "sun.security.util.Resources";
+ private final static String AUTH_RESOURCES = "sun.security.util.AuthResources";
- // intended for java.security, javax.security and sun.security resources
- private static java.util.ResourceBundle bundle;
-
- // intended for com.sun.security resources
- private static java.util.ResourceBundle altBundle;
+ private final static Map<String, ResourceBundle> bundles = new ConcurrentHashMap<>();
public static String getString(String s) {
-
+ ResourceBundle bundle = bundles.get(RESOURCES);
if (bundle == null) {
// only load if/when needed
@@ -52,19 +56,15 @@
return bundle.getString(s);
}
- public static String getString(String s, final String altBundleName) {
-
- if (altBundle == null) {
-
- // only load if/when needed
- altBundle = java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction<java.util.ResourceBundle>() {
- public java.util.ResourceBundle run() {
- return (java.util.ResourceBundle.getBundle(altBundleName));
- }
- });
+ public static String getAuthResourceString(String s) {
+ if (VM.initLevel() == 3) {
+ // cannot trigger loading of any resource bundle as
+ // it depends on the system class loader fully initialized.
+ throw new InternalError("system class loader is being initialized");
}
- return altBundle.getString(s);
+ return bundles.computeIfAbsent(AUTH_RESOURCES, ResourceBundle::getBundle)
+ .getString(s);
}
+
}
--- a/jdk/src/java.base/share/lib/security/default.policy Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/share/lib/security/default.policy Mon Jan 23 10:27:58 2017 -0800
@@ -205,3 +205,11 @@
grant codeBase "jrt:/jdk.desktop" {
permission java.lang.RuntimePermission "accessClassInPackage.com.sun.awt";
};
+
+// permissions needed by applications using java.desktop module
+grant {
+ permission java.lang.RuntimePermission "accessClassInPackage.com.sun.beans";
+ permission java.lang.RuntimePermission "accessClassInPackage.com.sun.beans.*";
+ permission java.lang.RuntimePermission "accessClassInPackage.com.sun.java.swing.plaf.*";
+ permission java.lang.RuntimePermission "accessClassInPackage.com.apple.*";
+};
--- a/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c Mon Jan 23 10:27:58 2017 -0800
@@ -75,8 +75,8 @@
} else if (timeout < 0) {
tv = NULL;
} else {
+ jlong sec = timeout / 1000;
tv = &timevalue;
- jlong sec = timeout / 1000;
//
// struct timeval members are signed 32-bit integers so the
// signed 64-bit jlong needs to be clamped
--- a/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/defaults/JmxProperties.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
package com.sun.jmx.defaults;
-import java.util.logging.Logger;
+import java.lang.System.Logger;
/**
* This contains the property list defined for this
@@ -120,7 +120,7 @@
* Logger for MBean Server information.
*/
public static final Logger MBEANSERVER_LOGGER =
- Logger.getLogger(MBEANSERVER_LOGGER_NAME);
+ System.getLogger(MBEANSERVER_LOGGER_NAME);
/**
* Logger name for MLet service information.
@@ -132,7 +132,7 @@
* Logger for MLet service information.
*/
public static final Logger MLET_LOGGER =
- Logger.getLogger(MLET_LOGGER_NAME);
+ System.getLogger(MLET_LOGGER_NAME);
/**
* Logger name for Monitor information.
@@ -144,7 +144,7 @@
* Logger for Monitor information.
*/
public static final Logger MONITOR_LOGGER =
- Logger.getLogger(MONITOR_LOGGER_NAME);
+ System.getLogger(MONITOR_LOGGER_NAME);
/**
* Logger name for Timer information.
@@ -156,7 +156,7 @@
* Logger for Timer information.
*/
public static final Logger TIMER_LOGGER =
- Logger.getLogger(TIMER_LOGGER_NAME);
+ System.getLogger(TIMER_LOGGER_NAME);
/**
* Logger name for Event Management information.
@@ -168,7 +168,7 @@
* Logger for Event Management information.
*/
public static final Logger NOTIFICATION_LOGGER =
- Logger.getLogger(NOTIFICATION_LOGGER_NAME);
+ System.getLogger(NOTIFICATION_LOGGER_NAME);
/**
* Logger name for Relation Service.
@@ -180,7 +180,7 @@
* Logger for Relation Service.
*/
public static final Logger RELATION_LOGGER =
- Logger.getLogger(RELATION_LOGGER_NAME);
+ System.getLogger(RELATION_LOGGER_NAME);
/**
* Logger name for Model MBean.
@@ -192,7 +192,7 @@
* Logger for Model MBean.
*/
public static final Logger MODELMBEAN_LOGGER =
- Logger.getLogger(MODELMBEAN_LOGGER_NAME);
+ System.getLogger(MODELMBEAN_LOGGER_NAME);
/**
* Logger name for all other JMX classes.
@@ -204,5 +204,5 @@
* Logger for all other JMX classes.
*/
public static final Logger MISC_LOGGER =
- Logger.getLogger(MISC_LOGGER_NAME);
+ System.getLogger(MISC_LOGGER_NAME);
}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
// JMX import
import javax.management.Attribute;
@@ -258,19 +258,16 @@
/* Load the appropriate class. */
if (withDefaultLoaderRepository) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "createMBean",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"ClassName = " + className + ", ObjectName = " + name);
}
theClass =
instantiator.findClassWithDefaultLoaderRepository(className);
} else if (loaderName == null) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "createMBean", "ClassName = " + className +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "ClassName = " + className +
", ObjectName = " + name + ", Loader name = null");
}
@@ -279,10 +276,9 @@
} else {
loaderName = nonDefaultDomain(loaderName);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "createMBean", "ClassName = " + className +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "ClassName = " + className +
", ObjectName = " + name +
", Loader name = " + loaderName);
}
@@ -633,10 +629,8 @@
name = nonDefaultDomain(name);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "getAttribute",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"Attribute = " + attribute + ", ObjectName = " + name);
}
@@ -670,10 +664,8 @@
name = nonDefaultDomain(name);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "getAttributes", "ObjectName = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name);
}
final DynamicMBean instance = getMBean(name);
@@ -732,10 +724,8 @@
name = nonDefaultDomain(name);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "setAttribute", "ObjectName = " + name +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name +
", Attribute = " + attribute.getName());
}
@@ -910,10 +900,9 @@
name = nonDefaultDomain(name);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "registerMBean", "ObjectName = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "ObjectName = " + name);
}
ObjectName logicalName = preRegister(mbean, server, name);
@@ -1023,14 +1012,14 @@
if (mbean instanceof MBeanRegistration)
((MBeanRegistration) mbean).postRegister(registrationDone);
} catch (RuntimeException e) {
- MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
+ MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+
"]: " + "Exception thrown by postRegister: " +
"rethrowing <"+e+">, but keeping the MBean registered");
throw new RuntimeMBeanException(e,
"RuntimeException thrown in postRegister method: "+
"rethrowing <"+e+">, but keeping the MBean registered");
} catch (Error er) {
- MBEANSERVER_LOGGER.fine("While registering MBean ["+logicalName+
+ MBEANSERVER_LOGGER.log(Level.DEBUG, "While registering MBean ["+logicalName+
"]: " + "Error thrown by postRegister: " +
"rethrowing <"+er+">, but keeping the MBean registered");
throw new RuntimeErrorException(er,
@@ -1053,7 +1042,7 @@
try {
moi.postDeregister();
} catch (RuntimeException e) {
- MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
+ MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
"]: " + "Exception thrown by postDeregister: " +
"rethrowing <"+e+">, although the MBean is succesfully " +
"unregistered");
@@ -1062,7 +1051,7 @@
"rethrowing <"+e+
">, although the MBean is sucessfully unregistered");
} catch (Error er) {
- MBEANSERVER_LOGGER.fine("While unregistering MBean ["+mbean+
+ MBEANSERVER_LOGGER.log(Level.DEBUG, "While unregistering MBean ["+mbean+
"]: " + "Error thrown by postDeregister: " +
"rethrowing <"+er+">, although the MBean is succesfully " +
"unregistered");
@@ -1087,10 +1076,9 @@
}
DynamicMBean obj = repository.retrieve(name);
if (obj == null) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "getMBean", name + " : Found no object");
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ name + " : Found no object");
}
throw new InstanceNotFoundException(name.toString());
}
@@ -1176,10 +1164,8 @@
// ------------------------------
// ------------------------------
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "addNotificationListener", "ObjectName = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name);
}
DynamicMBean instance = getMBean(name);
@@ -1226,10 +1212,8 @@
// ----------------
// Add a listener on an MBean
// ----------------
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "addNotificationListener",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"ObjectName = " + name + ", Listener = " + listener);
}
server.addNotificationListener(name,(NotificationListener) resource,
@@ -1255,10 +1239,8 @@
throws InstanceNotFoundException, ListenerNotFoundException {
NotificationListener instance = getListener(listener);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "removeNotificationListener",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"ObjectName = " + name + ", Listener = " + listener);
}
server.removeNotificationListener(name, instance);
@@ -1272,10 +1254,8 @@
NotificationListener instance = getListener(listener);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "removeNotificationListener",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"ObjectName = " + name + ", Listener = " + listener);
}
server.removeNotificationListener(name, instance, filter, handback);
@@ -1313,10 +1293,8 @@
boolean removeAll)
throws InstanceNotFoundException, ListenerNotFoundException {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "removeNotificationListener", "ObjectName = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "ObjectName = " + name);
}
DynamicMBean instance = getMBean(name);
@@ -1421,10 +1399,9 @@
return classNameClass.isAssignableFrom(resourceClass);
} catch (Exception x) {
/* Could be SecurityException or ClassNotFoundException */
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- DefaultMBeanServerInterceptor.class.getName(),
- "isInstanceOf", "Exception calling isInstanceOf", x);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
+ "Exception calling isInstanceOf", x);
}
return false;
}
@@ -1489,10 +1466,8 @@
MBeanServerNotification notif = new MBeanServerNotification(
NotifType,MBeanServerDelegate.DELEGATE_NAME,0,name);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "sendNotification", NotifType + " " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, NotifType + " " + name);
}
delegate.sendNotification(notif);
@@ -1594,10 +1569,8 @@
try {
return getClassName(mbean);
} catch (Exception e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- DefaultMBeanServerInterceptor.class.getName(),
- "safeGetClassName",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Exception getting MBean class name", e);
}
return null;
@@ -1885,10 +1858,9 @@
// ---------------------
// Send create event
// ---------------------
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "addObject", "Send create notification of object " +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "Send create notification of object " +
logicalName.getCanonicalName());
}
@@ -1926,10 +1898,9 @@
// ---------------------
// Send deletion event
// ---------------------
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- DefaultMBeanServerInterceptor.class.getName(),
- "unregisterMBean", "Send delete notification of object " +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "Send delete notification of object " +
logicalName.getCanonicalName());
}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/ClassLoaderRepositorySupport.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.MBeanPermission;
import javax.management.ObjectName;
@@ -148,10 +148,9 @@
// from javax.management.loading.DefaultLoaderRepository
public final Class<?> loadClassWithout(ClassLoader without, String className)
throws ClassNotFoundException {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "loadClassWithout", className + " without " + without);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ className + " without " + without);
}
// without is null => just behave as loadClass
@@ -172,10 +171,9 @@
public final Class<?> loadClassBefore(ClassLoader stop, String className)
throws ClassNotFoundException {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "loadClassBefore", className + " before " + stop);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ className + " before " + stop);
}
if (stop == null)
@@ -206,10 +204,8 @@
continue;
if (cl == stop)
break;
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "loadClass", "Trying loader = " + cl);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "Trying loader = " + cl);
}
/* We used to have a special case for "instanceof
MLet" here, where we invoked the method
@@ -239,10 +235,9 @@
//
List<ClassLoader> excluded = search.get(className);
if ((excluded!= null) && (excluded.contains(aloader))) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "startValidSearch", "Already requested loader = " +
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
+ "Already requested loader = " +
aloader + " class = " + className);
}
throw new ClassNotFoundException(className);
@@ -255,10 +250,8 @@
search.put(className, excluded);
}
excluded.add(aloader);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "startValidSearch",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"loader = " + aloader + " class = " + className);
}
}
@@ -271,10 +264,8 @@
List<ClassLoader> excluded = search.get(className);
if (excluded != null) {
excluded.remove(aloader);
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- ClassLoaderRepositorySupport.class.getName(),
- "stopValidSearch",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"loader = " + aloader + " class = " + className);
}
}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/JmxMBeanServer.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
import java.security.PrivilegedExceptionAction;
import java.util.List;
import java.util.Set;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Attribute;
import javax.management.AttributeList;
@@ -1229,16 +1229,14 @@
}
});
} catch (SecurityException e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- JmxMBeanServer.class.getName(), "initialize",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Unexpected security exception occurred", e);
}
throw e;
} catch (Exception e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- JmxMBeanServer.class.getName(), "initialize",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Unexpected exception occurred", e);
}
throw new
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanInstantiator.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@
import java.security.PrivilegedAction;
import java.security.ProtectionDomain;
import java.util.Map;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
@@ -186,19 +186,15 @@
}
}
} catch (ClassNotFoundException e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanInstantiator.class.getName(),
- "findSignatureClasses",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"The parameter class could not be found", e);
}
throw new ReflectionException(e,
"The parameter class could not be found");
} catch (RuntimeException e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanInstantiator.class.getName(),
- "findSignatureClasses",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Unexpected exception", e);
}
throw e;
@@ -696,19 +692,15 @@
tab[i] = Class.forName(signature[i], false, aLoader);
}
} catch (ClassNotFoundException e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanInstantiator.class.getName(),
- "findSignatureClasses",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"The parameter class could not be found", e);
}
throw new ReflectionException(e,
"The parameter class could not be found");
} catch (RuntimeException e) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanInstantiator.class.getName(),
- "findSignatureClasses",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Unexpected exception", e);
}
throw e;
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/MBeanServerDelegateImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
*/
package com.sun.jmx.mbeanserver;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Attribute;
import javax.management.AttributeList;
@@ -244,10 +244,8 @@
} catch (Exception x) {
// Skip the attribute that couldn't be obtained.
//
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanServerDelegateImpl.class.getName(),
- "getAttributes",
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"Attribute " + attn[i] + " not found");
}
}
--- a/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import java.util.Map;
import java.util.Set;
import javax.management.DynamicMBean;
@@ -264,7 +264,7 @@
context.unregistered();
} catch (Exception x) {
// shouldn't come here...
- MBEANSERVER_LOGGER.log(Level.FINE,
+ MBEANSERVER_LOGGER.log(Level.DEBUG,
"Unexpected exception while unregistering "+name,
x);
}
@@ -385,9 +385,8 @@
final RegistrationContext context)
throws InstanceAlreadyExistsException {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
- "addMBean", "name = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name);
}
// Extract the domain name.
@@ -456,9 +455,8 @@
* false otherwise.
*/
public boolean contains(ObjectName name) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
- "contains", " name = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name);
}
lock.readLock().lock();
try {
@@ -478,9 +476,8 @@
* null otherwise.
*/
public DynamicMBean retrieve(ObjectName name) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
- "retrieve", "name = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name);
}
// Calls internal retrieve method to get the named object
@@ -609,9 +606,8 @@
throws InstanceNotFoundException {
// Debugging stuff
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINER)) {
- MBEANSERVER_LOGGER.logp(Level.FINER, Repository.class.getName(),
- "remove", "name = " + name);
+ if (MBEANSERVER_LOGGER.isLoggable(Level.TRACE)) {
+ MBEANSERVER_LOGGER.log(Level.TRACE, "name = " + name);
}
// Extract domain name.
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/util/ClassLogger.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,222 +25,188 @@
package com.sun.jmx.remote.util;
-import java.util.logging.Logger;
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.util.ResourceBundle;
-public class ClassLogger {
+public class ClassLogger implements System.Logger {
- private static final boolean ok;
private final String className;
private final Logger logger;
- static {
- /* We attempt to work even if we are running in J2SE 1.3, where
- there is no java.util.logging. The technique we use here is
- not strictly portable, but it does work with Sun's J2SE 1.3
- at least. This is just a best effort: the Right Thing is for
- people to use at least J2SE 1.4. */
- boolean loaded = false;
- try {
- Class<?> c = java.util.logging.Logger.class;
- loaded = true;
- } catch (Error e) {
- // OK.
- // java.util.logger package is not available in this jvm.
- }
- ok = loaded;
- }
-
public ClassLogger(String subsystem, String className) {
- if (ok)
- logger = Logger.getLogger(subsystem);
- else
- logger = null;
+ logger = System.getLogger(subsystem);
this.className = className;
}
public final boolean traceOn() {
- return finerOn();
+ return logger.isLoggable(Level.TRACE);
}
public final boolean debugOn() {
- return finestOn();
+ return logger.isLoggable(Level.DEBUG);
}
public final boolean warningOn() {
- return ok && logger.isLoggable(java.util.logging.Level.WARNING);
+ return logger.isLoggable(Level.WARNING);
}
public final boolean infoOn() {
- return ok && logger.isLoggable(java.util.logging.Level.INFO);
+ return logger.isLoggable(Level.INFO);
}
public final boolean configOn() {
- return ok && logger.isLoggable(java.util.logging.Level.CONFIG);
+ return logger.isLoggable(Level.DEBUG);
}
public final boolean fineOn() {
- return ok && logger.isLoggable(java.util.logging.Level.FINE);
+ return logger.isLoggable(Level.DEBUG);
}
public final boolean finerOn() {
- return ok && logger.isLoggable(java.util.logging.Level.FINER);
+ return logger.isLoggable(Level.TRACE);
}
public final boolean finestOn() {
- return ok && logger.isLoggable(java.util.logging.Level.FINEST);
+ return logger.isLoggable(Level.TRACE);
}
public final void debug(String func, String msg) {
- finest(func,msg);
+ logger.log(Level.DEBUG, msg);
}
public final void debug(String func, Throwable t) {
- finest(func,t);
+ logger.log(Level.DEBUG, className + "::" + func, t);
}
public final void debug(String func, String msg, Throwable t) {
- finest(func,msg,t);
+ logger.log(Level.DEBUG, msg, t);
}
public final void trace(String func, String msg) {
- finer(func,msg);
+ logger.log(Level.TRACE, msg);
}
public final void trace(String func, Throwable t) {
- finer(func,t);
+ logger.log(Level.TRACE, className + "::" + func, t);
}
public final void trace(String func, String msg, Throwable t) {
- finer(func,msg,t);
+ logger.log(Level.TRACE, msg, t);
}
public final void error(String func, String msg) {
- severe(func,msg);
+ logger.log(Level.ERROR, msg);
}
public final void error(String func, Throwable t) {
- severe(func,t);
+ logger.log(Level.ERROR, className + "::" + func, t);
}
public final void error(String func, String msg, Throwable t) {
- severe(func,msg,t);
+ logger.log(Level.ERROR, msg, t);
}
public final void finest(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.FINEST, className, func, msg);
+ logger.log(Level.TRACE, msg);
}
public final void finest(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINEST, className, func,
- t.toString(), t);
+ logger.log(Level.TRACE, className + "::" + func, t);
}
public final void finest(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINEST, className, func, msg,
- t);
+ logger.log(Level.TRACE, msg, t);
}
public final void finer(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.FINER, className, func, msg);
+ logger.log(Level.TRACE, msg);
}
public final void finer(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINER, className, func,
- t.toString(), t);
+ logger.log(Level.TRACE, className + "::" + func, t);
}
public final void finer(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINER, className, func, msg,t);
+ logger.log(Level.DEBUG, msg, t);
}
public final void fine(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.FINE, className, func, msg);
+ logger.log(Level.DEBUG, msg);
}
public final void fine(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINE, className, func,
- t.toString(), t);
+ logger.log(Level.DEBUG, className + "::" + func, t);
}
public final void fine(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.FINE, className, func, msg,
- t);
+ logger.log(Level.DEBUG, msg, t);
}
public final void config(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.CONFIG, className, func, msg);
+ logger.log(Level.DEBUG, msg);
}
public final void config(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.CONFIG, className, func,
- t.toString(), t);
+ logger.log(Level.DEBUG, className + "::" + func, t);
}
public final void config(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.CONFIG, className, func, msg,
- t);
+ logger.log(Level.DEBUG, msg, t);
}
public final void info(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.INFO, className, func, msg);
+ logger.log(Level.INFO, msg);
}
public final void info(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.INFO, className, func,
- t.toString(), t);
+ logger.log(Level.INFO, className + "::" + func, t);
}
public final void info(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.INFO, className, func, msg,
- t);
+ logger.log(Level.INFO, msg, t);
}
public final void warning(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.WARNING, className, func, msg);
+ logger.log(Level.WARNING, msg);
}
public final void warning(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.WARNING, className, func,
- t.toString(), t);
+ logger.log(Level.WARNING, className + "::" + func, t);
}
public final void warning(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.WARNING, className, func, msg,
- t);
+ logger.log(Level.WARNING, msg, t);
}
public final void severe(String func, String msg) {
- if (ok)
- logger.logp(java.util.logging.Level.SEVERE, className, func, msg);
+ logger.log(Level.ERROR, msg);
}
public final void severe(String func, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.SEVERE, className, func,
- t.toString(), t);
+ logger.log(Level.ERROR, className + "::" + func, t);
}
public final void severe(String func, String msg, Throwable t) {
- if (ok)
- logger.logp(java.util.logging.Level.SEVERE, className, func, msg,
- t);
+ logger.log(Level.ERROR, msg, t);
+ }
+
+ public final String getName() {
+ return logger.getName();
+ }
+
+ public final boolean isLoggable(Level level) {
+ return logger.isLoggable(level);
}
+
+ public final void log(Level level, ResourceBundle bundle, String msg,
+ Throwable thrown) {
+ logger.log(level, bundle, msg, thrown);
+ }
+
+ public final void log(Level level, ResourceBundle bundle, String format,
+ Object... params) {
+ logger.log(level, bundle, format, params);
+ }
+
}
--- a/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerDelegate.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
package javax.management;
+import java.lang.System.Logger.Level;
import com.sun.jmx.defaults.JmxProperties;
import com.sun.jmx.defaults.ServiceName;
import com.sun.jmx.mbeanserver.Util;
@@ -84,7 +85,8 @@
try {
localHost = java.net.InetAddress.getLocalHost().getHostName();
} catch (java.net.UnknownHostException e) {
- JmxProperties.MISC_LOGGER.finest("Can't get local host name, " +
+ JmxProperties.MISC_LOGGER.log(Level.TRACE,
+ "Can't get local host name, " +
"using \"localhost\" instead. Cause is: "+e);
localHost = "localhost";
}
--- a/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanServerFactory.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
import java.security.AccessController;
import java.security.Permission;
import java.util.ArrayList;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.loading.ClassLoaderRepository;
import sun.reflect.misc.ReflectUtil;
@@ -399,7 +399,7 @@
return (String) mbs.getAttribute(MBeanServerDelegate.DELEGATE_NAME,
"MBeanServerId");
} catch (JMException e) {
- JmxProperties.MISC_LOGGER.finest(
+ JmxProperties.MISC_LOGGER.log(Level.TRACE,
"Ignoring exception while getting MBeanServerId: "+e);
return null;
}
@@ -421,9 +421,7 @@
private static synchronized void removeMBeanServer(MBeanServer mbs) {
boolean removed = mBeanServerList.remove(mbs);
if (!removed) {
- MBEANSERVER_LOGGER.logp(Level.FINER,
- MBeanServerFactory.class.getName(),
- "removeMBeanServer(MBeanServer)",
+ MBEANSERVER_LOGGER.log(Level.TRACE,
"MBeanServer was not in list!");
throw new IllegalArgumentException("MBeanServer was not in list!");
}
@@ -504,15 +502,12 @@
throw new JMRuntimeException(msg, x);
}
} catch (RuntimeException x) {
- if (MBEANSERVER_LOGGER.isLoggable(Level.FINEST)) {
+ if (MBEANSERVER_LOGGER.isLoggable(Level.DEBUG)) {
StringBuilder strb = new StringBuilder()
.append("Failed to instantiate MBeanServerBuilder: ").append(x)
.append("\n\t\tCheck the value of the ")
.append(JMX_INITIAL_BUILDER).append(" property.");
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- MBeanServerFactory.class.getName(),
- "checkMBeanServerBuilder",
- strb.toString());
+ MBEANSERVER_LOGGER.log(Level.DEBUG, strb::toString);
}
throw x;
}
--- a/jdk/src/java.management/share/classes/javax/management/StandardMBean.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/StandardMBean.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.WeakHashMap;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.openmbean.OpenMBeanAttributeInfo;
import javax.management.openmbean.OpenMBeanAttributeInfoSupport;
import javax.management.openmbean.OpenMBeanConstructorInfo;
@@ -432,16 +432,14 @@
final MBeanInfo cached = getCachedMBeanInfo();
if (cached != null) return cached;
} catch (RuntimeException x) {
- if (MISC_LOGGER.isLoggable(Level.FINEST)) {
- MISC_LOGGER.logp(Level.FINEST,
- MBeanServerFactory.class.getName(), "getMBeanInfo",
+ if (MISC_LOGGER.isLoggable(Level.DEBUG)) {
+ MISC_LOGGER.log(Level.DEBUG,
"Failed to get cached MBeanInfo", x);
}
}
- if (MISC_LOGGER.isLoggable(Level.FINER)) {
- MISC_LOGGER.logp(Level.FINER,
- MBeanServerFactory.class.getName(), "getMBeanInfo",
+ if (MISC_LOGGER.isLoggable(Level.TRACE)) {
+ MISC_LOGGER.log(Level.TRACE,
"Building MBeanInfo for " +
getImplementationClass().getName());
}
@@ -465,9 +463,8 @@
try {
cacheMBeanInfo(nmbi);
} catch (RuntimeException x) {
- if (MISC_LOGGER.isLoggable(Level.FINEST)) {
- MISC_LOGGER.logp(Level.FINEST,
- MBeanServerFactory.class.getName(), "getMBeanInfo",
+ if (MISC_LOGGER.isLoggable(Level.DEBUG)) {
+ MISC_LOGGER.log(Level.DEBUG,
"Failed to cache MBeanInfo", x);
}
}
--- a/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER;
import java.util.Iterator;
import java.util.List;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
@@ -71,9 +71,7 @@
*/
public static Class<?> loadClass(String className)
throws ClassNotFoundException {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- DefaultLoaderRepository.class.getName(),
- "loadClass", className);
+ MBEANSERVER_LOGGER.log(Level.TRACE, className);
return load(null, className);
}
@@ -96,9 +94,7 @@
public static Class<?> loadClassWithout(ClassLoader loader,
String className)
throws ClassNotFoundException {
- MBEANSERVER_LOGGER.logp(Level.FINEST,
- DefaultLoaderRepository.class.getName(),
- "loadClassWithout", className);
+ MBEANSERVER_LOGGER.log(Level.TRACE, className);
return load(loader, className);
}
--- a/jdk/src/java.management/share/classes/javax/management/loading/MLet.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLet.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
@@ -412,9 +412,8 @@
if (!Arrays.asList(getURLs()).contains(ur))
super.addURL(ur);
} catch (MalformedURLException e) {
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "addUrl", "Malformed URL: " + url, e);
+ if (MLET_LOGGER.isLoggable(Level.DEBUG)) {
+ MLET_LOGGER.log(Level.DEBUG, "Malformed URL: " + url, e);
}
throw new
ServiceNotFoundException("The specified URL is malformed");
@@ -481,23 +480,19 @@
public Set<Object> getMBeansFromURL(String url)
throws ServiceNotFoundException {
- String mth = "getMBeansFromURL";
-
if (server == null) {
throw new IllegalStateException("This MLet MBean is not " +
"registered with an MBeanServer.");
}
// Parse arguments
if (url == null) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- mth, "URL is null");
+ MLET_LOGGER.log(Level.TRACE, "URL is null");
throw new ServiceNotFoundException("The specified URL is null");
} else {
url = url.replace(File.separatorChar,'/');
}
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- mth, "<URL = " + url + ">");
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE, "<URL = " + url + ">");
}
// Parse URL
@@ -508,7 +503,7 @@
final String msg =
"Problems while parsing URL [" + url +
"], got exception [" + e.toString() + "]";
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg);
+ MLET_LOGGER.log(Level.TRACE, msg);
throw EnvHelp.initCause(new ServiceNotFoundException(msg), e);
}
@@ -516,7 +511,7 @@
if (mletList.size() == 0) {
final String msg =
"File " + url + " not found or MLET tag not defined in file";
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg);
+ MLET_LOGGER.log(Level.TRACE, msg);
throw new ServiceNotFoundException(msg);
}
@@ -538,7 +533,7 @@
URL documentBase = elmt.getDocumentBase();
// Display debug information
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
final StringBuilder strb = new StringBuilder()
.append("\n\tMLET TAG = ").append(elmt.getAttributes())
.append("\n\tCODEBASE = ").append(codebase)
@@ -548,16 +543,15 @@
.append("\n\tNAME = ").append(name)
.append("\n\tVERSION = ").append(version)
.append("\n\tDOCUMENT URL = ").append(documentBase);
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- mth, strb.toString());
+ MLET_LOGGER.log(Level.TRACE, strb::toString);
}
// Load classes from JAR files
StringTokenizer st = new StringTokenizer(jarFiles, ",", false);
while (st.hasMoreTokens()) {
String tok = st.nextToken().trim();
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Load archive for codebase <" + codebase +
">, file <" + tok + ">");
}
@@ -570,8 +564,8 @@
try {
codebase = check(version, codebase, tok, elmt);
} catch (Exception ex) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- mth, "Got unexpected exception", ex);
+ MLET_LOGGER.log(Level.DEBUG,
+ "Got unexpected exception", ex);
mbeans.add(ex);
continue;
}
@@ -599,7 +593,7 @@
final String msg =
"CODE and OBJECT parameters cannot be specified at the " +
"same time in tag MLET";
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg);
+ MLET_LOGGER.log(Level.TRACE, msg);
mbeans.add(new Error(msg));
continue;
}
@@ -607,7 +601,7 @@
final String msg =
"Either CODE or OBJECT parameter must be specified in " +
"tag MLET";
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth, msg);
+ MLET_LOGGER.log(Level.TRACE, msg);
mbeans.add(new Error(msg));
continue;
}
@@ -635,7 +629,7 @@
Object[] parms = objectPars.toArray();
String[] signature = new String[signat.size()];
signat.toArray(signature);
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
final StringBuilder strb = new StringBuilder();
for (int i = 0; i < signature.length; i++) {
strb.append("\n\tSignature = ")
@@ -643,9 +637,7 @@
.append("\t\nParams = ")
.append(parms[i]);
}
- MLET_LOGGER.logp(Level.FINEST,
- MLet.class.getName(),
- mth, strb.toString());
+ MLET_LOGGER.log(Level.TRACE, strb::toString);
}
if (name == null) {
objInst =
@@ -668,53 +660,46 @@
objInst = new ObjectInstance(name, o.getClass().getName());
}
} catch (ReflectionException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "ReflectionException", ex);
+ MLET_LOGGER.log(Level.TRACE, "ReflectionException", ex);
mbeans.add(ex);
continue;
} catch (InstanceAlreadyExistsException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ MLET_LOGGER.log(Level.TRACE,
"InstanceAlreadyExistsException", ex);
mbeans.add(ex);
continue;
} catch (MBeanRegistrationException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "MBeanRegistrationException", ex);
+ MLET_LOGGER.log(Level.TRACE, "MBeanRegistrationException", ex);
mbeans.add(ex);
continue;
} catch (MBeanException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "MBeanException", ex);
+ MLET_LOGGER.log(Level.TRACE, "MBeanException", ex);
mbeans.add(ex);
continue;
} catch (NotCompliantMBeanException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ MLET_LOGGER.log(Level.TRACE,
"NotCompliantMBeanException", ex);
mbeans.add(ex);
continue;
} catch (InstanceNotFoundException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ MLET_LOGGER.log(Level.TRACE,
"InstanceNotFoundException", ex);
mbeans.add(ex);
continue;
} catch (IOException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "IOException", ex);
+ MLET_LOGGER.log(Level.TRACE, "IOException", ex);
mbeans.add(ex);
continue;
} catch (SecurityException ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "SecurityException", ex);
+ MLET_LOGGER.log(Level.TRACE, "SecurityException", ex);
mbeans.add(ex);
continue;
} catch (Exception ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "Exception", ex);
+ MLET_LOGGER.log(Level.TRACE, "Exception", ex);
mbeans.add(ex);
continue;
} catch (Error ex) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
- "Error", ex);
+ MLET_LOGGER.log(Level.TRACE, "Error", ex);
mbeans.add(ex);
continue;
}
@@ -937,20 +922,18 @@
Class<?> findClass(String name, ClassLoaderRepository clr)
throws ClassNotFoundException {
Class<?> c = null;
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), "findClass", name);
+ MLET_LOGGER.log(Level.TRACE, name);
// Try looking in the JAR:
try {
c = super.findClass(name);
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- "findClass",
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Class " + name + " loaded through MLet classloader");
}
} catch (ClassNotFoundException e) {
// Drop through
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "findClass",
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Class " + name + " not found locally");
}
}
@@ -959,32 +942,28 @@
// Try the classloader repository:
//
try {
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "findClass",
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Class " + name + " : looking in CLR");
}
c = clr.loadClassBefore(this, name);
// The loadClassBefore method never returns null.
// If the class is not found we get an exception.
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- "findClass",
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Class " + name + " loaded through " +
"the default classloader repository");
}
} catch (ClassNotFoundException e) {
// Drop through
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "findClass",
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Class " + name + " not found in CLR");
}
}
}
if (c == null) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "findClass", "Failed to load class " + name);
+ MLET_LOGGER.log(Level.TRACE, "Failed to load class " + name);
throw new ClassNotFoundException(name);
}
return c;
@@ -1041,8 +1020,8 @@
//
// See if the native library is accessible as a resource through the JAR file.
//
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"Search " + libname + " in all JAR files");
}
@@ -1051,14 +1030,14 @@
// for "foo" on Solaris SPARC 5.7 we try to load "libfoo.so"
// from the JAR file.
//
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"loadLibraryAsResource(" + nativelibname + ")");
}
abs_path = loadLibraryAsResource(nativelibname);
if (abs_path != null) {
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
nativelibname + " loaded, absolute path = " + abs_path);
}
return abs_path;
@@ -1073,15 +1052,15 @@
removeSpace(System.getProperty("os.arch")) + File.separator +
removeSpace(System.getProperty("os.version")) + File.separator +
"lib" + File.separator + nativelibname;
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
"loadLibraryAsResource(" + nativelibname + ")");
}
abs_path = loadLibraryAsResource(nativelibname);
if (abs_path != null) {
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
nativelibname + " loaded, absolute path = " + abs_path);
}
return abs_path;
@@ -1091,10 +1070,10 @@
// All paths exhausted, library not found in JAR file.
//
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE,
libname + " not found in any JAR file");
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(), mth,
+ MLET_LOGGER.log(Level.TRACE,
"Search " + libname + " along the path " +
"specified as the java.library.path property");
}
@@ -1127,8 +1106,8 @@
if (tmpDirFile == null) return null;
return tmpDirFile.getAbsolutePath();
} catch (Exception x) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "getTmpDir", "Failed to determine system temporary dir");
+ MLET_LOGGER.log(Level.DEBUG,
+ "Failed to determine system temporary dir");
return null;
} finally {
// Cleanup ...
@@ -1136,12 +1115,12 @@
try {
boolean deleted = tmpFile.delete();
if (!deleted) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "getTmpDir", "Failed to delete temp file");
+ MLET_LOGGER.log(Level.DEBUG,
+ "Failed to delete temp file");
}
} catch (Exception x) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "getTmpDir", "Failed to delete temporary file", x);
+ MLET_LOGGER.log(Level.DEBUG,
+ "Failed to delete temporary file", x);
}
}
}
@@ -1183,8 +1162,7 @@
}
}
} catch (Exception e) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "loadLibraryAsResource",
+ MLET_LOGGER.log(Level.DEBUG,
"Failed to load library : " + libname, e);
return null;
}
@@ -1248,9 +1226,8 @@
if (filename != null) {
filename = filename.replace(File.separatorChar,'/');
}
- if (MLET_LOGGER.isLoggable(Level.FINER)) {
- MLET_LOGGER.logp(Level.FINER, MLet.class.getName(),
- "loadSerializedObject", codebase.toString() + filename);
+ if (MLET_LOGGER.isLoggable(Level.TRACE)) {
+ MLET_LOGGER.log(Level.TRACE, codebase.toString() + filename);
}
InputStream is = getResourceAsStream(filename);
if (is != null) {
@@ -1260,24 +1237,21 @@
ois.close();
return serObject;
} catch (IOException e) {
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "loadSerializedObject",
+ if (MLET_LOGGER.isLoggable(Level.DEBUG)) {
+ MLET_LOGGER.log(Level.DEBUG,
"Exception while deserializing " + filename, e);
}
throw e;
} catch (ClassNotFoundException e) {
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "loadSerializedObject",
+ if (MLET_LOGGER.isLoggable(Level.DEBUG)) {
+ MLET_LOGGER.log(Level.DEBUG,
"Exception while deserializing " + filename, e);
}
throw e;
}
} else {
- if (MLET_LOGGER.isLoggable(Level.FINEST)) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "loadSerializedObject", "Error: File " + filename +
+ if (MLET_LOGGER.isLoggable(Level.DEBUG)) {
+ MLET_LOGGER.log(Level.DEBUG, "Error: File " + filename +
" containing serialized object not found");
}
throw new Error("File " + filename + " containing serialized object not found");
@@ -1300,8 +1274,7 @@
return(cons.newInstance(oo));
} catch (Exception e) {
- MLET_LOGGER.logp(Level.FINEST, MLet.class.getName(),
- "constructParameter", "Got unexpected exception", e);
+ MLET_LOGGER.log(Level.DEBUG, "Got unexpected exception", e);
}
}
if (type.compareTo("java.lang.Boolean") == 0)
--- a/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/loading/MLetParser.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
/**
* This class is used for parsing URLs.
@@ -153,7 +153,6 @@
* Scan an html file for {@literal <mlet>} tags.
*/
public List<MLetContent> parse(URL url) throws IOException {
- String mth = "parse";
// Warning Messages
String requiresTypeWarning = "<arg type=... value=...> tag requires type parameter.";
String requiresValueWarning = "<arg type=... value=...> tag requires value parameter.";
@@ -204,33 +203,25 @@
Map<String,String> t = scanTag(in);
String att = t.get("type");
if (att == null) {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, requiresTypeWarning);
+ MLET_LOGGER.log(Level.TRACE, requiresTypeWarning);
throw new IOException(requiresTypeWarning);
} else {
if (atts != null) {
types.add(att);
} else {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, paramOutsideWarning);
+ MLET_LOGGER.log(Level.TRACE, paramOutsideWarning);
throw new IOException(paramOutsideWarning);
}
}
String val = t.get("value");
if (val == null) {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, requiresValueWarning);
+ MLET_LOGGER.log(Level.TRACE, requiresValueWarning);
throw new IOException(requiresValueWarning);
} else {
if (atts != null) {
values.add(val);
} else {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, paramOutsideWarning);
+ MLET_LOGGER.log(Level.TRACE, paramOutsideWarning);
throw new IOException(paramOutsideWarning);
}
}
@@ -238,15 +229,11 @@
if (nm.equalsIgnoreCase(tag)) {
atts = scanTag(in);
if (atts.get("code") == null && atts.get("object") == null) {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, requiresCodeWarning);
+ MLET_LOGGER.log(Level.TRACE, requiresCodeWarning);
throw new IOException(requiresCodeWarning);
}
if (atts.get("archive") == null) {
- MLET_LOGGER.logp(Level.FINER,
- MLetParser.class.getName(),
- mth, requiresJarsWarning);
+ MLET_LOGGER.log(Level.TRACE, requiresJarsWarning);
throw new IOException(requiresJarsWarning);
}
}
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
import java.util.SortedMap;
import java.util.StringTokenizer;
import java.util.TreeMap;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.ImmutableDescriptor;
@@ -164,10 +164,8 @@
* (the method {@link #isValid isValid} returns <CODE>false</CODE>)
*/
public DescriptorSupport() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "DescriptorSupport()" , "Constructor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Constructor");
}
init(null);
}
@@ -188,17 +186,14 @@
*/
public DescriptorSupport(int initNumFields)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(initNumFields = " + initNumFields + ")",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(initNumFields = " + initNumFields + ") " +
"Constructor");
}
if (initNumFields <= 0) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(initNumFields)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: initNumFields <= 0");
}
final String msg =
@@ -219,10 +214,9 @@
* fields, an empty Descriptor will be created.
*/
public DescriptorSupport(DescriptorSupport inDescr) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(Descriptor)", "Constructor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(Descriptor) Constructor");
}
if (inDescr == null)
init(null);
@@ -268,16 +262,14 @@
XMLParseException {
/* parse an XML-formatted string and populate internal
* structure with it */
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String = '" + inStr + "')", "Constructor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String = '" + inStr + "') Constructor");
}
if (inStr == null) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String = null)", "Illegal arguments");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String = null) Illegal arguments");
}
final String msg = "String in parameter is null";
final RuntimeException iae = new IllegalArgumentException(msg);
@@ -350,10 +342,9 @@
}
}
} // while tokens
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(XMLString)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(XMLString) Exit");
}
}
@@ -380,19 +371,17 @@
*/
public DescriptorSupport(String[] fieldNames, Object[] fieldValues)
throws RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(fieldNames,fieldObjects)", "Constructor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(fieldNames,fieldObjects) Constructor");
}
if ((fieldNames == null) || (fieldValues == null) ||
(fieldNames.length != fieldValues.length)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(fieldNames,fieldObjects)",
- "Illegal arguments");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(fieldNames,fieldObjects)" +
+ " Illegal arguments");
}
final String msg =
@@ -408,10 +397,9 @@
// the fieldName and fieldValue will be validated in setField.
setField(fieldNames[i], fieldValues[i]);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(fieldNames,fieldObjects)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(fieldNames,fieldObjects) Exit");
}
}
@@ -444,10 +432,9 @@
*/
public DescriptorSupport(String... fields)
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String... fields)", "Constructor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String... fields) Constructor");
}
init(null);
if (( fields == null ) || ( fields.length == 0))
@@ -462,10 +449,9 @@
int eq_separator = fields[i].indexOf('=');
if (eq_separator < 0) {
// illegal if no = or is first character
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String... fields)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String... fields) " +
"Illegal arguments: field does not have " +
"'=' as a name and value separator");
}
@@ -482,10 +468,9 @@
}
if (fieldName.equals("")) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String... fields)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String... fields) " +
"Illegal arguments: fieldName is empty");
}
@@ -496,10 +481,9 @@
setField(fieldName,fieldValue);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "Descriptor(String... fields)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor(String... fields) Exit");
}
}
@@ -517,10 +501,8 @@
throws RuntimeOperationsException {
if ((fieldName == null) || (fieldName.equals(""))) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldValue(String fieldName)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null field name");
}
final String msg = "Fieldname requested is null";
@@ -528,10 +510,9 @@
throw new RuntimeOperationsException(iae, msg);
}
Object retValue = descriptorMap.get(fieldName);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldValue(String fieldName = " + fieldName + ")",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "getFieldValue(String fieldName = " + fieldName + ") " +
"Returns '" + retValue + "'");
}
return(retValue);
@@ -542,10 +523,8 @@
// field name cannot be null or empty
if ((fieldName == null) || (fieldName.equals(""))) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setField(fieldName,fieldValue)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null or empty field name");
}
@@ -555,10 +534,8 @@
}
if (!validateField(fieldName, fieldValue)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setField(fieldName,fieldValue)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments");
}
@@ -568,10 +545,8 @@
throw new RuntimeOperationsException(iae, msg);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setField(fieldName,fieldValue)", "Entry: setting '"
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry: setting '"
+ fieldName + "' to '" + fieldValue + "'");
}
@@ -582,10 +557,8 @@
}
public synchronized String[] getFields() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFields()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
int numberOfEntries = descriptorMap.size();
@@ -594,20 +567,18 @@
int i = 0;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFields()", "Returning " + numberOfEntries + " fields");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Returning " + numberOfEntries + " fields");
}
for (Iterator<Map.Entry<String, Object>> iter = returnedSet.iterator();
iter.hasNext(); i++) {
Map.Entry<String, Object> currElement = iter.next();
if (currElement == null) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFields()", "Element is null");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Element is null");
}
} else {
Object currValue = currElement.getValue();
@@ -626,20 +597,16 @@
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFields()", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return responseFields;
}
public synchronized String[] getFieldNames() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldNames()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
int numberOfEntries = descriptorMap.size();
@@ -648,10 +615,8 @@
int i = 0;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldNames()",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Returning " + numberOfEntries + " fields");
}
@@ -660,20 +625,16 @@
Map.Entry<String, Object> currElement = iter.next();
if (( currElement == null ) || (currElement.getKey() == null)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldNames()", "Field is null");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Field is null");
}
} else {
responseFields[i] = currElement.getKey().toString();
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldNames()", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return responseFields;
@@ -681,10 +642,8 @@
public synchronized Object[] getFieldValues(String... fieldNames) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldValues(String... fieldNames)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
// if fieldNames == null return all values
// if fieldNames is String[0] return no values
@@ -695,10 +654,8 @@
int i = 0;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldValues(String... fieldNames)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Returning " + numberOfEntries + " fields");
}
@@ -715,10 +672,8 @@
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "getFieldValues(String... fieldNames)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return responseFields;
@@ -728,18 +683,14 @@
Object[] fieldValues)
throws RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setFields(fieldNames,fieldValues)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if ((fieldNames == null) || (fieldValues == null) ||
(fieldNames.length != fieldValues.length)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setFields(fieldNames,fieldValues)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments");
}
@@ -750,10 +701,8 @@
for (int i=0; i < fieldNames.length; i++) {
if (( fieldNames[i] == null) || (fieldNames[i].equals(""))) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setFields(fieldNames,fieldValues)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Null field name encountered at element " + i);
}
final String msg = "fieldNames is null or invalid";
@@ -762,10 +711,8 @@
}
setField(fieldNames[i], fieldValues[i]);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "setFields(fieldNames,fieldValues)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -779,10 +726,8 @@
@Override
public synchronized Object clone() throws RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "clone()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(new DescriptorSupport(this));
}
@@ -898,20 +843,17 @@
*/
public synchronized boolean isValid() throws RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "isValid()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
// verify that the descriptor is valid, by iterating over each field...
Set<Map.Entry<String, Object>> returnedSet = descriptorMap.entrySet();
if (returnedSet == null) { // null descriptor, not valid
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "isValid()", "Returns false (null set)");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "isValid() Returns false (null set)");
}
return false;
}
@@ -934,10 +876,8 @@
(currElement.getValue()).toString())) {
continue;
} else {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "isValid()",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Field " + currElement.getKey() + "=" +
currElement.getValue() + " is not valid");
}
@@ -948,10 +888,9 @@
}
// fell through, all fields OK
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "isValid()", "Returns true");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "isValid() Returns true");
}
return true;
}
@@ -1287,28 +1226,23 @@
*/
@Override
public synchronized String toString() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "toString()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
String respStr = "";
String[] fields = getFields();
if ((fields == null) || (fields.length == 0)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "toString()", "Empty Descriptor");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Empty Descriptor");
}
return respStr;
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "toString()", "Printing " + fields.length + " fields");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Printing " + fields.length + " fields");
}
for (int i=0; i < fields.length; i++) {
@@ -1319,10 +1253,8 @@
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINEST)) {
- MODELMBEAN_LOGGER.logp(Level.FINEST,
- DescriptorSupport.class.getName(),
- "toString()", "Exit returning " + respStr);
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit returning " + respStr);
}
return respStr;
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanAttributeInfo.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
import java.io.ObjectStreamField;
import java.lang.reflect.Method;
import java.security.AccessController;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.DescriptorKey;
@@ -201,12 +201,11 @@
throws javax.management.IntrospectionException {
super(name, description, getter, setter);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanAttributeInfo(" +
- "String,String,Method,Method)",
- "Entry", name);
+ "String,String,Method,Method) " +
+ "Entry " + name);
}
attrDescriptor = validDescriptor(null);
@@ -251,12 +250,11 @@
super(name, description, getter, setter);
// put getter and setter methods in operations list
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanAttributeInfo(" +
- "String,String,Method,Method,Descriptor)",
- "Entry", name);
+ "String,String,Method,Method,Descriptor) " +
+ "Entry " + name);
}
attrDescriptor = validDescriptor(descriptor);
}
@@ -282,8 +280,8 @@
super(name, type, description, isReadable, isWritable, isIs);
// create default descriptor
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
ModelMBeanAttributeInfo.class.getName(),
"ModelMBeanAttributeInfo(" +
"String,String,String,boolean,boolean,boolean)",
@@ -321,12 +319,11 @@
Descriptor descriptor)
{
super(name, type, description, isReadable, isWritable, isIs);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanAttributeInfo(String,String,String," +
- "boolean,boolean,boolean,Descriptor)",
- "Entry", name);
+ "boolean,boolean,boolean,Descriptor)" +
+ "Entry " + name);
}
attrDescriptor = validDescriptor(descriptor);
}
@@ -347,10 +344,9 @@
inInfo.isReadable(),
inInfo.isWritable(),
inInfo.isIs());
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
- "ModelMBeanAttributeInfo(ModelMBeanAttributeInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanAttributeInfo(ModelMBeanAttributeInfo) " +
"Entry");
}
Descriptor newDesc = inInfo.getDescriptor();
@@ -368,10 +364,8 @@
*/
public Descriptor getDescriptor() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
- "getDescriptor()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (attrDescriptor == null) {
attrDescriptor = validDescriptor(null);
@@ -411,10 +405,8 @@
@Override
public Object clone()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanAttributeInfo.class.getName(),
- "clone()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(new ModelMBeanAttributeInfo(this));
}
@@ -454,7 +446,7 @@
boolean defaulted = (in == null);
if (defaulted) {
clone = new DescriptorSupport();
- MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new.");
} else {
clone = (Descriptor) in.clone();
}
@@ -462,15 +454,15 @@
//Setting defaults.
if (defaulted && clone.getFieldValue("name")==null) {
clone.setField("name", this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName());
}
if (defaulted && clone.getFieldValue("descriptorType")==null) {
clone.setField("descriptorType", "attribute");
- MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"attribute\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"attribute\"");
}
if (clone.getFieldValue("displayName") == null) {
clone.setField("displayName",this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName());
}
//Checking validity
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanConstructorInfo.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
import java.io.ObjectStreamField;
import java.lang.reflect.Constructor;
import java.security.AccessController;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
@@ -164,10 +164,9 @@
Constructor<?> constructorMethod)
{
super(description, constructorMethod);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
- "ModelMBeanConstructorInfo(String,Constructor)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanConstructorInfo(String,Constructor) " +
"Entry");
}
consDescriptor = validDescriptor(null);
@@ -209,11 +208,10 @@
super(description, constructorMethod);
// put getter and setter methods in constructors list
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanConstructorInfo(" +
- "String,Constructor,Descriptor)", "Entry");
+ "String,Constructor,Descriptor) Entry");
}
consDescriptor = validDescriptor(descriptor);
}
@@ -232,11 +230,10 @@
super(name, description, signature);
// create default descriptor
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanConstructorInfo(" +
- "String,String,MBeanParameterInfo[])", "Entry");
+ "String,String,MBeanParameterInfo[]) Entry");
}
consDescriptor = validDescriptor(null);
}
@@ -265,11 +262,10 @@
Descriptor descriptor)
{
super(name, description, signature);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanConstructorInfo(" +
- "String,String,MBeanParameterInfo[],Descriptor)",
+ "String,String,MBeanParameterInfo[],Descriptor) " +
"Entry");
}
consDescriptor = validDescriptor(descriptor);
@@ -284,11 +280,10 @@
ModelMBeanConstructorInfo(ModelMBeanConstructorInfo old)
{
super(old.getName(), old.getDescription(), old.getSignature());
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanConstructorInfo(" +
- "ModelMBeanConstructorInfo)", "Entry");
+ "ModelMBeanConstructorInfo) Entry");
}
consDescriptor = validDescriptor(consDescriptor);
}
@@ -300,10 +295,8 @@
@Override
public Object clone ()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
- "clone()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(new ModelMBeanConstructorInfo(this)) ;
}
@@ -321,10 +314,8 @@
@Override
public Descriptor getDescriptor()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
- "getDescriptor()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (consDescriptor == null){
consDescriptor = validDescriptor(null);
@@ -356,10 +347,8 @@
*/
public void setDescriptor(Descriptor inDescriptor)
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
- "setDescriptor()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
consDescriptor = validDescriptor(inDescriptor);
}
@@ -370,10 +359,8 @@
@Override
public String toString()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanConstructorInfo.class.getName(),
- "toString()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
String retStr =
"ModelMBeanConstructorInfo: " + this.getName() +
@@ -408,7 +395,7 @@
boolean defaulted = (in == null);
if (defaulted) {
clone = new DescriptorSupport();
- MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new.");
} else {
clone = (Descriptor) in.clone();
}
@@ -416,19 +403,19 @@
//Setting defaults.
if (defaulted && clone.getFieldValue("name")==null) {
clone.setField("name", this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName());
}
if (defaulted && clone.getFieldValue("descriptorType")==null) {
clone.setField("descriptorType", "operation");
- MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"operation\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"operation\"");
}
if (clone.getFieldValue("displayName") == null) {
clone.setField("displayName",this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName());
}
if (clone.getFieldValue("role") == null) {
clone.setField("role","constructor");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor role field to \"constructor\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor role field to \"constructor\"");
}
//Checking validity
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import java.security.AccessController;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.MBeanAttributeInfo;
@@ -231,19 +231,16 @@
modelMBeanDescriptor = validDescriptor(mbeandescriptor);
} catch (MBeanException mbe) {
modelMBeanDescriptor = validDescriptor(null);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "ModelMBeanInfo(ModelMBeanInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanInfo(ModelMBeanInfo) " +
"Could not get a valid modelMBeanDescriptor, " +
"setting a default Descriptor");
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "ModelMBeanInfo(ModelMBeanInfo)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -330,12 +327,11 @@
modelMBeanOperations = operations;
modelMBeanNotifications = notifications;
modelMBeanDescriptor = validDescriptor(mbeandescriptor);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanInfoSupport(String,String,ModelMBeanAttributeInfo[]," +
"ModelMBeanConstructorInfo[],ModelMBeanOperationInfo[]," +
- "ModelMBeanNotificationInfo[],Descriptor)",
+ "ModelMBeanNotificationInfo[],Descriptor) " +
"Exit");
}
}
@@ -367,10 +363,8 @@
public Descriptor[] getDescriptors(String inDescriptorType)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getDescriptors(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if ((inDescriptorType == null) || (inDescriptorType.equals(""))) {
@@ -474,10 +468,8 @@
" the descriptors of the MBean";
throw new RuntimeOperationsException(iae,msg);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getDescriptors(String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return retList;
@@ -486,10 +478,8 @@
public void setDescriptors(Descriptor[] inDescriptors)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptors(Descriptor[])", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inDescriptors==null) {
// throw RuntimeOperationsException - invalid descriptor
@@ -504,10 +494,8 @@
for (int j=0; j < inDescriptors.length; j++) {
setDescriptor(inDescriptors[j],null);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptors(Descriptor[])", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -530,10 +518,8 @@
public Descriptor getDescriptor(String inDescriptorName)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getDescriptor(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(getDescriptor(inDescriptorName, null));
}
@@ -606,10 +592,8 @@
throws MBeanException, RuntimeOperationsException {
final String excMsg =
"Exception occurred trying to set the descriptors of the MBean";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptor(Descriptor,String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inDescriptor==null) {
@@ -621,10 +605,9 @@
(String) inDescriptor.getFieldValue("descriptorType");
if (inDescriptorType == null) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptor(Descriptor,String)",
- "descriptorType null in both String parameter and Descriptor, defaulting to "+ MMB);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "descriptorType null in both String parameter " +
+ "and Descriptor, defaulting to "+ MMB);
inDescriptorType = MMB;
}
}
@@ -632,10 +615,9 @@
String inDescriptorName =
(String) inDescriptor.getFieldValue("name");
if (inDescriptorName == null) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptor(Descriptor,String)",
- "descriptor name null, defaulting to "+ this.getClassName());
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "descriptor name null, defaulting to " +
+ this.getClassName());
inDescriptorName = this.getClassName();
}
boolean found = false;
@@ -653,17 +635,14 @@
ModelMBeanAttributeInfo mmbai =
(ModelMBeanAttributeInfo) attrList[i];
mmbai.setDescriptor(inDescriptor);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
StringBuilder strb = new StringBuilder()
.append("Setting descriptor to ").append(inDescriptor)
.append("\t\n local: AttributeInfo descriptor is ")
.append(mmbai.getDescriptor())
.append("\t\n modelMBeanInfo: AttributeInfo descriptor is ")
.append(this.getDescriptor(inDescriptorName,"attribute"));
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptor(Descriptor,String)",
- strb.toString());
+ MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString);
}
}
}
@@ -720,10 +699,8 @@
"; name=" + inDescriptorName);
throw new RuntimeOperationsException(iae, excMsg);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setDescriptor(Descriptor,String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -732,10 +709,8 @@
public ModelMBeanAttributeInfo getAttribute(String inName)
throws MBeanException, RuntimeOperationsException {
ModelMBeanAttributeInfo retInfo = null;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getAttribute(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inName == null) {
throw new RuntimeOperationsException(
@@ -748,7 +723,7 @@
if (attrList != null) numAttrs = attrList.length;
for (int i=0; (i < numAttrs) && (retInfo == null); i++) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
final StringBuilder strb = new StringBuilder()
.append("\t\n this.getAttributes() MBeanAttributeInfo Array ")
.append(i).append(":")
@@ -756,18 +731,14 @@
.append("\t\n this.modelMBeanAttributes MBeanAttributeInfo Array ")
.append(i).append(":")
.append(((ModelMBeanAttributeInfo)modelMBeanAttributes[i]).getDescriptor());
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getAttribute(String)", strb.toString());
+ MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString);
}
if (inName.equals(attrList[i].getName())) {
retInfo = ((ModelMBeanAttributeInfo)attrList[i].clone());
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getAttribute(String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return retInfo;
@@ -778,10 +749,8 @@
public ModelMBeanOperationInfo getOperation(String inName)
throws MBeanException, RuntimeOperationsException {
ModelMBeanOperationInfo retInfo = null;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getOperation(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inName == null) {
throw new RuntimeOperationsException(
@@ -798,10 +767,8 @@
retInfo = ((ModelMBeanOperationInfo) operList[i].clone());
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getOperation(String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return retInfo;
@@ -824,10 +791,8 @@
public ModelMBeanConstructorInfo getConstructor(String inName)
throws MBeanException, RuntimeOperationsException {
ModelMBeanConstructorInfo retInfo = null;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getConstructor(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inName == null) {
throw new RuntimeOperationsException(
@@ -844,10 +809,8 @@
retInfo = ((ModelMBeanConstructorInfo) consList[i].clone());
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getConstructor(String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return retInfo;
@@ -857,10 +820,8 @@
public ModelMBeanNotificationInfo getNotification(String inName)
throws MBeanException, RuntimeOperationsException {
ModelMBeanNotificationInfo retInfo = null;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getNotification(String)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inName == null) {
throw new RuntimeOperationsException(
@@ -877,10 +838,8 @@
retInfo = ((ModelMBeanNotificationInfo) notifList[i].clone());
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getNotification(String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return retInfo;
@@ -901,19 +860,15 @@
}
private Descriptor getMBeanDescriptorNoException() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getMBeanDescriptorNoException()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (modelMBeanDescriptor == null)
modelMBeanDescriptor = validDescriptor(null);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "getMBeanDescriptorNoException()",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Exit, returning: " + modelMBeanDescriptor);
}
return (Descriptor) modelMBeanDescriptor.clone();
@@ -921,10 +876,8 @@
public void setMBeanDescriptor(Descriptor inMBeanDescriptor)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanInfoSupport.class.getName(),
- "setMBeanDescriptor(Descriptor)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
modelMBeanDescriptor = validDescriptor(inMBeanDescriptor);
}
@@ -948,7 +901,7 @@
boolean defaulted = (in == null);
if (defaulted) {
clone = new DescriptorSupport();
- MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new.");
} else {
clone = (Descriptor) in.clone();
}
@@ -956,27 +909,27 @@
//Setting defaults.
if (defaulted && clone.getFieldValue("name")==null) {
clone.setField("name", this.getClassName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getClassName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getClassName());
}
if (defaulted && clone.getFieldValue("descriptorType")==null) {
clone.setField("descriptorType", MMB);
- MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"" + MMB + "\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"" + MMB + "\"");
}
if (clone.getFieldValue("displayName") == null) {
clone.setField("displayName",this.getClassName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getClassName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getClassName());
}
if (clone.getFieldValue("persistPolicy") == null) {
clone.setField("persistPolicy","never");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor persistPolicy to \"never\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor persistPolicy to \"never\"");
}
if (clone.getFieldValue("log") == null) {
clone.setField("log","F");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor \"log\" field to \"F\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor \"log\" field to \"F\"");
}
if (clone.getFieldValue("visibility") == null) {
clone.setField("visibility","1");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor visibility to 1");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor visibility to 1");
}
//Checking validity
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanNotificationInfo.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import java.security.AccessController;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
@@ -199,10 +199,8 @@
String description,
Descriptor descriptor) {
super(notifTypes, name, description);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "ModelMBeanNotificationInfo", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
notificationDescriptor = validDescriptor(descriptor);
}
@@ -225,10 +223,8 @@
* duplicate of this ModelMBeanNotificationInfo.
**/
public Object clone () {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "clone()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(new ModelMBeanNotificationInfo(this));
}
@@ -243,18 +239,15 @@
* @see #setDescriptor
**/
public Descriptor getDescriptor() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "getDescriptor()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (notificationDescriptor == null) {
// Dead code. Should never happen.
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "getDescriptor()", "Descriptor value is null, " +
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Descriptor value is null, " +
"setting descriptor to default values");
}
notificationDescriptor = validDescriptor(null);
@@ -281,10 +274,8 @@
* @see #getDescriptor
**/
public void setDescriptor(Descriptor inDescriptor) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "setDescriptor(Descriptor)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
notificationDescriptor = validDescriptor(inDescriptor);
}
@@ -296,10 +287,8 @@
* @return a string describing this object.
**/
public String toString() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanNotificationInfo.class.getName(),
- "toString()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
final StringBuilder retStr = new StringBuilder();
@@ -342,7 +331,7 @@
boolean defaulted = (in == null);
if (defaulted) {
clone = new DescriptorSupport();
- MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new.");
} else {
clone = (Descriptor) in.clone();
}
@@ -350,19 +339,19 @@
//Setting defaults.
if (defaulted && clone.getFieldValue("name")==null) {
clone.setField("name", this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName());
}
if (defaulted && clone.getFieldValue("descriptorType")==null) {
clone.setField("descriptorType", "notification");
- MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"notification\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"notification\"");
}
if (clone.getFieldValue("displayName") == null) {
clone.setField("displayName",this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName());
}
if (clone.getFieldValue("severity") == null) {
clone.setField("severity", "6");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor severity field to 6");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor severity field to 6");
}
//Checking validity
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanOperationInfo.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
import java.io.ObjectStreamField;
import java.lang.reflect.Method;
import java.security.AccessController;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Descriptor;
import javax.management.DescriptorAccess;
@@ -185,10 +185,9 @@
{
super(description, operationMethod);
// create default descriptor
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "ModelMBeanOperationInfo(String,Method)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanOperationInfo(String,Method) " +
"Entry");
}
operationDescriptor = validDescriptor(null);
@@ -228,11 +227,10 @@
{
super(description, operationMethod);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "ModelMBeanOperationInfo(String,Method,Descriptor)",
- "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanOperationInfo(String,Method,Descriptor) "
+ + "Entry");
}
operationDescriptor = validDescriptor(descriptor);
}
@@ -258,11 +256,10 @@
super(name, description, signature, type, impact);
// create default descriptor
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanOperationInfo(" +
- "String,String,MBeanParameterInfo[],String,int)",
+ "String,String,MBeanParameterInfo[],String,int) " +
"Entry");
}
operationDescriptor = validDescriptor(null);
@@ -302,11 +299,10 @@
Descriptor descriptor)
{
super(name, description, signature, type, impact);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanOperationInfo(String,String," +
- "MBeanParameterInfo[],String,int,Descriptor)",
+ "MBeanParameterInfo[],String,int,Descriptor) " +
"Entry");
}
operationDescriptor = validDescriptor(descriptor);
@@ -327,10 +323,9 @@
inInfo.getSignature(),
inInfo.getReturnType(),
inInfo.getImpact());
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "ModelMBeanOperationInfo(ModelMBeanOperationInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "ModelMBeanOperationInfo(ModelMBeanOperationInfo)" +
"Entry");
}
Descriptor newDesc = inInfo.getDescriptor();
@@ -345,10 +340,8 @@
public Object clone ()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "clone()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
return(new ModelMBeanOperationInfo(this)) ;
}
@@ -365,10 +358,8 @@
public Descriptor getDescriptor()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "getDescriptor()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (operationDescriptor == null) {
operationDescriptor = validDescriptor(null);
@@ -396,10 +387,8 @@
*/
public void setDescriptor(Descriptor inDescriptor)
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "setDescriptor(Descriptor)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
operationDescriptor = validDescriptor(inDescriptor);
}
@@ -410,10 +399,8 @@
*/
public String toString()
{
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- ModelMBeanOperationInfo.class.getName(),
- "toString()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
String retStr =
"ModelMBeanOperationInfo: " + this.getName() +
@@ -449,7 +436,7 @@
boolean defaulted = (in == null);
if (defaulted) {
clone = new DescriptorSupport();
- MODELMBEAN_LOGGER.finer("Null Descriptor, creating new.");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Null Descriptor, creating new.");
} else {
clone = (Descriptor) in.clone();
}
@@ -457,19 +444,19 @@
//Setting defaults.
if (defaulted && clone.getFieldValue("name")==null) {
clone.setField("name", this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor name to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor name to " + this.getName());
}
if (defaulted && clone.getFieldValue("descriptorType")==null) {
clone.setField("descriptorType", "operation");
- MODELMBEAN_LOGGER.finer("Defaulting descriptorType to \"operation\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting descriptorType to \"operation\"");
}
if (clone.getFieldValue("displayName") == null) {
clone.setField("displayName",this.getName());
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor displayName to " + this.getName());
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor displayName to " + this.getName());
}
if (clone.getFieldValue("role") == null) {
clone.setField("role","operation");
- MODELMBEAN_LOGGER.finer("Defaulting Descriptor role field to \"operation\"");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Defaulting Descriptor role field to \"operation\"");
}
//Checking validity
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import java.util.Map;
import java.util.Set;
@@ -166,16 +166,12 @@
**/
public RequiredModelMBean()
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "RequiredModelMBean()", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
modelMBeanInfo = createDefaultModelMBeanInfo();
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "RequiredModelMBean()", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -202,17 +198,13 @@
public RequiredModelMBean(ModelMBeanInfo mbi)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "RequiredModelMBean(MBeanInfo)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
setModelMBeanInfo(mbi);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "RequiredModelMBean(MBeanInfo)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -257,17 +249,13 @@
public void setModelMBeanInfo(ModelMBeanInfo mbi)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (mbi == null) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanInfo is null: Raising exception.");
}
final RuntimeException x = new
@@ -279,10 +267,8 @@
}
if (registered) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"RequiredMBean is registered: Raising exception.");
}
final String exceptionText =
@@ -293,32 +279,24 @@
throw new RuntimeOperationsException(x,exceptionText);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Setting ModelMBeanInfo to " + printModelMBeanInfo(mbi));
int noOfNotifications = 0;
if (mbi.getNotifications() != null) {
noOfNotifications = mbi.getNotifications().length;
}
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)",
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanInfo notifications has " +
noOfNotifications + " elements");
}
modelMBeanInfo = (ModelMBeanInfo)mbi.clone();
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)","set mbeanInfo to: "+
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "set mbeanInfo to: "+
printModelMBeanInfo(modelMBeanInfo));
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setModelMBeanInfo(ModelMBeanInfo)","Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -346,37 +324,29 @@
public void setManagedResource(Object mr, String mr_type)
throws MBeanException, RuntimeOperationsException,
InstanceNotFoundException, InvalidTargetObjectTypeException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setManagedResource(Object,String)","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
// check that the mr_type is supported by this JMXAgent
// only "objectReference" is supported
if ((mr_type == null) ||
(! mr_type.equalsIgnoreCase("objectReference"))) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setManagedResource(Object,String)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Managed Resource Type is not supported: " + mr_type);
}
throw new InvalidTargetObjectTypeException(mr_type);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setManagedResource(Object,String)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Managed Resource is valid");
}
managedResource = mr;
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setManagedResource(Object, String)", "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -482,11 +452,9 @@
private Object resolveForCacheValue(Descriptor descr)
throws MBeanException, RuntimeOperationsException {
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
- final String mth = "resolveForCacheValue(Descriptor)";
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Entry");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
Object response = null;
@@ -495,25 +463,22 @@
if (descr == null) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Input Descriptor is null");
}
return response;
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "descriptor is " + descr);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "descriptor is " + descr);
}
final Descriptor mmbDescr = modelMBeanInfo.getMBeanDescriptor();
if (mmbDescr == null) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"MBean Descriptor is null");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "MBean Descriptor is null");
}
//return response;
}
@@ -538,9 +503,8 @@
if (expTime != null) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"currencyTimeLimit: " + expTime);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "currencyTimeLimit: " + expTime);
}
// convert seconds to milliseconds for time comparison
@@ -550,8 +514,7 @@
returnCachedValue = false;
resetValue = true;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
currencyPeriod + ": never Cached");
}
} else if (currencyPeriod == 0) {
@@ -559,9 +522,7 @@
returnCachedValue = true;
resetValue = false;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
- "always valid Cache");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "always valid Cache");
}
} else {
Object objtStamp =
@@ -572,8 +533,7 @@
else tStamp = null;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"lastUpdatedTimeStamp: " + tStamp);
}
@@ -583,8 +543,7 @@
long lastTime = Long.parseLong(tStamp);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"currencyPeriod:" + currencyPeriod +
" lastUpdatedTimeStamp:" + lastTime);
}
@@ -595,8 +554,7 @@
returnCachedValue = true;
resetValue = false;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
" timed valid Cache for " + now + " < " +
(lastTime + currencyPeriod));
}
@@ -604,16 +562,14 @@
returnCachedValue = false;
resetValue = true;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"timed expired cache for " + now + " > " +
(lastTime + currencyPeriod));
}
}
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"returnCachedValue:" + returnCachedValue +
" resetValue: " + resetValue);
}
@@ -625,17 +581,15 @@
response = currValue;
/* need to cast string cached value to type */
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"valid Cache value: " + currValue);
}
} else {
response = null;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"no Cached value");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "no Cached value");
}
}
}
@@ -647,16 +601,14 @@
response = null;
modelMBeanInfo.setDescriptor(descr,null);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"reset cached value to null");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "reset cached value to null");
}
}
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return response;
@@ -672,31 +624,24 @@
**/
public MBeanInfo getMBeanInfo() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getMBeanInfo()","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (modelMBeanInfo == null) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getMBeanInfo()","modelMBeanInfo is null");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "modelMBeanInfo is null");
}
modelMBeanInfo = createDefaultModelMBeanInfo();
//return new ModelMBeanInfo(" ", "", null, null, null, null);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getMBeanInfo()","ModelMBeanInfo is " +
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "ModelMBeanInfo is " +
modelMBeanInfo.getClassName() + " for " +
modelMBeanInfo.getDescription());
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getMBeanInfo()",printModelMBeanInfo(modelMBeanInfo));
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ printModelMBeanInfo(modelMBeanInfo));
}
return((MBeanInfo) modelMBeanInfo.clone());
@@ -705,10 +650,8 @@
private String printModelMBeanInfo(ModelMBeanInfo info) {
final StringBuilder retStr = new StringBuilder();
if (info == null) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "printModelMBeanInfo(ModelMBeanInfo)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"ModelMBeanInfo to print is null, " +
"printing local ModelMBeanInfo");
}
@@ -909,12 +852,10 @@
public Object invoke(String opName, Object[] opArgs, String[] sig)
throws MBeanException, ReflectionException {
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
- final String mth = "invoke(String, Object[], String[])";
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Entry");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (opName == null) {
@@ -943,9 +884,8 @@
opMethodName = opMethodName.substring(0,opSplitter);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "Finding operation " + opName + " as " + opMethodName);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Finding operation " + opName + " as " + opMethodName);
}
ModelMBeanOperationInfo opInfo =
@@ -965,10 +905,7 @@
final Object cached = resolveForCacheValue(opDescr);
if (cached != null) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,
- "Returning cached value");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Returning cached value");
}
return cached;
}
@@ -996,9 +933,8 @@
final Object targetObjectField = opDescr.getFieldValue("targetObject");
if (tracing && targetObjectField != null)
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "Found target object in descriptor");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Found target object in descriptor");
/* Now look for the method, either in RequiredModelMBean itself
or in the target object. Set "method" and "targetObject"
@@ -1013,9 +949,8 @@
targetObject = this;
else {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "looking for method in managedResource class");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "looking for method in managedResource class");
}
if (targetObjectField != null)
targetObject = targetObjectField;
@@ -1071,18 +1006,15 @@
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "found " + opMethodName + ", now invoking");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "found " + opMethodName + ", now invoking");
}
final Object result =
invokeMethod(opName, method, targetObject, opArgs);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "successfully invoked method");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "successfully invoked method");
}
if (result != null)
@@ -1095,12 +1027,11 @@
String opMethodName,
final String[] sig)
throws ReflectionException {
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),"resolveMethod",
- "resolving " + targetClass.getName() + "." + opMethodName);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "resolving " + targetClass.getName() + "." + opMethodName);
}
final Class<?>[] argClasses;
@@ -1119,8 +1050,7 @@
public Void run() {
for (int i = 0; i < sig.length; i++) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),"resolveMethod",
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"resolve type " + sig[i]);
}
argClasses[i] = (Class<?>) primitiveClassMap.get(sig[i]);
@@ -1131,9 +1061,7 @@
Class.forName(sig[i], false, targetClassLoader);
} catch (ClassNotFoundException e) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "resolveMethod",
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"class not found");
}
final String msg = "Parameter class not found";
@@ -1182,12 +1110,10 @@
Object targetObjectField,
String opClassName,
String[] sig) {
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "invoke(String, Object[], String[])",
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"looking for method in RequiredModelMBean class");
}
@@ -1340,10 +1266,8 @@
modelMBeanInfo.setDescriptor(opDescr,
"operation");
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "invoke(String,Object[],Object[])",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"new descriptor is " + opDescr);
}
}
@@ -1495,12 +1419,9 @@
IllegalArgumentException("attributeName must not be null"),
"Exception occurred trying to get attribute of a " +
"RequiredModelMBean");
- final String mth = "getAttribute(String)";
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "Entry with " + attrName);
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry with " + attrName);
}
/* Check attributeDescriptor for getMethod */
@@ -1530,16 +1451,14 @@
/* return current cached value */
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
- "*** cached value is " + response);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "*** cached value is " + response);
}
if (response == null) {
/* no cached value, run getMethod */
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"**** cached value is null - getting getMethod");
}
String attrGetMethod =
@@ -1548,9 +1467,8 @@
if (attrGetMethod != null) {
/* run method from operations descriptor */
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "invoking a getMethod for " + attrName);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "invoking a getMethod for " + attrName);
}
Object getResponse =
@@ -1560,9 +1478,8 @@
if (getResponse != null) {
// error/validity check return value here
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "got a non-null response " +
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "got a non-null response " +
"from getMethod\n");
}
@@ -1585,9 +1502,7 @@
if ((ctl != null) && !(ctl.equals("-1"))) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"setting cached value and " +
"lastUpdatedTime in descriptor");
}
@@ -1600,19 +1515,15 @@
modelMBeanInfo.setDescriptor(attrDescr,
"attribute");
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"new descriptor is " +attrDescr);
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,"AttributeInfo descriptor is " +
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "new descriptor is " +attrDescr);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "AttributeInfo descriptor is " +
attrInfo.getDescriptor());
final String attStr = modelMBeanInfo.
getDescriptor(attrName,"attribute").
toString();
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"modelMBeanInfo: AttributeInfo " +
"descriptor is " + attStr);
}
@@ -1620,8 +1531,7 @@
} else {
// response was invalid or really returned null
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"got a null response from getMethod\n");
}
response = null;
@@ -1635,8 +1545,7 @@
response = attrDescr.getFieldValue("default");
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"could not find getMethod for " +attrName +
", returning descriptor " +qualifier + "value");
}
@@ -1698,9 +1607,8 @@
subtype = false;
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- mth, "Exception: ",e);
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Exception: ", e);
}
}
if (!subtype)
@@ -1708,9 +1616,8 @@
}
if (wrongType) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
- "Wrong response type '" + respType + "'");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Wrong response type '" + respType + "'");
}
// throw exception, didn't get
// back right attribute type
@@ -1724,8 +1631,7 @@
}
} else {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"getMethod failed " + attrName +
" not in attributeDescriptor\n");
}
@@ -1743,8 +1649,7 @@
throw t;
} catch (Exception e) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"getMethod failed with " + e.getMessage() +
" exception type " + (e.getClass()).toString());
}
@@ -1753,8 +1658,7 @@
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return response;
@@ -1777,10 +1681,9 @@
* @see #setAttributes(javax.management.AttributeList)
*/
public AttributeList getAttributes(String[] attrNames) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getAttributes(String[])","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ RequiredModelMBean.class.getName(), "Entry");
}
if (attrNames == null)
@@ -1797,19 +1700,15 @@
} catch (Exception e) {
// eat exceptions because interface doesn't have an
// exception on it
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getAttributes(String[])",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Failed to get \"" + attrNames[i] + "\": ", e);
}
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getAttributes(String[])","Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return responseList;
@@ -1894,11 +1793,9 @@
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException,
MBeanException, ReflectionException {
- final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.FINER);
+ final boolean tracing = MODELMBEAN_LOGGER.isLoggable(Level.TRACE);
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute()","Entry");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (attribute == null)
@@ -1958,11 +1855,9 @@
attrValue.getClass().getName() +
" received.");
} catch (ClassNotFoundException x) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)","Class " +
- attrType + " for attribute "
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Class " + attrType + " for attribute "
+ attrName + " not found: ", x);
}
}
@@ -1996,9 +1891,7 @@
if (updateCache || updateDescriptor) {
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)",
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"setting cached value of " +
attrName + " to " + attrValue);
}
@@ -2022,26 +1915,22 @@
.append(attrInfo.getDescriptor())
.append(". AttributeInfo descriptor is ")
.append(modelMBeanInfo.getDescriptor(attrName,"attribute"));
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)",strb.toString());
+ MODELMBEAN_LOGGER.log(Level.TRACE, strb::toString);
}
}
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)","sending sendAttributeNotification");
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "sending sendAttributeNotification");
}
sendAttributeChangeNotification(oldAttr,attribute);
} else { // if descriptor ... else no descriptor
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)","setMethod failed "+attrName+
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "setMethod failed " + attrName +
" not in attributeDescriptor\n");
}
@@ -2051,9 +1940,7 @@
} // else no descriptor
if (tracing) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)", "Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2076,10 +1963,8 @@
**/
public AttributeList setAttributes(AttributeList attributes) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "setAttribute(Attribute)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (attributes == null)
@@ -2118,17 +2003,13 @@
private synchronized void writeToLog(String logFileName,
String logEntry) throws Exception {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "writeToLog(String, String)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Notification Logging to " + logFileName + ": " + logEntry);
}
if ((logFileName == null) || (logEntry == null)) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "writeToLog(String, String)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Bad input parameters, will not log this entry.");
}
return;
@@ -2139,17 +2020,13 @@
PrintStream logOut = new PrintStream(fos);
logOut.println(logEntry);
logOut.close();
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "writeToLog(String, String)","Successfully opened log " +
- logFileName);
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ "Successfully opened log " + logFileName);
}
} catch (Exception e) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "writeToLog(String, String)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Exception " + e.toString() +
" trying to write to the Notification log file " +
logFileName);
@@ -2184,11 +2061,8 @@
NotificationFilter filter,
Object handback)
throws java.lang.IllegalArgumentException {
- final String mth = "addNotificationListener(" +
- "NotificationListener, NotificationFilter, Object)";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (listener == null)
@@ -2200,12 +2074,10 @@
generalBroadcaster.addNotificationListener(listener, filter,
handback);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"NotificationListener added");
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2227,10 +2099,8 @@
throw new ListenerNotFoundException(
"Notification listener is null");
- final String mth="removeNotificationListener(NotificationListener)";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (generalBroadcaster == null)
@@ -2239,9 +2109,8 @@
generalBroadcaster.removeNotificationListener(listener);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2255,12 +2124,8 @@
throw new ListenerNotFoundException(
"Notification listener is null");
- final String mth = "removeNotificationListener(" +
- "NotificationListener, NotificationFilter, Object)";
-
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (generalBroadcaster == null)
@@ -2271,19 +2136,16 @@
generalBroadcaster.removeNotificationListener(listener,filter,
handback);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth, "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
public void sendNotification(Notification ntfyObj)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(Notification)", "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (ntfyObj == null)
@@ -2324,10 +2186,8 @@
ntfyObj.getMessage() + " Severity = " +
(String)ntfyDesc.getFieldValue("severity"));
} catch (Exception e) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) {
- MODELMBEAN_LOGGER.logp(Level.FINE,
- RequiredModelMBean.class.getName(),
- "sendNotification(Notification)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) {
+ MODELMBEAN_LOGGER.log(Level.DEBUG,
"Failed to log " +
ntfyObj.getType() + " notification: ", e);
}
@@ -2339,14 +2199,10 @@
generalBroadcaster.sendNotification(ntfyObj);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(Notification)",
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"sendNotification sent provided notification object");
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(Notification)"," Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2354,10 +2210,8 @@
public void sendNotification(String ntfyText)
throws MBeanException, RuntimeOperationsException {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(String)","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (ntfyText == null)
@@ -2370,13 +2224,9 @@
Notification myNtfyObj = new Notification("jmx.modelmbean.generic",
this, 1, ntfyText);
sendNotification(myNtfyObj);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(String)","Notification sent");
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "sendNotification(String)","Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Notification sent");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2456,10 +2306,8 @@
*
**/
public MBeanNotificationInfo[] getNotificationInfo() {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getNotificationInfo()","Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
// Using hasNotification() is not optimal, but shouldn't really
@@ -2518,10 +2366,8 @@
respInfo[offset+j] = currInfo[j];
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),
- "getNotificationInfo()","Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return respInfo;
@@ -2535,12 +2381,8 @@
Object inhandback)
throws MBeanException, RuntimeOperationsException,
IllegalArgumentException {
- final String mth="addAttributeChangeNotificationListener(" +
- "NotificationListener, String, Object)";
-
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (inlistener == null)
@@ -2581,24 +2423,21 @@
}
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
Vector<String> enabledAttrs = currFilter.getEnabledAttributes();
String s = (enabledAttrs.size() > 1) ?
"[" + enabledAttrs.firstElement() + ", ...]" :
enabledAttrs.toString();
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(), mth,
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Set attribute change filter to " + s);
}
attributeBroadcaster.addNotificationListener(inlistener,currFilter,
inhandback);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Notification listener added for " + inAttributeName);
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Exit");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
@@ -2609,12 +2448,9 @@
if (inlistener == null) throw new
ListenerNotFoundException("Notification listener is null");
- final String mth = "removeAttributeChangeNotificationListener(" +
- "NotificationListener, String)";
-
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
+ RequiredModelMBean.class.getName(), "Entry");
}
@@ -2648,21 +2484,17 @@
attributeBroadcaster.removeNotificationListener(inlistener);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
public void sendAttributeChangeNotification(AttributeChangeNotification
ntfyObj)
throws MBeanException, RuntimeOperationsException {
- final String mth = "sendAttributeChangeNotification(" +
- "AttributeChangeNotification)";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,"Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
if (ntfyObj == null)
@@ -2678,9 +2510,8 @@
if (oldv == null) oldv = "null";
if (newv == null) newv = "null";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE,
"Sending AttributeChangeNotification with " +
ntfyObj.getAttributeName() + ntfyObj.getAttributeType() +
ntfyObj.getNewValue() + ntfyObj.getOldValue());
@@ -2718,9 +2549,8 @@
" Old value = " + oldv +
" New value = " + newv);
} catch (Exception e) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) {
- MODELMBEAN_LOGGER.logp(Level.FINE,
- RequiredModelMBean.class.getName(),mth,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) {
+ MODELMBEAN_LOGGER.log(Level.DEBUG,
"Failed to log " + ntfyObj.getType() +
" notification: ", e);
}
@@ -2744,9 +2574,8 @@
" Old value = " + oldv +
" New value = " + newv);
} catch (Exception e) {
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINE)) {
- MODELMBEAN_LOGGER.logp(Level.FINE,
- RequiredModelMBean.class.getName(),mth,
+ if (MODELMBEAN_LOGGER.isLoggable(Level.DEBUG)) {
+ MODELMBEAN_LOGGER.log(Level.DEBUG,
"Failed to log " + ntfyObj.getType() +
" notification: ", e);
}
@@ -2768,25 +2597,17 @@
generalBroadcaster.sendNotification(ntfyObj);
}
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
- "sent notification");
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
- "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "sent notification");
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
public void sendAttributeChangeNotification(Attribute inOldVal,
Attribute inNewVal)
throws MBeanException, RuntimeOperationsException {
- final String mth =
- "sendAttributeChangeNotification(Attribute, Attribute)";
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
- "Entry");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
// do we really want to do this?
@@ -2824,10 +2645,8 @@
sendAttributeChangeNotification(myNtfyObj);
- if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
- MODELMBEAN_LOGGER.logp(Level.FINER,
- RequiredModelMBean.class.getName(),mth,
- "Exit");
+ if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
+ MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
}
--- a/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/CounterMonitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.management.monitor;
import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.ObjectName;
import javax.management.MBeanNotificationInfo;
import static javax.management.monitor.Monitor.NumericalType.*;
@@ -228,8 +228,7 @@
*/
public synchronized void start() {
if (isActive()) {
- MONITOR_LOGGER.logp(Level.FINER, CounterMonitor.class.getName(),
- "start", "the monitor is already active");
+ MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active");
return;
}
// Reset values.
@@ -696,7 +695,7 @@
}
}
} else {
- if (MONITOR_LOGGER.isLoggable(Level.FINER)) {
+ if (MONITOR_LOGGER.isLoggable(Level.TRACE)) {
final StringBuilder strb = new StringBuilder()
.append("The notification:")
.append("\n\tNotification observed object = ")
@@ -708,8 +707,7 @@
.append("\n\tNotification derived gauge = ")
.append(o.getDerivedGauge())
.append("\nhas already been sent");
- MONITOR_LOGGER.logp(Level.FINER, CounterMonitor.class.getName(),
- "updateNotifications", strb.toString());
+ MONITOR_LOGGER.log(Level.TRACE, strb::toString);
}
}
@@ -756,9 +754,7 @@
break;
default:
// Should never occur...
- MONITOR_LOGGER.logp(Level.FINEST,
- CounterMonitor.class.getName(),
- "updateThreshold",
+ MONITOR_LOGGER.log(Level.TRACE,
"the threshold type is invalid");
break;
}
@@ -819,8 +815,7 @@
case LONG: o.setDerivedGauge(Long.valueOf(derived)); break;
default:
// Should never occur...
- MONITOR_LOGGER.logp(Level.FINEST, CounterMonitor.class.getName(),
- "setDerivedGaugeWithDifference",
+ MONITOR_LOGGER.log(Level.TRACE,
"the threshold type is invalid");
break;
}
--- a/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/GaugeMonitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.management.monitor;
import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.MBeanNotificationInfo;
import javax.management.ObjectName;
import static javax.management.monitor.Monitor.NumericalType.*;
@@ -224,8 +224,7 @@
*/
public synchronized void start() {
if (isActive()) {
- MONITOR_LOGGER.logp(Level.FINER, GaugeMonitor.class.getName(),
- "start", "the monitor is already active");
+ MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active");
return;
}
// Reset values.
@@ -664,8 +663,7 @@
break;
default:
// Should never occur...
- MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(),
- "setDerivedGaugeWithDifference",
+ MONITOR_LOGGER.log(Level.TRACE,
"the threshold type is invalid");
return;
}
@@ -698,8 +696,7 @@
return (greater.doubleValue() >= less.doubleValue());
default:
// Should never occur...
- MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(),
- "isFirstGreaterThanLast",
+ MONITOR_LOGGER.log(Level.TRACE,
"the threshold type is invalid");
return false;
}
@@ -733,8 +730,7 @@
}
else {
// Should never occur...
- MONITOR_LOGGER.logp(Level.FINEST, GaugeMonitor.class.getName(),
- "isFirstStrictlyGreaterThanLast",
+ MONITOR_LOGGER.log(Level.TRACE,
"the threshold type is invalid");
return false;
}
--- a/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/Monitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,7 +47,7 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceNotFoundException;
import javax.management.IntrospectionException;
@@ -205,13 +205,11 @@
try {
maximumPoolSizeTmp = Integer.parseInt(maximumPoolSizeStr);
} catch (NumberFormatException e) {
- if (MONITOR_LOGGER.isLoggable(Level.FINER)) {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "<static initializer>",
+ if (MONITOR_LOGGER.isLoggable(Level.TRACE)) {
+ MONITOR_LOGGER.log(Level.TRACE,
"Wrong value for " + maximumPoolSizeSysProp +
" system property", e);
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "<static initializer>",
+ MONITOR_LOGGER.log(Level.TRACE,
maximumPoolSizeSysProp + " defaults to 10");
}
maximumPoolSizeTmp = 10;
@@ -391,8 +389,7 @@
public ObjectName preRegister(MBeanServer server, ObjectName name)
throws Exception {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "preRegister(MBeanServer, ObjectName)",
+ MONITOR_LOGGER.log(Level.TRACE,
"initialize the reference on the MBean server");
this.server = server;
@@ -419,8 +416,7 @@
*/
public void preDeregister() throws Exception {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "preDeregister()", "stop the monitor");
+ MONITOR_LOGGER.log(Level.TRACE, "stop the monitor");
// Stop the Monitor.
//
@@ -693,13 +689,11 @@
* Starts the monitor.
*/
void doStart() {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "doStart()", "start the monitor");
+ MONITOR_LOGGER.log(Level.TRACE, "start the monitor");
synchronized (this) {
if (isActive()) {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "doStart()", "the monitor is already active");
+ MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active");
return;
}
@@ -729,13 +723,11 @@
* Stops the monitor.
*/
void doStop() {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "doStop()", "stop the monitor");
+ MONITOR_LOGGER.log(Level.TRACE, "stop the monitor");
synchronized (this) {
if (!isActive()) {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "doStop()", "the monitor is not active");
+ MONITOR_LOGGER.log(Level.TRACE, "the monitor is not active");
return;
}
@@ -1089,9 +1081,8 @@
if (!isActive())
return;
- if (MONITOR_LOGGER.isLoggable(Level.FINER)) {
- MONITOR_LOGGER.logp(Level.FINER, Monitor.class.getName(),
- "sendNotification", "send notification: " +
+ if (MONITOR_LOGGER.isLoggable(Level.TRACE)) {
+ MONITOR_LOGGER.log(Level.TRACE, "send notification: " +
"\n\tNotification observed object = " + object +
"\n\tNotification observed attribute = " + observedAttribute +
"\n\tNotification derived gauge = " + derGauge);
@@ -1163,8 +1154,7 @@
setAlreadyNotified(
o, index, OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, an);
msg = "The observed attribute value is null.";
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
+ MONITOR_LOGGER.log(Level.TRACE, msg);
}
} catch (NullPointerException np_ex) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED))
@@ -1176,10 +1166,8 @@
"The monitor must be registered in the MBean " +
"server or an MBeanServerConnection must be " +
"explicitly supplied.";
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", np_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, np_ex::toString);
}
} catch (InstanceNotFoundException inf_ex) {
if (isAlreadyNotified(o, OBSERVED_OBJECT_ERROR_NOTIFIED))
@@ -1191,10 +1179,8 @@
msg =
"The observed object must be accessible in " +
"the MBeanServerConnection.";
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", inf_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, inf_ex::toString);
}
} catch (AttributeNotFoundException anf_ex) {
if (isAlreadyNotified(o, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED))
@@ -1206,10 +1192,8 @@
msg =
"The observed attribute must be accessible in " +
"the observed object.";
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", anf_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, anf_ex::toString);
}
} catch (MBeanException mb_ex) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED))
@@ -1218,10 +1202,8 @@
notifType = RUNTIME_ERROR;
setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an);
msg = mb_ex.getMessage() == null ? "" : mb_ex.getMessage();
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", mb_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, mb_ex::toString);
}
} catch (ReflectionException ref_ex) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED)) {
@@ -1230,10 +1212,8 @@
notifType = RUNTIME_ERROR;
setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an);
msg = ref_ex.getMessage() == null ? "" : ref_ex.getMessage();
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", ref_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, ref_ex::toString);
}
} catch (IOException io_ex) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED))
@@ -1242,10 +1222,8 @@
notifType = RUNTIME_ERROR;
setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an);
msg = io_ex.getMessage() == null ? "" : io_ex.getMessage();
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", io_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, io_ex::toString);
}
} catch (RuntimeException rt_ex) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED))
@@ -1254,10 +1232,8 @@
notifType = RUNTIME_ERROR;
setAlreadyNotified(o, index, RUNTIME_ERROR_NOTIFIED, an);
msg = rt_ex.getMessage() == null ? "" : rt_ex.getMessage();
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST, Monitor.class.getName(),
- "monitor", rt_ex.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, rt_ex::toString);
}
}
@@ -1297,10 +1273,8 @@
msg =
"The observed attribute value does not " +
"implement the Comparable interface.";
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", e.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, e::toString);
}
} catch (AttributeNotFoundException e) {
if (isAlreadyNotified(o, OBSERVED_ATTRIBUTE_ERROR_NOTIFIED))
@@ -1312,10 +1286,8 @@
msg =
"The observed attribute must be accessible in " +
"the observed object.";
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", e.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, e::toString);
}
} catch (RuntimeException e) {
if (isAlreadyNotified(o, RUNTIME_ERROR_NOTIFIED))
@@ -1325,10 +1297,8 @@
setAlreadyNotified(o, index,
RUNTIME_ERROR_NOTIFIED, an);
msg = e.getMessage() == null ? "" : e.getMessage();
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", e.toString());
+ MONITOR_LOGGER.log(Level.TRACE, msg);
+ MONITOR_LOGGER.log(Level.TRACE, e::toString);
}
}
}
@@ -1346,8 +1316,7 @@
setAlreadyNotified(o, index,
OBSERVED_ATTRIBUTE_TYPE_ERROR_NOTIFIED, an);
msg = "The observed attribute type is not valid.";
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
+ MONITOR_LOGGER.log(Level.TRACE, msg);
}
}
}
@@ -1363,8 +1332,7 @@
setAlreadyNotified(o, index,
THRESHOLD_ERROR_NOTIFIED, an);
msg = "The threshold type is not valid.";
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
+ MONITOR_LOGGER.log(Level.TRACE, msg);
}
}
}
@@ -1381,8 +1349,7 @@
notifType = RUNTIME_ERROR;
setAlreadyNotified(o, index,
RUNTIME_ERROR_NOTIFIED, an);
- MONITOR_LOGGER.logp(Level.FINEST,
- Monitor.class.getName(), "monitor", msg);
+ MONITOR_LOGGER.log(Level.TRACE, msg);
}
}
}
--- a/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/monitor/StringMonitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.management.monitor;
import static com.sun.jmx.defaults.JmxProperties.MONITOR_LOGGER;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.ObjectName;
import javax.management.MBeanNotificationInfo;
import static javax.management.monitor.MonitorNotification.*;
@@ -151,8 +151,7 @@
*/
public synchronized void start() {
if (isActive()) {
- MONITOR_LOGGER.logp(Level.FINER, StringMonitor.class.getName(),
- "start", "the monitor is already active");
+ MONITOR_LOGGER.log(Level.TRACE, "the monitor is already active");
return;
}
// Reset values.
--- a/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/relation/MBeanServerNotificationFilter.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
import javax.management.ObjectName;
import java.util.List;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import java.util.Vector;
/**
@@ -160,14 +160,12 @@
public MBeanServerNotificationFilter() {
super();
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "MBeanServerNotificationFilter");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
enableType(MBeanServerNotification.REGISTRATION_NOTIFICATION);
enableType(MBeanServerNotification.UNREGISTRATION_NOTIFICATION);
- RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
- "MBeanServerNotificationFilter");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -181,14 +179,12 @@
*/
public synchronized void disableAllObjectNames() {
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "disableAllObjectNames");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
selectedNames = new Vector<ObjectName>();
deselectedNames = null;
- RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
- "disableAllObjectNames");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -207,8 +203,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "disableObjectName", objectName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}" + objectName);
// Removes from selected ObjectNames, if present
if (selectedNames != null) {
@@ -226,8 +221,7 @@
}
}
- RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
- "disableObjectName");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -236,14 +230,12 @@
*/
public synchronized void enableAllObjectNames() {
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "enableAllObjectNames");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
selectedNames = null;
deselectedNames = new Vector<ObjectName>();
- RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
- "enableAllObjectNames");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -262,8 +254,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "enableObjectName", objectName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", objectName);
// Removes from deselected ObjectNames, if present
if (deselectedNames != null) {
@@ -281,8 +272,7 @@
}
}
- RELATION_LOGGER.exiting(MBeanServerNotificationFilter.class.getName(),
- "enableObjectName");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -349,16 +339,13 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled", notif);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", notif);
// Checks the type first
String ntfType = notif.getType();
Vector<String> enabledTypes = getEnabledTypes();
if (!(enabledTypes.contains(ntfType))) {
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"Type not selected, exiting");
return false;
}
@@ -375,9 +362,7 @@
// checks for explicit selection
if (selectedNames.size() == 0) {
// All are explicitly not selected
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"No ObjectNames selected, exiting");
return false;
}
@@ -385,9 +370,7 @@
isSelectedFlg = selectedNames.contains(objName);
if (!isSelectedFlg) {
// Not in the explicit selected list
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"ObjectName not in selected list, exiting");
return false;
}
@@ -399,26 +382,20 @@
if (deselectedNames == null) {
// All are implicitly deselected and it is not explicitly
// selected
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"ObjectName not selected, and all " +
"names deselected, exiting");
return false;
} else if (deselectedNames.contains(objName)) {
// Explicitly deselected
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"ObjectName explicitly not selected, exiting");
return false;
}
}
- RELATION_LOGGER.logp(Level.FINER,
- MBeanServerNotificationFilter.class.getName(),
- "isNotificationEnabled",
+ RELATION_LOGGER.log(Level.TRACE,
"ObjectName selected, exiting");
return true;
}
--- a/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationService.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import javax.management.Attribute;
import javax.management.AttributeNotFoundException;
@@ -157,13 +157,11 @@
*/
public RelationService(boolean immediatePurgeFlag) {
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "RelationService");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
setPurgeFlag(immediatePurgeFlag);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "RelationService");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -286,8 +284,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "createRelationType", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
// Can throw an InvalidRelationTypeException
RelationType relType =
@@ -295,8 +292,7 @@
addRelationTypeInt(relType);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "createRelationType");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -325,8 +321,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "addRelationType");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Checks the role infos
List<RoleInfo> roleInfoList = relationTypeObj.getRoleInfos();
@@ -346,8 +341,7 @@
addRelationTypeInt(relationTypeObj);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "addRelationType");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -385,14 +379,12 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRoleInfos", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
// Can throw a RelationTypeNotFoundException
RelationType relType = getRelationType(relationTypeName);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRoleInfos");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return relType.getRoleInfos();
}
@@ -421,8 +413,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRoleInfo", new Object[] {relationTypeName, roleInfoName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationTypeName, roleInfoName);
// Can throw a RelationTypeNotFoundException
RelationType relType = getRelationType(relationTypeName);
@@ -430,8 +422,7 @@
// Can throw a RoleInfoNotFoundException
RoleInfo roleInfo = relType.getRoleInfo(roleInfoName);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRoleInfo");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return roleInfo;
}
@@ -461,8 +452,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "removeRelationType", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
// Checks if the relation type to be removed exists
// Can throw a RelationTypeNotFoundException
@@ -504,8 +494,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "removeRelationType");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -566,9 +555,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "createRelation",
- new Object[] {relationId, relationTypeName, roleList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ relationId, relationTypeName, roleList);
// Creates RelationSupport object
// Can throw InvalidRoleValueException
@@ -588,8 +576,7 @@
relationId,
relationTypeName,
roleList);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "createRelation");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -654,8 +641,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "addRelation", relationObjectName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationObjectName);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -791,8 +777,7 @@
newRefList.add(relationObjectName);
updateUnregistrationListener(newRefList, null);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "addRelation");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -819,8 +804,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "isRelationMBean", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Can throw RelationNotFoundException
Object result = getRelation(relationId);
@@ -850,8 +834,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "isRelation", objectName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", objectName);
String result = null;
synchronized(myRelMBeanObjName2RelIdMap) {
@@ -881,8 +864,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "hasRelation", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
try {
// Can throw RelationNotFoundException
@@ -933,8 +915,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "checkRoleReading", new Object[] {roleName, relationTypeName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ roleName, relationTypeName);
Integer result;
@@ -956,8 +938,7 @@
result = Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleReading");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -995,9 +976,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "checkRoleWriting",
- new Object[] {role, relationTypeName, initFlag});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ role, relationTypeName, initFlag);
// Can throw a RelationTypeNotFoundException
RelationType relType = getRelationType(relationTypeName);
@@ -1013,8 +993,7 @@
try {
roleInfo = relType.getRoleInfo(roleName);
} catch (RoleInfoNotFoundException exc) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleWriting");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
}
@@ -1024,8 +1003,7 @@
roleInfo,
writeChkFlag);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleWriting");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1055,8 +1033,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "sendRelationCreationNotification", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Message
StringBuilder ntfMsg = new StringBuilder("Creation of relation ");
@@ -1071,8 +1048,7 @@
null,
null);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "sendRelationCreationNotification");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1114,9 +1090,8 @@
if (!(oldValue instanceof ArrayList<?>))
oldValue = new ArrayList<ObjectName>(oldValue);
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "sendRoleUpdateNotification",
- new Object[] {relationId, newRole, oldValue});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ relationId, newRole, oldValue);
String roleName = newRole.getRoleName();
List<ObjectName> newRoleVal = newRole.getRoleValue();
@@ -1140,8 +1115,7 @@
newRoleVal,
oldValue);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "sendRoleUpdateNotification");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
}
/**
@@ -1172,9 +1146,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "sendRelationRemovalNotification",
- new Object[] {relationId, unregMBeanList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationId, unregMBeanList);
// Can throw RelationNotFoundException
sendNotificationInt(3,
@@ -1186,8 +1159,7 @@
null);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "sendRelationRemovalNotification");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1226,8 +1198,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "updateRoleMap", new Object[] {relationId, newRole, oldValue});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ relationId, newRole, oldValue);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -1303,8 +1275,7 @@
// all ObjectNames of interest
updateUnregistrationListener(newRefList, obsRefList);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "updateRoleMap");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1338,8 +1309,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "removeRelation", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Checks there is a relation with this id
// Can throw RelationNotFoundException
@@ -1442,8 +1412,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "removeRelation");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1476,8 +1445,7 @@
public void purgeRelations()
throws RelationServiceNotRegisteredException {
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "purgeRelations");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -1574,8 +1542,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "purgeRelations");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1610,9 +1577,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "findReferencingRelations",
- new Object[] {mbeanName, relationTypeName, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ mbeanName, relationTypeName, roleName);
Map<String,List<String>> result = new HashMap<String,List<String>>();
@@ -1684,8 +1650,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "findReferencingRelations");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1720,9 +1685,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "findAssociatedMBeans",
- new Object[] {mbeanName, relationTypeName, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ mbeanName, relationTypeName, roleName);
// Retrieves the map <relation id> -> <role names> for those
// criterias
@@ -1769,8 +1733,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "findAssociatedMBeans");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1794,8 +1757,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "findRelationsOfType");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Can throw RelationTypeNotFoundException
RelationType relType = getRelationType(relationTypeName);
@@ -1809,8 +1771,7 @@
result = new ArrayList<String>(result1);
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "findRelationsOfType");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1845,8 +1806,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRole", new Object[] {relationId, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationId, roleName);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -1899,7 +1860,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(), "getRole");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1931,8 +1892,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRoles", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -1976,7 +1936,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(), "getRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2004,8 +1964,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRoles", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Can throw a RelationNotFoundException
Object relObj = getRelation(relationId);
@@ -2028,7 +1987,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(), "getRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2055,8 +2014,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRoleCardinality", new Object[] {relationId, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationId, roleName);
// Can throw a RelationNotFoundException
Object relObj = getRelation(relationId);
@@ -2098,8 +2057,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRoleCardinality");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2147,8 +2105,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "setRole", new Object[] {relationId, role});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationId, role);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -2211,7 +2169,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(), "setRole");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -2247,8 +2205,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "setRoles", new Object[] {relationId, roleList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ relationId, roleList);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -2296,7 +2254,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(), "setRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2322,8 +2280,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getReferencedMBeans", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}",
+ relationId);
// Can throw a RelationNotFoundException
Object relObj = getRelation(relationId);
@@ -2346,8 +2304,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getReferencedMBeans");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2371,8 +2328,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRelationTypeName", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// Can throw a RelationNotFoundException
Object relObj = getRelation(relationId);
@@ -2395,8 +2351,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRelationTypeName");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -2421,8 +2376,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "handleNotification", notif);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", notif);
if (notif instanceof MBeanServerNotification) {
@@ -2480,8 +2434,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "handleNotification");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -2495,8 +2448,7 @@
*/
public MBeanNotificationInfo[] getNotificationInfo() {
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getNotificationInfo");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
String ntfClass = "javax.management.relation.RelationNotification";
@@ -2514,8 +2466,7 @@
MBeanNotificationInfo ntfInfo =
new MBeanNotificationInfo(ntfTypes, ntfClass, ntfDesc);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getNotificationInfo");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return new MBeanNotificationInfo[] {ntfInfo};
}
@@ -2539,8 +2490,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "addRelationTypeInt");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
String relTypeName = relationTypeObj.getRelationTypeName();
@@ -2570,8 +2520,7 @@
((RelationTypeSupport)relationTypeObj).setRelationServiceFlag(true);
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "addRelationTypeInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -2595,8 +2544,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRelationType", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
// No null relation type accepted, so can use get()
RelationType relType;
@@ -2611,8 +2559,7 @@
throw new RelationTypeNotFoundException(excMsgStrB.toString());
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRelationType");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return relType;
}
@@ -2639,8 +2586,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "getRelation", relationId);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationId);
// No null relation accepted, so can use get()
Object rel;
@@ -2653,8 +2599,7 @@
throw new RelationNotFoundException(excMsg);
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "getRelation");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return rel;
}
@@ -2684,9 +2629,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "addNewMBeanReference",
- new Object[] {objectName, relationId, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ objectName, relationId, roleName);
boolean isNewFlag = false;
@@ -2739,8 +2683,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "addNewMBeanReference");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return isNewFlag;
}
@@ -2772,9 +2715,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "removeMBeanReference",
- new Object[] {objectName, relationId, roleName, allRolesFlag});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
+ objectName, relationId, roleName, allRolesFlag);
boolean noLongerRefFlag = false;
@@ -2790,8 +2732,7 @@
if (mbeanRefMap == null) {
// The MBean is no longer referenced
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "removeMBeanReference");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return true;
}
@@ -2824,8 +2765,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "removeMBeanReference");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return noLongerRefFlag;
}
@@ -2850,9 +2790,8 @@
}
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "updateUnregistrationListener",
- new Object[] {newRefList, obsoleteRefList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}",
+ newRefList, obsoleteRefList);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -2936,8 +2875,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "updateUnregistrationListener");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -3003,9 +2941,10 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "addRelationInt", new Object[] {relationBaseFlag, relationObj,
- relationObjName, relationId, relationTypeName, roleList});
+ RELATION_LOGGER.log(Level.TRACE,
+ "ENTRY {0} {1} {2} {3} {4} {5}",
+ relationBaseFlag, relationObj, relationObjName,
+ relationId, relationTypeName, roleList);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -3144,8 +3083,7 @@
// OK : The Relation could not be found.
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "addRelationInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -3185,15 +3123,13 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "checkRoleInt", new Object[] {chkType, roleName,
- roleValue, roleInfo, writeChkFlag});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4}",
+ chkType, roleName, roleValue, roleInfo, writeChkFlag);
// Compares names
String expName = roleInfo.getName();
if (!(roleName.equals(expName))) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return Integer.valueOf(RoleStatus.NO_ROLE_WITH_NAME);
}
@@ -3201,13 +3137,11 @@
if (chkType == 1) {
boolean isReadable = roleInfo.isReadable();
if (!isReadable) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return Integer.valueOf(RoleStatus.ROLE_NOT_READABLE);
} else {
// End of check :)
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return 0;
}
}
@@ -3216,8 +3150,7 @@
if (writeChkFlag) {
boolean isWritable = roleInfo.isWritable();
if (!isWritable) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.ROLE_NOT_WRITABLE;
}
}
@@ -3227,16 +3160,14 @@
// Checks minimum cardinality
boolean chkMinFlag = roleInfo.checkMinDegree(refNbr);
if (!chkMinFlag) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE;
}
// Checks maximum cardinality
boolean chkMaxFlag = roleInfo.checkMaxDegree(refNbr);
if (!chkMaxFlag) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE;
}
@@ -3252,8 +3183,7 @@
// Checks it is registered
if (currObjName == null) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.REF_MBEAN_NOT_REGISTERED;
}
@@ -3263,20 +3193,17 @@
boolean classSts = myMBeanServer.isInstanceOf(currObjName,
expClassName);
if (!classSts) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS;
}
} catch (InstanceNotFoundException exc) {
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return RoleStatus.REF_MBEAN_NOT_REGISTERED;
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "checkRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return 0;
}
@@ -3328,10 +3255,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "initializeMissingRoles", new Object[] {relationBaseFlag,
- relationObj, relationObjName, relationId, relationTypeName,
- roleInfoList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5}",
+ relationBaseFlag, relationObj, relationObjName,
+ relationId, relationTypeName, roleInfoList);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -3410,8 +3336,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "initializeMissingRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -3528,9 +3453,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "sendNotificationInt", new Object[] {intNtfType, message,
- relationId, unregMBeanList, roleName, roleNewValue, oldValue});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4} {5} {6}",
+ intNtfType, message, relationId, unregMBeanList,
+ roleName, roleNewValue, oldValue);
// Relation type name
// Note: do not use getRelationTypeName() as if it is a relation MBean
@@ -3616,8 +3541,7 @@
sendNotification(ntf);
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "sendNotificationInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -3654,9 +3578,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationService.class.getName(),
- "handleReferenceUnregistration",
- new Object[] {relationId, objectName, roleNameList});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ relationId, objectName, roleNameList);
// Can throw RelationServiceNotRegisteredException
isActive();
@@ -3782,8 +3705,7 @@
}
}
- RELATION_LOGGER.exiting(RelationService.class.getName(),
- "handleReferenceUnregistration");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
}
--- a/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationSupport.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
+import java.lang.System.Logger.Level;
import java.util.ArrayList;
-
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -162,8 +162,7 @@
super();
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "RelationSupport");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Can throw InvalidRoleValueException and IllegalArgumentException
initMembers(relationId,
@@ -172,8 +171,7 @@
relationTypeName,
list);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "RelationSupport");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
}
/**
@@ -239,8 +237,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "RelationSupport");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Can throw InvalidRoleValueException and
// IllegalArgumentException
@@ -250,8 +247,7 @@
relationTypeName,
list);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "RelationSupport");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
}
//
@@ -286,15 +282,14 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getRole", roleName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName);
// Can throw RoleNotFoundException and
// RelationServiceNotRegisteredException
List<ObjectName> result = cast(
getRoleInt(roleName, false, null, false));
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRole");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -324,12 +319,12 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(), "getRoles");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
// Can throw RelationServiceNotRegisteredException
RoleResult result = getRolesInt(roleNameArray, false, null);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -346,8 +341,7 @@
public RoleResult getAllRoles()
throws RelationServiceNotRegisteredException {
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getAllRoles");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
RoleResult result = null;
try {
@@ -356,7 +350,7 @@
// OK : Invalid parameters, ignore...
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getAllRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -367,8 +361,7 @@
*/
public RoleList retrieveAllRoles() {
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "retrieveAllRoles");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
RoleList result;
synchronized(myRoleName2ValueMap) {
@@ -376,8 +369,7 @@
new RoleList(new ArrayList<Role>(myRoleName2ValueMap.values()));
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "retrieveAllRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -400,8 +392,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getRoleCardinality", roleName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName);
// Try to retrieve the role
Role role;
@@ -426,8 +417,7 @@
List<ObjectName> roleValue = role.getRoleValue();
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "getRoleCardinality");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return roleValue.size();
}
@@ -476,13 +466,12 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "setRole", role);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", role);
// Will return null :)
Object result = setRoleInt(role, false, null, false);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRole");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -521,12 +510,11 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "setRoles", list);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", list);
RoleResult result = setRolesInt(list, false, null);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRoles");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -570,9 +558,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "handleMBeanUnregistration",
- new Object[]{objectName, roleName});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1}", objectName, roleName);
// Can throw RoleNotFoundException, InvalidRoleValueException,
// or RelationTypeNotFoundException
@@ -581,8 +567,7 @@
false,
null);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "handleMBeanUnregistration");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -594,8 +579,7 @@
*/
public Map<ObjectName,List<String>> getReferencedMBeans() {
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getReferencedMBeans");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
Map<ObjectName,List<String>> refMBeanMap =
new HashMap<ObjectName,List<String>>();
@@ -628,8 +612,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "getReferencedMBeans");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return refMBeanMap;
}
@@ -779,8 +762,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getRoleInt", roleName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleName);
int pbType = 0;
@@ -885,7 +867,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "getRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -921,8 +903,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getRolesInt");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
RoleList roleList = new RoleList();
RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
@@ -966,8 +947,7 @@
}
RoleResult result = new RoleResult(roleList, roleUnresList);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "getRolesInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -991,8 +971,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "getAllRolesInt");
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY");
List<String> roleNameList;
synchronized(myRoleName2ValueMap) {
@@ -1006,8 +985,7 @@
relationServCallFlg,
relationServ);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "getAllRolesInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1083,9 +1061,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "setRoleInt", new Object[] {aRole, relationServCallFlg,
- relationServ, multiRoleFlg});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
+ aRole, relationServCallFlg, relationServ,
+ multiRoleFlg);
String roleName = aRole.getRoleName();
int pbType = 0;
@@ -1244,7 +1222,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRoleInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1286,9 +1264,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "sendRoleUpdateNotification", new Object[] {newRole,
- oldRoleValue, relationServCallFlg, relationServ});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
+ newRole, oldRoleValue, relationServCallFlg,
+ relationServ);
if (relationServCallFlg) {
// Direct call to the Relation Service
@@ -1341,8 +1319,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "sendRoleUpdateNotification");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1383,9 +1360,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "updateRelationServiceMap", new Object[] {newRole,
- oldRoleValue, relationServCallFlg, relationServ});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
+ newRole, oldRoleValue, relationServCallFlg,
+ relationServ);
if (relationServCallFlg) {
// Direct call to the Relation Service
@@ -1433,8 +1410,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "updateRelationServiceMap");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1484,9 +1460,8 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "setRolesInt",
- new Object[] {list, relationServCallFlg, relationServ});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2}",
+ list, relationServCallFlg, relationServ);
RoleList roleList = new RoleList();
RoleUnresolvedList roleUnresList = new RoleUnresolvedList();
@@ -1534,7 +1509,7 @@
RoleResult result = new RoleResult(roleList, roleUnresList);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "setRolesInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -1578,9 +1553,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "initMembers", new Object[] {relationId, relationServiceName,
- relationServiceMBeanServer, relationTypeName, list});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3} {4}",
+ relationId, relationServiceName,
+ relationServiceMBeanServer, relationTypeName, list);
myRelId = relationId;
myRelServiceName = relationServiceName;
@@ -1589,7 +1564,7 @@
// Can throw InvalidRoleValueException
initRoleMap(list);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initMembers");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1608,8 +1583,7 @@
return;
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "initRoleMap", list);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", list);
synchronized(myRoleName2ValueMap) {
@@ -1632,7 +1606,7 @@
}
}
- RELATION_LOGGER.exiting(RelationSupport.class.getName(), "initRoleMap");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -1692,9 +1666,9 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationSupport.class.getName(),
- "handleMBeanUnregistrationInt", new Object[] {objectName,
- roleName, relationServCallFlg, relationServ});
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0} {1} {2} {3}",
+ objectName, roleName, relationServCallFlg,
+ relationServ);
// Retrieves current role value
Role role;
@@ -1723,8 +1697,7 @@
Object result =
setRoleInt(newRole, relationServCallFlg, relationServ, false);
- RELATION_LOGGER.exiting(RelationSupport.class.getName(),
- "handleMBeanUnregistrationInt");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
--- a/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/relation/RelationTypeSupport.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
/**
* A RelationTypeSupport object implements the RelationType interface.
@@ -173,15 +173,13 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationTypeSupport.class.getName(),
- "RelationTypeSupport", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
// Can throw InvalidRelationTypeException, ClassNotFoundException
// and NotCompliantMBeanException
initMembers(relationTypeName, roleInfoArray);
- RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(),
- "RelationTypeSupport");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -199,13 +197,11 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationTypeSupport.class.getName(),
- "RelationTypeSupport", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
typeName = relationTypeName;
- RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(),
- "RelationTypeSupport");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -251,8 +247,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationTypeSupport.class.getName(),
- "getRoleInfo", roleInfoName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleInfoName);
// No null RoleInfo allowed, so use get()
RoleInfo result = roleName2InfoMap.get(roleInfoName);
@@ -265,8 +260,7 @@
throw new RoleInfoNotFoundException(excMsgStrB.toString());
}
- RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(),
- "getRoleInfo");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return result;
}
@@ -297,8 +291,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationTypeSupport.class.getName(),
- "addRoleInfo", roleInfo);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", roleInfo);
if (isInRelationService) {
// Trying to update a declared relation type
@@ -319,8 +312,7 @@
roleName2InfoMap.put(roleName, new RoleInfo(roleInfo));
- RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(),
- "addRoleInfo");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
@@ -351,8 +343,7 @@
throw new IllegalArgumentException(excMsg);
}
- RELATION_LOGGER.entering(RelationTypeSupport.class.getName(),
- "initMembers", relationTypeName);
+ RELATION_LOGGER.log(Level.TRACE, "ENTRY {0}", relationTypeName);
typeName = relationTypeName;
@@ -366,8 +357,7 @@
new RoleInfo(currRoleInfo));
}
- RELATION_LOGGER.exiting(RelationTypeSupport.class.getName(),
- "initMembers");
+ RELATION_LOGGER.log(Level.TRACE, "RETURN");
return;
}
--- a/jdk/src/java.management/share/classes/javax/management/timer/Timer.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/timer/Timer.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,7 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
// jmx imports
//
@@ -221,8 +221,7 @@
*/
public void preDeregister() throws java.lang.Exception {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "preDeregister", "stop the timer");
+ TIMER_LOGGER.log(Level.TRACE, "stop the timer");
// Stop the timer.
//
@@ -273,8 +272,7 @@
*/
public synchronized void start() {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "start", "starting the timer");
+ TIMER_LOGGER.log(Level.TRACE, "starting the timer");
// Start the TimerAlarmClock.
//
@@ -323,11 +321,9 @@
//
isActive = true;
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "start", "timer started");
+ TIMER_LOGGER.log(Level.TRACE, "timer started");
} else {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "start", "the timer is already activated");
+ TIMER_LOGGER.log(Level.TRACE, "the timer is already activated");
}
}
@@ -336,8 +332,7 @@
*/
public synchronized void stop() {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "stop", "stopping the timer");
+ TIMER_LOGGER.log(Level.TRACE, "stopping the timer");
// Stop the TimerAlarmClock.
//
@@ -370,11 +365,9 @@
//
isActive = false;
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "stop", "timer stopped");
+ TIMER_LOGGER.log(Level.TRACE, "timer stopped");
} else {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "stop", "the timer is already deactivated");
+ TIMER_LOGGER.log(Level.TRACE, "the timer is already deactivated");
}
}
@@ -444,9 +437,8 @@
if (currentDate.after(date)) {
date.setTime(currentDate.getTime());
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "addNotification",
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
+ TIMER_LOGGER.log(Level.TRACE,
"update timer notification to add with:" +
"\n\tNotification date = " + date);
}
@@ -486,7 +478,7 @@
obj[ALARM_CLOCK_INDEX] = (Object)alarmClock;
obj[FIXED_RATE_INDEX] = Boolean.valueOf(fixedRate);
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
StringBuilder strb = new StringBuilder()
.append("adding timer notification:\n\t")
.append("Notification source = ")
@@ -503,8 +495,7 @@
.append(nbOccurences)
.append("\n\tNotification executes at fixed rate = ")
.append(fixedRate);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "addNotification", strb.toString());
+ TIMER_LOGGER.log(Level.TRACE, strb::toString);
}
timerTable.put(notifID, obj);
@@ -522,8 +513,7 @@
}
}
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "addNotification", "timer notification added");
+ TIMER_LOGGER.log(Level.TRACE, "timer notification added");
return notifID;
}
@@ -677,7 +667,7 @@
// Remove the timer notification from the timer table.
//
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
StringBuilder strb = new StringBuilder()
.append("removing timer notification:")
.append("\n\tNotification source = ")
@@ -694,14 +684,12 @@
.append(obj[TIMER_NB_OCCUR_INDEX])
.append("\n\tNotification executes at fixed rate = ")
.append(obj[FIXED_RATE_INDEX]);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "removeNotification", strb.toString());
+ TIMER_LOGGER.log(Level.TRACE, strb::toString);
}
timerTable.remove(id);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "removeNotification", "timer notification removed");
+ TIMER_LOGGER.log(Level.TRACE, "timer notification removed");
}
/**
@@ -752,19 +740,16 @@
}
// Remove all the timer notifications from the timer table.
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "removeAllNotifications", "removing all timer notifications");
+ TIMER_LOGGER.log(Level.TRACE, "removing all timer notifications");
timerTable.clear();
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "removeAllNotifications", "all timer notifications removed");
+ TIMER_LOGGER.log(Level.TRACE, "all timer notifications removed");
// Reset the counterID.
//
counterID = 0;
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "removeAllNotifications", "timer notification counter ID reset");
+ TIMER_LOGGER.log(Level.TRACE, "timer notification counter ID reset");
}
// GETTERS AND SETTERS
@@ -1021,7 +1006,7 @@
while ( (currentDate.after(date)) && (timerTable.containsKey(notifID)) ) {
if (currentFlag == true) {
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
StringBuilder strb = new StringBuilder()
.append("sending past timer notification:")
.append("\n\tNotification source = ")
@@ -1038,13 +1023,11 @@
.append(obj[TIMER_NB_OCCUR_INDEX])
.append("\n\tNotification executes at fixed rate = ")
.append(obj[FIXED_RATE_INDEX]);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "sendPastNotifications", strb.toString());
+ TIMER_LOGGER.log(Level.TRACE, strb::toString);
}
sendNotification(date, notif);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "sendPastNotifications", "past timer notification sent");
+ TIMER_LOGGER.log(Level.TRACE, "past timer notification sent");
}
// Update the date and the number of occurrences of the timer notification.
@@ -1107,7 +1090,7 @@
timer.schedule(alarmClock, alarmClock.timeout);
}
}
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
TimerNotification notif = (TimerNotification)obj[TIMER_NOTIF_INDEX];
StringBuilder strb = new StringBuilder()
.append("update timer notification with:")
@@ -1125,8 +1108,7 @@
.append(nbOccurences)
.append("\n\tNotification executes at fixed rate = ")
.append(fixedRate);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "updateTimerTable", strb.toString());
+ TIMER_LOGGER.log(Level.TRACE, strb::toString);
}
}
else {
@@ -1211,7 +1193,7 @@
*/
void sendNotification(Date timeStamp, TimerNotification notification) {
- if (TIMER_LOGGER.isLoggable(Level.FINER)) {
+ if (TIMER_LOGGER.isLoggable(Level.TRACE)) {
StringBuilder strb = new StringBuilder()
.append("sending timer notification:")
.append("\n\tNotification source = ")
@@ -1222,8 +1204,7 @@
.append(notification.getNotificationID())
.append("\n\tNotification date = ")
.append(timeStamp);
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "sendNotification", strb.toString());
+ TIMER_LOGGER.log(Level.TRACE, strb::toString);
}
long curSeqNumber;
synchronized(this) {
@@ -1236,7 +1217,6 @@
this.sendNotification((TimerNotification)notification.cloneTimerNotification());
}
- TIMER_LOGGER.logp(Level.FINER, Timer.class.getName(),
- "sendNotification", "timer notification sent");
+ TIMER_LOGGER.log(Level.TRACE, "timer notification sent");
}
}
--- a/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/javax/management/timer/TimerAlarmClock.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
package javax.management.timer;
import java.util.Date;
-import java.util.logging.Level;
+import java.lang.System.Logger.Level;
import static com.sun.jmx.defaults.JmxProperties.TIMER_LOGGER;
/**
@@ -73,7 +73,7 @@
TimerAlarmClockNotification notif = new TimerAlarmClockNotification(this);
listener.notifyAlarmClock(notif);
} catch (Exception e) {
- TIMER_LOGGER.logp(Level.FINEST, Timer.class.getName(), "run",
+ TIMER_LOGGER.log(Level.TRACE,
"Got unexpected exception when sending a notification", e);
}
}
--- a/jdk/src/java.management/share/classes/module-info.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/java.management/share/classes/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@
*/
module java.management {
requires transitive java.rmi;
- requires java.logging;
requires java.naming;
exports java.lang.management;
@@ -55,4 +54,3 @@
provides javax.security.auth.spi.LoginModule
with com.sun.jmx.remote.security.FileLoginModule;
}
-
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java Mon Jan 23 10:27:58 2017 -0800
@@ -73,7 +73,6 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Consumer;
-import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.jar.JarEntry;
@@ -395,25 +394,30 @@
// create jmod with temporary name to avoid it being examined
// when scanning the module path
Path target = options.jmodFile;
- Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp");
+ Path tempTarget = jmodTempFilePath(target);
try {
try (JmodOutputStream jos = JmodOutputStream.newOutputStream(tempTarget)) {
jmod.write(jos);
}
Files.move(tempTarget, target);
} catch (Exception e) {
- if (Files.exists(tempTarget)) {
- try {
- Files.delete(tempTarget);
- } catch (IOException ioe) {
- e.addSuppressed(ioe);
- }
+ try {
+ Files.deleteIfExists(tempTarget);
+ } catch (IOException ioe) {
+ e.addSuppressed(ioe);
}
throw e;
}
return true;
}
+ /*
+ * Create a JMOD .tmp file for the given target JMOD file
+ */
+ private static Path jmodTempFilePath(Path target) throws IOException {
+ return target.resolveSibling("." + target.getFileName() + ".tmp");
+ }
+
private class JmodFileWriter {
final List<Path> cmds = options.cmds;
final List<Path> libs = options.libs;
@@ -908,7 +912,7 @@
throws IOException
{
Path target = moduleToPath(name);
- Path tempTarget = Files.createTempFile(target.getFileName().toString(), ".tmp");
+ Path tempTarget = jmodTempFilePath(target);
try {
if (target.getFileName().toString().endsWith(".jmod")) {
updateJmodFile(target, tempTarget, moduleHashes);
@@ -916,12 +920,10 @@
updateModularJar(target, tempTarget, moduleHashes);
}
} catch (IOException|RuntimeException e) {
- if (Files.exists(tempTarget)) {
- try {
- Files.delete(tempTarget);
- } catch (IOException ioe) {
- e.addSuppressed(ioe);
- }
+ try {
+ Files.deleteIfExists(tempTarget);
+ } catch (IOException ioe) {
+ e.addSuppressed(ioe);
}
throw e;
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTDomainPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -65,9 +65,8 @@
public NTDomainPrincipal(String name) {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
}
@@ -92,9 +91,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTDomainPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTDomainPrincipal.name"));
Object[] source = {name};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTNumericCredential.java Mon Jan 23 10:27:58 2017 -0800
@@ -61,9 +61,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTNumericCredential.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTNumericCredential.name"));
Object[] source = {Long.toString(impersonationToken)};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSid.java Mon Jan 23 10:27:58 2017 -0800
@@ -70,17 +70,15 @@
public NTSid (String stringSid) {
if (stringSid == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"stringSid"};
throw new NullPointerException(form.format(source));
}
if (stringSid.length() == 0) {
throw new IllegalArgumentException
- (sun.security.util.ResourcesMgr.getString
- ("Invalid.NTSid.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("Invalid.NTSid.value"));
}
sid = new String(stringSid);
}
@@ -101,9 +99,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTSid.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTSid.name"));
Object[] source = {sid};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidDomainPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -68,9 +68,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTSidDomainPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTSidDomainPrincipal.name"));
Object[] source = {getName()};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidGroupPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -63,9 +63,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTSidGroupPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTSidGroupPrincipal.name"));
Object[] source = {getName()};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidPrimaryGroupPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -65,9 +65,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTSidPrimaryGroupPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTSidPrimaryGroupPrincipal.name"));
Object[] source = {getName()};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTSidUserPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -62,9 +62,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTSidUserPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTSidUserPrincipal.name"));
Object[] source = {getName()};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/NTUserPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -61,9 +61,8 @@
public NTUserPrincipal(String name) {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
}
@@ -86,9 +85,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("NTUserPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("NTUserPrincipal.name"));
Object[] source = {name};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericGroupPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -26,6 +26,7 @@
package com.sun.security.auth;
import java.security.Principal;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
* This class implements the {@code Principal} interface
@@ -53,9 +54,6 @@
private static final long serialVersionUID = 2345199581042573224L;
- private static final java.util.ResourceBundle rb =
- java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
-
/**
* @serial
*/
@@ -82,7 +80,7 @@
*/
public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) {
if (name == null)
- throw new NullPointerException(rb.getString("provided.null.name"));
+ throw new NullPointerException(getAuthResourceString("provided.null.name"));
this.name = name;
this.primaryGroup = primaryGroup;
@@ -146,11 +144,11 @@
* {@code SolarisNumericGroupPrincipal}.
*/
public String toString() {
- return((primaryGroup ?
- rb.getString
+ return primaryGroup ?
+ getAuthResourceString
("SolarisNumericGroupPrincipal.Primary.Group.") + name :
- rb.getString
- ("SolarisNumericGroupPrincipal.Supplementary.Group.") + name));
+ getAuthResourceString
+ ("SolarisNumericGroupPrincipal.Supplementary.Group.") + name;
}
/**
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisNumericUserPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -26,6 +26,7 @@
package com.sun.security.auth;
import java.security.Principal;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
* This class implements the {@code Principal} interface
@@ -52,9 +53,6 @@
private static final long serialVersionUID = -3178578484679887104L;
- private static final java.util.ResourceBundle rb =
- java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
-
/**
* @serial
*/
@@ -72,7 +70,7 @@
*/
public SolarisNumericUserPrincipal(String name) {
if (name == null)
- throw new NullPointerException(rb.getString("provided.null.name"));
+ throw new NullPointerException(getAuthResourceString("provided.null.name"));
this.name = name;
}
@@ -118,7 +116,7 @@
* {@code SolarisNumericUserPrincipal}.
*/
public String toString() {
- return(rb.getString("SolarisNumericUserPrincipal.") + name);
+ return(getAuthResourceString("SolarisNumericUserPrincipal.") + name);
}
/**
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/SolarisPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -26,6 +26,8 @@
package com.sun.security.auth;
import java.security.Principal;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
+
/**
* This class implements the {@code Principal} interface
@@ -50,10 +52,6 @@
private static final long serialVersionUID = -7840670002439379038L;
- private static final java.util.ResourceBundle rb =
- java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
-
-
/**
* @serial
*/
@@ -69,7 +67,7 @@
*/
public SolarisPrincipal(String name) {
if (name == null)
- throw new NullPointerException(rb.getString("provided.null.name"));
+ throw new NullPointerException(getAuthResourceString("provided.null.name"));
this.name = name;
}
@@ -89,7 +87,7 @@
* @return a string representation of this {@code SolarisPrincipal}.
*/
public String toString() {
- return(rb.getString("SolarisPrincipal.") + name);
+ return(getAuthResourceString("SolarisPrincipal.") + name);
}
/**
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericGroupPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -74,9 +74,8 @@
public UnixNumericGroupPrincipal(String name, boolean primaryGroup) {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
}
@@ -146,16 +145,14 @@
if (primaryGroup) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("UnixNumericGroupPrincipal.Primary.Group.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("UnixNumericGroupPrincipal.Primary.Group.name"));
Object[] source = {name};
return form.format(source);
} else {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("UnixNumericGroupPrincipal.Supplementary.Group.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("UnixNumericGroupPrincipal.Supplementary.Group.name"));
Object[] source = {name};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixNumericUserPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -64,9 +64,8 @@
public UnixNumericUserPrincipal(String name) {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
}
@@ -116,9 +115,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("UnixNumericUserPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("UnixNumericUserPrincipal.name"));
Object[] source = {name};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/UnixPrincipal.java Mon Jan 23 10:27:58 2017 -0800
@@ -61,9 +61,8 @@
public UnixPrincipal(String name) {
if (name == null) {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("invalid.null.input.value",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("invalid.null.input.value"));
Object[] source = {"name"};
throw new NullPointerException(form.format(source));
}
@@ -87,9 +86,8 @@
*/
public String toString() {
java.text.MessageFormat form = new java.text.MessageFormat
- (sun.security.util.ResourcesMgr.getString
- ("UnixPrincipal.name",
- "sun.security.util.AuthResources"));
+ (sun.security.util.ResourcesMgr.getAuthResourceString
+ ("UnixPrincipal.name"));
Object[] source = {name};
return form.format(source);
}
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/X500Principal.java Mon Jan 23 10:27:58 2017 -0800
@@ -27,6 +27,7 @@
import java.security.Principal;
import sun.security.x509.X500Name;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
* This class represents an X.500 {@code Principal}.
@@ -55,9 +56,6 @@
private static final long serialVersionUID = -8222422609431628648L;
- private static final java.util.ResourceBundle rb =
- java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
-
/**
* @serial
*/
@@ -80,7 +78,7 @@
*/
public X500Principal(String name) {
if (name == null)
- throw new NullPointerException(rb.getString("provided.null.name"));
+ throw new NullPointerException(getAuthResourceString("provided.null.name"));
try {
thisX500Name = new X500Name(name);
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/JndiLoginModule.java Mon Jan 23 10:27:58 2017 -0800
@@ -32,15 +32,13 @@
import javax.naming.*;
import javax.naming.directory.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.util.Map;
import java.util.LinkedList;
-import java.util.ResourceBundle;
import com.sun.security.auth.UnixPrincipal;
import com.sun.security.auth.UnixNumericUserPrincipal;
import com.sun.security.auth.UnixNumericGroupPrincipal;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
@@ -153,9 +151,6 @@
*/
public class JndiLoginModule implements LoginModule {
- private static final ResourceBundle rb =
- ResourceBundle.getBundle("sun.security.util.AuthResources");
-
/** JNDI Provider */
public final String USER_PROVIDER = "user.provider.url";
public final String GROUP_PROVIDER = "group.provider.url";
@@ -677,9 +672,9 @@
Callback[] callbacks = new Callback[2];
callbacks[0] = new NameCallback(protocol + " "
- + rb.getString("username."));
+ + getAuthResourceString("username."));
callbacks[1] = new PasswordCallback(protocol + " " +
- rb.getString("password."),
+ getAuthResourceString("password."),
false);
try {
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/KeyStoreLoginModule.java Mon Jan 23 10:27:58 2017 -0800
@@ -51,6 +51,7 @@
import javax.security.auth.spi.LoginModule;
import sun.security.util.Password;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
* Provides a JAAS login module that prompts for a key store alias and
@@ -112,9 +113,6 @@
*/
public class KeyStoreLoginModule implements LoginModule {
- private static final ResourceBundle rb =
- ResourceBundle.getBundle("sun.security.util.AuthResources");
-
/* -- Fields -- */
private static final int UNINITIALIZED = 0;
@@ -132,7 +130,7 @@
private static final TextOutputCallback bannerCallback =
new TextOutputCallback
(TextOutputCallback.INFORMATION,
- rb.getString("Please.enter.keystore.information"));
+ getAuthResourceString("Please.enter.keystore.information"));
private final ConfirmationCallback confirmationCallback =
new ConfirmationCallback
(ConfirmationCallback.INFORMATION,
@@ -344,11 +342,10 @@
NameCallback aliasCallback;
if (keyStoreAlias == null || keyStoreAlias.length() == 0) {
- aliasCallback = new NameCallback(
- rb.getString("Keystore.alias."));
+ aliasCallback = new NameCallback(getAuthResourceString("Keystore.alias."));
} else {
aliasCallback =
- new NameCallback(rb.getString("Keystore.alias."),
+ new NameCallback(getAuthResourceString("Keystore.alias."),
keyStoreAlias);
}
@@ -360,11 +357,11 @@
break;
case NORMAL:
keyPassCallback = new PasswordCallback
- (rb.getString("Private.key.password.optional."), false);
+ (getAuthResourceString("Private.key.password.optional."), false);
// fall thru
case TOKEN:
storePassCallback = new PasswordCallback
- (rb.getString("Keystore.password."), false);
+ (getAuthResourceString("Keystore.password."), false);
break;
}
prompt(aliasCallback, storePassCallback, keyPassCallback);
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/Krb5LoginModule.java Mon Jan 23 10:27:58 2017 -0800
@@ -27,8 +27,6 @@
package com.sun.security.auth.module;
import java.io.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
import java.text.MessageFormat;
import java.util.*;
@@ -45,6 +43,7 @@
import sun.security.jgss.krb5.Krb5Util;
import sun.security.krb5.Credentials;
import sun.security.util.HexDumpEncoder;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
* This {@code LoginModule} authenticates users using
@@ -419,8 +418,6 @@
private static final String NAME = "javax.security.auth.login.name";
private static final String PWD = "javax.security.auth.login.password";
- private static final ResourceBundle rb =
- ResourceBundle.getBundle("sun.security.util.AuthResources");
/**
* Initialize this {@code LoginModule}.
@@ -831,7 +828,7 @@
Callback[] callbacks = new Callback[1];
MessageFormat form = new MessageFormat(
- rb.getString(
+ getAuthResourceString(
"Kerberos.username.defUsername."));
Object[] source = {defUsername};
callbacks[0] = new NameCallback(form.format(source));
@@ -886,7 +883,7 @@
Callback[] callbacks = new Callback[1];
String userName = krb5PrincName.toString();
MessageFormat form = new MessageFormat(
- rb.getString(
+ getAuthResourceString(
"Kerberos.password.for.username."));
Object[] source = {userName};
callbacks[0] = new PasswordCallback(
--- a/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/com/sun/security/auth/module/LdapLoginModule.java Mon Jan 23 10:27:58 2017 -0800
@@ -25,14 +25,11 @@
package com.sun.security.auth.module;
-import java.security.AccessController;
import java.net.SocketPermission;
import java.security.Principal;
-import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Map;
-import java.util.ResourceBundle;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Set;
@@ -47,6 +44,7 @@
import com.sun.security.auth.LdapPrincipal;
import com.sun.security.auth.UserPrincipal;
+import static sun.security.util.ResourcesMgr.getAuthResourceString;
/**
@@ -305,10 +303,6 @@
*/
public class LdapLoginModule implements LoginModule {
- // Use the default classloader for this class to load the prompt strings.
- private static final ResourceBundle rb =
- ResourceBundle.getBundle("sun.security.util.AuthResources");
-
// Keys to retrieve the stored username and password
private static final String USERNAME_KEY = "javax.security.auth.login.name";
private static final String PASSWORD_KEY =
@@ -957,8 +951,8 @@
"to acquire authentication information from the user");
Callback[] callbacks = new Callback[2];
- callbacks[0] = new NameCallback(rb.getString("username."));
- callbacks[1] = new PasswordCallback(rb.getString("password."), false);
+ callbacks[0] = new NameCallback(getAuthResourceString("username."));
+ callbacks[1] = new PasswordCallback(getAuthResourceString("password."), false);
try {
callbackHandler.handle(callbacks);
--- a/jdk/src/jdk.security.auth/share/classes/module-info.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/src/jdk.security.auth/share/classes/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -36,8 +36,6 @@
exports com.sun.security.auth.login;
exports com.sun.security.auth.module;
- uses sun.security.util.AuthResourcesProvider;
-
provides javax.security.auth.spi.LoginModule with
com.sun.security.auth.module.Krb5LoginModule,
com.sun.security.auth.module.UnixLoginModule,
--- a/jdk/src/linux/doc/man/ja/jvisualvm.1 Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-'\" t
-.\"
-.\" 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.
-.\"
-.\" Title: jvisualvm
-.\" Language: Japanese
-.\" Date: 2013ǯ11·î21Æü
-.\" SectDesc: Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó¥°¤ª¤è¤Ó´ÉÍý¥Ä¡¼¥ë
-.\" Software: JDK 8
-.\" Arch: ÈÆÍÑ
-.\" Part Number: E58103-01
-.\" Doc ID: JSSON
-.\"
-.if n .pl 99999
-.TH "jvisualvm" "1" "2013ǯ11·î21Æü" "JDK 8" "Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "̾Á°"
-jvisualvm \- Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò»ë³ÐŪ¤Ë¥â¥Ë¥¿¡¼¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥È¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ë¤·¤Þ¤¹¡£
-.SH "³µÍ×"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjvisualvm\fR [ \fIoptions\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIoptions\fR
-.RS 4
-¥³¥Þ¥ó¥É¹Ô¥ª¥×¥·¥ç¥ó¡£¥ª¥×¥·¥ç¥ó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
-.RE
-.SH "ÀâÌÀ"
-.PP
-Java VisualVM¤Ï¡¢»ØÄꤵ¤ì¤¿Java Virtual Machine (JVM)¤ÇJava¥Æ¥¯¥Î¥í¥¸¡¦¥Ù¡¼¥¹¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó(Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó)¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¤È¤¤Ë¡¢¤½¤ÎJava¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ë¾ÜºÙ¤Ê¾ðÊó¤òÄ󶡤¹¤ëľ´¶Åª¤Ê¥°¥é¥Õ¥£¥«¥ë¡¦¥æ¡¼¥¶¡¼¡¦¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£Java VisualVM¤È¤¤¤¦Ì¾Á°¤Ï¡¢Java VisualVM¤¬JVM¥½¥Õ¥È¥¦¥§¥¢¤Ë´Ø¤¹¤ë¾ðÊó¤ò»ë³ÐŪ¤ËÄ󶡤¹¤ë¤È¤¤¤¦»ö¼Â¤ËͳÍ褷¤Æ¤¤¤Þ¤¹¡£
-.PP
-Java VisualVM¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¥â¥Ë¥¿¥ê¥ó¥°¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò1¤Ä¤Î¥Ä¡¼¥ë¤ËÅý¹ç¤·¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¥¹¥¿¥ó¥É¥¢¥í¥ó¡¦¥Ä¡¼¥ë\fBjmap\fR¡¢\fBjinfo\fR¡¢\fBjstat\fR¤ª¤è¤Ó\fBjstack\fR¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ëµ¡Ç½¤Î¤Û¤È¤ó¤É¤¬¡¢Java VisualVM¤ËÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£\fBjconsole\fR¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤ÆÄ󶡤µ¤ì¤ë°ìÉô¤Îµ¡Ç½¤Ê¤É¡¢Â¾¤Îµ¡Ç½¤Ï¥ª¥×¥·¥ç¥ó¤Î¥×¥é¥°¥¤¥ó¤È¤·¤ÆÄɲäǤ¤Þ¤¹¡£
-.PP
-Java VisualVM¤Ï¡¢Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¼Ô¤¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ò¹Ô¤Ã¤¿¤ê¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ò¥â¥Ë¥¿¡¼¤ª¤è¤Ó²þÁ±¤·¤¿¤ê¤¹¤ë¤Î¤ËÌòΩ¤Á¤Þ¤¹¡£Java VisualVM¤ò»ÈÍѤ¹¤ë¤È¡¢³«È¯¼Ô¤Ï¥Ò¡¼¥×¡¦¥À¥ó¥×¤ÎÀ¸À®¤ª¤è¤Ó²òÀÏ¡¢¥á¥â¥ê¡¼¡¦¥ê¡¼¥¯¤ÎÆÃÄê¡¢¥¬¥Ù¡¼¥¸¡¦¥³¥ì¥¯¥·¥ç¥ó¤Î¼Â¹Ô¤ª¤è¤Ó¥â¥Ë¥¿¡¼¡¢¤ª¤è¤Ó¥á¥â¥ê¡¼¤ÈCPU¤Î´Ê°×¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Î¼Â¹Ô¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£¥×¥é¥°¥¤¥ó¤ÇJava VisualVM¤Îµ¡Ç½¤ò³ÈÄ¥¤Ç¤¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢\fBjconsole\fR¥³¥Þ¥ó¥É¤Î¤Û¤È¤ó¤É¤Îµ¡Ç½¤Ï¡¢¡ÖMBean¡×¥¿¥Ö¤ª¤è¤ÓJConsole Plug\-in Wrapper¥×¥é¥°¥¤¥ó¤ò²ð¤·¤Æ»ÈÍѤǤ¤Þ¤¹¡£É¸½à¤ÎJava VisualVM¥×¥é¥°¥¤¥ó¤Î¥«¥¿¥í¥°¤«¤éÁªÂò¤¹¤ë¤Ë¤Ï¡¢Java VisualVM¥á¥Ë¥å¡¼¤Î\fB¡Ö¥Ä¡¼¥ë¡×\fR¡¢\fB¡Ö¥×¥é¥°¥¤¥ó¡×\fR¤òÁªÂò¤·¤Þ¤¹¡£
-.PP
-Java VisualVM¤òµ¯Æ°¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Þ¤¹¡£
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB% jvisualvm <options>\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.SH "¥ª¥×¥·¥ç¥ó"
-.PP
-¼¡¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢Java VisualVM¤òµ¯Æ°¤·¤¿¤È¤¤Ë¼Â¹Ô²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
-.PP
-\-J\fIjvm_option\fR
-.RS 4
-¤³¤Î\fBjvm_option\fR¤òJVM¥½¥Õ¥È¥¦¥§¥¢¤ËÅϤ·¤Þ¤¹¡£
-.RE
-.SH "´ØÏ¢¹àÌÜ"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Java VisualVM³«È¯¼Ô¤Î¥µ¥¤¥È
-http://visualvm\&.java\&.net/
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Java SE¥É¥¥å¥á¥ó¥È¤ÎJava VisualVM
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/visualvm/index\&.html)
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/src/linux/doc/man/jvisualvm.1 Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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.
-."
-." 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.
-."
-.TH jvisualvm 1 "10 May 2011"
-
-.LP
-.SH "Name"
-\f2jvisualvm\fP \- Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool
-.LP
-.SH "SYNOPSIS"
-.LP
-.nf
-\f3
-.fl
- \fP\f3jvisualvm\fP [ \f2options\fP ]
-.fl
-.fi
-
-.LP
-.SH "PARAMETERS"
-.LP
-.LP
-Options, if used, should follow immediately after the command name. Options may be in any order. For a discussion of parameters that apply to a specific option, see OPTIONS below.
-.LP
-.SH "DESCRIPTION"
-.LP
-.LP
-Java VisualVM is an intuitive graphical user interface that provides detailed information about Java technology\-based applications (Java applications) while they are running on a given Java Virtual Machine (JVM(*)). The name Java VisualVM comes from the fact that Java VisualVM provides information about the JVM software \f2visually\fP.
-.LP
-.LP
-Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the functionality offered by the standalone tools \f2jmap\fP, \f2jinfo\fP, \f2jstat\fP and \f2jstack\fP have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug\-ins.
-.LP
-.SH "OPTIONS"
-.LP
-.LP
-The following option is possible when you launch Java VisualVM.
-.LP
-.RS 3
-.TP 3
-\-J<jvm_option>\
-Pass this \f2<jvm_option>\fP to the JVM software.
-.RE
-
-.LP
-.SH "USAGE"
-.LP
-.LP
-Java VisualVM is useful to Java application developers to troubleshoot applications and to monitor and improve the applications' performance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, perform and monitor garbage collection, and perform lightweight memory and CPU profiling. Plug\-ins also exist that expand the functionality of Java VisualVM. For example, most of the functionality of the JConsole tool is available via the MBeans Tab and JConsole Plug\-in Wrapper plug\-ins. You can choose from a catalog of standard Java VisualVM plug\-ins by selecting 'Tools' | 'Plugins' in the Java VisualVM menus.
-.LP
-.LP
-Start Java VisualVM with the following command:
-.LP
-.nf
-\f3
-.fl
-% jvisualvm \fP\f4<options>\fP\f3
-.fl
-\fP
-.fi
-
-.LP
-.SH "SEE ALSO"
-.LP
-.LP
-For more details about Java VisualVM see the following pages.
-.LP
-.RS 3
-.TP 2
-o
-.na
-\f2Java VisualVM developers' site\fP @
-.fi
-http://visualvm.java.net
-.TP 2
-o
-.na
-\f2Java VisualVM in Java SE platform documentation\fP @
-.fi
-http://download.oracle.com/javase/7/docs/technotes/guides/visualvm/index.html
-.RE
-
-.LP
-.LP
-\f2(* The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.)\fP
-.LP
-
--- a/jdk/src/solaris/doc/sun/man/man1/ja/jvisualvm.1 Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-'\" t
-.\"
-.\" 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.
-.\"
-.\" Title: jvisualvm
-.\" Language: Japanese
-.\" Date: 2013ǯ11·î21Æü
-.\" SectDesc: Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó¥°¤ª¤è¤Ó´ÉÍý¥Ä¡¼¥ë
-.\" Software: JDK 8
-.\" Arch: ÈÆÍÑ
-.\" Part Number: E58103-01
-.\" Doc ID: JSSON
-.\"
-.if n .pl 99999
-.TH "jvisualvm" "1" "2013ǯ11·î21Æü" "JDK 8" "Java¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¡¢¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¢¥â¥Ë¥¿¥ê¥ó"
-.\" -----------------------------------------------------------------
-.\" * Define some portability stuff
-.\" -----------------------------------------------------------------
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.\" http://bugs.debian.org/507673
-.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
-.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "̾Á°"
-jvisualvm \- Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤ò»ë³ÐŪ¤Ë¥â¥Ë¥¿¡¼¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥È¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ë¤·¤Þ¤¹¡£
-.SH "³µÍ×"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fBjvisualvm\fR [ \fIoptions\fR ]
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-\fIoptions\fR
-.RS 4
-¥³¥Þ¥ó¥É¹Ô¥ª¥×¥·¥ç¥ó¡£¥ª¥×¥·¥ç¥ó¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
-.RE
-.SH "ÀâÌÀ"
-.PP
-Java VisualVM¤Ï¡¢»ØÄꤵ¤ì¤¿Java Virtual Machine (JVM)¤ÇJava¥Æ¥¯¥Î¥í¥¸¡¦¥Ù¡¼¥¹¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó(Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó)¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤ë¤È¤¤Ë¡¢¤½¤ÎJava¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ë´Ø¤¹¤ë¾ÜºÙ¤Ê¾ðÊó¤òÄ󶡤¹¤ëľ´¶Åª¤Ê¥°¥é¥Õ¥£¥«¥ë¡¦¥æ¡¼¥¶¡¼¡¦¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ç¤¹¡£Java VisualVM¤È¤¤¤¦Ì¾Á°¤Ï¡¢Java VisualVM¤¬JVM¥½¥Õ¥È¥¦¥§¥¢¤Ë´Ø¤¹¤ë¾ðÊó¤ò»ë³ÐŪ¤ËÄ󶡤¹¤ë¤È¤¤¤¦»ö¼Â¤ËͳÍ褷¤Æ¤¤¤Þ¤¹¡£
-.PP
-Java VisualVM¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¥â¥Ë¥¿¥ê¥ó¥°¡¢¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ª¤è¤Ó¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¡¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£¤ò1¤Ä¤Î¥Ä¡¼¥ë¤ËÅý¹ç¤·¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢¥¹¥¿¥ó¥É¥¢¥í¥ó¡¦¥Ä¡¼¥ë\fBjmap\fR¡¢\fBjinfo\fR¡¢\fBjstat\fR¤ª¤è¤Ó\fBjstack\fR¤ÇÄ󶡤µ¤ì¤Æ¤¤¤ëµ¡Ç½¤Î¤Û¤È¤ó¤É¤¬¡¢Java VisualVM¤ËÁȤ߹þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£\fBjconsole\fR¥³¥Þ¥ó¥É¤Ë¤è¤Ã¤ÆÄ󶡤µ¤ì¤ë°ìÉô¤Îµ¡Ç½¤Ê¤É¡¢Â¾¤Îµ¡Ç½¤Ï¥ª¥×¥·¥ç¥ó¤Î¥×¥é¥°¥¤¥ó¤È¤·¤ÆÄɲäǤ¤Þ¤¹¡£
-.PP
-Java VisualVM¤Ï¡¢Java¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î³«È¯¼Ô¤¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥È¥é¥Ö¥ë¥·¥å¡¼¥Æ¥£¥ó¥°¤ò¹Ô¤Ã¤¿¤ê¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Î¥Ñ¥Õ¥©¡¼¥Þ¥ó¥¹¤ò¥â¥Ë¥¿¡¼¤ª¤è¤Ó²þÁ±¤·¤¿¤ê¤¹¤ë¤Î¤ËÌòΩ¤Á¤Þ¤¹¡£Java VisualVM¤ò»ÈÍѤ¹¤ë¤È¡¢³«È¯¼Ô¤Ï¥Ò¡¼¥×¡¦¥À¥ó¥×¤ÎÀ¸À®¤ª¤è¤Ó²òÀÏ¡¢¥á¥â¥ê¡¼¡¦¥ê¡¼¥¯¤ÎÆÃÄê¡¢¥¬¥Ù¡¼¥¸¡¦¥³¥ì¥¯¥·¥ç¥ó¤Î¼Â¹Ô¤ª¤è¤Ó¥â¥Ë¥¿¡¼¡¢¤ª¤è¤Ó¥á¥â¥ê¡¼¤ÈCPU¤Î´Ê°×¥×¥í¥Õ¥¡¥¤¥ê¥ó¥°¤Î¼Â¹Ô¤¬²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£¥×¥é¥°¥¤¥ó¤ÇJava VisualVM¤Îµ¡Ç½¤ò³ÈÄ¥¤Ç¤¤Þ¤¹¡£¤¿¤È¤¨¤Ð¡¢\fBjconsole\fR¥³¥Þ¥ó¥É¤Î¤Û¤È¤ó¤É¤Îµ¡Ç½¤Ï¡¢¡ÖMBean¡×¥¿¥Ö¤ª¤è¤ÓJConsole Plug\-in Wrapper¥×¥é¥°¥¤¥ó¤ò²ð¤·¤Æ»ÈÍѤǤ¤Þ¤¹¡£É¸½à¤ÎJava VisualVM¥×¥é¥°¥¤¥ó¤Î¥«¥¿¥í¥°¤«¤éÁªÂò¤¹¤ë¤Ë¤Ï¡¢Java VisualVM¥á¥Ë¥å¡¼¤Î\fB¡Ö¥Ä¡¼¥ë¡×\fR¡¢\fB¡Ö¥×¥é¥°¥¤¥ó¡×\fR¤òÁªÂò¤·¤Þ¤¹¡£
-.PP
-Java VisualVM¤òµ¯Æ°¤¹¤ë¤Ë¤Ï¡¢¼¡¤Î¥³¥Þ¥ó¥É¤ò¼Â¹Ô¤·¤Þ¤¹¡£
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-\fB% jvisualvm <options>\fR
-
-.fi
-.if n \{\
-.RE
-.\}
-.SH "¥ª¥×¥·¥ç¥ó"
-.PP
-¼¡¤Î¥ª¥×¥·¥ç¥ó¤Ï¡¢Java VisualVM¤òµ¯Æ°¤·¤¿¤È¤¤Ë¼Â¹Ô²Äǽ¤Ë¤Ê¤ê¤Þ¤¹¡£
-.PP
-\-J\fIjvm_option\fR
-.RS 4
-¤³¤Î\fBjvm_option\fR¤òJVM¥½¥Õ¥È¥¦¥§¥¢¤ËÅϤ·¤Þ¤¹¡£
-.RE
-.SH "´ØÏ¢¹àÌÜ"
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Java VisualVM³«È¯¼Ô¤Î¥µ¥¤¥È
-http://visualvm\&.java\&.net/
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-Java SE¥É¥¥å¥á¥ó¥È¤ÎJava VisualVM
-(http://docs\&.oracle\&.com/javase/8/docs/technotes/guides/visualvm/index\&.html)
-.RE
-.br
-'pl 8.5i
-'bp
--- a/jdk/src/solaris/doc/sun/man/man1/jvisualvm.1 Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +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.
-."
-." 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.
-."
-.TH jvisualvm 1 "10 May 2011"
-
-.LP
-.SH "Name"
-\f2jvisualvm\fP \- Java Virtual Machine Monitoring, Troubleshooting, and Profiling Tool
-.LP
-.SH "SYNOPSIS"
-.LP
-.nf
-\f3
-.fl
- \fP\f3jvisualvm\fP [ \f2options\fP ]
-.fl
-.fi
-
-.LP
-.SH "PARAMETERS"
-.LP
-.LP
-Options, if used, should follow immediately after the command name. Options may be in any order. For a discussion of parameters that apply to a specific option, see OPTIONS below.
-.LP
-.SH "DESCRIPTION"
-.LP
-.LP
-Java VisualVM is an intuitive graphical user interface that provides detailed information about Java technology\-based applications (Java applications) while they are running on a given Java Virtual Machine (JVM(*)). The name Java VisualVM comes from the fact that Java VisualVM provides information about the JVM software \f2visually\fP.
-.LP
-.LP
-Java VisualVM combines several monitoring, troubleshooting, and profiling utilities into a single tool. For example, most of the functionality offered by the standalone tools \f2jmap\fP, \f2jinfo\fP, \f2jstat\fP and \f2jstack\fP have been integrated into Java VisualVM. Other functionalities, such as some of those offered by the JConsole tool, can be added as optional plug\-ins.
-.LP
-.SH "OPTIONS"
-.LP
-.LP
-The following option is possible when you launch Java VisualVM.
-.LP
-.RS 3
-.TP 3
-\-J<jvm_option>\
-Pass this \f2<jvm_option>\fP to the JVM software.
-.RE
-
-.LP
-.SH "USAGE"
-.LP
-.LP
-Java VisualVM is useful to Java application developers to troubleshoot applications and to monitor and improve the applications' performance. Java VisualVM can allow developers to generate and analyse heap dumps, track down memory leaks, perform and monitor garbage collection, and perform lightweight memory and CPU profiling. Plug\-ins also exist that expand the functionality of Java VisualVM. For example, most of the functionality of the JConsole tool is available via the MBeans Tab and JConsole Plug\-in Wrapper plug\-ins. You can choose from a catalog of standard Java VisualVM plug\-ins by selecting 'Tools' | 'Plugins' in the Java VisualVM menus.
-.LP
-.LP
-Start Java VisualVM with the following command:
-.LP
-.nf
-\f3
-.fl
-% jvisualvm \fP\f4<options>\fP\f3
-.fl
-\fP
-.fi
-
-.LP
-.SH "SEE ALSO"
-.LP
-.LP
-For more details about Java VisualVM see the following pages.
-.LP
-.RS 3
-.TP 2
-o
-.na
-\f2Java VisualVM developers' site\fP @
-.fi
-http://visualvm.java.net
-.TP 2
-o
-.na
-\f2Java VisualVM in Java SE platform documentation\fP @
-.fi
-http://download.oracle.com/javase/7/docs/technotes/guides/visualvm/index.html
-.RE
-
-.LP
-.LP
-\f2(* The terms "Java Virtual Machine" and "JVM" mean a Virtual Machine for the Java platform.)\fP
-.LP
-
--- a/jdk/test/ProblemList.txt Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/ProblemList.txt Mon Jan 23 10:27:58 2017 -0800
@@ -199,6 +199,8 @@
java/rmi/activation/Activatable/extLoadedImpl/ext.sh 8062724 generic-all
+java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java 8169569 windows-all
+
sun/rmi/rmic/newrmic/equivalence/run.sh 8145980 generic-all
############################################################################
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java Mon Jan 23 10:27:58 2017 -0800
@@ -137,8 +137,7 @@
// java.desktop module loaded by boot loader and has an openQual pkg
// that is exported
new Test("java.desktop", "java.applet", null, "sun.applet",
- "sun.awt", "com.sun.java.swing.plaf.windows",
- "javax.swing.plaf.basic"),
+ "sun.awt", null, "javax.swing.plaf.basic"),
// java.security.jgss module loaded by platform loader
new Test("java.security.jgss", "org.ietf.jgss", null,
"sun.security.krb5.internal.crypto", "sun.security.krb5",
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/LoggingTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+public class LoggingTest {
+
+ static class TestStream extends PrintStream {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ private volatile boolean recording;
+ public TestStream(PrintStream wrapped) {
+ super(wrapped);
+ }
+
+ void startRecording() {
+ recording = true;
+ }
+
+ void stopRecording() {
+ recording = false;
+ }
+
+ @Override
+ public void write(int b) {
+ if (recording) {
+ bos.write(b);
+ }
+ super.write(b);
+ }
+
+ @Override
+ public void write(byte[] buf, int off, int len) {
+ if (recording) {
+ bos.write(buf, off, len);
+ }
+ super.write(buf, off, len);
+ }
+
+ @Override
+ public void write(byte[] buf) throws IOException {
+ if (recording) {
+ bos.write(buf);
+ }
+ super.write(buf);
+ }
+
+ }
+
+ public void run(TestStream ts) {
+
+ // start recording traces and trigger creation of the platform
+ // MBeanServer to produce some. This won't work if the platform
+ // MBeanServer was already initialized - so it's important to
+ // run this test in its own JVM.
+ ts.startRecording();
+ MBeanServer platform = ManagementFactory.getPlatformMBeanServer();
+ ts.stopRecording();
+ String printed = ts.bos.toString();
+ ts.bos.reset();
+
+ // Check that the Platform MBeanServer is emitting the expected
+ // log traces. This can be a bit fragile because debug traces
+ // could be changed without notice - in which case this test will
+ // need to be updated.
+ // For each registered MBean we expect to see three traces.
+ // If the messages logged by the MBeanServer change then these checks
+ // may need to be revisited.
+ List<String> checkTraces =
+ List.of("ObjectName = %s", "name = %s", "JMX.mbean.registered %s");
+
+ for (ObjectName o : platform.queryNames(ObjectName.WILDCARD, null)) {
+ String n = o.toString();
+ System.out.println("Checking log for: " + n);
+ for (String check : checkTraces) {
+ String s = String.format(check, n);
+ if (!printed.contains(s)) {
+ throw new RuntimeException("Trace not found: " + s);
+ }
+ }
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/LoggingWithJULTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.nio.file.Paths;
+
+/**
+ * @test
+ * @bug 8172971
+ * @modules java.management java.logging
+ * @summary Smoke test to check that logging in java.management works as expected.
+ * @build LoggingTest LoggingWithJULTest
+ * @run main/othervm LoggingWithJULTest
+ * @author danielfuchs
+ */
+public class LoggingWithJULTest {
+
+ public static void main(String[] args) {
+ // Replace System.err
+ LoggingTest.TestStream ts = new LoggingTest.TestStream(System.err);
+ System.setErr(ts);
+
+ // activate the javax.management traces
+ String properties = Paths.get(System.getProperty("test.src", "src"),
+ "logging.properties").toString();
+ System.setProperty("java.util.logging.config.file", properties);
+
+ // run the test
+ new LoggingTest().run(ts);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/LoggingWithLoggerFinderTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8172971
+ * @modules java.management
+ * @summary Smoke test to check that logging in java.management is performed
+ * through System.Logger. This test installs a LoggerFinder service
+ * provider and verifies that it gets the traces.
+ * @build test.loggerfinder/test.loggerfinder.TestLoggerFinder LoggingTest LoggingWithLoggerFinderTest
+ * @run main/othervm --add-modules test.loggerfinder LoggingWithLoggerFinderTest
+ * @author danielfuchs
+ */
+public class LoggingWithLoggerFinderTest {
+
+ public static void main(String[] args) {
+ // Replace System.err
+ LoggingTest.TestStream ts = new LoggingTest.TestStream(System.err);
+ System.setErr(ts);
+
+ // run the test
+ new LoggingTest().run(ts);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/logging.properties Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,55 @@
+############################################################
+# Global properties
+############################################################
+
+# "handlers" specifies a comma separated list of log Handler
+# classes. These handlers will be installed during VM startup.
+# Note that these classes must be on the system classpath.
+# By default we only configure a ConsoleHandler, which will only
+# show messages at the INFO and above levels.
+handlers= java.util.logging.ConsoleHandler
+
+# To also add the FileHandler, use the following line instead.
+#handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler
+
+# Default global logging level.
+# This specifies which kinds of events are logged across
+# all loggers. For any given facility this global level
+# can be overriden by a facility specific level
+# Note that the ConsoleHandler also has a separate level
+# setting to limit messages printed to the console.
+.level= INFO
+
+############################################################
+# Handler specific properties.
+# Describes specific configuration info for Handlers.
+############################################################
+
+# default file output is in user's home directory.
+java.util.logging.FileHandler.pattern = %h/java%u.log
+java.util.logging.FileHandler.limit = 50000
+java.util.logging.FileHandler.count = 1
+# Default number of locks FileHandler can obtain synchronously.
+# This specifies maximum number of attempts to obtain lock file by FileHandler
+# implemented by incrementing the unique field %u as per FileHandler API documentation.
+java.util.logging.FileHandler.maxLocks = 100
+java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
+
+# Limit the message that are printed on the console to INFO and above.
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+
+# Example to customize the SimpleFormatter output format
+# to print one-line log message like this:
+# <level>: <log message> [<date/time>]
+#
+# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1$tc]%n
+
+############################################################
+# Facility specific properties.
+# Provides extra control for each logger.
+############################################################
+
+# For example, set the com.xyz.foo logger to only log SEVERE
+# messages:
+javax.management.level = ALL
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+module test.loggerfinder {
+ // Install a LoggerFinder that will direct traces directly to System.err,
+ // without involving java.util.logging
+ provides java.lang.System.LoggerFinder with test.loggerfinder.TestLoggerFinder;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/management/LoggingTest/test.loggerfinder/test/loggerfinder/TestLoggerFinder.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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 test.loggerfinder;
+
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.lang.System.LoggerFinder;
+import java.lang.reflect.Module;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Optional;
+import java.util.ResourceBundle;
+import java.util.function.Predicate;
+import java.lang.StackWalker.StackFrame;
+import java.text.MessageFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * A LoggerFinder that provides System.Logger which print directly
+ * on System.err, without involving java.logging.
+ * For the purpose of the test, loggers whose name start with java.management.
+ * will log all messages, and other loggers will only log level > INFO.
+ * @author danielfuchs
+ */
+public class TestLoggerFinder extends LoggerFinder {
+
+ static class TestLogger implements Logger {
+
+ final String name;
+
+ public TestLogger(String name) {
+ this.name = name;
+ }
+
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean isLoggable(Level level) {
+ return name.equals("javax.management")
+ || name.startsWith("javax.management.")
+ || level.getSeverity() >= Level.INFO.getSeverity();
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String msg, Throwable thrown) {
+ if (!isLoggable(level)) return;
+ publish(level, bundle, msg, thrown);
+ }
+
+ @Override
+ public void log(Level level, ResourceBundle bundle, String format, Object... params) {
+ if (!isLoggable(level)) return;
+ publish(level, bundle, format, params);
+ }
+
+ static void publish(Level level, ResourceBundle bundle, String msg, Throwable thrown) {
+ StackFrame sf = new CallerFinder().get().get();
+
+ if (bundle != null && msg != null) {
+ msg = bundle.getString(msg);
+ }
+ if (msg == null) msg = "";
+ LocalDateTime ldt = LocalDateTime.now();
+ String date = DateTimeFormatter.ISO_DATE_TIME.format(ldt);
+ System.err.println(date + " "
+ + sf.getClassName() + " " + sf.getMethodName() + "\n"
+ + String.valueOf(level) + ": " + msg);
+ thrown.printStackTrace(System.err);
+ }
+
+ static void publish(Level level, ResourceBundle bundle, String format, Object... params) {
+ StackFrame sf = new CallerFinder().get().get();
+ if (bundle != null && format != null) {
+ format = bundle.getString(format);
+ }
+ String msg = format(format, params);
+ LocalDateTime ldt = LocalDateTime.now();
+ String date = DateTimeFormatter.ISO_DATE_TIME.format(ldt);
+ System.err.println(date + " "
+ + sf.getClassName() + " " + sf.getMethodName() + "\n"
+ + String.valueOf(level) + ": " + msg);
+ }
+
+ static String format(String format, Object... args) {
+ if (format == null) return "";
+ int index = 0, len = format.length();
+ while ((index = format.indexOf(index, '{')) >= 0) {
+ if (index >= len - 2) break;
+ char c = format.charAt(index+1);
+ if (c >= '0' && c <= '9') {
+ return MessageFormat.format(format, args);
+ }
+ index++;
+ }
+ return format;
+ }
+
+ }
+
+ /*
+ * CallerFinder is a stateful predicate.
+ */
+ static final class CallerFinder implements Predicate<StackWalker.StackFrame> {
+ private static final StackWalker WALKER;
+ static {
+ PrivilegedAction<StackWalker> pa =
+ () -> StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
+ WALKER = AccessController.doPrivileged(pa);
+ }
+
+ /**
+ * Returns StackFrame of the caller's frame.
+ * @return StackFrame of the caller's frame.
+ */
+ Optional<StackWalker.StackFrame> get() {
+ return WALKER.walk((s) -> s.filter(this).findFirst());
+ }
+
+ private boolean lookingForLogger = true;
+ /**
+ * Returns true if we have found the caller's frame, false if the frame
+ * must be skipped.
+ *
+ * @param t The frame info.
+ * @return true if we have found the caller's frame, false if the frame
+ * must be skipped.
+ */
+ @Override
+ public boolean test(StackWalker.StackFrame s) {
+ // We should skip all frames until we have found the logger,
+ // because these frames could be frames introduced by e.g. custom
+ // sub classes of Handler.
+ Class<?> c = s.getDeclaringClass();
+ boolean isLogger = System.Logger.class.isAssignableFrom(c);
+ if (lookingForLogger) {
+ // Skip all frames until we have found the first logger frame.
+ lookingForLogger = c != TestLogger.class;
+ return false;
+ }
+ // Continue walking until we've found the relevant calling frame.
+ // Skips logging/logger infrastructure.
+ return !isLogger;
+ }
+ }
+
+ @Override
+ public Logger getLogger(String name, Module module) {
+ return new TestLogger(name);
+ }
+
+}
--- a/jdk/test/sun/security/provider/PolicyFile/TokenStore.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/sun/security/provider/PolicyFile/TokenStore.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -250,10 +250,9 @@
Enumeration perms = p.getPermissions(pd).elements();
while (perms.hasMoreElements()) {
Permission perm = (Permission)perms.nextElement();
- if (!(perm instanceof AllPermission)) {
- throw new SecurityException("expected AllPermission");
- } else {
+ if (perm instanceof AllPermission) {
foundIt = true;
+ break;
}
}
if (!foundIt) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/keytool/ImportPrompt.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+
+import java.io.File;
+import java.security.KeyStore;
+
+/**
+ * @test
+ * @bug 8172975
+ * @summary SecurityTools.keytool() needs to accept user input
+ * @library /test/lib
+ */
+
+public class ImportPrompt {
+
+ private static final String COMMON =
+ "-storetype jks -storepass changeit -keypass changeit -debug";
+
+ public static void main(String[] args) throws Throwable {
+
+ kt("-keystore ks1 -genkeypair -alias a -dname CN=A");
+ kt("-keystore ks1 -exportcert -alias a -file a.cert");
+
+ // Just create a keystore
+ kt("-keystore ks2 -genkeypair -alias b -dname CN=B");
+
+ // no response text, assume no
+ kt("-keystore ks2 -importcert -alias a -file a.cert");
+ Asserts.assertFalse(hasA());
+
+ // no reply is no
+ SecurityTools.setResponse("no");
+ kt("-keystore ks2 -importcert -alias a -file a.cert");
+ Asserts.assertFalse(hasA());
+
+ // explicit yes
+ SecurityTools.setResponse("yes");
+ kt("-keystore ks2 -importcert -alias a -file a.cert");
+ Asserts.assertTrue(hasA());
+
+ // remove it
+ kt("-keystore ks2 -delete -alias a");
+ Asserts.assertFalse(hasA());
+
+ // the previous "yes" will not be remembered
+ kt("-keystore ks2 -importcert -alias a -file a.cert");
+ Asserts.assertFalse(hasA());
+
+ // add with -noprompt
+ SecurityTools.setResponse("");
+ kt("-keystore ks2 -importcert -alias a -file a.cert -noprompt");
+ Asserts.assertTrue(hasA());
+ }
+
+ private static OutputAnalyzer kt(String cmd) throws Throwable {
+ return SecurityTools.keytool(COMMON + " " + cmd)
+ .shouldHaveExitValue(0);
+ }
+
+ private static boolean hasA() throws Exception {
+ return KeyStore.getInstance(new File("ks2"), "changeit".toCharArray())
+ .containsAlias("a");
+ }
+}
--- a/jdk/test/sun/security/tools/keytool/ReadJar.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/sun/security/tools/keytool/ReadJar.java Mon Jan 23 10:27:58 2017 -0800
@@ -57,16 +57,15 @@
System.out.println(out.getOutput());
out.shouldHaveExitValue(0);
- out = SecurityTools.jarsigner("test_rsa.jar", "rsa_alias",
- "-keystore keystore -storepass password ");
+ out = SecurityTools.jarsigner("-keystore keystore -storepass password "
+ + "test_rsa.jar rsa_alias");
System.out.println(out.getOutput());
out.shouldHaveExitValue(0);
printCert("test_rsa.jar");
- out = SecurityTools.jarsigner("test_md5.jar", "rsa_alias",
- "-keystore keystore -storepass password "
- + "-sigalg MD5withRSA -digestalg MD5");
+ out = SecurityTools.jarsigner("-keystore keystore -storepass password "
+ + "-sigalg MD5withRSA -digestalg MD5 test_md5.jar rsa_alias");
System.out.println(out.getOutput());
out.shouldHaveExitValue(0);
--- a/jdk/test/tools/jmod/JmodTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/tools/jmod/JmodTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -43,7 +43,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jdk.testlibrary.FileUtils;
-import jdk.testlibrary.JDKToolFinder;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -587,17 +586,10 @@
// Ensure that it is removed in the event of a failure.
// The failure in this case is a class in the unnamed package.
- String filename = "testTmpFileRemoved.jmod";
- Path jmod = MODS_DIR.resolve(filename);
-
- // clean up files
+ Path jmod = MODS_DIR.resolve("testTmpFileRemoved.jmod");
+ Path tmp = MODS_DIR.resolve(".testTmpFileRemoved.jmod.tmp");
FileUtils.deleteFileIfExistsWithRetry(jmod);
- findTmpFiles(filename).forEach(tmp -> {
- try {
- FileUtils.deleteFileIfExistsWithRetry(tmp);
- } catch (IOException e) {}
- });
-
+ FileUtils.deleteFileIfExistsWithRetry(tmp);
String cp = EXPLODED_DIR.resolve("foo").resolve("classes") + File.pathSeparator +
EXPLODED_DIR.resolve("foo").resolve("classes")
.resolve("jdk").resolve("test").resolve("foo").toString();
@@ -605,31 +597,11 @@
jmod("create",
"--class-path", cp,
jmod.toString())
- .assertFailure()
- .resultChecker(r -> {
- assertContains(r.output, "unnamed package");
- List<Path> tmpfiles = findTmpFiles(filename);
- assertTrue(tmpfiles.isEmpty(), "Unexpected tmp file:" + tmpfiles);
- });
- }
-
- /*
- * Returns the list of writeable tmp files with the given prefix.
- *
- * Ignore the non-writeable tmp files because this test is possibly
- * running by another user.
- */
- private List<Path> findTmpFiles(String prefix) {
- Path tmpdir = Paths.get(System.getProperty("java.io.tmpdir"));
- try (Stream<Path> stream = Files.list(tmpdir)) {
- return stream.filter(p -> {
- String fn = p.getFileName().toString();
- return Files.isWritable(p)
- && fn.startsWith(prefix) && fn.endsWith(".tmp");
- }).collect(Collectors.toList());
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
+ .assertFailure()
+ .resultChecker(r -> {
+ assertContains(r.output, "unnamed package");
+ assertTrue(Files.notExists(tmp), "Unexpected tmp file:" + tmp);
+ });
}
// ---
--- a/jdk/test/tools/launcher/VersionCheck.java Mon Jan 23 19:58:06 2017 +0300
+++ b/jdk/test/tools/launcher/VersionCheck.java Mon Jan 23 10:27:58 2017 -0800
@@ -58,7 +58,6 @@
"jmc",
"jmc.ini",
"jweblauncher",
- "jvisualvm",
"packager",
"ssvagent",
"unpack200",
@@ -100,7 +99,6 @@
"jstat",
"jstatd",
"jweblauncher",
- "jvisualvm",
"keytool",
"kinit",
"klist",
--- a/langtools/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -394,3 +394,5 @@
4d4cd7cd731c1952d7330ea5bcfda8bd26820fa5 jdk-9+149
e5a42ddaf633fde14b983f740ae0e7e490741fd1 jdk-9+150
4f348bd05341581df84ff1510d5b3a9b5b488367 jdk-9+151
+5b6f12de6f9167a582fa2c6ac54e69c591b09e68 jdk-9+152
+03f48cd283f5dd6b7153fd7e0cf2df8582b14391 jdk-9+153
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/Processor.java Mon Jan 23 10:27:58 2017 -0800
@@ -243,9 +243,9 @@
* Returns the names of the annotation types supported by this
* processor. An element of the result may be the canonical
* (fully qualified) name of a supported annotation type.
- * Alternately it may be of the form "<tt><i>name</i>.*</tt>"
+ * Alternately it may be of the form "<code><i>name</i>.*</code>"
* representing the set of all annotation types with canonical
- * names beginning with "<tt><i>name.</i></tt>".
+ * names beginning with "<code><i>name.</i></code>".
*
* In either of those cases, the name of the annotation type can
* be optionally preceded by a module name followed by a {@code
@@ -267,13 +267,13 @@
* <dl>
* <dt><i>SupportedAnnotationTypeString:</i>
* <dd><i>ModulePrefix</i><sub><i>opt</i></sub> <i>TypeName</i> <i>DotStar</i><sub><i>opt</i></sub>
- * <dd><tt>*</tt>
+ * <dd><code>*</code>
*
* <dt><i>ModulePrefix:</i>
- * <dd><i>TypeName</i> <tt>/</tt>
+ * <dd><i>TypeName</i> <code>/</code>
*
* <dt><i>DotStar:</i>
- * <dd><tt>.</tt> <tt>*</tt>
+ * <dd><code>.</code> <code>*</code>
* </dl>
* </blockquote>
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/AnnotationValueVisitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@
* implementing this interface are used to operate on a value when the
* type of that value is unknown at compile time. When a visitor is
* passed to a value's {@link AnnotationValue#accept accept} method,
- * the <tt>visit<i>XYZ</i></tt> method applicable to that value is
+ * the <code>visit<i>Xyz</i></code> method applicable to that value is
* invoked.
*
* <p> Classes implementing this interface may or may not throw a
@@ -65,9 +65,9 @@
* be added in a source <em>compatible</em> way if they were added as
* <em>default methods</em>. However, default methods are only
* available on Java SE 8 and higher releases and the {@code
- * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * javax.lang.model.*} packages bundled in Java SE 8 were required to
* also be runnable on Java SE 7. Therefore, default methods
- * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * were <em>not</em> used when extending {@code javax.lang.model.*}
* to cover Java SE 8 language features. However, default methods may
* be used in subsequent revisions of the {@code javax.lang.model.*}
* packages that are only required to run on Java SE 8 and higher
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/element/ElementVisitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
* pattern. Classes implementing this interface are used to operate
* on an element when the kind of element is unknown at compile time.
* When a visitor is passed to an element's {@link Element#accept
- * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
+ * accept} method, the <code>visit<i>Xyz</i></code> method most applicable
* to that element is invoked.
*
* <p> Classes implementing this interface may or may not throw a
@@ -56,9 +56,9 @@
* be added in a source <em>compatible</em> way if they were added as
* <em>default methods</em>. However, default methods are only
* available on Java SE 8 and higher releases and the {@code
- * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * javax.lang.model.*} packages bundled in Java SE 8 were required to
* also be runnable on Java SE 7. Therefore, default methods
- * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * were <em>not</em> used when extending {@code javax.lang.model.*}
* to cover Java SE 8 language features. However, default methods may
* be used in subsequent revisions of the {@code javax.lang.model.*}
* packages that are only required to run on Java SE 8 and higher
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
* visitor design pattern. Classes implementing this
* interface are used to operate on a type when the kind of
* type is unknown at compile time. When a visitor is passed to a
- * type's {@link TypeMirror#accept accept} method, the <tt>visit<i>XYZ</i></tt>
+ * type's {@link TypeMirror#accept accept} method, the <code>visit<i>Xyz</i></code>
* method most applicable to that type is invoked.
*
* <p> Classes implementing this interface may or may not throw a
@@ -56,9 +56,9 @@
* be added in a source <em>compatible</em> way if they were added as
* <em>default methods</em>. However, default methods are only
* available on Java SE 8 and higher releases and the {@code
- * javax.lang.model.*} packages bundled in Java SE 8 are required to
+ * javax.lang.model.*} packages bundled in Java SE 8 were required to
* also be runnable on Java SE 7. Therefore, default methods
- * <em>cannot</em> be used when extending {@code javax.lang.model.*}
+ * were <em>not</em> used when extending {@code javax.lang.model.*}
* to cover Java SE 8 language features. However, default methods may
* be used in subsequent revisions of the {@code javax.lang.model.*}
* packages that are only required to run on Java SE 8 and higher
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/type/WildcardType.java Mon Jan 23 10:27:58 2017 -0800
@@ -28,11 +28,11 @@
/**
* Represents a wildcard type argument.
- * Examples include: <pre><tt>
+ * Examples include: <pre><code>
* ?
* ? extends Number
* ? super T
- * </tt></pre>
+ * </code></pre>
*
* <p> A wildcard may have its upper bound explicitly set by an
* {@code extends} clause, its lower bound explicitly set by a
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -54,15 +54,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,15 +51,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,15 +51,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,15 +53,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,15 +52,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,15 +52,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,15 +52,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,15 +52,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,15 +52,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,10 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for the {@link
* SourceVersion#RELEASE_6 RELEASE_6} source version. For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -67,15 +67,6 @@
* for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for the {@link
* SourceVersion#RELEASE_7 RELEASE_7} source version. For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -65,15 +65,6 @@
* for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for the {@link
* SourceVersion#RELEASE_8 RELEASE_8} source version. For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -65,15 +65,6 @@
* for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for the {@link
* SourceVersion#RELEASE_9 RELEASE_9} source version. For {@linkplain
- * Element elements} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * Element elements} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,26 +34,26 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6}
- * source version. The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version. The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
* their {@linkplain Element#getEnclosedElements enclosed elements},
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
* indicated in the individual method specifications. A subclass can
* control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
+ * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
* than {@code v.visit(e, p)} on the root objects of interest.
*
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the
* new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
+ * default way by calling <code>super.visit<i>Xyz</i></code>. In this
* fashion, the concrete visitor can control the ordering of traversal
* over the component elements with respect to the additional
* processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>Xyz</i></code> at the start of the overridden
* methods will yield a preorder traversal, etc. If the component
* elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method
* should call {@code scan} with the elements in the desired order.
*
* <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,26 +34,26 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_7 RELEASE_7}
- * source version. The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version. The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
* their {@linkplain Element#getEnclosedElements enclosed elements},
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
* indicated in the individual method specifications. A subclass can
* control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
+ * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
* than {@code v.visit(e, p)} on the root objects of interest.
*
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the
* new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
+ * default way by calling <code>super.visit<i>Xyz</i></code>. In this
* fashion, the concrete visitor can control the ordering of traversal
* over the component elements with respect to the additional
* processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>Xyz</i></code> at the start of the overridden
* methods will yield a preorder traversal, etc. If the component
* elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method
* should call {@code scan} with the elements in the desired order.
*
* <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,26 +34,26 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8}
- * source version. The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version. The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
* their {@linkplain Element#getEnclosedElements enclosed elements},
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
* indicated in the individual method specifications. A subclass can
* control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
+ * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
* than {@code v.visit(e, p)} on the root objects of interest.
*
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the
* new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
+ * default way by calling <code>super.visit<i>Xyz</i></code>. In this
* fashion, the concrete visitor can control the ordering of traversal
* over the component elements with respect to the additional
* processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>Xyz</i></code> at the start of the overridden
* methods will yield a preorder traversal, etc. If the component
* elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method
* should call {@code scan} with the elements in the desired order.
*
* <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,26 +34,26 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for the {@link SourceVersion#RELEASE_9 RELEASE_9}
- * source version. The <tt>visit<i>XYZ</i></tt> methods in this
+ * source version. The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
* their {@linkplain Element#getEnclosedElements enclosed elements},
* {@linkplain ExecutableElement#getParameters parameters}, etc., as
* indicated in the individual method specifications. A subclass can
* control the order elements are visited by overriding the
- * <tt>visit<i>XYZ</i></tt> methods. Note that clients of a scanner
+ * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner
* may get the desired behavior be invoking {@code v.scan(e, p)} rather
* than {@code v.visit(e, p)} on the root objects of interest.
*
- * <p>When a subclass overrides a <tt>visit<i>XYZ</i></tt> method, the
+ * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the
* new method can cause the enclosed elements to be scanned in the
- * default way by calling <tt>super.visit<i>XYZ</i></tt>. In this
+ * default way by calling <code>super.visit<i>Xyz</i></code>. In this
* fashion, the concrete visitor can control the ordering of traversal
* over the component elements with respect to the additional
* processing; for example, consistently calling
- * <tt>super.visit<i>XYZ</i></tt> at the start of the overridden
+ * <code>super.visit<i>Xyz</i></code> at the start of the overridden
* methods will yield a preorder traversal, etc. If the component
* elements should be traversed in some other order, instead of
- * calling <tt>super.visit<i>XYZ</i></tt>, an overriding visit method
+ * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method
* should call {@code scan} with the elements in the desired order.
*
* <p> Methods in this class may be overridden subject to their
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -63,15 +63,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,15 +58,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,15 +58,6 @@
* behavior for the visit method in question. When the new visitor is
* introduced, all or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods
* @param <P> the type of the additional parameter to this visitor's methods.
*
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,15 +65,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@code Void}
* for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's methods. Use {@code Void}
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -62,15 +62,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@code Void}
* for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's methods. Use {@code Void}
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,15 +61,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@code Void}
* for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's methods. Use {@code Void}
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -64,15 +64,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,15 +61,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,15 +61,6 @@
* visit method in question. When the new visitor is introduced, all
* or portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor6.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_6
* RELEASE_6} source version. For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -63,15 +63,6 @@
* method in question. When the new visitor is introduced, all or
* portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor7.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_7
* RELEASE_7} source version. For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -63,15 +63,6 @@
* method in question. When the new visitor is introduced, all or
* portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor8.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor8.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_8
* RELEASE_8} source version. For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
@@ -63,15 +63,6 @@
* method in question. When the new visitor is introduced, all or
* portions of this visitor may be deprecated.
*
- * <p>Note that adding a default implementation of a new visit method
- * in a visitor class will occur instead of adding a <em>default
- * method</em> directly in the visitor interface since a Java SE 8
- * language feature cannot be used to this version of the API since
- * this version is required to be runnable on Java SE 7
- * implementations. Future versions of the API that are only required
- * to run on Java SE 8 and later may take advantage of default methods
- * in this situation.
- *
* @param <R> the return type of this visitor's methods. Use {@link
* Void} for visitors that do not need to return results.
* @param <P> the type of the additional parameter to this visitor's
--- a/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitor9.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
* 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,10 +34,10 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for the {@link SourceVersion#RELEASE_9
* RELEASE_9} source version. For {@linkplain
- * TypeMirror types} <tt><i>XYZ</i></tt> that may have more than one
- * kind, the <tt>visit<i>XYZ</i></tt> methods in this class delegate
- * to the <tt>visit<i>XYZKind</i></tt> method corresponding to the
- * first argument's kind. The <tt>visit<i>XYZKind</i></tt> methods
+ * TypeMirror types} <code><i>Xyz</i></code> that may have more than one
+ * kind, the <code>visit<i>Xyz</i></code> methods in this class delegate
+ * to the <code>visit<i>Xyz</i>As<i>Kind</i></code> method corresponding to the
+ * first argument's kind. The <code>visit<i>Xyz</i>As<i>Kind</i></code> methods
* call {@link #defaultAction defaultAction}, passing their arguments
* to {@code defaultAction}'s corresponding parameters.
*
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Mon Jan 23 10:27:58 2017 -0800
@@ -921,6 +921,7 @@
public PackageSymbol unnamedPackage;
public Map<Name, PackageSymbol> visiblePackages;
+ public Set<ModuleSymbol> readModules;
public List<Symbol> enclosedPackages = List.nil();
public Completer usesProvidesCompleter = Completer.NULL_COMPLETER;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java Mon Jan 23 10:27:58 2017 -0800
@@ -61,7 +61,6 @@
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.Name;
import com.sun.tools.javac.util.Names;
-import com.sun.tools.javac.util.Options;
import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Kinds.Kind.*;
@@ -469,9 +468,7 @@
scope.enter(errSymbol);
Source source = Source.instance(context);
- Options options = Options.instance(context);
- boolean noModules = options.isSet("noModules");
- if (source.allowModules() && !noModules) {
+ if (source.allowModules()) {
java_base = enterModule(names.java_base);
//avoid completing java.base during the Symtab initialization
java_base.completer = Completer.NULL_COMPLETER;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,7 @@
import static com.sun.tools.javac.code.Flags.SYNTHETIC;
import static com.sun.tools.javac.code.Kinds.Kind.MDL;
import static com.sun.tools.javac.code.Kinds.Kind.MTH;
+import static com.sun.tools.javac.code.Kinds.Kind.PCK;
import static com.sun.tools.javac.code.Kinds.Kind.VAR;
import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
import static com.sun.tools.javac.code.TypeTag.ARRAY;
@@ -228,7 +229,14 @@
s.resetAnnotations(); // mark Annotations as incomplete for now
normal(() -> {
- Assert.check(s.annotationsPendingCompletion());
+ // Packages are unusual, in that they are the only type of declaration that can legally appear
+ // more than once in a compilation, and in all cases refer to the same underlying symbol.
+ // This means they are the only kind of declaration that syntactically may have multiple sets
+ // of annotations, each on a different package declaration, even though that is ultimately
+ // forbidden by JLS 8 section 7.4.
+ // The corollary here is that all of the annotations on a package symbol may have already
+ // been handled, meaning that the set of annotations pending completion is now empty.
+ Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
deferPos != null
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java Mon Jan 23 10:27:58 2017 -0800
@@ -353,7 +353,7 @@
@Override @DefinedBy(Api.COMPILER_TREE)
public Symbol visitMemberSelect(MemberSelectTree node, Env<AttrContext> env) {
Symbol site = visit(node.getExpression(), env);
- if (site.kind == ERR || site.kind == ABSENT_TYP)
+ if (site.kind == ERR || site.kind == ABSENT_TYP || site.kind == HIDDEN)
return site;
Name name = (Name)node.getIdentifier();
if (site.kind == PCK) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -436,8 +436,10 @@
}
void clearLocalClassNameIndexes(ClassSymbol c) {
- localClassNameIndexes.remove(new Pair<>(
- c.owner.enclClass().flatname, c.name));
+ if (c.owner != null && c.owner.kind != NIL) {
+ localClassNameIndexes.remove(new Pair<>(
+ c.owner.enclClass().flatname, c.name));
+ }
}
public void newRound() {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Jan 23 10:27:58 2017 -0800
@@ -792,6 +792,7 @@
switch (tree.getTag()) {
case APPLY: ((JCMethodInvocation)tree).varargsElement = varargsElement; break;
case NEWCLASS: ((JCNewClass)tree).varargsElement = varargsElement; break;
+ case TYPECAST: setVarargsIfNeeded(((JCTypeCast) tree).expr, varargsElement); break;
default: throw new AssertionError();
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java Mon Jan 23 10:27:58 2017 -0800
@@ -1327,6 +1327,7 @@
initAddExports();
msym.visiblePackages = new LinkedHashMap<>();
+ msym.readModules = new HashSet<>(readable);
Map<Name, ModuleSymbol> seen = new HashMap<>();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Jan 23 10:27:58 2017 -0800
@@ -54,14 +54,19 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
+import java.util.Set;
+import java.util.function.BiFunction;
import java.util.function.BiPredicate;
+import java.util.function.Predicate;
import java.util.stream.Stream;
import javax.lang.model.element.ElementVisitor;
+import com.sun.tools.javac.code.Directive.ExportsDirective;
import static com.sun.tools.javac.code.Flags.*;
import static com.sun.tools.javac.code.Flags.BLOCK;
import static com.sun.tools.javac.code.Flags.STATIC;
@@ -69,6 +74,8 @@
import static com.sun.tools.javac.code.Kinds.Kind.*;
import static com.sun.tools.javac.code.TypeTag.*;
import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
+import com.sun.tools.javac.resources.CompilerProperties.Errors;
+import com.sun.tools.javac.resources.CompilerProperties.Fragments;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
/** Helper class for name resolution, used mostly by the attribution phase.
@@ -89,6 +96,7 @@
Check chk;
Infer infer;
ClassFinder finder;
+ ModuleFinder moduleFinder;
Types types;
JCDiagnostic.Factory diags;
public final boolean allowMethodHandles;
@@ -98,8 +106,6 @@
private final boolean compactMethodDiags;
final EnumSet<VerboseResolutionMode> verboseResolutionMode;
- private final boolean checkModuleAccess;
-
WriteableScope polymorphicSignatureScope;
protected Resolve(Context context) {
@@ -118,6 +124,7 @@
chk = Check.instance(context);
infer = Infer.instance(context);
finder = ClassFinder.instance(context);
+ moduleFinder = ModuleFinder.instance(context);
types = Types.instance(context);
diags = JCDiagnostic.Factory.instance(context);
Source source = Source.instance(context);
@@ -135,10 +142,6 @@
inapplicableMethodException = new InapplicableMethodException(diags);
allowModules = source.allowModules();
-
- // The following is required, for now, to support building
- // Swing beaninfo via javadoc.
- checkModuleAccess = !options.isSet("noModules");
}
/** error symbols, which are returned when resolution fails
@@ -321,8 +324,7 @@
isAccessible = true;
break;
case PUBLIC:
- isAccessible = true;
- if (allowModules && checkModuleAccess) {
+ if (allowModules) {
ModuleSymbol currModule = env.toplevel.modle;
currModule.complete();
PackageSymbol p = c.packge();
@@ -497,7 +499,7 @@
public Void visitClassType(ClassType t, Env<AttrContext> env) {
visit(t.getTypeArguments(), env);
if (!isAccessible(env, t, true)) {
- accessBase(new AccessError(t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
+ accessBase(new AccessError(env, null, t.tsym), env.tree.pos(), env.enclClass.sym, t, t.tsym.name, true);
}
return null;
}
@@ -1971,7 +1973,7 @@
Symbol loadClass(Env<AttrContext> env, Name name) {
try {
ClassSymbol c = finder.loadClass(env.toplevel.modle, name);
- return isAccessible(env, c) ? c : new AccessError(c);
+ return isAccessible(env, c) ? c : new AccessError(env, null, c);
} catch (ClassFinder.BadClassFile err) {
throw err;
} catch (CompletionFailure ex) {
@@ -1989,20 +1991,29 @@
Symbol loadClass(Env<AttrContext> env, Name name);
}
- private RecoveryLoadClass recoveryLoadClass = (env, name) -> {
- //even if a class cannot be found in the current module and packages in modules it depends on that
- //are exported for any or this module, the class may exist internally in some of these modules,
- //or may exist in a module on which this module does not depend. Provide better diagnostic in
- //such cases by looking for the class in any module:
- for (ModuleSymbol ms : syms.getAllModules()) {
- //do not load currently unloaded classes, to avoid too eager completion of random things in other modules:
- ClassSymbol clazz = syms.getClass(ms, name);
-
- if (clazz != null) {
- return new AccessError(clazz);
+ private RecoveryLoadClass recoveryLoadClass = new RecoveryLoadClass() {
+ @Override
+ public Symbol loadClass(Env<AttrContext> env, Name name) {
+ if (allowModules) {
+ Scope importScope = env.toplevel.namedImportScope;
+ Symbol existing = importScope.findFirst(Convert.shortName(name),
+ sym -> sym.kind == TYP && sym.flatName() == name);
+
+ if (existing != null) {
+ return new InvisibleSymbolError(env, true, existing);
+ }
+
+ return lookupInvisibleSymbol(env, name, syms::getClass, (ms, n) -> {
+ try {
+ return finder.loadClass(ms, n);
+ } catch (CompletionFailure cf) {
+ //ignore
+ return null;
+ }
+ }, sym -> sym.kind == Kind.TYP, false, typeNotFound);
}
- }
- return null;
+ return null;
+ }
};
public RecoveryLoadClass setRecoveryLoadClass(RecoveryLoadClass recovery) {
@@ -2011,6 +2022,84 @@
return prev;
}
+ Symbol lookupPackage(Env<AttrContext> env, Name name) {
+ PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, name);
+
+ if (allowModules && isImportOnDemand(env, name)) {
+ pack.complete();
+ if (!pack.exists()) {
+ Name nameAndDot = name.append('.', names.empty);
+ boolean prefixOfKnown =
+ env.toplevel.modle.visiblePackages.values()
+ .stream()
+ .anyMatch(p -> p.fullname.startsWith(nameAndDot));
+
+ return lookupInvisibleSymbol(env, name, syms::getPackage, syms::enterPackage, sym -> {
+ sym.complete();
+ return sym.exists();
+ }, prefixOfKnown, pack);
+ }
+ }
+
+ return pack;
+ }
+
+ private boolean isImportOnDemand(Env<AttrContext> env, Name name) {
+ if (!env.tree.hasTag(IMPORT))
+ return false;
+
+ JCTree qualid = ((JCImport) env.tree).qualid;
+
+ if (!qualid.hasTag(SELECT))
+ return false;
+
+ if (TreeInfo.name(qualid) != names.asterisk)
+ return false;
+
+ return TreeInfo.fullName(((JCFieldAccess) qualid).selected) == name;
+ }
+
+ private Symbol lookupInvisibleSymbol(Env<AttrContext> env,
+ Name name,
+ BiFunction<ModuleSymbol, Name, Symbol> get,
+ BiFunction<ModuleSymbol, Name, Symbol> load,
+ Predicate<Symbol> validate,
+ boolean suppressError,
+ Symbol defaultResult) {
+ //even if a class/package cannot be found in the current module and among packages in modules
+ //it depends on that are exported for any or this module, the class/package may exist internally
+ //in some of these modules, or may exist in a module on which this module does not depend.
+ //Provide better diagnostic in such cases by looking for the class in any module:
+ Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
+
+ recoverableModules.remove(env.toplevel.modle);
+
+ for (ModuleSymbol ms : recoverableModules) {
+ Symbol sym = get.apply(ms, name);
+
+ //avoid overly eager completing classes from source-based modules, as those
+ //may not be completable with the current compiler settings:
+ if (sym == null && (ms.sourceLocation == null)) {
+ if (ms.classLocation == null) {
+ ms = moduleFinder.findModule(ms);
+ }
+
+ if (ms.kind != ERR) {
+ sym = load.apply(ms, name);
+ }
+ }
+
+ if (sym == null)
+ continue;
+
+ if (validate.test(sym)) {
+ return new InvisibleSymbolError(env, suppressError, sym);
+ }
+ }
+
+ return defaultResult;
+ }
+
/**
* Find a type declared in a scope (not inherited). Return null
* if none is found.
@@ -2211,7 +2300,7 @@
}
if (kind.contains(KindSelector.PCK))
- return syms.lookupPackage(env.toplevel.modle, name);
+ return lookupPackage(env, name);
else return bestSoFar;
}
@@ -2225,11 +2314,6 @@
Name name, KindSelector kind) {
Name fullname = TypeSymbol.formFullName(name, pck);
Symbol bestSoFar = typeNotFound;
- PackageSymbol pack = null;
- if (kind.contains(KindSelector.PCK)) {
- pack = syms.lookupPackage(env.toplevel.modle, fullname);
- if (pack.exists()) return pack;
- }
if (kind.contains(KindSelector.TYP)) {
Symbol sym = loadClass(env, fullname);
if (sym.exists()) {
@@ -2238,7 +2322,10 @@
}
else bestSoFar = bestOf(bestSoFar, sym);
}
- return (pack != null) ? pack : bestSoFar;
+ if (kind.contains(KindSelector.PCK)) {
+ return lookupPackage(env, fullname);
+ }
+ return bestSoFar;
}
/** Find an identifier among the members of a given type `site'.
@@ -3947,10 +4034,6 @@
private Env<AttrContext> env;
private Type site;
- AccessError(Symbol sym) {
- this(null, null, sym);
- }
-
AccessError(Env<AttrContext> env, Type site, Symbol sym) {
super(HIDDEN, sym, "access error");
this.env = env;
@@ -3983,7 +4066,14 @@
if (sym.owner.kind == PCK) {
return diags.create(dkind, log.currentSource(),
pos, "not.def.access.package.cant.access",
- sym, sym.location());
+ sym, sym.location(), inaccessiblePackageReason(env, sym.packge()));
+ } else if ( sym.packge() != syms.rootPackage
+ && sym.packge().modle != env.toplevel.modle
+ && !isAccessible(env, sym.outermostClass())) {
+ return diags.create(dkind, log.currentSource(),
+ pos, "not.def.access.class.intf.cant.access.reason",
+ sym, sym.location(), sym.location().packge(),
+ inaccessiblePackageReason(env, sym.packge()));
} else {
return diags.create(dkind, log.currentSource(),
pos, "not.def.access.class.intf.cant.access",
@@ -4015,6 +4105,90 @@
}
}
+ class InvisibleSymbolError extends InvalidSymbolError {
+
+ private final Env<AttrContext> env;
+ private final boolean suppressError;
+
+ InvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
+ super(HIDDEN, sym, "invisible class error");
+ this.env = env;
+ this.suppressError = suppressError;
+ this.name = sym.name;
+ }
+
+ @Override
+ JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
+ DiagnosticPosition pos,
+ Symbol location,
+ Type site,
+ Name name,
+ List<Type> argtypes,
+ List<Type> typeargtypes) {
+ if (suppressError)
+ return null;
+
+ if (sym.kind == PCK) {
+ JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
+ return diags.create(dkind, log.currentSource(),
+ pos, "package.not.visible", sym, details);
+ }
+
+ JCDiagnostic details = inaccessiblePackageReason(env, sym.packge());
+
+ if (pos.getTree() != null && pos.getTree().hasTag(SELECT) && sym.owner.kind == PCK) {
+ pos = ((JCFieldAccess) pos.getTree()).selected.pos();
+
+ return diags.create(dkind, log.currentSource(),
+ pos, "package.not.visible", sym.packge(), details);
+ }
+
+ return diags.create(dkind, log.currentSource(),
+ pos, "not.def.access.package.cant.access", sym, sym.packge(), details);
+ }
+ }
+
+ JCDiagnostic inaccessiblePackageReason(Env<AttrContext> env, PackageSymbol sym) {
+ //no dependency:
+ if (!env.toplevel.modle.readModules.contains(sym.modle)) {
+ //does not read:
+ if (sym.modle != syms.unnamedModule) {
+ if (env.toplevel.modle != syms.unnamedModule) {
+ return diags.fragment(Fragments.NotDefAccessDoesNotRead(env.toplevel.modle,
+ sym,
+ sym.modle));
+ } else {
+ return diags.fragment(Fragments.NotDefAccessDoesNotReadFromUnnamed(sym,
+ sym.modle));
+ }
+ } else {
+ return diags.fragment(Fragments.NotDefAccessDoesNotReadUnnamed(sym,
+ env.toplevel.modle));
+ }
+ } else {
+ if (sym.packge().modle.exports.stream().anyMatch(e -> e.packge == sym)) {
+ //not exported to this module:
+ if (env.toplevel.modle != syms.unnamedModule) {
+ return diags.fragment(Fragments.NotDefAccessNotExportedToModule(sym,
+ sym.modle,
+ env.toplevel.modle));
+ } else {
+ return diags.fragment(Fragments.NotDefAccessNotExportedToModuleFromUnnamed(sym,
+ sym.modle));
+ }
+ } else {
+ //not exported:
+ if (env.toplevel.modle != syms.unnamedModule) {
+ return diags.fragment(Fragments.NotDefAccessNotExported(sym,
+ sym.modle));
+ } else {
+ return diags.fragment(Fragments.NotDefAccessNotExportedFromUnnamed(sym,
+ sym.modle));
+ }
+ }
+ }
+ }
+
/**
* InvalidSymbolError error class indicating that an instance member
* has erroneously been accessed from a static context.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,9 @@
importNamedStatic(tree, p, name, localEnv);
chk.checkCanonical(imp.selected);
} else {
- TypeSymbol c = attribImportType(imp, localEnv).tsym;
+ Type importedType = attribImportType(imp, localEnv);
+ Type originalType = importedType.getOriginalType();
+ TypeSymbol c = originalType.hasTag(CLASS) ? originalType.tsym : importedType.tsym;
chk.checkCanonical(imp);
importNamed(tree.pos(), c, env, tree);
}
@@ -938,6 +940,7 @@
*/
void finishClass(JCClassDecl tree, Env<AttrContext> env) {
if ((tree.mods.flags & Flags.ENUM) != 0 &&
+ !tree.sym.type.hasTag(ERROR) &&
(types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
addEnumMembers(tree, env);
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -818,13 +818,17 @@
return List.nil();
String checkPackages = options.get(Option.XDOCLINT_PACKAGE);
-
if (checkPackages != null) {
for (String s : checkPackages.split("\\s+")) {
doclintOpts.add(DocLint.XCHECK_PACKAGE + s);
}
}
+ String format = options.get(Option.DOCLINT_FORMAT);
+ if (format != null) {
+ doclintOpts.add(DocLint.XHTML_VERSION_PREFIX + format);
+ }
+
// standard doclet normally generates H1, H2,
// so for now, allow user comments to assume that
doclintOpts.add(DocLint.XIMPLICIT_HEADERS + "2");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java Mon Jan 23 10:27:58 2017 -0800
@@ -681,7 +681,7 @@
if (sep == -1) {
msym = modules.getDefaultModule();
typeName = name;
- } else if (source.allowModules() && !options.isSet("noModules")) {
+ } else if (source.allowModules()) {
Name modName = names.fromString(name.substring(0, sep));
msym = moduleFinder.findModule(modName);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -154,6 +154,8 @@
}
},
+ DOCLINT_FORMAT("--doclint-format", "opt.doclint.format", EXTENDED, BASIC, ONEOF, "html4", "html5"),
+
// -nowarn is retained for command-line backward compatibility
NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
@Override
@@ -1216,10 +1218,12 @@
sb.append(name);
if (argsNameKey == null) {
if (choices != null) {
+ if (!name.endsWith(":"))
+ sb.append(" ");
String sep = "{";
for (String choice : choices) {
sb.append(sep);
- sb.append(choices);
+ sb.append(choice);
sep = ",";
}
sb.append("}");
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacElements.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,11 @@
package com.sun.tools.javac.model;
+import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
+import java.util.stream.Collectors;
import javax.lang.model.AnnotatedConstruct;
import javax.lang.model.SourceVersion;
@@ -67,6 +69,7 @@
import com.sun.tools.javac.comp.Modules;
import com.sun.tools.javac.comp.Resolve;
import com.sun.tools.javac.comp.Resolve.RecoveryLoadClass;
+import com.sun.tools.javac.resources.CompilerProperties.Notes;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
/**
@@ -87,6 +90,8 @@
private final Enter enter;
private final Resolve resolve;
private final JavacTaskImpl javacTaskImpl;
+ private final Log log;
+ private final boolean allowModules;
public static JavacElements instance(Context context) {
JavacElements instance = context.get(JavacElements.class);
@@ -106,6 +111,9 @@
resolve = Resolve.instance(context);
JavacTask t = context.get(JavacTask.class);
javacTaskImpl = t instanceof JavacTaskImpl ? (JavacTaskImpl) t : null;
+ log = Log.instance(context);
+ Source source = Source.instance(context);
+ allowModules = source.allowModules();
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -134,7 +142,7 @@
ensureEntered("getPackageElement");
if (name.length() == 0)
return syms.unnamedModule.unnamedPackage;
- return doGetElement(module, name, PackageSymbol.class);
+ return doGetElement(module, "getPackageElement", name, PackageSymbol.class);
}
@Override @DefinedBy(Api.LANGUAGE_MODEL)
@@ -151,22 +159,27 @@
private ClassSymbol doGetTypeElement(ModuleElement module, CharSequence name) {
ensureEntered("getTypeElement");
- return doGetElement(module, name, ClassSymbol.class);
+ return doGetElement(module, "getTypeElement", name, ClassSymbol.class);
}
- private <S extends Symbol> S doGetElement(ModuleElement module, CharSequence name, Class<S> clazz) {
+ private <S extends Symbol> S doGetElement(ModuleElement module, String methodName,
+ CharSequence name, Class<S> clazz) {
String strName = name.toString();
if (!SourceVersion.isName(strName)) {
return null;
}
if (module == null) {
- return unboundNameToSymbol(strName, clazz);
+ return unboundNameToSymbol(methodName, strName, clazz);
} else {
return nameToSymbol((ModuleSymbol) module, strName, clazz);
}
}
- private <S extends Symbol> S unboundNameToSymbol(String nameStr, Class<S> clazz) {
+ private final Set<String> alreadyWarnedDuplicates = new HashSet<>();
+
+ private <S extends Symbol> S unboundNameToSymbol(String methodName,
+ String nameStr,
+ Class<S> clazz) {
if (modules.getDefaultModule() == syms.noModule) { //not a modular mode:
return nameToSymbol(syms.noModule, nameStr, clazz);
}
@@ -179,12 +192,25 @@
S sym = nameToSymbol(msym, nameStr, clazz);
if (sym != null) {
- found.add(sym);
+ if (!allowModules || clazz == ClassSymbol.class || !sym.members().isEmpty()) {
+ //do not add packages without members:
+ found.add(sym);
+ }
}
}
if (found.size() == 1) {
return found.iterator().next();
+ } else if (found.size() > 1) {
+ //more than one element found, produce a note:
+ if (alreadyWarnedDuplicates.add(methodName + ":" + nameStr)) {
+ String moduleNames = found.stream()
+ .map(s -> s.packge().modle)
+ .map(m -> m.toString())
+ .collect(Collectors.joining(", "));
+ log.note(Notes.MultipleElements(methodName, nameStr, moduleNames));
+ }
+ return null;
} else {
//not found, or more than one element found:
return null;
@@ -222,41 +248,6 @@
}
}
- public JavacSourcePosition getSourcePosition(Element e) {
- Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
- if (treeTop == null)
- return null;
- JCTree tree = treeTop.fst;
- JCCompilationUnit toplevel = treeTop.snd;
- JavaFileObject sourcefile = toplevel.sourcefile;
- if (sourcefile == null)
- return null;
- return new JavacSourcePosition(sourcefile, tree.pos, toplevel.lineMap);
- }
-
- public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a) {
- Pair<JCTree, JCCompilationUnit> treeTop = getTreeAndTopLevel(e);
- if (treeTop == null)
- return null;
- JCTree tree = treeTop.fst;
- JCCompilationUnit toplevel = treeTop.snd;
- JavaFileObject sourcefile = toplevel.sourcefile;
- if (sourcefile == null)
- return null;
-
- JCTree annoTree = matchAnnoToTree(a, e, tree);
- if (annoTree == null)
- return null;
- return new JavacSourcePosition(sourcefile, annoTree.pos,
- toplevel.lineMap);
- }
-
- public JavacSourcePosition getSourcePosition(Element e, AnnotationMirror a,
- AnnotationValue v) {
- // TODO: better accuracy in getSourcePosition(... AnnotationValue)
- return getSourcePosition(e, a);
- }
-
/**
* Returns the tree for an annotation given the annotated element
* and the element's own tree. Returns null if the tree cannot be found.
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacSourcePosition.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.model;
-
-import javax.tools.JavaFileObject;
-import com.sun.tools.javac.util.Position;
-
-/**
- * Implementation of model API SourcePosition based on javac internal state.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-class JavacSourcePosition {
-
- final JavaFileObject sourcefile;
- final int pos;
- final Position.LineMap lineMap;
-
- JavacSourcePosition(JavaFileObject sourcefile,
- int pos,
- Position.LineMap lineMap) {
- this.sourcefile = sourcefile;
- this.pos = pos;
- this.lineMap = (pos != Position.NOPOS) ? lineMap : null;
- }
-
- public JavaFileObject getFile() {
- return sourcefile;
- }
-
- public int getOffset() {
- return pos; // makes use of fact that Position.NOPOS == -1
- }
-
- public int getLine() {
- return (lineMap != null) ? lineMap.getLineNumber(pos) : -1;
- }
-
- public int getColumn() {
- return (lineMap != null) ? lineMap.getColumnNumber(pos) : -1;
- }
-
- public String toString() {
- int line = getLine();
- return (line > 0)
- ? sourcefile + ":" + line
- : sourcefile.toString();
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Mon Jan 23 10:27:58 2017 -0800
@@ -230,7 +230,7 @@
chk = Check.instance(context);
initProcessorLoader();
- allowModules = source.allowModules() && options.isUnset("noModules");
+ allowModules = source.allowModules();
}
public void setProcessors(Iterable<? extends Processor> processors) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -823,17 +823,87 @@
compiler.err.not.annotation.type=\
{0} is not an annotation type
-# 0: symbol, 1: symbol
+# 0: symbol, 1: symbol, 2: message segment
compiler.err.not.def.access.package.cant.access=\
- {0} is not visible because package {1} is not visible
+ {0} is not visible\n\
+ ({2})
+
+# 0: symbol, 1: symbol, 2: message segment
+compiler.misc.not.def.access.package.cant.access=\
+ {0} is not visible\n\
+ ({2})
+
+# 0: symbol, 1: message segment
+compiler.err.package.not.visible=\
+ package {0} is not visible\n\
+ ({1})
+
+# 0: symbol, 1: message segment
+compiler.misc.package.not.visible=\
+ package {0} is not visible\n\
+ ({1})
+
+# {0} - current module
+# {1} - package in which the invisible class is declared
+# {2} - module in which {1} is declared
+# 0: symbol, 1: symbol, 2: symbol
+compiler.misc.not.def.access.does.not.read=\
+ package {1} is declared in module {2}, but module {0} does not read it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.does.not.read.from.unnamed=\
+ package {0} is declared in module {1}, which is not in the module graph
+
+# {0} - package in which the invisible class is declared
+# {1} - current module
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.does.not.read.unnamed=\
+ package {0} is declared in the unnamed module, but module {0} does not read it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported=\
+ package {0} is declared in module {1}, which does not export it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported.from.unnamed=\
+ package {0} is declared in module {1}, which does not export it
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# {2} - current module
+# 0: symbol, 1: symbol, 2: symbol
+compiler.misc.not.def.access.not.exported.to.module=\
+ package {0} is declared in module {1}, which does not export it to module {2}
+
+# {0} - package in which the invisible class is declared
+# {1} - module in which {0} is declared
+# 0: symbol, 1: symbol
+compiler.misc.not.def.access.not.exported.to.module.from.unnamed=\
+ package {0} is declared in module {1}, which does not export it to the unnamed module
# 0: symbol, 1: symbol
compiler.err.not.def.access.class.intf.cant.access=\
- {0} in {1} is defined in an inaccessible class or interface
+ {1}.{0} is defined in an inaccessible class or interface
# 0: symbol, 1: symbol
compiler.misc.not.def.access.class.intf.cant.access=\
- {0} in {1} is defined in an inaccessible class or interface
+ {1}.{0} is defined in an inaccessible class or interface
+
+# 0: symbol, 1: symbol, 2: symbol, 3: message segment
+compiler.err.not.def.access.class.intf.cant.access.reason=\
+ {1}.{0} in package {2} is not accessible\n\
+ ({3})
+
+# 0: symbol, 1: symbol, 2: symbol, 3: message segment
+compiler.misc.not.def.access.class.intf.cant.access.reason=\
+ {1}.{0} in package {2} is not accessible\n\
+ ({3})
# 0: symbol, 1: list of type, 2: type
compiler.misc.cant.access.inner.cls.constr=\
@@ -1366,6 +1436,10 @@
compiler.note.proc.messager=\
{0}
+# 0: string, 1: string, 2: string
+compiler.note.multiple.elements=\
+ Multiple elements named '{1}' in modules '{2}' were found by javax.lang.model.util.Elements.{0}.
+
#####
# 0: number
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
# 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,6 +263,9 @@
expands to all sub-packages of the given package. Each <package> can be prefixed\n\
with '-' to disable checks for the specified package or packages.
+javac.opt.doclint.format=\
+ Specify the format for documentation comments
+
javac.opt.Xstdout=\
Redirect standard output
javac.opt.X=\
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/debug/InternalDebugControl.java Mon Jan 23 10:27:58 2017 -0800
@@ -68,6 +68,11 @@
*/
public static final int DBG_EVNT = 0b0010000;
+ /**
+ * Event debugging.
+ */
+ public static final int DBG_WRAP = 0b0100000;
+
private static Map<JShell, Integer> debugMap = null;
/**
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Mon Jan 23 10:27:58 2017 -0800
@@ -119,6 +119,7 @@
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
+import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
import static jdk.internal.jshell.tool.ContinuousCompletionProvider.STARTSWITH_MATCHER;
/**
@@ -217,7 +218,7 @@
static final String DEFAULT_STARTUP_NAME = "DEFAULT";
static final Pattern BUILTIN_FILE_PATTERN = Pattern.compile("\\w+");
- static final String BUILTIN_FILE_PATH_FORMAT = "jrt:/jdk.jshell/jdk/jshell/tool/resources/%s.jsh";
+ static final String BUILTIN_FILE_PATH_FORMAT = "/jdk/jshell/tool/resources/%s.jsh";
// match anything followed by whitespace
private static final Pattern OPTION_PRE_PATTERN =
@@ -1919,9 +1920,13 @@
flags |= DBG_EVNT;
fluff("Event debugging on");
break;
+ case 'w':
+ flags |= DBG_WRAP;
+ fluff("Wrap debugging on");
+ break;
default:
hard("Unknown debugging option: %c", ch);
- fluff("Use: 0 r g f c d");
+ fluff("Use: 0 r g f c d e w");
return false;
}
}
@@ -2421,9 +2426,11 @@
String readResource(String name) throws IOException {
// Attempt to find the file as a resource
String spec = String.format(BUILTIN_FILE_PATH_FORMAT, name);
- URL url = new URL(spec);
- BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
- return reader.lines().collect(Collectors.joining("\n"));
+
+ try (InputStream in = JShellTool.class.getResourceAsStream(spec);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
+ return reader.lines().collect(Collectors.joining("\n"));
+ }
}
// retrieve the default startup string
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Mon Jan 23 10:27:58 2017 -0800
@@ -66,7 +66,7 @@
if ((read = input.read()) == (-1)) {
break;
}
- if (read == 3 && currentState == State.BUFFER) {
+ if (read == 3 && getState() == State.BUFFER) {
stop.run();
} else {
write(read);
@@ -141,6 +141,10 @@
}
}
+ private synchronized State getState() {
+ return state;
+ }
+
private synchronized State waitInputNeeded() {
while (state == State.WAIT) {
try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Mon Jan 23 10:27:58 2017 -0800
@@ -49,6 +49,7 @@
import java.io.Writer;
import java.util.LinkedHashSet;
import java.util.Set;
+import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
import jdk.jshell.Key.ErroneousKey;
import jdk.jshell.Key.MethodKey;
import jdk.jshell.Key.TypeDeclKey;
@@ -58,7 +59,6 @@
import jdk.jshell.TaskFactory.BaseTask;
import jdk.jshell.TaskFactory.CompileTask;
import jdk.jshell.TaskFactory.ParseTask;
-import jdk.jshell.TreeDissector.ExpressionInfo;
import jdk.jshell.Wrap.Range;
import jdk.jshell.Snippet.Status;
import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
@@ -296,7 +296,7 @@
private List<Snippet> processExpression(String userSource, String compileSource) {
String name = null;
- ExpressionInfo ei = typeOfExpression(compileSource);
+ ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(compileSource, state);
ExpressionTree assignVar;
Wrap guts;
Snippet snip;
@@ -499,16 +499,6 @@
return singletonList(snip);
}
- private ExpressionInfo typeOfExpression(String expression) {
- Wrap guts = Wrap.methodReturnWrap(expression);
- TaskFactory.AnalyzeTask at = trialCompile(guts);
- if (!at.hasErrors() && at.firstCuTree() != null) {
- return TreeDissector.createByFirstClass(at)
- .typeOfReturnStatement(at, state);
- }
- return null;
- }
-
/**
* Should a temp var wrap the expression. TODO make this user configurable.
*
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ExpressionToTypeInfo.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,216 @@
+/*
+ * 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. 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.jshell;
+
+import com.sun.source.tree.ReturnTree;
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ConditionalExpressionTree;
+import com.sun.source.tree.ExpressionTree;
+import com.sun.source.tree.MethodTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.TreePath;
+import com.sun.source.util.TreePathScanner;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Types;
+import jdk.jshell.TaskFactory.AnalyzeTask;
+
+/**
+ * Compute information about an expression string, particularly its type name.
+ */
+class ExpressionToTypeInfo {
+
+ private static final String OBJECT_TYPE_NAME = "Object";
+
+ final AnalyzeTask at;
+ final CompilationUnitTree cu;
+ final JShell state;
+ final Symtab syms;
+ final Types types;
+
+ private ExpressionToTypeInfo(AnalyzeTask at, CompilationUnitTree cu, JShell state) {
+ this.at = at;
+ this.cu = cu;
+ this.state = state;
+ this.syms = Symtab.instance(at.context);
+ this.types = Types.instance(at.context);
+ }
+
+ public static class ExpressionInfo {
+ ExpressionTree tree;
+ String typeName;
+ boolean isNonVoid;
+ }
+
+ // return mechanism and other general structure from TreePath.getPath()
+ private static class Result extends Error {
+
+ static final long serialVersionUID = -5942088234594905629L;
+ final TreePath expressionPath;
+
+ Result(TreePath path) {
+ this.expressionPath = path;
+ }
+ }
+
+ private static class PathFinder extends TreePathScanner<TreePath, Boolean> {
+
+ // Optimize out imports etc
+ @Override
+ public TreePath visitCompilationUnit(CompilationUnitTree node, Boolean isTargetContext) {
+ return scan(node.getTypeDecls(), isTargetContext);
+ }
+
+ // Only care about members
+ @Override
+ public TreePath visitClass(ClassTree node, Boolean isTargetContext) {
+ return scan(node.getMembers(), isTargetContext);
+ }
+
+ // Only want the doit method where the code is
+ @Override
+ public TreePath visitMethod(MethodTree node, Boolean isTargetContext) {
+ if (Util.isDoIt(node.getName())) {
+ return scan(node.getBody(), true);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public TreePath visitReturn(ReturnTree node, Boolean isTargetContext) {
+ ExpressionTree tree = node.getExpression();
+ TreePath tp = new TreePath(getCurrentPath(), tree);
+ if (isTargetContext) {
+ throw new Result(tp);
+ } else {
+ return null;
+ }
+ }
+ }
+
+ private Type pathToType(TreePath tp) {
+ return (Type) at.trees().getTypeMirror(tp);
+ }
+
+ private Type pathToType(TreePath tp, Tree tree) {
+ if (tree instanceof ConditionalExpressionTree) {
+ // Conditionals always wind up as Object -- this corrects
+ ConditionalExpressionTree cet = (ConditionalExpressionTree) tree;
+ Type tmt = pathToType(new TreePath(tp, cet.getTrueExpression()));
+ Type tmf = pathToType(new TreePath(tp, cet.getFalseExpression()));
+ if (!tmt.isPrimitive() && !tmf.isPrimitive()) {
+ Type lub = types.lub(tmt, tmf);
+ // System.err.printf("cond ? %s : %s -- lub = %s\n",
+ // varTypeName(tmt), varTypeName(tmf), varTypeName(lub));
+ return lub;
+ }
+ }
+ return pathToType(tp);
+ }
+
+ /**
+ * Entry method: get expression info
+ * @param code the expression as a string
+ * @param state a JShell instance
+ * @return type information
+ */
+ public static ExpressionInfo expressionInfo(String code, JShell state) {
+ if (code == null || code.isEmpty()) {
+ return null;
+ }
+ try {
+ OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodReturnWrap(code));
+ AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
+ CompilationUnitTree cu = at.firstCuTree();
+ if (at.hasErrors() || cu == null) {
+ return null;
+ }
+ return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+ private ExpressionInfo typeOfExpression() {
+ return treeToInfo(findExpressionPath());
+ }
+
+ private TreePath findExpressionPath() {
+ try {
+ new PathFinder().scan(new TreePath(cu), false);
+ } catch (Result result) {
+ return result.expressionPath;
+ }
+ return null;
+ }
+
+ private ExpressionInfo treeToInfo(TreePath tp) {
+ if (tp != null) {
+ Tree tree = tp.getLeaf();
+ if (tree instanceof ExpressionTree) {
+ ExpressionInfo ei = new ExpressionInfo();
+ ei.tree = (ExpressionTree) tree;
+ Type type = pathToType(tp, tree);
+ if (type != null) {
+ switch (type.getKind()) {
+ case VOID:
+ case NONE:
+ case ERROR:
+ case OTHER:
+ break;
+ case NULL:
+ ei.isNonVoid = true;
+ ei.typeName = OBJECT_TYPE_NAME;
+ break;
+ default: {
+ ei.isNonVoid = true;
+ ei.typeName = varTypeName(type);
+ if (ei.typeName == null) {
+ ei.typeName = OBJECT_TYPE_NAME;
+ }
+ break;
+ }
+ }
+ }
+ return ei;
+ }
+ }
+ return null;
+ }
+
+ private String varTypeName(Type type) {
+ try {
+ TypePrinter tp = new VarTypePrinter(at.messages(),
+ state.maps::fullClassNameAndPackageToClass, syms, types);
+ return tp.toString(type);
+ } catch (Exception ex) {
+ return null;
+ }
+ }
+
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Mon Jan 23 10:27:58 2017 -0800
@@ -105,7 +105,6 @@
import java.util.stream.Collectors;
import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toCollection;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
@@ -128,6 +127,7 @@
import javax.tools.JavaFileManager.Location;
import javax.tools.StandardLocation;
+import jdk.jshell.ExpressionToTypeInfo.ExpressionInfo;
import static jdk.jshell.Util.REPL_DOESNOTMATTER_CLASS_NAME;
import static jdk.jshell.SourceCodeAnalysis.Completeness.DEFINITELY_INCOMPLETE;
import static jdk.jshell.TreeDissector.printType;
@@ -1430,47 +1430,17 @@
@Override
public String analyzeType(String code, int cursor) {
- code = code.substring(0, cursor);
- CompletionInfo completionInfo = analyzeCompletion(code);
- if (!completionInfo.completeness().isComplete())
- return null;
- if (completionInfo.completeness() == Completeness.COMPLETE_WITH_SEMI) {
- code += ";";
- }
-
- OuterWrap codeWrap;
switch (guessKind(code)) {
case IMPORT: case METHOD: case CLASS: case ENUM:
case INTERFACE: case ANNOTATION_TYPE: case VARIABLE:
return null;
default:
- codeWrap = proc.outerMap.wrapInTrialClass(Wrap.methodWrap(code));
break;
}
- AnalyzeTask at = proc.taskFactory.new AnalyzeTask(codeWrap);
- SourcePositions sp = at.trees().getSourcePositions();
- CompilationUnitTree topLevel = at.firstCuTree();
- int pos = codeWrap.snippetIndexToWrapIndex(code.length());
- TreePath tp = pathFor(topLevel, sp, pos);
- while (ExpressionTree.class.isAssignableFrom(tp.getParentPath().getLeaf().getKind().asInterface()) &&
- tp.getParentPath().getLeaf().getKind() != Kind.ERRONEOUS &&
- tp.getParentPath().getParentPath() != null)
- tp = tp.getParentPath();
- TypeMirror type = at.trees().getTypeMirror(tp);
-
- if (type == null)
- return null;
-
- switch (type.getKind()) {
- case ERROR: case NONE: case OTHER:
- case PACKAGE: case VOID:
- return null; //not usable
- case NULL:
- type = at.getElements().getTypeElement("java.lang.Object").asType();
- break;
- }
-
- return TreeDissector.printType(at, proc, type);
+ ExpressionInfo ei = ExpressionToTypeInfo.expressionInfo(code, proc);
+ return (ei == null || !ei.isNonVoid)
+ ? null
+ : ei.typeName;
}
@Override
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TaskFactory.java Mon Jan 23 10:27:58 2017 -0800
@@ -321,7 +321,7 @@
final JavacTaskImpl task;
private DiagList diags = null;
private final SourceHandler<?> sourceHandler;
- private final Context context = new Context();
+ final Context context = new Context();
private Types types;
private JavacMessages messages;
private Trees trees;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TreeDissector.java Mon Jan 23 10:27:58 2017 -0800
@@ -28,14 +28,11 @@
import com.sun.source.tree.ClassTree;
import com.sun.source.tree.CompilationUnitTree;
-import com.sun.source.tree.ExpressionTree;
import com.sun.source.tree.MethodTree;
-import com.sun.source.tree.ReturnTree;
import com.sun.source.tree.StatementTree;
import com.sun.source.tree.Tree;
import com.sun.source.tree.VariableTree;
import com.sun.source.util.SourcePositions;
-import com.sun.source.util.TreePath;
import com.sun.source.util.Trees;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.code.Type.MethodType;
@@ -47,7 +44,6 @@
import jdk.jshell.Wrap.Range;
import java.util.List;
-import java.util.Locale;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -61,16 +57,6 @@
class TreeDissector {
- private static final String OBJECT_TYPE = "Object";
-
- static class ExpressionInfo {
-
- boolean isNonVoid;
- String typeName;
- ExpressionTree tree;
- String signature;
- }
-
private final TaskFactory.BaseTask bt;
private final ClassTree targetClass;
private final CompilationUnitTree targetCompilationUnit;
@@ -219,41 +205,6 @@
return null;
}
-
- ExpressionInfo typeOfReturnStatement(AnalyzeTask at, JShell state) {
- ExpressionInfo ei = new ExpressionInfo();
- Tree unitTree = firstStatement();
- if (unitTree instanceof ReturnTree) {
- ei.tree = ((ReturnTree) unitTree).getExpression();
- if (ei.tree != null) {
- TreePath viPath = trees().getPath(targetCompilationUnit, ei.tree);
- if (viPath != null) {
- TypeMirror tm = trees().getTypeMirror(viPath);
- if (tm != null) {
- ei.typeName = printType(at, state, tm);
- switch (tm.getKind()) {
- case VOID:
- case NONE:
- case ERROR:
- case OTHER:
- break;
- case NULL:
- ei.isNonVoid = true;
- ei.typeName = OBJECT_TYPE;
- break;
- default: {
- ei.isNonVoid = true;
- break;
-
- }
- }
- }
- }
- }
- }
- return ei;
- }
-
String typeOfMethod(MethodSnippet msn) {
Tree unitTree = method(msn);
if (unitTree instanceof JCMethodDecl) {
@@ -274,8 +225,13 @@
public static String printType(AnalyzeTask at, JShell state, TypeMirror type) {
Type typeImpl = (Type) type;
- TypePrinter tp = new TypePrinter(at.messages(), state.maps::fullClassNameAndPackageToClass, typeImpl);
- return tp.visit(typeImpl, Locale.getDefault());
+ try {
+ TypePrinter tp = new TypePrinter(at.messages(),
+ state.maps::fullClassNameAndPackageToClass);
+ return tp.toString(typeImpl);
+ } catch (Exception ex) {
+ return null;
+ }
}
/**
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/TypePrinter.java Mon Jan 23 10:27:58 2017 -0800
@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package jdk.jshell;
import static com.sun.tools.javac.code.Flags.COMPOUND;
@@ -41,17 +40,21 @@
* Print types in source form.
*/
class TypePrinter extends Printer {
+
private static final String OBJECT = "Object";
private final JavacMessages messages;
private final BinaryOperator<String> fullClassNameAndPackageToClass;
- private boolean useWildCard = false;
- TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass, Type typeToPrint) {
+ TypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass) {
this.messages = messages;
this.fullClassNameAndPackageToClass = fullClassNameAndPackageToClass;
}
+ String toString(Type t) {
+ return visit(t, Locale.getDefault());
+ }
+
@Override
protected String localize(Locale locale, String key, Object... args) {
return messages.getLocalizedString(locale, key, args);
@@ -68,18 +71,6 @@
}
@Override
- public String visitWildcardType(Type.WildcardType wt, Locale locale) {
- if (useWildCard) { // at TypeArgument(ex: List<? extends T>)
- return super.visitWildcardType(wt, locale);
- } else { // at TopLevelType(ex: ? extends List<T>, ? extends Number[][])
- Type extendsBound = wt.getExtendsBound();
- return extendsBound == null
- ? OBJECT
- : visit(extendsBound, locale);
- }
- }
-
- @Override
public String visitType(Type t, Locale locale) {
String s = (t.tsym == null || t.tsym.name == null)
? OBJECT // none
@@ -87,20 +78,9 @@
return s;
}
- @Override
- public String visitClassType(ClassType ct, Locale locale) {
- boolean prevUseWildCard = useWildCard;
- try {
- useWildCard = true;
- return super.visitClassType(ct, locale);
- } finally {
- useWildCard = prevUseWildCard;
- }
- }
-
/**
- * Converts a class name into a (possibly localized) string. Anonymous
- * inner classes get converted into a localized string.
+ * Converts a class name into a (possibly localized) string. Anonymous inner
+ * classes get converted into a localized string.
*
* @param t the type of the class whose name is to be rendered
* @param longform if set, the class' fullname is displayed - if unset the
@@ -112,21 +92,13 @@
protected String className(ClassType t, boolean longform, Locale locale) {
Symbol sym = t.tsym;
if (sym.name.length() == 0 && (sym.flags() & COMPOUND) != 0) {
- /***
- StringBuilder s = new StringBuilder(visit(t.supertype_field, locale));
- for (List<Type> is = t.interfaces_field; is.nonEmpty(); is = is.tail) {
- s.append('&');
- s.append(visit(is.head, locale));
- }
- return s.toString();
- ***/
return OBJECT;
} else if (sym.name.length() == 0) {
// Anonymous
String s;
ClassType norm = (ClassType) t.tsym.type;
if (norm == null) {
- s = "object";
+ s = OBJECT;
} else if (norm.interfaces_field != null && norm.interfaces_field.nonEmpty()) {
s = visit(norm.interfaces_field.head, locale);
} else {
@@ -160,7 +132,7 @@
@Override
public String visitPackageSymbol(PackageSymbol s, Locale locale) {
return s.isUnnamed()
- ? "" // Unnamed package
+ ? "" // Unnamed package
: s.fullname.toString();
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java Mon Jan 23 10:27:58 2017 -0800
@@ -46,6 +46,7 @@
import static java.util.stream.Collectors.toSet;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
+import static jdk.internal.jshell.debug.InternalDebugControl.DBG_WRAP;
import static jdk.jshell.Snippet.Status.OVERWRITTEN;
import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
@@ -180,6 +181,8 @@
.collect(toList());
// Set the outer wrap for this snippet
si.setOuterWrap(state.outerMap.wrapInClass(except, plus, snippets, wraps));
+ state.debug(DBG_WRAP, "++setWrap() %s\n%s\n",
+ si, si.outerWrap().wrapped());
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/VarTypePrinter.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,265 @@
+/*
+ * 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. 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.jshell;
+
+import java.util.HashSet;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.util.JavacMessages;
+import java.util.Locale;
+import java.util.Set;
+import java.util.function.BinaryOperator;
+import com.sun.tools.javac.code.BoundKind;
+import com.sun.tools.javac.code.Flags;
+import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type.CapturedType;
+import com.sun.tools.javac.code.Type.TypeMapping;
+import com.sun.tools.javac.code.Type.TypeVar;
+import com.sun.tools.javac.code.Type.WildcardType;
+import com.sun.tools.javac.code.Types;
+import com.sun.tools.javac.code.Types.SimpleVisitor;
+import com.sun.tools.javac.util.List;
+import static com.sun.tools.javac.code.BoundKind.EXTENDS;
+import static com.sun.tools.javac.code.BoundKind.SUPER;
+import static com.sun.tools.javac.code.BoundKind.UNBOUND;
+import static com.sun.tools.javac.code.Type.ArrayType;
+import static com.sun.tools.javac.code.TypeTag.BOT;
+import static com.sun.tools.javac.code.TypeTag.WILDCARD;
+
+/**
+ * Print variable types in source form.
+ * TypeProjection and CaptureScanner are copied from Types in the JEP-286
+ * Sandbox by Maurizio. The checks for Non-Denotable in TypePrinter are
+ * cribbed from denotableChecker of the same source.
+ *
+ * @author Maurizio Cimadamore
+ * @author Robert Field
+ */
+class VarTypePrinter extends TypePrinter {
+ private static final String WILD = "?";
+
+ private final Symtab syms;
+ private final Types types;
+
+ VarTypePrinter(JavacMessages messages, BinaryOperator<String> fullClassNameAndPackageToClass,
+ Symtab syms, Types types) {
+ super(messages, fullClassNameAndPackageToClass);
+ this.syms = syms;
+ this.types = types;
+ }
+
+ @Override
+ String toString(Type t) {
+ return super.toString(upward(t));
+ }
+
+ @Override
+ public String visitTypeVar(TypeVar t, Locale locale) {
+ /* Any type variable mentioned in the inferred type must have been declared as a type parameter
+ (i.e cannot have been produced by inference (18.4))
+ */
+ // and beyond that, there are no global type vars, so if there are any
+ // type variables left, they need to be eliminated
+ return WILD; // Non-denotable
+ }
+
+ @Override
+ public String visitCapturedType(CapturedType t, Locale locale) {
+ /* Any type variable mentioned in the inferred type must have been declared as a type parameter
+ (i.e cannot have been produced by capture conversion (5.1.10))
+ */
+ return WILD; // Non-denotable
+ }
+
+ public Type upward(Type t) {
+ List<Type> captures = captures(t);
+ return upward(t, captures);
+ }
+
+ /************* Following from JEP-286 Types.java ***********/
+
+ public Type upward(Type t, List<Type> vars) {
+ return t.map(new TypeProjection(vars), true);
+ }
+
+ public List<Type> captures(Type t) {
+ CaptureScanner cs = new CaptureScanner();
+ Set<Type> captures = new HashSet<>();
+ cs.visit(t, captures);
+ return List.from(captures);
+ }
+
+ class CaptureScanner extends SimpleVisitor<Void, Set<Type>> {
+
+ @Override
+ public Void visitType(Type t, Set<Type> types) {
+ return null;
+ }
+
+ @Override
+ public Void visitClassType(ClassType t, Set<Type> seen) {
+ if (t.isCompound()) {
+ types.directSupertypes(t).forEach(s -> visit(s, seen));
+ } else {
+ t.allparams().forEach(ta -> visit(ta, seen));
+ }
+ return null;
+ }
+
+ @Override
+ public Void visitArrayType(ArrayType t, Set<Type> seen) {
+ return visit(t.elemtype, seen);
+ }
+
+ @Override
+ public Void visitWildcardType(WildcardType t, Set<Type> seen) {
+ visit(t.type, seen);
+ return null;
+ }
+
+ @Override
+ public Void visitTypeVar(TypeVar t, Set<Type> seen) {
+ if ((t.tsym.flags() & Flags.SYNTHETIC) != 0 && seen.add(t)) {
+ visit(t.getUpperBound(), seen);
+ }
+ return null;
+ }
+
+ @Override
+ public Void visitCapturedType(CapturedType t, Set<Type> seen) {
+ if (seen.add(t)) {
+ visit(t.getUpperBound(), seen);
+ visit(t.getLowerBound(), seen);
+ }
+ return null;
+ }
+ }
+
+ class TypeProjection extends TypeMapping<Boolean> {
+
+ List<Type> vars;
+ Set<Type> seen = new HashSet<>();
+
+ public TypeProjection(List<Type> vars) {
+ this.vars = vars;
+ }
+
+ @Override
+ public Type visitClassType(ClassType t, Boolean upward) {
+ if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
+ //lift anonymous class type to first supertype (class or interface)
+ return types.directSupertypes(t).last();
+ } else if (t.isCompound()) {
+ List<Type> components = types.directSupertypes(t);
+ List<Type> components1 = components.map(c -> c.map(this, upward));
+ if (components == components1) return t;
+ else return types.makeIntersectionType(components1);
+ } else {
+ Type outer = t.getEnclosingType();
+ Type outer1 = visit(outer, upward);
+ List<Type> typarams = t.getTypeArguments();
+ List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
+ if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
+ //not defined
+ return syms.botType;
+ }
+ if (outer1 == outer && typarams1 == typarams) return t;
+ else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
+ @Override
+ protected boolean needsStripping() {
+ return true;
+ }
+ };
+ }
+ }
+
+ protected Type makeWildcard(Type upper, Type lower) {
+ BoundKind bk;
+ Type bound;
+ if (upper.hasTag(BOT)) {
+ upper = syms.objectType;
+ }
+ boolean isUpperObject = types.isSameType(upper, syms.objectType);
+ if (!lower.hasTag(BOT) && isUpperObject) {
+ bound = lower;
+ bk = SUPER;
+ } else {
+ bound = upper;
+ bk = isUpperObject ? UNBOUND : EXTENDS;
+ }
+ return new WildcardType(bound, bk, syms.boundClass);
+ }
+
+ @Override
+ public Type visitTypeVar(TypeVar t, Boolean upward) {
+ if (vars.contains(t)) {
+ try {
+ if (seen.add(t)) {
+ return (upward ?
+ t.getUpperBound() :
+ (t.getLowerBound() == null) ?
+ syms.botType :
+ t.getLowerBound())
+ .map(this, upward);
+ } else {
+ //cycle
+ return syms.objectType;
+ }
+ } finally {
+ seen.remove(t);
+ }
+ } else {
+ return t;
+ }
+ }
+
+ @Override
+ public Type visitWildcardType(WildcardType wt, Boolean upward) {
+ if (upward) {
+ return wt.isExtendsBound() ?
+ wt.type.map(this, upward) :
+ syms.objectType;
+ } else {
+ return wt.isSuperBound() ?
+ wt.type.map(this, upward) :
+ syms.botType;
+ }
+ }
+
+ private Type mapTypeArgument(Type t, boolean upward) {
+ if (!t.containsAny(vars)) {
+ return t;
+ } else if (!t.hasTag(WILDCARD) && !upward) {
+ //not defined
+ return syms.botType;
+ } else {
+ Type upper = t.map(this, upward);
+ Type lower = t.map(this, !upward);
+ return makeWildcard(upper, lower);
+ }
+ }
+ }
+}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DefaultLoaderDelegate.java Mon Jan 23 10:27:58 2017 -0800
@@ -115,12 +115,6 @@
}
@Override
- public void setClasspath(String path)
- throws EngineTerminationException, InternalException {
- throw new NotImplementedException("setClasspath: Not supported yet.");
- }
-
- @Override
public Class<?> findClass(String name) throws ClassNotFoundException {
Class<?> klass = klasses.get(name);
if (klass == null) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/DirectExecutionControl.java Mon Jan 23 10:27:58 2017 -0800
@@ -131,12 +131,6 @@
loaderDelegate.addToClasspath(cp);
}
- @Override
- public void setClasspath(String path)
- throws EngineTerminationException, InternalException {
- loaderDelegate.setClasspath(path);
- }
-
/**
* {@inheritDoc}
* <p>
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/ExecutionControlForwarder.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/ExecutionControlForwarder.java Mon Jan 23 10:27:58 2017 -0800
@@ -147,12 +147,6 @@
ec.addToClasspath(cp);
return writeSuccess();
}
- case CMD_SET_CLASSPATH: {
- // Set the claspath
- String cp = in.readUTF();
- ec.setClasspath(cp);
- return writeSuccess();
- }
case CMD_STOP: {
// Stop the current execution
try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java Mon Jan 23 10:27:58 2017 -0800
@@ -60,16 +60,6 @@
throws EngineTerminationException, InternalException;
/**
- * Sets the execution class path to the specified path.
- *
- * @param path the path to add
- * @throws EngineTerminationException the execution engine has terminated
- * @throws InternalException an internal problem occurred
- */
- void setClasspath(String path)
- throws EngineTerminationException, InternalException;
-
- /**
* Finds the class with the specified binary name.
*
* @param name the binary name of the class
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteCodes.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/RemoteCodes.java Mon Jan 23 10:27:58 2017 -0800
@@ -66,10 +66,6 @@
*/
static final String CMD_ADD_CLASSPATH = "CMD_ADD_CLASSPATH";
/**
- * Set the class-path.
- */
- static final String CMD_SET_CLASSPATH = "CMD_SET_CLASSPATH";
- /**
* Stop an invoke.
*/
static final String CMD_STOP = "CMD_STOP";
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/StreamingExecutionControl.java Mon Jan 23 10:27:58 2017 -0800
@@ -137,21 +137,6 @@
}
@Override
- public void setClasspath(String path)
- throws EngineTerminationException, InternalException {
- try {
- // Send the classpath addition command to the remote agent.
- writeCommand(CMD_SET_CLASSPATH);
- out.writeUTF(path);
- out.flush();
- // Retrieve and report results from the remote agent.
- readAndReportClassSimpleResult();
- } catch (IOException ex) {
- throw new EngineTerminationException("Exception writing remote set classpath: " + ex);
- }
- }
-
- @Override
public void stop()
throws EngineTerminationException, InternalException {
try {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/spi/ExecutionControl.java Mon Jan 23 10:27:58 2017 -0800
@@ -118,16 +118,6 @@
throws EngineTerminationException, InternalException;
/**
- * Sets the execution class path to the specified path.
- *
- * @param path the path to add
- * @throws EngineTerminationException the execution engine has terminated
- * @throws InternalException an internal problem occurred
- */
- void setClasspath(String path)
- throws EngineTerminationException, InternalException;
-
- /**
* Interrupts a running invoke.
*
* @throws EngineTerminationException the execution engine has terminated
--- a/langtools/test/jdk/jshell/CompletionSuggestionTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/jdk/jshell/CompletionSuggestionTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -673,6 +673,7 @@
keepParameterNames.set(getAnalysis(), new String[0]);
}
+ @Test(enabled = false) //TODO 8171829
public void testBrokenClassFile2() throws IOException {
Path broken = outDir.resolve("broken");
compiler.compile(broken,
--- a/langtools/test/jdk/jshell/KullaTesting.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/jdk/jshell/KullaTesting.java Mon Jan 23 10:27:58 2017 -0800
@@ -99,7 +99,6 @@
private Map<String, Snippet> idToSnippet = new LinkedHashMap<>();
private Set<Snippet> allSnippets = new LinkedHashSet<>();
- private List<String> classpath;
static {
JShell js = JShell.create();
@@ -159,7 +158,6 @@
}
public void addToClasspath(String path) {
- classpath.add(path);
getState().addToClasspath(path);
}
@@ -200,7 +198,6 @@
state = builder.build();
allSnippets = new LinkedHashSet<>();
idToSnippet = new LinkedHashMap<>();
- classpath = new ArrayList<>();
}
@AfterMethod
@@ -210,7 +207,6 @@
analysis = null;
allSnippets = null;
idToSnippet = null;
- classpath = null;
}
public ClassLoader createAndRunFromModule(String moduleName, Path modPath) {
--- a/langtools/test/jdk/jshell/StopExecutionTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/jdk/jshell/StopExecutionTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8171385
* @summary Test JShell#stop
* @modules jdk.jshell/jdk.internal.jshell.tool
* @build KullaTesting TestingInputStream
@@ -30,9 +31,13 @@
*/
import java.io.IOException;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.function.Consumer;
import jdk.internal.jshell.tool.StopDetectingInputStream;
import jdk.internal.jshell.tool.StopDetectingInputStream.State;
@@ -128,4 +133,31 @@
}
}
+ public void testStopDetectingInputBufferWaitStop() throws Exception {
+ Runnable shouldNotHappenRun =
+ () -> { throw new AssertionError("Should not happen."); };
+ Consumer<Exception> shouldNotHappenExc =
+ exc -> { throw new AssertionError("Should not happen.", exc); };
+ StopDetectingInputStream sd = new StopDetectingInputStream(shouldNotHappenRun, shouldNotHappenExc);
+ CountDownLatch reading = new CountDownLatch(1);
+ PipedInputStream is = new PipedInputStream() {
+ @Override
+ public int read() throws IOException {
+ reading.countDown();
+ return super.read();
+ }
+ };
+ PipedOutputStream os = new PipedOutputStream(is);
+
+ sd.setInputStream(is);
+ sd.setState(State.BUFFER);
+ reading.await();
+ sd.setState(State.WAIT);
+ os.write(3);
+ int value = sd.read();
+
+ if (value != 3) {
+ throw new AssertionError();
+ }
+ }
}
--- a/langtools/test/jdk/jshell/TypeNameTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/jdk/jshell/TypeNameTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -23,81 +23,229 @@
/*
* @test
- * @bug 8144903
+ * @bug 8144903 8171981
* @summary Tests for determining the type from the expression
* @build KullaTesting TestingInputStream
* @run testng TypeNameTest
*/
-import jdk.jshell.Snippet;
-import jdk.jshell.VarSnippet;
import org.testng.annotations.Test;
-import static jdk.jshell.Snippet.Status.VALID;
import static org.testng.Assert.assertEquals;
@Test
public class TypeNameTest extends KullaTesting {
- public void testReplClassName() {
- assertEval("class C {}");
- VarSnippet sn = (VarSnippet) varKey(assertEval("new C();"));
- assertEquals(sn.typeName(), "C");
+
+ private void assertType(String expr, String type) {
+ assertEquals(varKey(assertEval(expr)).typeName(), type);
+ assertInferredType(expr, type);
+ }
+
+ public void testTypeInference() {
+ assertEval("import java.util.List;");
+ assertEval("import java.util.ArrayList;");
+ assertEval("import java.util.Arrays;");
+
+ assertType("new Object().getClass().getSuperclass() ", "Class<?>");
+ assertType("new ArrayList().getClass().getSuperclass()", "Class<?>");
+ assertType("new ArrayList().getClass()", "Class<? extends ArrayList>");
+ assertType("ArrayList.class", "Class<ArrayList>");
+ assertType("ArrayList.class.getSuperclass()", "Class<? super ArrayList>");
+
+ assertEval("class D<T extends CharSequence> { D<? super T> getS() { return null; } }");
+ assertEval("D<?> d = new D<String>();");
+ assertType("d.getS()", "D<? extends CharSequence>");
+ assertType("null", "Object");
+ assertType("Class.forName( \"java.util.ArrayList\" )", "Class<?>");
+ assertType("new ArrayList<Boolean>() {}", "ArrayList<Boolean>");
+ assertType("new ArrayList<String>().stream()", "java.util.stream.Stream<String>");
+ assertType("Arrays.asList( 1, 2, 3)", "List<Integer>");
+ assertType("new ArrayList().getClass().getClass()", "Class<? extends Class>");
+
+ assertEval("interface A {}");
+ assertEval("interface I {}");
+ assertEval("interface J extends A, I {}");
+ assertEval("interface K extends A, I {}");
+ assertEval("class P<T extends A & I> {}");
+ assertType("(P<?>) null", "P<? extends Object>");
+ }
+
+ public void testConditionals() {
+ assertEval("import java.util.List;");
+ assertEval("import java.util.ArrayList;");
+ assertEval("import java.util.Arrays;");
+
+ assertEval("CharSequence cs = \"hi\";");
+ assertEval("String st = \"low\";");
+ assertEval("boolean b;");
+ assertType("b? cs : st", "CharSequence");
+
+ assertEval("List<String> l1 = Arrays.asList(\"hi\");");
+ assertEval("List<? extends String> l2 = Arrays.asList(\"po\");");
+ assertType("b? l1.get(0) : l2.get(0)", "String");
+
+ assertEval("class X {}");
+ assertEval("class B extends X {}");
+ assertEval("class C extends X {}");
+ assertType("b? new B() : new C()", "X");
+ }
+
+ public void testJEP286NonDenotable() {
+ assertEval("import java.util.List;");
+ assertEval("import java.util.Arrays;");
+ assertEval("import java.util.Iterator;");
+
+ assertEval("List<? extends String> extString() { return Arrays.asList( \"hi\", \"low\" ); }");
+ assertEval("List<? super String> supString() { return Arrays.asList( \"hi\", \"low\" ); }");
+ assertEval("List<?> unbString() { return Arrays.asList( \"hi\", \"low\" ); }");
+ assertEval("List<? extends String>[] extStringArr() {" +
+ " @SuppressWarnings(\"unchecked\") " +
+ "List<? extends String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+ assertEval("List<? super String>[] supStringArr() {" +
+ " @SuppressWarnings(\"unchecked\") " +
+ "List<? super String>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+ assertEval("List<?>[] unbStringArr() {" +
+ " @SuppressWarnings(\"unchecked\") " +
+ "List<?>[] a = new List[1]; a[0] = Arrays.asList(\"hi\"); return a; }");
+ assertEval("Iterable<? extends List<? extends String>> extStringIter() {" +
+ "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+ assertEval("Iterable<? extends List<? super String>> supStringIter() {" +
+ "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+ assertEval("Iterable<? extends List<?>> unbStringIter() {" +
+ "return Arrays.asList( Arrays.asList( \"hi\" ) ); }");
+ assertType("extString()", "List<? extends String>");
+ assertType("extString().get(0)", "String");
+ assertType("supString()", "List<? super String>");
+ assertType("supString().get(0)", "Object");
+ assertType("unbString()", "List<?>");
+ assertType("unbString().get(0)", "Object");
+ assertType("supStringArr()", "List<? super String>[]");
+ assertType("supStringArr()[0]", "List<? super String>");
+ assertType("supStringArr()[0].get(0)", "Object");
+ assertType("unbStringArr()", "List<?>[]");
+ assertType("unbStringArr()[0]", "List<?>");
+ assertType("unbStringArr()[0].get(0)", "Object");
+ assertType("extStringIter()", "Iterable<? extends List<? extends String>>");
+ assertType("extStringIter().iterator()", "Iterator<? extends List<? extends String>>");
+ assertType("extStringIter().iterator().next()", "List<? extends String>");
+ assertType("extStringIter().iterator().next().get(0)", "String");
+ assertType("supStringIter()", "Iterable<? extends List<? super String>>");
+ assertType("supStringIter().iterator()", "Iterator<? extends List<? super String>>");
+ assertType("supStringIter().iterator().next()", "List<? super String>");
+ assertType("supStringIter().iterator().next().get(0)", "Object");
+ assertType("unbStringIter()", "Iterable<? extends List<?>>");
+ assertType("unbStringIter().iterator()", "Iterator<? extends List<?>>");
+ assertType("unbStringIter().iterator().next()", "List<?>");
+ assertType("unbStringIter().iterator().next().get(0)", "Object");
+ }
+
+ public void testJEP286NonDenotable2() {
+ assertEval("import java.util.List;");
+ assertEval("import java.util.Arrays;");
+ assertEval("import java.lang.reflect.Array;");
+
+ assertEval("<Z extends Comparable<Z>> List<? extends Z> extFbound() {" +
+ "return Arrays.asList( (Z)null ); }");
+ assertEval("<Z extends Comparable<Z>> List<? super Z> supFbound() {" +
+ "return Arrays.asList( (Z)null ); }");
+ assertEval("<Z extends Comparable<Z>> List<? extends Z>[] extFboundArr() {" +
+ "@SuppressWarnings(\"unchecked\")" +
+ "List<? extends Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
+ assertEval("<Z extends Comparable<Z>> List<? super Z>[] supFboundArr() {" +
+ "@SuppressWarnings(\"unchecked\")" +
+ "List<? super Z>[] a = new List[1]; a[0] = Arrays.asList( (Z)null ); return a; }");
+ assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? extends Z>> extFboundIter() {" +
+ "return Arrays.asList( Arrays.asList( (Z)null ) ); }");
+ assertEval("<Z extends Comparable<Z>> Iterable<? extends List<? super Z>> supFboundIter() {" +
+ "return Arrays.asList( Arrays.asList( (Z)null ) ); }");
+ assertEval("<Z> List<Z> listOf(Z z) { return Arrays.asList( z ); }");
+ assertEval("<Z> Z[] arrayOf(Z z) {" +
+ "@SuppressWarnings(\"unchecked\")" +
+ "final Z[] a = (Z[]) Array.newInstance(z.getClass(), 1); a[0] = z; return a; }");
+ assertType("extFbound()", "List<? extends Comparable<?>>");
+ assertType("extFbound().get(0)", "Comparable<?>");
+ assertType("supFbound()", "List<?>");
+ assertType("supFbound().get(0)", "Object");
+ assertType("extFboundArr()", "List<? extends Comparable<?>>[]");
+ assertType("extFboundArr()[0]", "List<? extends Comparable<?>>");
+ assertType("extFboundArr()[0].get(0)", "Comparable<?>");
+ assertType("supFboundArr()", "List<?>[]");
+ assertType("supFboundArr()[0]", "List<?>");
+ assertType("supFboundArr()[0].get(0)", "Object");
+ assertType("extFboundIter()", "Iterable<? extends List<? extends Comparable<?>>>");
+ assertType("extFboundIter().iterator()", "java.util.Iterator<? extends List<? extends Comparable<?>>>");
+ assertType("extFboundIter().iterator().next()", "List<? extends Comparable<?>>");
+ assertType("extFboundIter().iterator().next().get(0)", "Comparable<?>");
+ assertType("supFboundIter()", "Iterable<? extends List<?>>");
+ assertType("supFboundIter().iterator()", "java.util.Iterator<? extends List<?>>");
+ assertType("supFboundIter().iterator().next()", "List<?>");
+ assertType("supFboundIter().iterator().next().get(0)", "Object");
+ assertType("listOf(23)", "List<Integer>");
+ assertType("listOf(true)", "List<Boolean>");
+ assertType("listOf(true).get(0)", "Boolean");
+ assertType("arrayOf(99)", "Integer[]");
+ assertType("arrayOf(99)[0]", "Integer");
+
+ assertEval("<Z> Z choose(Z z1, Z z2) { return z1; }");
+ assertType("choose(1, 1L);", "Object");
+ }
+
+ public void testVariableTypeName() {
+ assertType("\"x\"", "String");
+
+ assertType("java.util.regex.Pattern.compile(\"x\")", "java.util.regex.Pattern");
+ assertEval("import java.util.regex.*;");
+ assertType("java.util.regex.Pattern.compile(\"x\")", "Pattern");
+
+ assertType("new java.util.ArrayList()", "java.util.ArrayList");
+ assertEval("import java.util.ArrayList;");
+ assertType("new java.util.ArrayList()", "ArrayList");
+
+ assertType("java.util.Locale.Category.FORMAT", "java.util.Locale.Category");
+ assertEval("import static java.util.Locale.Category;");
+ assertType("java.util.Locale.Category.FORMAT", "Category");
}
public void testReplNestedClassName() {
assertEval("class D { static class E {} }");
- VarSnippet sn = (VarSnippet) varKey(assertEval("new D.E();"));
- assertEquals(sn.typeName(), "D.E");
+ assertType("new D.E();", "D.E");
}
public void testAnonymousClassName() {
assertEval("class C {}");
- VarSnippet sn = (VarSnippet) varKey(assertEval("new C() { int x; };"));
- assertEquals(sn.typeName(), "C");
+ assertType("new C();", "C");
+ assertType("new C() { int x; };", "C");
}
public void testCapturedTypeName() {
- VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass();"));
- assertEquals(sn.typeName(), "Class<? extends String>");
- }
-
- public void testArrayTypeOfCapturedTypeName() {
- VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getEnumConstants();"));
- assertEquals(sn.typeName(), "String[]");
+ assertType("\"\".getClass();", "Class<? extends String>");
+ assertType("\"\".getClass().getEnumConstants();", "String[]");
}
public void testJavaLang() {
- VarSnippet sn = (VarSnippet) varKey(assertEval("\"\";"));
- assertEquals(sn.typeName(), "String");
+ assertType("\"\";", "String");
}
public void testNotOverEagerPackageEating() {
- VarSnippet sn = (VarSnippet) varKey(assertEval("\"\".getClass().getDeclaredMethod(\"hashCode\");"));
- assertEquals(sn.typeName(), "java.lang.reflect.Method");
+ assertType("\"\".getClass().getDeclaredMethod(\"hashCode\");", "java.lang.reflect.Method");
}
public void testBounds() {
assertEval("java.util.List<? extends String> list1 = java.util.Arrays.asList(\"\");");
- VarSnippet sn1 = (VarSnippet) varKey(assertEval("list1.iterator().next()"));
- assertEquals(sn1.typeName(), "String");
+ assertType("list1.iterator().next()", "String");
assertEval("java.util.List<? super String> list2 = java.util.Arrays.asList(\"\");");
- VarSnippet sn2 = (VarSnippet) varKey(assertEval("list2.iterator().next()"));
- assertEquals(sn2.typeName(), "Object");
+ assertType("list2.iterator().next()", "Object");
assertEval("java.util.List<?> list3 = java.util.Arrays.asList(\"\");");
- VarSnippet sn3 = (VarSnippet) varKey(assertEval("list3.iterator().next()"));
- assertEquals(sn3.typeName(), "Object");
+ assertType("list3.iterator().next()", "Object");
assertEval("class Test1<X extends CharSequence> { public X get() { return null; } }");
- Snippet x = varKey(assertEval("Test1<?> test1 = new Test1<>();"));
- VarSnippet sn4 = (VarSnippet) varKey(assertEval("test1.get()"));
- assertEquals(sn4.typeName(), "Object");
+ assertEval("Test1<?> test1 = new Test1<>();");
+ assertType("test1.get()", "CharSequence");
assertEval("class Test2<X extends Number & CharSequence> { public X get() { return null; } }");
assertEval("Test2<?> test2 = new Test2<>();");
- VarSnippet sn5 = (VarSnippet) varKey(assertEval("test2.get()"));
- assertEquals(sn5.typeName(), "Object");
- assertEval("class Test3<T> { T[][] get() { return null; } }", added(VALID));
+ assertType("test2.get()", "Object");
+ assertEval("class Test3<T> { T[][] get() { return null; } }");
assertEval("Test3<? extends String> test3 = new Test3<>();");
- VarSnippet sn6 = (VarSnippet) varKey(assertEval("test3.get()"));
- assertEquals(sn6.typeName(), "String[][]");
+ assertType("test3.get()", "String[][]");
}
}
--- a/langtools/test/jdk/jshell/VariablesTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/jdk/jshell/VariablesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -337,20 +337,4 @@
assertEquals(unr.get(0), "class undefined");
assertVariables(variable("undefined", "d"));
}
-
- public void variableTypeName() {
- assertEquals(varKey(assertEval("\"x\"")).typeName(), "String");
-
- assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "java.util.regex.Pattern");
- assertEval("import java.util.regex.*;", added(VALID));
- assertEquals(varKey(assertEval("java.util.regex.Pattern.compile(\"x\")")).typeName(), "Pattern");
-
- assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "java.util.ArrayList");
- assertEval("import java.util.ArrayList;", added(VALID));
- assertEquals(varKey(assertEval("new java.util.ArrayList()")).typeName(), "ArrayList");
-
- assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "java.util.Locale.Category");
- assertEval("import static java.util.Locale.Category;", added(VALID));
- assertEquals(varKey(assertEval("java.util.Locale.Category.FORMAT")).typeName(), "Category");
- }
}
--- a/langtools/test/tools/javac/T5003235/T5003235a.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/T5003235/T5003235a.java Mon Jan 23 10:27:58 2017 -0800
@@ -3,7 +3,7 @@
* @bug 5003235
* @summary Private inner class accessible from subclasses
* @author Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235a.out --diags:layout=%b:%l:%_%m T5003235a.java
+ * @compile/fail/ref=T5003235a.out -XDrawDiagnostics T5003235a.java
*/
class Super {
--- a/langtools/test/tools/javac/T5003235/T5003235a.out Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/T5003235/T5003235a.out Mon Jan 23 10:27:58 2017 -0800
@@ -1,13 +1,5 @@
-T5003235a.java:21: defaultM() in Super.Inner is defined in an inaccessible class or interface
- i.defaultM();
- ^
-T5003235a.java:22: protectedM() in Super.Inner is defined in an inaccessible class or interface
- i.protectedM();
- ^
-T5003235a.java:23: publicM() in Super.Inner is defined in an inaccessible class or interface
- i.publicM();
- ^
-T5003235a.java:24: privateM() in Super.Inner is defined in an inaccessible class or interface
- i.privateM();
- ^
+T5003235a.java:21:10: compiler.err.not.def.access.class.intf.cant.access: defaultM(), Super.Inner
+T5003235a.java:22:10: compiler.err.not.def.access.class.intf.cant.access: protectedM(), Super.Inner
+T5003235a.java:23:10: compiler.err.not.def.access.class.intf.cant.access: publicM(), Super.Inner
+T5003235a.java:24:10: compiler.err.not.def.access.class.intf.cant.access: privateM(), Super.Inner
4 errors
--- a/langtools/test/tools/javac/T5003235/T5003235b.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/T5003235/T5003235b.java Mon Jan 23 10:27:58 2017 -0800
@@ -3,7 +3,7 @@
* @bug 5003235
* @summary Accessibility of private inner class
* @author Peter von der Ah\u00e9
- * @compile/fail/ref=T5003235b.out --diags:layout=%b:%l:%_%m T5003235b.java
+ * @compile/fail/ref=T5003235b.out -XDrawDiagnostics T5003235b.java
*/
class Outer {
--- a/langtools/test/tools/javac/T5003235/T5003235b.out Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/T5003235/T5003235b.out Mon Jan 23 10:27:58 2017 -0800
@@ -1,13 +1,5 @@
-T5003235b.java:28: k in Outer.Inner is defined in an inaccessible class or interface
- System.out.println("Value of k: " + outer.inner.k);
- ^
-T5003235b.java:29: l in Outer.Inner is defined in an inaccessible class or interface
- System.out.println("Value of l: " + outer.inner.l);
- ^
-T5003235b.java:30: m in Outer.Inner is defined in an inaccessible class or interface
- System.out.println("Value of m: " + outer.inner.m);
- ^
-T5003235b.java:31: n in Outer.Inner is defined in an inaccessible class or interface
- System.out.println("Value of n: " + outer.inner.n);
- ^
+T5003235b.java:28:56: compiler.err.not.def.access.class.intf.cant.access: k, Outer.Inner
+T5003235b.java:29:56: compiler.err.not.def.access.class.intf.cant.access: l, Outer.Inner
+T5003235b.java:30:56: compiler.err.not.def.access.class.intf.cant.access: m, Outer.Inner
+T5003235b.java:31:56: compiler.err.not.def.access.class.intf.cant.access: n, Outer.Inner
4 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171325/NPEClearingLocalClassNameIndexesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8171325
+ * @summary NPE in Check.clearLocalClassNameIndexes
+ * @compile/fail/ref=NPEClearingLocalClassNameIndexesTest.out -XDrawDiagnostics NPEClearingLocalClassNameIndexesTest.java
+ */
+
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class NPEClearingLocalClassNameIndexesTest {
+ <A> void f(List<A> t) {}
+ <B, C> C g(C u, Function<B, C> v) { return null; }
+ <D> D g(Supplier<D> w) { return null; }
+
+ public void test() {
+ f(g((String) null, task -> g(new NoSuch() {})));
+ f(g((String) null, task -> g(new NoSuch<int>() {})));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171325/NPEClearingLocalClassNameIndexesTest.out Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,6 @@
+NPEClearingLocalClassNameIndexesTest.java:18:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
+NPEClearingLocalClassNameIndexesTest.java:18:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
+NPEClearingLocalClassNameIndexesTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, f, java.util.List<A>, java.lang.String, kindname.class, NPEClearingLocalClassNameIndexesTest, (compiler.misc.incompatible.upper.lower.bounds: C, java.lang.Object,java.util.List<A>, java.lang.String)
+NPEClearingLocalClassNameIndexesTest.java:19:42: compiler.err.cant.resolve.location: kindname.class, NoSuch, , , (compiler.misc.location: kindname.class, NPEClearingLocalClassNameIndexesTest, null)
+NPEClearingLocalClassNameIndexesTest.java:19:49: compiler.err.type.found.req: int, (compiler.misc.type.req.ref)
+5 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Buggy.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+@Deprecated enum Buggy implements Buggy {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Processor.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,21 @@
+/**
+ * @test /nodynamiccopyright/
+ * @bug 8171332
+ * @summary 8171332: NPE in MembersPhase.finishClass
+ * @modules java.compiler
+ * jdk.compiler
+ * @build Processor
+ * @compile/fail/ref=Processor.out -XDrawDiagnostics -processor Processor Buggy.java
+ */
+
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends AbstractProcessor {
+ @Override
+ public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171332/Processor.out Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,3 @@
+Buggy.java:24:35: compiler.err.intf.expected.here
+Buggy.java:24:13: compiler.err.cyclic.inheritance: Buggy
+2 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/DuplicatedAnnotatedPackagesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,6 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8171528
+ * @summary Crash in Annotate with duplicate package-info declarations
+ * @compile/fail/ref=DuplicatedAnnotatedPackagesTest.out -XDrawDiagnostics pkg1/package-info.java pkg2/package-info.java
+ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/DuplicatedAnnotatedPackagesTest.out Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,4 @@
+package-info.java:2:9: compiler.warn.pkg-info.already.seen: test
+package-info.java:1:1: compiler.err.already.annotated: kindname.package, test
+1 error
+1 warning
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/pkg1/package-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,2 @@
+@Deprecated
+package test;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8171528/pkg2/package-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,2 @@
+@Deprecated
+package test;
--- a/langtools/test/tools/javac/diags/Example.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/diags/Example.java Mon Jan 23 10:27:58 2017 -0800
@@ -61,9 +61,10 @@
declaredKeys = new TreeSet<String>();
srcFiles = new ArrayList<File>();
procFiles = new ArrayList<File>();
- supportFiles = new ArrayList<File>();
srcPathFiles = new ArrayList<File>();
moduleSourcePathFiles = new ArrayList<File>();
+ modulePathFiles = new ArrayList<File>();
+ classPathFiles = new ArrayList<File>();
additionalFiles = new ArrayList<File>();
findFiles(file, srcFiles);
@@ -89,10 +90,13 @@
} else if (files == srcFiles && c.getName().equals("additional")) {
additionalFilesDir = c;
findFiles(c, additionalFiles);
- } else if (files == srcFiles && c.getName().equals("support"))
- findFiles(c, supportFiles);
- else
+ } else if (files == srcFiles && c.getName().equals("modulepath")) {
+ findFiles(c, modulePathFiles);
+ } else if (files == srcFiles && c.getName().equals("classpath")) {
+ findFiles(c, classPathFiles);
+ } else {
findFiles(c, files);
+ }
}
} else if (f.isFile()) {
if (f.getName().endsWith(".java")) {
@@ -194,23 +198,32 @@
*/
private void run(PrintWriter out, Set<String> keys, boolean raw, boolean verbose)
throws IOException {
- ClassLoader loader = getClass().getClassLoader();
- if (supportFiles.size() > 0) {
- File supportDir = new File(tempDir, "support");
- supportDir.mkdirs();
- clean(supportDir);
- List<String> sOpts = Arrays.asList("-d", supportDir.getPath());
- new Jsr199Compiler(verbose).run(null, null, false, sOpts, procFiles);
- URLClassLoader ucl =
- new URLClassLoader(new URL[] { supportDir.toURI().toURL() }, loader);
- loader = ucl;
+ List<String> opts = new ArrayList<String>();
+ if (!modulePathFiles.isEmpty()) {
+ File modulepathDir = new File(tempDir, "modulepath");
+ modulepathDir.mkdirs();
+ clean(modulepathDir);
+ List<String> sOpts = Arrays.asList("-d", modulepathDir.getPath(),
+ "--module-source-path", new File(file, "modulepath").getAbsolutePath());
+ new Jsr199Compiler(verbose).run(null, null, false, sOpts, modulePathFiles);
+ opts.add("--module-path");
+ opts.add(modulepathDir.getAbsolutePath());
+ }
+
+ if (!classPathFiles.isEmpty()) {
+ File classpathDir = new File(tempDir, "classpath");
+ classpathDir.mkdirs();
+ clean(classpathDir);
+ List<String> sOpts = Arrays.asList("-d", classpathDir.getPath());
+ new Jsr199Compiler(verbose).run(null, null, false, sOpts, classPathFiles);
+ opts.add("--class-path");
+ opts.add(classpathDir.getAbsolutePath());
}
File classesDir = new File(tempDir, "classes");
classesDir.mkdirs();
clean(classesDir);
- List<String> opts = new ArrayList<String>();
opts.add("-d");
opts.add(classesDir.getPath());
if (options != null)
@@ -327,8 +340,9 @@
File additionalFilesDir;
List<File> srcPathFiles;
List<File> moduleSourcePathFiles;
+ List<File> modulePathFiles;
+ List<File> classPathFiles;
List<File> additionalFiles;
- List<File> supportFiles;
File infoFile;
private List<String> runOpts;
private List<String> options;
--- a/langtools/test/tools/javac/diags/RunExamples.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/diags/RunExamples.java Mon Jan 23 10:27:58 2017 -0800
@@ -239,8 +239,10 @@
srcFiles.remove(e.infoFile);
showFiles(e, srcFiles);
showFiles(e, e.srcPathFiles);
+ showFiles(e, e.moduleSourcePathFiles);
+ showFiles(e, e.modulePathFiles);
+ showFiles(e, e.classPathFiles);
showFiles(e, e.procFiles);
- showFiles(e, e.supportFiles);
}
run(e);
}
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt Mon Jan 23 10:27:58 2017 -0800
@@ -20,11 +20,13 @@
compiler.err.limit.stack # Code
compiler.err.limit.string # Gen
compiler.err.limit.string.overflow # JavaCompiler
+compiler.err.module.non.zero.opens # bad class file
compiler.err.name.reserved.for.internal.use # UNUSED
compiler.err.no.annotation.member
compiler.err.no.encl.instance.of.type.in.scope # cannot occur; always followed by assert false;
compiler.err.no.match.entry # UNUSED?
compiler.err.not.annotation.type # cannot occur given preceding checkType
+compiler.err.not.def.access.package.cant.access
compiler.err.proc.bad.config.file # JavacProcessingEnvironment
compiler.err.proc.cant.access # completion failure
compiler.err.proc.cant.access.1 # completion failure, no stack trace
@@ -69,10 +71,11 @@
compiler.misc.kindname.value
compiler.misc.incompatible.eq.lower.bounds # cannot happen?
compiler.misc.module.name.mismatch
+compiler.misc.module.non.zero.opens # bad class file
compiler.misc.no.unique.minimal.instance.exists
compiler.misc.no.unique.maximal.instance.exists # cannot happen?
-compiler.err.module.non.zero.opens # bad class file
-compiler.misc.module.non.zero.opens # bad class file
+compiler.misc.not.def.access.package.cant.access
+compiler.misc.package.not.visible
compiler.misc.resume.abort # prompt for a response
compiler.misc.source.unavailable # DiagnosticSource
compiler.misc.token.bad-symbol
@@ -117,6 +120,7 @@
compiler.misc.bad.const.pool.entry # constant pool entry has wrong type
compiler.warn.access.to.member.from.serializable.lambda # in order to generate it we need to modify a restricted package
compiler.warn.invalid.path # this warning is generated only in Windows systems
+compiler.note.multiple.elements # needs user code
# The following module-related messages will have to stay on the not-yet list for various reasons:
compiler.warn.locn.unknown.file.on.module.path # Never issued ATM (short circuited with an if (false))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/NotDefAccessClassIntfCantAccessReason.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.not.def.access.class.intf.cant.access.reason
+//key: compiler.misc.not.def.access.does.not.read
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apia/api1/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 api1;
+
+public class Api {
+ public static void test() {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apia/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module apia {
+ exports api1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apib/api2/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 api2;
+
+public class Api {
+ public static api1.Api get() { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/apib/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module apib {
+ requires apia;
+ exports api2;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ void test() {
+ api2.Api.get().test();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReason/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module impl {
+ requires apib;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/NotDefAccessClassIntfCantAccessReason.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.not.def.access.class.intf.cant.access.reason
+// key: compiler.misc.not.def.access.does.not.read
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apia/api1/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 api1;
+
+public class Api {
+ public static void test() {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apia/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module apia {
+ exports api1;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apib/api2/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 api2;
+
+public class Api {
+ public static api1.Api get() { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/apib/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+module apib {
+ requires apia;
+ exports api2;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ void test(api2.Api a2) {
+ Runnable r = a2.get() :: test;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessClassIntfCantAccessReasonFragment/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module impl {
+ requires apib;
+}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/NotDefAccessClassPackageCantAccess.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-// key: compiler.err.not.def.access.package.cant.access
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/module-info.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module m1x {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m1x/p1/C1.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
- * 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 p1;
-
-public class C1 {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/module-info.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-
-module m2x {}
--- a/langtools/test/tools/javac/diags/examples/NotDefAccessClassPackageCantAccess/modulesourcepath/m2x/p2/C2.java Mon Jan 23 19:58:06 2017 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * 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 p2;
-
-public class C2 {
- p1.C1 c1;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/NotDefAccessDoesNotRead.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.does.not.read
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module api {
+ exports api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotRead/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+module impl {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/NotDefAccessDoesNotReadFromUnnamed.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.does.not.read.from.unnamed
+
+public class NotDefAccessDoesNotReadFromUnnamed {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/modulepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadFromUnnamed/modulepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module api {
+ exports api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/NotDefAccessDoesNotReadUnnamed.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.not.def.access.class.intf.cant.access.reason
+//key: compiler.misc.not.def.access.does.not.read.unnamed
+//options: --add-reads=auxiliary=ALL-UNNAMED
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/classpath/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 api;
+
+public class Api {
+ public void test() {}
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/auxiliary/auxiliary/Auxiliary.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 auxiliary;
+
+public class Auxiliary {
+ public static api.Api get() { return null; }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/auxiliary/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module auxiliary {
+ exports auxiliary;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ {
+ auxiliary.Auxiliary.get().test();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessDoesNotReadUnnamed/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module impl {
+ requires auxiliary;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/NotDefAccessNotExported.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+module api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExported/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module impl {
+ requires api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/NotDefAccessNotExportedFromUnnamed.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.from.unnamed
+//options: --add-modules api
+
+public class NotDefAccessNotExportedFromUnnamed {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/modulepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedFromUnnamed/modulepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+module api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/NotDefAccessNotExportedToModule.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.to.module
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module api {
+ exports api to other;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/impl/impl/Impl.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,28 @@
+/*
+ * 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 impl;
+
+public class Impl {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/impl/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module impl {
+ requires api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModule/modulesourcepath/other/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module other {
+ requires api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/NotDefAccessNotExportedToModuleFromUnnamed.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+//key: compiler.err.package.not.visible
+//key: compiler.misc.not.def.access.not.exported.to.module.from.unnamed
+//options: --add-modules api
+
+public class NotDefAccessNotExportedToModuleFromUnnamed {
+ api.Api api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/api/api/Api.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,27 @@
+/*
+ * 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 api;
+
+public class Api {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/api/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module api {
+ exports api to other;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/NotDefAccessNotExportedToModuleFromUnnamed/modulepath/other/module-info.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+module other {
+ requires api;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/doclint/DocLintFormatTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8172474
+ * @summary javac should enable doclint checking for HTML 5
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @run main DocLintFormatTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class DocLintFormatTest {
+ public static void main(String... args) throws Exception {
+ new DocLintFormatTest().run();
+ }
+
+ private ToolBox tb = new ToolBox();
+ private Path src = Paths.get("src");
+ private Path classes = Paths.get("classes");
+
+ void run() throws Exception {
+ Files.createDirectories(classes);
+
+ tb.writeJavaFiles(src,
+ // 1 2
+ //2345678901234567890
+ "/** This is an <tt>HTML 4</tt> comment. */ public class Test4 { }",
+ "/** This is an <mark>HTML 5</mark> comment. */ public class Test5 { }"
+ );
+
+ test(src.resolve("Test4.java"), "html4");
+ test(src.resolve("Test4.java"), "html5",
+ "Test4.java:1:16: compiler.err.proc.messager: tag not supported in the generated HTML version: tt");
+ test(src.resolve("Test5.java"), "html4",
+ "Test5.java:1:16: compiler.err.proc.messager: tag not supported in the generated HTML version: mark");
+ test(src.resolve("Test5.java"), "html5");
+
+ if (errors > 0) {
+ throw new Exception(errors + " errors occurred");
+ }
+ }
+
+ void test(Path file, String format, String... expect) {
+ System.err.println("Test: " + format + " " + file);
+ List<String> output = new JavacTask(tb)
+ .outdir(classes)
+ .options("-XDrawDiagnostics", "-Xdoclint", "--doclint-format", format)
+ .files(file)
+ .run(expect.length == 0 ? Task.Expect.SUCCESS : Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ if (expect.length == 0) {
+ if (!(output.size() == 1 && output.get(0).isEmpty())) {
+ error("All output unexpected.");
+ }
+ } else {
+ for (String e : expect) {
+ if (!output.contains(e)) {
+ error("expected output not found: " + e);
+ }
+ }
+ }
+ }
+
+ void error(String message) {
+ System.err.println("Error: " + message);
+ errors++;
+ }
+
+ private int errors = 0;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MethodReferenceVarargsTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8171993
+ * @summary AssertionError when compiling method reference with generic code and varargs.
+ * @compile MethodReferenceVarargsTest.java
+ */
+
+public class MethodReferenceVarargsTest<T> {
+ public T invoke(Object... args) {
+ return null;
+ }
+ public static <T extends String> void test() { // works with <T> alone.
+ MethodReferenceVarargsTest<T> bug = new MethodReferenceVarargsTest<>();
+ java.util.function.Function<String, T> b = bug::invoke;
+ java.util.function.Function<String, T> f = (args) -> bug.invoke(args);
+ }
+}
\ No newline at end of file
--- a/langtools/test/tools/javac/modules/AddLimitMods.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/AddLimitMods.java Mon Jan 23 10:27:58 2017 -0800
@@ -217,8 +217,8 @@
private static final List<Entry<String[], String>> variants = Arrays.asList(
new SimpleEntry<String[], String>(new String[] {},
- "Test.java:2:18: compiler.err.doesnt.exist: javax.annotation\n"
- + "Test.java:5:19: compiler.err.doesnt.exist: javax.xml.bind\n"
+ "Test.java:2:7: compiler.err.package.not.visible: javax.annotation, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.annotation, java.annotations.common)\n"
+ + "Test.java:5:14: compiler.err.package.not.visible: javax.xml.bind, (compiler.misc.not.def.access.does.not.read.from.unnamed: javax.xml.bind, java.xml.bind)\n"
+ "2 errors\n"),
new SimpleEntry<String[], String>(new String[] {"--add-modules", "java.annotations.common,java.xml.bind"},
null),
--- a/langtools/test/tools/javac/modules/AddReadsTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/AddReadsTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -81,7 +81,7 @@
.getOutput(Task.OutputKind.DIRECT);
checkOutputContains(log,
- "Test.java:1:44: compiler.err.not.def.access.package.cant.access: api.Api, api");
+ "Test.java:1:41: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)");
//test add dependencies:
new JavacTask(tb)
--- a/langtools/test/tools/javac/modules/AnnotationProcessing.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/AnnotationProcessing.java Mon Jan 23 10:27:58 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8133884 8162711 8133896 8172158
+ * @bug 8133884 8162711 8133896 8172158 8172262
* @summary Verify that annotation processing works.
* @library /tools/lib
* @modules
@@ -50,6 +50,7 @@
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.function.Function;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.annotation.processing.AbstractProcessor;
@@ -1067,24 +1068,43 @@
"package impl1; public class Impl { }",
"package impl.conflict.module; class Impl { }",
"package impl.conflict.clazz; public class pkg { public static class I { } }",
- "package impl.conflict.src; public class Impl { }");
+ "package impl.conflict.src; public class Impl { }",
+ "package nested.pack.pack; public class Impl { }",
+ "package unique.nested; public class Impl { }");
tb.writeJavaFiles(m2,
"module m2x { }",
"package impl2; public class Impl { }",
"package impl.conflict.module; class Impl { }",
- "package impl.conflict; public class clazz { public static class pkg { } }");
+ "package impl.conflict; public class clazz { public static class pkg { } }",
+ "package nested.pack; public class Impl { }");
//from source:
- new JavacTask(tb)
+ String log = new JavacTask(tb)
.options("--module-source-path", moduleSrc.toString(),
"--source-path", src.toString(),
"-processorpath", System.getProperty("test.class.path"),
- "-processor", UnboundLookup.class.getName())
+ "-processor", UnboundLookup.class.getName(),
+ "-XDrawDiagnostics")
.outdir(classes)
.files(findJavaFiles(moduleSrc))
.run()
- .writeAll();
+ .writeAll()
+ .getOutput(OutputKind.DIRECT);
+
+ String moduleImplConflictString =
+ "- compiler.note.multiple.elements: getTypeElement, impl.conflict.module.Impl, m2x, m1x";
+ String srcConflictString =
+ "- compiler.note.multiple.elements: getTypeElement, impl.conflict.src.Impl, m1x, unnamed module";
+
+ if (!log.contains(moduleImplConflictString) ||
+ !log.contains(srcConflictString)) {
+ throw new AssertionError("Expected output not found: " + log);
+ }
+
+ if (log.split(Pattern.quote(moduleImplConflictString)).length > 2) {
+ throw new AssertionError("Too many warnings in: " + log);
+ }
new JavacTask(tb)
.options("--source-path", src.toString())
@@ -1130,11 +1150,17 @@
assertTypeElementExists("impl.conflict.clazz", "m2x");
assertPackageElementExists("impl.conflict.clazz", "m1x");
assertPackageElementExists("impl2", "m2x");
+ assertPackageElementExists("nested.pack.pack", "m1x");
+ assertPackageElementExists("nested.pack", "m2x");
+ assertTypeElementExists("unique.nested.Impl", "m1x");
assertTypeElementNotFound("impl.conflict.module.Impl");
+ assertTypeElementNotFound("impl.conflict.module.Impl"); //check that the warning/note is produced only once
assertPackageElementNotFound("impl.conflict.module");
assertTypeElementNotFound("impl.conflict.src.Impl");
assertPackageElementNotFound("impl.conflict.src");
assertTypeElementNotFound("impl.conflict.clazz.pkg");
+ assertPackageElementNotFound("unique"); //do not return packages without members in module mode
+ assertTypeElementNotFound("nested"); //cannot distinguish between m1x and m2x
return false;
}
--- a/langtools/test/tools/javac/modules/AutomaticModules.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/AutomaticModules.java Mon Jan 23 10:27:58 2017 -0800
@@ -283,7 +283,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected = Arrays.asList("Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
+ List<String> expected = Arrays.asList("Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
"1 error");
if (!expected.equals(log)) {
@@ -300,8 +300,8 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- expected = Arrays.asList("Impl.java:1:51: compiler.err.doesnt.exist: apiB",
- "Impl.java:1:62: compiler.err.not.def.access.package.cant.access: m2x.M2, m2x",
+ expected = Arrays.asList("Impl.java:1:47: compiler.err.package.not.visible: apiB, (compiler.misc.not.def.access.does.not.read: m1x, apiB, automaticB)",
+ "Impl.java:1:59: compiler.err.package.not.visible: m2x, (compiler.misc.not.def.access.does.not.read: m1x, m2x, m2x)",
"2 errors");
if (!expected.equals(log)) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/modules/ConvenientAccessErrorsTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,596 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8169197 8172668
+ * @summary Check convenient errors are produced for inaccessible classes.
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ * jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JarTask toolbox.JavacTask ModuleTestBase
+ * @run main ConvenientAccessErrorsTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+
+public class ConvenientAccessErrorsTest extends ModuleTestBase {
+
+ public static void main(String... args) throws Exception {
+ new ConvenientAccessErrorsTest().runTests();
+ }
+
+ @Test
+ public void testNoDep(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api; }",
+ "package api; public class Api { public void call() { } }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { }",
+ "package test; public class Test { api.Api api; }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:35: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read: m2x, api, m1x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testNotExported(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api; }",
+ "package api; public class Api { }",
+ "package impl; public class Impl { }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test; public class Test { impl.Impl api; }");
+ Path src_m3 = src.resolve("m3x");
+ tb.writeJavaFiles(src_m3,
+ "module m3x { requires m1x; }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported: impl, m1x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api; exports impl to m3x;}");
+
+ log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList(
+ "Test.java:1:35: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.to.module: impl, m1x, m2x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testInaccessibleInExported(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api; }",
+ "package api; class Api { }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test; public class Test { api.Api api; }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:38: compiler.err.not.def.public.cant.access: api.Api, api",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+// @Test
+ public void testInaccessibleUnnamedModule(Path base) throws Exception {
+ Path jar = prepareTestJar(base, "package api; class Api { public static class Foo {} }");
+
+ Path moduleSrc = base.resolve("module-src");
+ Path m1x = moduleSrc.resolve("m1x");
+
+ Path classes = base.resolve("classes");
+
+ Files.createDirectories(classes);
+
+ tb.writeJavaFiles(m1x,
+ "module m1x { }",
+ "package test; public class Test { api.Api api; api.Api.Foo api; }");
+
+ List<String> log = new JavacTask(tb)
+ .options("-classpath", jar.toString(),
+ "-XDrawDiagnostics")
+ .outdir(classes)
+ .files(findJavaFiles(moduleSrc))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:38: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+ "Test.java:1:51: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+ "2 errors");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testIndirectReferenceToUnnamedModule(Path base) throws Exception {
+ Path jar = prepareTestJar(base, "package api; public class Api { public void test() {} }");
+
+ Path moduleSrc = base.resolve("module-src");
+ Path m1x = moduleSrc.resolve("m1x");
+ Path auxiliary = moduleSrc.resolve("auxiliary");
+
+ Path classes = base.resolve("classes");
+
+ Files.createDirectories(classes);
+
+ tb.writeJavaFiles(m1x,
+ "module m1x { requires auxiliary; }",
+ "package test; public class Test { { auxiliary.Auxiliary.get().test(); } }");
+
+ tb.writeJavaFiles(auxiliary,
+ "module auxiliary { exports auxiliary; }",
+ "package auxiliary; public class Auxiliary { public static api.Api get() { return null; } }");
+
+ List<String> log = new JavacTask(tb)
+ .options("-classpath", jar.toString(),
+ "-XDrawDiagnostics",
+ "--add-reads", "auxiliary=ALL-UNNAMED",
+ "--module-source-path", moduleSrc.toString())
+ .outdir(classes)
+ .files(findJavaFiles(moduleSrc))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:62: compiler.err.not.def.access.class.intf.cant.access.reason: test(), api.Api, api, (compiler.misc.not.def.access.does.not.read.unnamed: api, m1x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ private Path prepareTestJar(Path base, String code) throws Exception {
+ Path legacySrc = base.resolve("legacy-src");
+ tb.writeJavaFiles(legacySrc, code);
+ Path legacyClasses = base.resolve("legacy-classes");
+ Files.createDirectories(legacyClasses);
+
+ String log = new JavacTask(tb)
+ .options()
+ .outdir(legacyClasses)
+ .files(findJavaFiles(legacySrc))
+ .run()
+ .writeAll()
+ .getOutput(Task.OutputKind.DIRECT);
+
+ if (!log.isEmpty()) {
+ throw new Exception("unexpected output: " + log);
+ }
+
+ Path lib = base.resolve("lib");
+
+ Files.createDirectories(lib);
+
+ Path jar = lib.resolve("test-api-1.0.jar");
+
+ new JarTask(tb, jar)
+ .baseDir(legacyClasses)
+ .files("api/Api.class")
+ .run();
+
+ return jar;
+ }
+
+ @Test
+ public void testUnnamedModuleAccess(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api to m2x; }",
+ "package api; class Api { }",
+ "package impl; class Impl { }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }");
+ Path modulepath = base.resolve("modulepath");
+ tb.createDirectories(modulepath);
+
+ new JavacTask(tb)
+ .options("--module-source-path", src.toString())
+ .outdir(modulepath)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll();
+
+ Path unnamedSrc = base.resolve("unnamedSrc");
+ tb.writeJavaFiles(unnamedSrc,
+ "public class Test { api.Api api; impl.Impl impl; }");
+ Path unnamedClasses = base.resolve("unnamed-classes");
+ Files.createDirectories(unnamedClasses);
+
+ List<String> log = new JavacTask(tb)
+ .options("--module-path", modulepath.toString(),
+ "-XDrawDiagnostics")
+ .outdir(unnamedClasses)
+ .files(findJavaFiles(unnamedSrc))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.does.not.read.from.unnamed: api, m1x)",
+ "Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.does.not.read.from.unnamed: impl, m1x)",
+ "2 errors"
+ );
+
+ if (!expected.equals(log)) {
+ throw new Exception("unexpected output: " + log);
+ }
+
+ log = new JavacTask(tb)
+ .options("--module-path", modulepath.toString(),
+ "--add-modules", "m1x",
+ "-XDrawDiagnostics")
+ .outdir(unnamedClasses)
+ .files(findJavaFiles(unnamedSrc))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ expected = Arrays.asList(
+ "Test.java:1:21: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported.to.module.from.unnamed: api, m1x)",
+ "Test.java:1:34: compiler.err.package.not.visible: impl, (compiler.misc.not.def.access.not.exported.from.unnamed: impl, m1x)",
+ "2 errors"
+ );
+
+ if (!expected.equals(log)) {
+ throw new Exception("unexpected output: " + log);
+ }
+ }
+
+ @Test
+ public void testInImport(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { }",
+ "package api; public class Api { public String test() { return null; } }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test; import api.Api; public class Test { Api api; { api.test().length(); } }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testInImportOnDemand(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { }",
+ "package api; public class Api { public String test() { return null; } }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test; import api.*; public class Test { Api api; { api.test().length(); } }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+ "Test.java:1:49: compiler.err.not.def.access.package.cant.access: api.Api, api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+ "2 errors");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testUnusedImportOnDemand1(Path base) throws Exception {
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "package test; import javax.annotation.*; public class Test { }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--add-modules", "java.compiler")
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList("");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testUnusedImportOnDemand2(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { }",
+ "package api; public class Api { }");
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test; import api.*; public class Test { }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:1:22: compiler.err.package.not.visible: api, (compiler.misc.not.def.access.not.exported: api, m1x)",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testClassPackageConflict(Path base) throws Exception {
+ Path libSrc = base.resolve("libSrc");
+ tb.writeJavaFiles(libSrc,
+ "package test.desktop; public class Any { }");
+ Path libClasses = base.resolve("libClasses");
+ tb.createDirectories(libClasses);
+
+ new JavacTask(tb)
+ .outdir(libClasses)
+ .files(findJavaFiles(libSrc))
+ .run()
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "package test; public class desktop { public static class Action { } }",
+ "package use; import test.desktop.*; public class Use { test.desktop.Action a; }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ new JavacTask(tb)
+ .options("-XDrawDiagnostics")
+ .classpath(libClasses)
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll();
+ }
+
+ @Test
+ public void testClassPackageConflictInUnnamed(Path base) throws Exception {
+ Path libSrc = base.resolve("libSrc");
+ tb.writeJavaFiles(libSrc,
+ "package desktop; public class Any { }");
+ Path libClasses = base.resolve("libClasses");
+ tb.createDirectories(libClasses);
+
+ new JavacTask(tb)
+ .outdir(libClasses)
+ .files(findJavaFiles(libSrc))
+ .run()
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ Path src = base.resolve("src");
+ tb.writeJavaFiles(src,
+ "public class desktop { public static class Action { } }",
+ "import desktop.*; public class Use { desktop.Action a; }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ new JavacTask(tb)
+ .options("-XDrawDiagnostics")
+ .classpath(libClasses)
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run()
+ .writeAll();
+ }
+
+ @Test
+ public void testUnresolvableInImport(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { }",
+ "package api; import can.not.resolve; public class Api { }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-source-path", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Api.java:1:28: compiler.err.doesnt.exist: can.not",
+ "1 error");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+ @Test
+ public void testMissingKnownClass(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1x");
+ tb.writeJavaFiles(src_m1,
+ "module m1x { exports api; }",
+ "package api; public class Base { }",
+ "package api; public class Sub extends Base { }");
+ Path classes = base.resolve("classes");
+ tb.createDirectories(classes);
+ Path m1xClasses = classes.resolve("m1x");
+ tb.createDirectories(m1xClasses);
+
+ new JavacTask(tb)
+ .options("-XDrawDiagnostics")
+ .outdir(m1xClasses)
+ .files(findJavaFiles(src_m1))
+ .run(Task.Expect.SUCCESS)
+ .writeAll();
+
+ Files.delete(m1xClasses.resolve("api").resolve("Base.class"));
+
+ Path src_m2 = src.resolve("m2x");
+ tb.writeJavaFiles(src_m2,
+ "module m2x { requires m1x; }",
+ "package test;\n" +
+ "import api.Sub;\n" +
+ "import api.Base;\n" +
+ "public class Test {\n" +
+ " Sub a2;\n" +
+ " Base a;\n" +
+ "}\n");
+ Path m2xClasses = classes.resolve("m2x");
+ tb.createDirectories(m2xClasses);
+ List<String> log = new JavacTask(tb)
+ .options("-XDrawDiagnostics",
+ "--module-path", classes.toString(),
+ "-XDdev")
+ .outdir(m2xClasses)
+ .files(findJavaFiles(src_m2))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutputLines(Task.OutputKind.DIRECT);
+
+ List<String> expected = Arrays.asList(
+ "Test.java:3:11: compiler.err.cant.resolve.location: kindname.class, Base, , , (compiler.misc.location: kindname.package, api, null)",
+ "Test.java:6:5: compiler.err.cant.resolve.location: kindname.class, Base, , , (compiler.misc.location: kindname.class, test.Test, null)",
+ "2 errors");
+
+ if (!expected.equals(log))
+ throw new Exception("expected output not found; actual: " + log);
+ }
+
+}
--- a/langtools/test/tools/javac/modules/EdgeCases.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/EdgeCases.java Mon Jan 23 10:27:58 2017 -0800
@@ -178,7 +178,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access: call(), api1.Api1") ||
+ if (!log.contains("Test.java:1:52: compiler.err.not.def.access.class.intf.cant.access.reason: call(), api1.Api1, api1, (compiler.misc.not.def.access.does.not.read: m3x, api1, m1x)") ||
!log.contains("Test.java:1:76: compiler.err.not.def.access.class.intf.cant.access: toString(), java.lang.Object"))
throw new Exception("expected output not found");
}
--- a/langtools/test/tools/javac/modules/GraphsTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/GraphsTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -134,9 +134,9 @@
.getOutputLines(Task.OutputKind.DIRECT);
List<String> expected = Arrays.asList(
- "Negative.java:1:43: compiler.err.doesnt.exist: closedO",
- "Negative.java:1:56: compiler.err.doesnt.exist: closedN",
- "Negative.java:1:69: compiler.err.doesnt.exist: closedL");
+ "Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
+ "Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
+ "Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
if (!log.containsAll(expected)) {
throw new Exception("Expected output not found");
}
@@ -153,9 +153,9 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
expected = Arrays.asList(
- "Negative.java:1:43: compiler.err.not.def.access.package.cant.access: closedO.O, closedO",
- "Negative.java:1:56: compiler.err.not.def.access.package.cant.access: closedN.N, closedN",
- "Negative.java:1:69: compiler.err.not.def.access.package.cant.access: closedL.L, closedL");
+ "Negative.java:1:36: compiler.err.package.not.visible: closedO, (compiler.misc.not.def.access.not.exported: closedO, O)",
+ "Negative.java:1:49: compiler.err.package.not.visible: closedN, (compiler.misc.not.def.access.not.exported: closedN, N)",
+ "Negative.java:1:62: compiler.err.package.not.visible: closedL, (compiler.misc.not.def.access.not.exported: closedL, L)");
if (!out.containsAll(expected)) {
throw new Exception("Expected output not found");
}
@@ -201,7 +201,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- String expected = "A.java:1:35: compiler.err.not.def.access.package.cant.access: pack.Clazz, pack";
+ String expected = "A.java:1:31: compiler.err.package.not.visible: pack, (compiler.misc.not.def.access.not.exported.to.module: pack, N, L)";
if (!log.contains(expected)) {
throw new Exception("Expected output not found");
}
--- a/langtools/test/tools/javac/modules/LimitModulesTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/LimitModulesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -180,7 +180,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("C.java:1:41: compiler.err.doesnt.exist: com.sun.tools.javac"))
+ if (!log.contains("C.java:1:35: compiler.err.package.not.visible: com.sun.tools.javac, (compiler.misc.not.def.access.does.not.read.from.unnamed: com.sun.tools.javac, jdk.compiler)"))
throw new Exception("expected output not found");
}
}
--- a/langtools/test/tools/javac/modules/OpenModulesTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/OpenModulesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -117,7 +117,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+ List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
"1 error");
if (!Objects.equals(log2, expected2))
throw new Exception("expected output not found: " + log2);
@@ -180,7 +180,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected2 = Arrays.asList("Test.java:1:53: compiler.err.doesnt.exist: api2",
+ List<String> expected2 = Arrays.asList("Test.java:1:49: compiler.err.package.not.visible: api2, (compiler.misc.not.def.access.not.exported: api2, m1x)",
"1 error");
if (!Objects.equals(log2, expected2))
throw new Exception("expected output not found: " + log2);
--- a/langtools/test/tools/javac/modules/PackageMultipleModules.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/PackageMultipleModules.java Mon Jan 23 10:27:58 2017 -0800
@@ -70,8 +70,8 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected = Arrays.asList("A.java:1:26: compiler.err.not.def.access.package.cant.access: test.B, test",
- "B.java:1:26: compiler.err.not.def.access.package.cant.access: test.A, test",
+ List<String> expected = Arrays.asList("A.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m1x, test, m2x)",
+ "B.java:1:22: compiler.err.package.not.visible: test, (compiler.misc.not.def.access.does.not.read: m2x, test, m1x)",
"2 errors");
if (!log.equals(expected))
throw new Exception("expected output not found");
--- a/langtools/test/tools/javac/modules/RequiresStaticTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/RequiresStaticTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -88,7 +88,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+ if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
throw new Exception("expected output not found");
}
@@ -124,18 +124,10 @@
.getOutput(Task.OutputKind.DIRECT);
String[] expect = {
- "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
- "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
- "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
- "C1.java:5:52: compiler.err.not.def.access.package.cant.access: p8.C8, p8",
- "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)",
- "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)",
- "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)",
- "C1.java:8:22: compiler.err.cant.resolve.location: kindname.class, C8, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)"
+ "C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
+ "C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
+ "C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)",
+ "C1.java:5:50: compiler.err.package.not.visible: p8, (compiler.misc.not.def.access.does.not.read: m1x, p8, m8x)"
};
for (String e: expect) {
--- a/langtools/test/tools/javac/modules/RequiresTransitiveTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/RequiresTransitiveTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -85,7 +85,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("Test.java:1:27: compiler.err.doesnt.exist: com.sun.source.tree"))
+ if (!log.contains("Test.java:1:22: compiler.err.package.not.visible: com.sun.source.tree, (compiler.misc.not.def.access.does.not.read: m, com.sun.source.tree, jdk.compiler)"))
throw new Exception("expected output not found");
}
@@ -121,15 +121,9 @@
.getOutput(Task.OutputKind.DIRECT);
String[] expect = {
- "C1.java:5:10: compiler.err.not.def.access.package.cant.access: p5.C5, p5",
- "C1.java:5:24: compiler.err.not.def.access.package.cant.access: p6.C6, p6",
- "C1.java:5:38: compiler.err.not.def.access.package.cant.access: p7.C7, p7",
- "C1.java:8:1: compiler.err.cant.resolve.location: kindname.class, C5, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)",
- "C1.java:8:8: compiler.err.cant.resolve.location: kindname.class, C6, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)",
- "C1.java:8:15: compiler.err.cant.resolve.location: kindname.class, C7, , , "
- + "(compiler.misc.location: kindname.class, p1.C1, null)"
+ "C1.java:5:8: compiler.err.package.not.visible: p5, (compiler.misc.not.def.access.does.not.read: m1x, p5, m5x)",
+ "C1.java:5:22: compiler.err.package.not.visible: p6, (compiler.misc.not.def.access.does.not.read: m1x, p6, m6x)",
+ "C1.java:5:36: compiler.err.package.not.visible: p7, (compiler.misc.not.def.access.does.not.read: m1x, p7, m7x)"
};
for (String e: expect) {
--- a/langtools/test/tools/javac/modules/ResolveTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/ResolveTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -99,7 +99,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+ if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
throw new Exception("expected output not found");
}
@@ -123,7 +123,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+ if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported: p1, m1x)"))
throw new Exception("expected output not found");
}
@@ -149,7 +149,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+ if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.not.exported.to.module: p1, m1x, m2x)"))
throw new Exception("expected output not found");
}
@@ -173,7 +173,7 @@
.writeAll()
.getOutput(Task.OutputKind.DIRECT);
- if (!log.contains("C2.java:1:33: compiler.err.not.def.access.package.cant.access: p1.C1, p1"))
+ if (!log.contains("C2.java:1:31: compiler.err.package.not.visible: p1, (compiler.misc.not.def.access.does.not.read: m2x, p1, m1x)"))
throw new Exception("expected output not found");
}
--- a/langtools/test/tools/javac/modules/UsesTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/UsesTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -262,7 +262,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
+ List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
"1 error");
if (!output.containsAll(expected)) {
throw new Exception("Expected output not found");
@@ -286,7 +286,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected = Arrays.asList("module-info.java:1:34: compiler.err.not.def.access.package.cant.access: p.C, p",
+ List<String> expected = Arrays.asList("module-info.java:1:33: compiler.err.package.not.visible: p, (compiler.misc.not.def.access.not.exported: p, m1x)",
"1 error");
if (!output.containsAll(expected)) {
throw new Exception("Expected output not found");
--- a/langtools/test/tools/javac/modules/XModuleTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/langtools/test/tools/javac/modules/XModuleTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -288,7 +288,7 @@
.writeAll()
.getOutputLines(Task.OutputKind.DIRECT);
- List<String> expected = Arrays.asList("A.java:1:36: compiler.err.doesnt.exist: pkg2",
+ List<String> expected = Arrays.asList("A.java:1:32: compiler.err.package.not.visible: pkg2, (compiler.misc.not.def.access.does.not.read: m1, pkg2, m2)",
"1 error");
if (!expected.equals(log))
--- a/make/Bundles.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/Bundles.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -77,9 +77,8 @@
$$(call MakeDir, $$(@D))
ifneq ($$($1_SPECIAL_INCLUDES), )
$$(foreach i, $$($1_SPECIAL_INCLUDES), \
- $$(foreach d, $$d, \
- ($(CD) $$d && $(FIND) $$i \
- >> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; ))
+ $$(foreach d, $$($1_BASE_DIRS), \
+ ($(CD) $$d && $(FIND) $$i >> $$($1_$$d_LIST_FILE)) ; ))
endif
ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
# If no subdir is specified, zip can be done directly from BASE_DIRS.
@@ -152,6 +151,9 @@
JRE_IMAGE_HOMEDIR := $(JRE_IMAGE_DIR)
JDK_BUNDLE_SUBDIR := jdk-$(VERSION_NUMBER)
JRE_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)
+ JRE_COMPACT1_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact1
+ JRE_COMPACT2_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact2
+ JRE_COMPACT3_BUNDLE_SUBDIR := jre-$(VERSION_NUMBER)-compact3
ifneq ($(DEBUG_LEVEL), release)
JDK_BUNDLE_SUBDIR := $(JDK_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
JRE_BUNDLE_SUBDIR := $(JRE_BUNDLE_SUBDIR)/$(DEBUG_LEVEL)
@@ -281,6 +283,35 @@
################################################################################
+ifneq ($(filter profiles-bundles, $(MAKECMDGOALS)), )
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $(error Creating compact profiles bundles on macosx is unsupported)
+ endif
+
+ define GenerateCompactProfilesBundles
+ ALL_JRE_COMPACT$1_FILES := $$(call CacheFind, $$(JRE_COMPACT$1_IMAGE_DIR))
+
+ JRE_COMPACT$1_BUNDLE_FILES := $$(filter-out \
+ $$(SYMBOLS_EXCLUDE_PATTERN), \
+ $$(ALL_JRE_COMPACT$1_FILES))
+
+ $$(eval $$(call SetupBundleFile, BUILD_JRE_COMPACT$1_BUNDLE, \
+ BUNDLE_NAME := $$(JRE_COMPACT$1_BUNDLE_NAME), \
+ FILES := $$(JRE_COMPACT$1_BUNDLE_FILES), \
+ BASE_DIRS := $$(JRE_COMPACT$1_IMAGE_DIR), \
+ SUBDIR := $$(JRE_COMPACT$1_BUNDLE_SUBDIR), \
+ ))
+
+ PROFILES_TARGETS += $$(BUILD_JRE_COMPACT$1_BUNDLE)
+ endef
+
+ $(eval $(call GenerateCompactProfilesBundles,1))
+ $(eval $(call GenerateCompactProfilesBundles,2))
+ $(eval $(call GenerateCompactProfilesBundles,3))
+endif
+
+################################################################################
+
ifneq ($(filter test-bundles, $(MAKECMDGOALS)), )
TEST_BUNDLE_FILES := $(call CacheFind, $(TEST_IMAGE_DIR))
@@ -316,7 +347,8 @@
################################################################################
product-bundles: $(PRODUCT_TARGETS)
+profiles-bundles: $(PROFILES_TARGETS)
test-bundles: $(TEST_TARGETS)
docs-bundles: $(DOCS_TARGETS)
-.PHONY: all default product-bundles test-bundles docs-bundles
+.PHONY: all default product-bundles profiles-bundles test-bundles docs-bundles
--- a/make/CompileJavaModules.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/CompileJavaModules.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -383,6 +383,10 @@
################################################################################
+jdk.jartool_ADD_JAVAC_FLAGS := -XDstringConcat=inline
+
+################################################################################
+
jdk.rmic_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
jdk.rmic_CLEAN := .properties
--- a/make/Images.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/Images.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -147,10 +147,6 @@
--output $(JRE_IMAGE_DIR)
$(TOUCH) $@
-JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
-JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
-JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
-
$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
$(call DependOnVariable, JRE_COMPACT1_MODULES_LIST) $(BASE_RELEASE_FILE)
--- a/make/Javadoc.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/Javadoc.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -1,4 +1,4 @@
-# Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
DRAFT_WINDOW_TITLE_MARKER := $(SPACE)[build $(VERSION_BUILD)]
endif
EARLYACCESS_TOP := \
- <div style="background-color: $$(HASH)EEEEEE"><div style="padding: 6px; \
+ <div style="background-color: $(HASH)EEEEEE"><div style="padding: 6px; \
margin-top: 2px; margin-bottom: 6px; margin-left: 6px; margin-right: \
6px; text-align: justify; font-size: 80%; font-family: Helvetica, Arial, \
sans-serif; font-weight: normal;">Please note that the specifications \
@@ -235,10 +235,6 @@
$1_OPTIONS += --add-modules $$(call CommaList, $$($1_MODULES))
- ifneq ($$(LOG_LEVEL), trace)
- $1_OPTIONS += -quiet
- endif
-
ifneq ($$($1_DISABLED_DOCLINT), )
# Create a string like ",-syntax,-html"
$1_DOCLINT_EXCEPTIONS := ,$$(call CommaList, $$(addprefix -, $$($1_DISABLED_DOCLINT)))
@@ -292,6 +288,13 @@
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
$$(SUPPORT_OUTPUTDIR)/docs/$1.vardeps)
+ # Do not store debug level options in VARDEPS.
+ ifneq ($$(LOG_LEVEL), trace)
+ $1_OPTIONS += -quiet
+ else
+ $1_OPTIONS += -verbose
+ endif
+
$1_PACKAGE_DEPS := $$(call CacheFind, $$(wildcard $$(foreach p, \
$$(subst .,/,$$(strip $$($1_PACKAGES))), \
$$(addsuffix /$$p, $$(wildcard $$(JAVADOC_SOURCE_DIRS))))))
--- a/make/Main.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/Main.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -342,7 +342,7 @@
symbols-image:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk symbols)
-profiles:
+profiles-image:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
mac-bundles-jdk:
@@ -356,7 +356,7 @@
ALL_TARGETS += store-source-revision create-source-revision-tracker bootcycle-images zip-security \
zip-source jrtfs-jar jdk-image jre-image \
- symbols-image profiles mac-bundles-jdk \
+ symbols-image profiles-image mac-bundles-jdk \
release-file exploded-image-optimize
################################################################################
@@ -510,13 +510,16 @@
product-bundles:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk product-bundles)
+profiles-bundles:
+ +($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk profiles-bundles)
+
test-bundles:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk test-bundles)
docs-bundles:
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk docs-bundles)
-ALL_TARGETS += product-bundles test-bundles docs-bundles
+ALL_TARGETS += product-bundles profiles-bundles test-bundles docs-bundles
################################################################################
# Install targets
@@ -734,7 +737,7 @@
jre-image: jmods release-file
symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
- profiles: jmods release-file
+ profiles-image: jmods release-file
mac-bundles-jdk: jdk-image jre-image
@@ -793,6 +796,8 @@
product-bundles: product-images
+ profiles-bundles: profiles-images
+
test-bundles: test-image
docs-bundles: docs-image
@@ -878,6 +883,9 @@
# an image until this can be cleaned up properly.
product-images: zip-security
+# Declare these for backwards compatiblity and convenience.
+profiles profiles-images: profiles-image
+
# The module summary cannot be run when:
# * Cross compiling and building a partial BUILDJDK for the build host
# * An external buildjdk has been supplied since it may not match the
@@ -909,7 +917,9 @@
copy java rmic libs launchers jmods \
jdk.jdwp.agent-gensrc $(ALL_MODULES) demos samples \
exploded-image-base exploded-image \
- create-buildjdk mac-bundles product-images docs-image test-image all-images \
+ create-buildjdk mac-bundles product-images \
+ profiles profiles-images \
+ docs-image test-image all-images \
all-bundles
################################################################################
--- a/make/common/MakeBase.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/common/MakeBase.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -435,7 +435,7 @@
Too many named arguments to macro, please update MAX_PARAMS in MakeBase.gmk))
# Iterate over 2 3 4... and evaluate the named parameters with $1_ as prefix
$(foreach i,$(PARAM_SEQUENCE), $(if $(strip $($i)),\
- $(strip $1)_$(strip $(call DoubleDollar, $($i))))$(NEWLINE))
+ $(strip $1)_$(strip $(call EscapeHash, $(call DoubleDollar, $($i))))$(NEWLINE)))
# Debug print all named parameter names and values
$(if $(findstring $(LOG_LEVEL),debug trace), \
$(info $0 $(strip $1) $(foreach i,$(PARAM_SEQUENCE), \
--- a/make/common/NativeCompilation.gmk Mon Jan 23 19:58:06 2017 +0300
+++ b/make/common/NativeCompilation.gmk Mon Jan 23 10:27:58 2017 -0800
@@ -288,8 +288,7 @@
$$($1_$(notdir $2)_OPTIMIZATION)), )
$1_$2_VARDEPS := $$($1_$(notdir $2)_CFLAGS) $$($1_$(notdir $2)_CXXFLAGS) \
$$($1_$(notdir $2)_OPT_CFLAGS) $$($1_$(notdir $2)_OPT_CXXFLAGS)
- $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
- $$(patsubst %$(OBJ_SUFFIX),%.vardeps,$$($1_$2_OBJ)))
+ $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, $$($1_$2_OBJ).vardeps)
endif
$$($1_$2_OBJ) : $2 $$($1_COMPILE_VARDEPS_FILE) $$($1_$2_VARDEPS_FILE) | $$($1_BUILD_INFO)
--- a/nashorn/.hgtags Mon Jan 23 19:58:06 2017 +0300
+++ b/nashorn/.hgtags Mon Jan 23 10:27:58 2017 -0800
@@ -385,3 +385,5 @@
c281306d33d83c92e0d870ace385d5f99678d7e7 jdk-9+149
ace1d994bca775d6545a4c874ae73d1dfc9ec18b jdk-9+150
2a0437036a64853334e538044eb68d2df70075fa jdk-9+151
+ddc52e72757086a75a54371e8e7f56a3f89f1e55 jdk-9+152
+19aaaf2d02b7d6986538cd9a8c46901ecb50eebf jdk-9+153
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Mon Jan 23 19:58:06 2017 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Mon Jan 23 10:27:58 2017 -0800
@@ -1032,7 +1032,7 @@
}
final Object key = property.getKey();
- property = iter.next();
+ property = iter.hasNext() ? iter.next() : null;
skipNotEnumerable();
return key;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Jan 23 19:58:06 2017 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Jan 23 10:27:58 2017 -0800
@@ -28,6 +28,8 @@
import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
@@ -100,7 +102,7 @@
* reparsed from source, or a soft reference to a {@code FunctionNode} for other functions (it is safe
* to be cleared as they can be reparsed).
*/
- private volatile Object cachedAst;
+ private volatile transient Object cachedAst;
/** Token of this function within the source. */
private final long token;
@@ -289,6 +291,9 @@
if (this.source == null && this.installer == null) {
this.source = src;
this.installer = inst;
+ for (final RecompilableScriptFunctionData nested : nestedFunctions.values()) {
+ nested.initTransients(src, inst);
+ }
} else if (this.source != src || !this.installer.isCompatibleWith(inst)) {
// Existing values must be same as those passed as parameters
throw new IllegalArgumentException();
@@ -424,7 +429,7 @@
} else if (lCachedAst instanceof SerializedAst) {
final SerializedAst serializedAst = (SerializedAst)lCachedAst;
// Even so, are we also softly caching the AST?
- final FunctionNode cachedFn = serializedAst.cachedAst.get();
+ final FunctionNode cachedFn = serializedAst.cachedAst == null ? null : serializedAst.cachedAst.get();
if (cachedFn != null) {
// Yes we are - this is fast
return cloneSymbols(cachedFn);
@@ -492,9 +497,11 @@
* we're using this tuple instead to also keep a deserialized AST around in memory to cut down on
* deserialization costs.
*/
- private static class SerializedAst {
+ private static class SerializedAst implements Serializable {
private final byte[] serializedAst;
- private volatile Reference<FunctionNode> cachedAst;
+ private volatile transient Reference<FunctionNode> cachedAst;
+
+ private static final long serialVersionUID = 1L;
SerializedAst(final FunctionNode fn, final Reference<FunctionNode> cachedAst) {
this.serializedAst = AstSerializer.serialize(fn);
@@ -1038,8 +1045,20 @@
return true;
}
+ private void writeObject(final ObjectOutputStream out) throws IOException {
+ final Object localCachedAst = cachedAst;
+ out.defaultWriteObject();
+ // We need to persist SerializedAst for split functions as they can't reparse the source code.
+ if (localCachedAst instanceof SerializedAst) {
+ out.writeObject(localCachedAst);
+ } else {
+ out.writeObject(null);
+ }
+ }
+
private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
+ cachedAst = in.readObject();
createLogger();
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/base.js Mon Jan 23 19:58:06 2017 +0300
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/base.js Mon Jan 23 10:27:58 2017 -0800
@@ -108,7 +108,7 @@
}
});
- Files.walkFileTree(rootDirectories[0], new JRTFSWalker());
+ Files.walkFileTree(rootDirectories.toArray()[0], new JRTFSWalker());
})();
LOAD_FX_CLASSES(this, "javafx.base");
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java Mon Jan 23 19:58:06 2017 +0300
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -47,7 +47,7 @@
@SuppressWarnings("javadoc")
public class CodeStoreAndPathTest {
- final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+ final static String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+ "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
+ "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
+ "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
@@ -69,7 +69,7 @@
+ "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+ "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+ "var x10 = 'Hello Script';}";
- final String code2 = "var code2; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+ final static String code2 = "var code2; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+ "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
+ "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
+ "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
@@ -92,9 +92,306 @@
+ "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+ "var x10 = 'Hello Script';}";
// Script size < Default minimum size for storing a compiled script class
- final String code3 = "var code3; var x = 'Hello Script'; var x1 = 'Hello Script'; ";
- final String codeCache = "build/nashorn_code_cache";
- final String oldUserDir = System.getProperty("user.dir");
+ final static String code3 = "var code3; var x = 'Hello Script'; var x1 = 'Hello Script'; ";
+ final static String nestedFunctions = "\n" +
+ "(function outer() { \n" +
+ " var map = null; \n" +
+ " (function inner() { \n" +
+ " var object; \n" +
+ " if (map === null) { \n" +
+ " map = (function() { \n" +
+ " var HashMap = Java.type('java.util.HashMap'); \n" +
+ " map = new HashMap(); \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " return map; \n" +
+ " }()); \n" +
+ " } \n" +
+ " object = {}; \n" +
+ " return object; \n" +
+ " })(); \n" +
+ "}()); ";
+ final static String longNestedFunctions = "\n" +
+ "(function outer() { \n" +
+ " var map = null; \n" +
+ " (function inner() { \n" +
+ " var object; \n" +
+ " var HashMap = Java.type('java.util.HashMap'); \n" +
+ " map = new HashMap(); \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address';\n" +
+ " map.name = 'name'; \n" +
+ " map.id = 1234;\n" +
+ " map.basePath = 'basePath'; \n" +
+ " map.extensionPath = 'extension';\n" +
+ " map.address = 'address'; \n" +
+ " object = {}; \n" +
+ " return object; \n" +
+ " })(); \n" +
+ "}()); ";
+ final static String codeCache = "build/nashorn_code_cache";
+ final static String oldUserDir = System.getProperty("user.dir");
private static final String[] ENGINE_OPTIONS_OPT = new String[]{"--persistent-code-cache", "--optimistic-types=true"};
private static final String[] ENGINE_OPTIONS_NOOPT = new String[]{"--persistent-code-cache", "--optimistic-types=false"};
@@ -166,6 +463,28 @@
checkCompiledScripts(stream, 4);
}
+ @Test
+ public void testNestedFunctionStore() throws ScriptException, IOException {
+ System.setProperty("nashorn.persistent.code.cache", codeCache);
+ final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(nestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(nestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(nestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(nestedFunctions);
+ }
+
+ @Test
+ public void testSplitFunctionStore() throws ScriptException, IOException {
+ System.setProperty("nashorn.persistent.code.cache", codeCache);
+ System.setProperty("nashorn.compiler.splitter.threshold", "500");
+ final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(longNestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(longNestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(longNestedFunctions);
+ factory.getScriptEngine(ENGINE_OPTIONS_OPT).eval(longNestedFunctions);
+ System.getProperties().remove("nashorn.compiler.splitter.threshold");
+ }
+
private static Path getCodeCachePath(final boolean optimistic) {
final String codeCache = System.getProperty("nashorn.persistent.code.cache");
final Path codeCachePath = FileSystems.getDefault().getPath(codeCache).toAbsolutePath();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/PropertyMapTest.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,65 @@
+/*
+ * 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. 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.nashorn.internal.runtime.test;
+
+import java.util.Iterator;
+import jdk.nashorn.internal.runtime.PropertyMap;
+import jdk.nashorn.internal.runtime.ScriptObject;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for PropertyMap functionality
+ *
+ * @test
+ * @modules jdk.scripting.nashorn/jdk.nashorn.internal.runtime
+ * @run testng jdk.nashorn.internal.runtime.test.PropertyMapTest
+ */
+@SuppressWarnings("javadoc")
+public class PropertyMapTest {
+
+ @Test
+ public void propertyMapIteratorTest() {
+ final ScriptObject scriptObject = new ScriptObject(PropertyMap.newMap()) {};
+ Assert.assertFalse(scriptObject.getMap().iterator().hasNext());
+
+ scriptObject.set("a", "a", 0);
+ scriptObject.set("b", 3, 0);
+ // 3 is a valid array key not stored in property map
+ scriptObject.set(3, 1, 0);
+ scriptObject.set(6.5, 1.3, 0);
+ final Iterator<Object> iterator = scriptObject.getMap().iterator();
+
+ Assert.assertTrue(iterator.hasNext());
+ Assert.assertEquals(iterator.next(), "a");
+ Assert.assertTrue(iterator.hasNext());
+ Assert.assertEquals(iterator.next(), "b");
+ Assert.assertTrue(iterator.hasNext());
+ Assert.assertEquals(iterator.next(), "6.5");
+ Assert.assertFalse(iterator.hasNext());
+ }
+
+}
--- a/test/failure_handler/src/share/conf/mac.properties Mon Jan 23 19:58:06 2017 +0300
+++ b/test/failure_handler/src/share/conf/mac.properties Mon Jan 23 10:27:58 2017 -0800
@@ -64,7 +64,7 @@
native.core.app=bash
native.core.delimiter=\0
native.core.args=-c\0gcore -o ./core.%p %p || \
- (DevToolsSecurity --status | grep -q enabled && lldb -o 'attach %p' -o 'process save-core core.%p' -o 'detach' -o 'quit')
+ (DevToolsSecurity --status | grep -q enabled && lldb --batch -o 'attach %p' -o 'process save-core core.%p' -o 'detach' -o 'quit')
native.core.params.timeout=3600000
################################################################################
# environment info to gather
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/SecurityTools.java Mon Jan 23 10:27:58 2017 -0800
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+public class SecurityTools {
+
+ public static final String NO_ALIAS = null;
+
+ // keytool
+
+ public static OutputAnalyzer keytool(List<String> options)
+ throws Throwable {
+
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("keytool")
+ .addVMArg("-Duser.language=en")
+ .addVMArg("-Duser.country=US");
+ for (String option : options) {
+ if (option.startsWith("-J")) {
+ launcher.addVMArg(option.substring(2));
+ } else {
+ launcher.addToolArg(option);
+ }
+ }
+ return ProcessTools.executeCommand(launcher.getCommand());
+ }
+
+ public static OutputAnalyzer keytool(String options) throws Throwable {
+ return keytool(options.split("\\s+"));
+ }
+
+ public static OutputAnalyzer keytool(String... options) throws Throwable {
+ return keytool(List.of(options));
+ }
+
+ // jarsigner
+
+ public static OutputAnalyzer jarsigner(String jar, String alias,
+ List<String> options) throws Throwable {
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jarsigner")
+ .addVMArg("-Duser.language=en")
+ .addVMArg("-Duser.country=US");
+ for (String option : options) {
+ if (option.startsWith("-J")) {
+ launcher.addVMArg(option.substring(2));
+ } else {
+ launcher.addToolArg(option);
+ }
+ }
+ launcher.addToolArg(jar);
+ if (alias != null) {
+ launcher.addToolArg(alias);
+ }
+ return ProcessTools.executeCommand(launcher.getCommand());
+ }
+
+ public static OutputAnalyzer jarsigner(String jar, String alias,
+ String options) throws Throwable {
+
+ return jarsigner(jar, alias, options.split("\\s+"));
+ }
+
+ public static OutputAnalyzer jarsigner(String jar, String alias,
+ String... options) throws Throwable {
+
+ return jarsigner(jar, alias, List.of(options));
+ }
+
+ public static OutputAnalyzer sign(String jar, String alias, String... options)
+ throws Throwable {
+
+ return jarsigner(jar, alias,
+ mergeOptions("-J-Djava.security.egd=file:/dev/./urandom", options));
+ }
+
+ public static OutputAnalyzer verify(String jar, String... options)
+ throws Throwable {
+
+ return jarsigner(jar, NO_ALIAS, mergeOptions("-verify", options));
+ }
+
+ // helper methods
+
+ private static List<String> mergeOptions(
+ String firstOption, String... secondPart) {
+
+ return mergeOptions(List.of(firstOption), secondPart);
+ }
+
+ private static List<String> mergeOptions(
+ List<String> firstPart, String... secondPart) {
+
+ List<String> options = new ArrayList<>(firstPart);
+ Collections.addAll(options, secondPart);
+ return options;
+ }
+}
+