# HG changeset patch # User kvn # Date 1373572220 25200 # Node ID 6ed8434664ed53e3092a54499ca31e22f5bb8b0b # Parent 0273c023680c9b2cf741edf1344721eb4545736d# Parent 2d3875b0d18b3ad1c2bebf385a697e309e4005a4 Merge diff -r 0273c023680c -r 6ed8434664ed .hgtags --- a/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ b72ae39e1329fefae50d4690db4fde43f3841a95 jdk8-b93 0d804e3b955dce406af6a79ac1cc35c696aff7fb jdk8-b94 49fe9c8049132647ad38837a877dd473e6c9b0e5 jdk8-b95 +ea73f01b9053e7165e7ba80f242bafecbc6af712 jdk8-b96 +0a85476a0b9cb876d5666d45097dac68bef3fce1 jdk8-b97 +711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed .hgtags-top-repo --- a/.hgtags-top-repo Tue Jul 02 17:38:10 2013 -0700 +++ b/.hgtags-top-repo Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ 27c51c6e31c1ef36afa0e6efb031f9b13f26c12b jdk8-b93 50d2bde060f2a9bbbe4da0c8986e20aca61f2e2e jdk8-b94 785d07fe38901ecc1b7e0145e53e1c3da9361fee jdk8-b95 +c156084add486f941c12d886a0b1b2854795d557 jdk8-b96 +a1c1e8bf71f354f3aec0214cf13d6668811e021d jdk8-b97 +0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed NewMakefile.gmk --- a/NewMakefile.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/NewMakefile.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -68,12 +68,15 @@ # First, find out the valid targets # Run the makefile with an arbitraty SPEC using -p -q (quiet dry-run and dump rules) to find # available PHONY targets. Use this list as valid targets to pass on to the repeated calls. - all_phony_targets=$(filter-out $(global_targets), $(strip $(shell \ - $(MAKE) -p -q -f common/makefiles SPEC=$(firstword $(SPEC)) | \ + all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \ + $(MAKE) -p -q -f common/makefiles/Main.gmk SPEC=$(firstword $(SPEC)) | \ grep ^.PHONY: | head -n 1 | cut -d " " -f 2-))) -$(all_phony_targets): - @$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true + $(all_phony_targets): + $(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \ + $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true + + .PHONY: $(all_phony_targets) endif endif diff -r 0273c023680c -r 6ed8434664ed common/autoconf/basics.m4 --- a/common/autoconf/basics.m4 Tue Jul 02 17:38:10 2013 -0700 +++ b/common/autoconf/basics.m4 Thu Jul 11 12:50:20 2013 -0700 @@ -43,6 +43,16 @@ fi ]) +# Appends a string to a path variable, only adding the : when needed. +AC_DEFUN([BASIC_APPEND_TO_PATH], +[ + if test "x[$]$1" = x; then + $1="$2" + else + $1="[$]$1:$2" + fi +]) + # This will make sure the given variable points to a full and proper # path. This means: # 1) There will be no spaces in the path. On posix platforms, @@ -351,7 +361,9 @@ AC_SUBST(SYS_ROOT) AC_ARG_WITH([tools-dir], [AS_HELP_STRING([--with-tools-dir], - [search this directory for compilers and tools (for cross-compiling)])], [TOOLS_DIR=$with_tools_dir]) + [search this directory for compilers and tools (for cross-compiling)])], + [TOOLS_DIR=$with_tools_dir] +) AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], [use this directory as base for tools-dir and sys-root (for cross-compiling)])], @@ -359,17 +371,14 @@ if test "x$with_sys_root" != x; then AC_MSG_ERROR([Cannot specify both --with-devkit and --with-sys-root at the same time]) fi - if test "x$with_tools_dir" != x; then - AC_MSG_ERROR([Cannot specify both --with-devkit and --with-tools-dir at the same time]) - fi - TOOLS_DIR=$with_devkit/bin + BASIC_FIXUP_PATH([with_devkit]) + BASIC_APPEND_TO_PATH([TOOLS_DIR],$with_devkit/bin) if test -d "$with_devkit/$host_alias/libc"; then SYS_ROOT=$with_devkit/$host_alias/libc elif test -d "$with_devkit/$host/sys-root"; then SYS_ROOT=$with_devkit/$host/sys-root fi ]) - ]) AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], @@ -612,6 +621,14 @@ AC_PATH_PROG(HG, hg) AC_PATH_PROG(STAT, stat) AC_PATH_PROG(TIME, time) +# Check if it's GNU time +IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'` +if test "x$IS_GNU_TIME" != x; then + IS_GNU_TIME=yes +else + IS_GNU_TIME=no +fi +AC_SUBST(IS_GNU_TIME) if test "x$OPENJDK_TARGET_OS" = "xwindows"; then BASIC_REQUIRE_PROG(COMM, comm) diff -r 0273c023680c -r 6ed8434664ed common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Tue Jul 02 17:38:10 2013 -0700 +++ b/common/autoconf/generated-configure.sh Thu Jul 11 12:50:20 2013 -0700 @@ -800,6 +800,7 @@ PKG_CONFIG CODESIGN XATTR +IS_GNU_TIME TIME STAT HG @@ -3089,6 +3090,9 @@ # Also set JVM_ARG_OK to true/false depending on outcome. +# Appends a string to a path variable, only adding the : when needed. + + # This will make sure the given variable points to a full and proper # path. This means: # 1) There will be no spaces in the path. On posix platforms, @@ -3790,7 +3794,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1372808067 +DATE_WHEN_GENERATED=1373572212 ############################################################################### # @@ -7465,6 +7469,7 @@ # Check whether --with-tools-dir was given. if test "${with_tools_dir+set}" = set; then : withval=$with_tools_dir; TOOLS_DIR=$with_tools_dir + fi @@ -7475,10 +7480,135 @@ if test "x$with_sys_root" != x; then as_fn_error $? "Cannot specify both --with-devkit and --with-sys-root at the same time" "$LINENO" 5 fi - if test "x$with_tools_dir" != x; then - as_fn_error $? "Cannot specify both --with-devkit and --with-tools-dir at the same time" "$LINENO" 5 - fi - TOOLS_DIR=$with_devkit/bin + + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + + # Input might be given as Windows format, start by converting to + # unix format. + path="$with_devkit" + 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 with_devkit, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is invalid." >&6;} + as_fn_error $? "Cannot locate the the path of with_devkit" "$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-stile (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 + with_devkit="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting with_devkit to \"$new_path\"" >&6;} + fi + + elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then + + path="$with_devkit" + 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 + with_devkit="$new_path" + { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_devkit to \"$new_path\"" >&5 +$as_echo "$as_me: Rewriting with_devkit 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 posix platform. Hooray! :) + path="$with_devkit" + has_space=`$ECHO "$path" | $GREP " "` + if test "x$has_space" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_devkit, which resolves as \"$path\", is invalid." >&5 +$as_echo "$as_me: The path of with_devkit, 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 with_devkit, which resolves as \"$path\", is not found." "$LINENO" 5 + fi + + with_devkit="`cd "$path"; $THEPWDCMD -L`" + fi + + + if test "x$TOOLS_DIR" = x; then + TOOLS_DIR="$with_devkit/bin" + else + TOOLS_DIR="$TOOLS_DIR:$with_devkit/bin" + fi + if test -d "$with_devkit/$host_alias/libc"; then SYS_ROOT=$with_devkit/$host_alias/libc elif test -d "$with_devkit/$host/sys-root"; then @@ -7489,7 +7619,6 @@ - # Setup default logging of stdout and stderr to build.log in the output root. BUILD_LOG='$(OUTPUT_ROOT)/build.log' BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old' @@ -10271,6 +10400,14 @@ fi +# Check if it's GNU time +IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'` +if test "x$IS_GNU_TIME" != x; then + IS_GNU_TIME=yes +else + IS_GNU_TIME=no +fi + if test "x$OPENJDK_TARGET_OS" = "xwindows"; then @@ -17231,6 +17368,8 @@ # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` + # Remove any paths containing # (typically F#) as that messes up make + PATH=`$ECHO "$PATH" | $SED 's/[^:#]*#[^:]*://g'` VS_PATH="$PATH" @@ -18982,15 +19121,6 @@ fi -if test "x$SYS_ROOT" != "x/" ; then - CFLAGS="--sysroot=$SYS_ROOT $CFLAGS" - CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS" - OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" - OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" - CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS" - LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS" -fi - # Store the CFLAGS etal passed to the configure script. ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" @@ -19941,7 +20071,7 @@ elif test "x$OPENJDK_TARGET_OS" = xwindows; then # First line typically looks something like: # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 - COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1` + COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'` COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \([1-9][0-9.]*\) .*/\1/p"` COMPILER_VENDOR="Microsoft CL.EXE" COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"` @@ -21514,7 +21644,7 @@ elif test "x$OPENJDK_TARGET_OS" = xwindows; then # First line typically looks something like: # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 - COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1` + COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'` COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \([1-9][0-9.]*\) .*/\1/p"` COMPILER_VENDOR="Microsoft CL.EXE" COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"` @@ -23774,19 +23904,20 @@ RC_FLAGS="$RC_FLAGS -d NDEBUG" fi - JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION - if test "x$JDK_UPDATE_VERSION" = x; then : - - JDK_UPDATE_VERSION_NOTNULL=0 - -fi - RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\"" + + # The version variables used to create RC_FLAGS may be overridden + # in a custom configure script, or possibly the command line. + # Let those variables be expanded at make time in spec.gmk. + # The \$ are escaped to the shell, and the $(...) variables + # are evaluated by make. + RC_FLAGS="$RC_FLAGS \ + -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" # lib.exe is used to create static libraries. # Extract the first word of "lib", so it can be a program name with args. diff -r 0273c023680c -r 6ed8434664ed common/autoconf/spec.gmk.in --- a/common/autoconf/spec.gmk.in Tue Jul 02 17:38:10 2013 -0700 +++ b/common/autoconf/spec.gmk.in Thu Jul 11 12:50:20 2013 -0700 @@ -516,6 +516,7 @@ TAIL:=@TAIL@ TEE:=@TEE@ TIME:=@TIME@ +IS_GNU_TIME:=@IS_GNU_TIME@ TR:=@TR@ TOUCH:=@TOUCH@ UNIQ:=@UNIQ@ diff -r 0273c023680c -r 6ed8434664ed common/autoconf/toolchain.m4 --- a/common/autoconf/toolchain.m4 Tue Jul 02 17:38:10 2013 -0700 +++ b/common/autoconf/toolchain.m4 Thu Jul 11 12:50:20 2013 -0700 @@ -47,7 +47,7 @@ elif test "x$OPENJDK_TARGET_OS" = xwindows; then # First line typically looks something like: # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86 - COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1` + COMPILER_VERSION_TEST=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'` COMPILER_VERSION=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.*Version \(@<:@1-9@:>@@<:@0-9.@:>@*\) .*/\1/p"` COMPILER_VENDOR="Microsoft CL.EXE" COMPILER_CPU_TEST=`$ECHO $COMPILER_VERSION_TEST | $SED -n "s/^.* for \(.*\)$/\1/p"` @@ -226,15 +226,6 @@ ], []) -if test "x$SYS_ROOT" != "x/" ; then - CFLAGS="--sysroot=$SYS_ROOT $CFLAGS" - CXXFLAGS="--sysroot=$SYS_ROOT $CXXFLAGS" - OBJCFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" - OBJCXXFLAGS="--sysroot=$SYS_ROOT $OBJCFLAGS" - CPPFLAGS="--sysroot=$SYS_ROOT $CPPFLAGS" - LDFLAGS="--sysroot=$SYS_ROOT $LDFLAGS" -fi - # Store the CFLAGS etal passed to the configure script. ORG_CFLAGS="$CFLAGS" ORG_CXXFLAGS="$CXXFLAGS" @@ -378,17 +369,20 @@ AS_IF([test "x$VARIANT" = xOPT], [ RC_FLAGS="$RC_FLAGS -d NDEBUG" ]) - JDK_UPDATE_VERSION_NOTNULL=$JDK_UPDATE_VERSION - AS_IF([test "x$JDK_UPDATE_VERSION" = x], [ - JDK_UPDATE_VERSION_NOTNULL=0 - ]) - RC_FLAGS="$RC_FLAGS -d \"JDK_BUILD_ID=$FULL_VERSION\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COMPANY=$COMPANY_NAME\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COMPONENT=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME binary\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_VER=$JDK_MINOR_VERSION.$JDK_MICRO_VERSION.$JDK_UPDATE_VERSION_NOTNULL.$COOKED_BUILD_NUMBER\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_NAME=$PRODUCT_NAME $JDK_RC_PLATFORM_NAME $JDK_MINOR_VERSION $JDK_UPDATE_META_TAG\"" - RC_FLAGS="$RC_FLAGS -d \"JDK_FVER=$JDK_MINOR_VERSION,$JDK_MICRO_VERSION,$JDK_UPDATE_VERSION_NOTNULL,$COOKED_BUILD_NUMBER\"" + + # The version variables used to create RC_FLAGS may be overridden + # in a custom configure script, or possibly the command line. + # Let those variables be expanded at make time in spec.gmk. + # The \$ are escaped to the shell, and the $(...) variables + # are evaluated by make. + RC_FLAGS="$RC_FLAGS \ + -d \"JDK_BUILD_ID=\$(FULL_VERSION)\" \ + -d \"JDK_COMPANY=\$(COMPANY_NAME)\" \ + -d \"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \ + -d \"JDK_VER=\$(JDK_MINOR_VERSION).\$(JDK_MICRO_VERSION).\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0).\$(COOKED_BUILD_NUMBER)\" \ + -d \"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \ + -d \"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(JDK_MINOR_VERSION) \$(JDK_UPDATE_META_TAG)\" \ + -d \"JDK_FVER=\$(JDK_MINOR_VERSION),\$(JDK_MICRO_VERSION),\$(if \$(JDK_UPDATE_VERSION),\$(JDK_UPDATE_VERSION),0),\$(COOKED_BUILD_NUMBER)\"" # lib.exe is used to create static libraries. AC_CHECK_PROG([WINAR], [lib],[lib],,,) diff -r 0273c023680c -r 6ed8434664ed common/autoconf/toolchain_windows.m4 --- a/common/autoconf/toolchain_windows.m4 Tue Jul 02 17:38:10 2013 -0700 +++ b/common/autoconf/toolchain_windows.m4 Thu Jul 11 12:50:20 2013 -0700 @@ -208,6 +208,8 @@ # Remove any trailing \ from INCLUDE and LIB to avoid trouble in spec.gmk. VS_INCLUDE=`$ECHO "$INCLUDE" | $SED 's/\\\\$//'` VS_LIB=`$ECHO "$LIB" | $SED 's/\\\\$//'` + # Remove any paths containing # (typically F#) as that messes up make + PATH=`$ECHO "$PATH" | $SED 's/[[^:#]]*#[^:]*://g'` VS_PATH="$PATH" AC_SUBST(VS_INCLUDE) AC_SUBST(VS_LIB) diff -r 0273c023680c -r 6ed8434664ed common/makefiles/JavaCompilation.gmk --- a/common/makefiles/JavaCompilation.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/common/makefiles/JavaCompilation.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -155,7 +155,7 @@ # lines, but not here for use in make dependencies. $1_DEPS+=$$(subst \,,$$(foreach src,$$($1_SRCS),$$(addprefix $$(src)/,$$($1_EXTRA_FILES)))) ifeq (,$$($1_SKIP_METAINF)) - $1_DEPS+=$$(call CacheFind $$(wildcard $$(addsuffix /META-INF,$$($1_SRCS)))) + $1_DEPS+=$$(call CacheFind,$$(wildcard $$(addsuffix /META-INF,$$($1_SRCS)))) endif endif @@ -255,12 +255,21 @@ $(call LogSetupMacroEntry,SetupZipArchive($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15)) $(if $(16),$(error Internal makefile error: Too many arguments to SetupZipArchive, please update JavaCompilation.gmk)) + # To avoid running find over too large sets of files, which causes make to crash + # on some configurations (cygwin), use INCLUDES and INCLUDE_FILES to build a set + # of directories to run find in, if available. + ifneq ($$($1_INCLUDES)$$($1_INCLUDE_FILES),) + $1_FIND_LIST := $$(wildcard $$(foreach i,$$($1_SRC),\ + $$(addprefix $$i/,$$($1_INCLUDES) $$($1_INCLUDE_FILES)))) + else + $1_FIND_LIST := $$($1_SRC) + endif + # Find all files in the source tree. $1_ALL_SRCS := $$(call not-containing,_the.,\ - $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind $$($1_SRC)))) + $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind,$$($1_FIND_LIST)))) ifneq ($$($1_INCLUDES),) - $1_SRC_INCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_INCLUDES)))) ifneq ($$($1_SUFFIXES),) $1_ZIP_INCLUDES := $$(foreach s,$$($1_SUFFIXES),\ $$(addprefix -i$(SPACE)$(DQUOTE),$$(addsuffix /*$$s$(DQUOTE),$$($1_INCLUDES)))) @@ -269,12 +278,8 @@ endif endif ifneq ($$($1_INCLUDE_FILES),) - $1_SRC_INCLUDES += $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$($1_INCLUDE_FILES))) $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES)) endif - ifneq ($$($1_SRC_INCLUDES),) - $1_ALL_SRCS := $$(filter $$($1_SRC_INCLUDES),$$($1_ALL_SRCS)) - endif ifneq ($$($1_EXCLUDES),) $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES)))) $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES))) diff -r 0273c023680c -r 6ed8434664ed common/makefiles/MakeBase.gmk --- a/common/makefiles/MakeBase.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/common/makefiles/MakeBase.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -332,9 +332,11 @@ # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make # For each target executed, will print # Building (from ) ( newer) - # but with a limit of 20 on , to avoid cluttering logs too much (and causing a crash on Cygwin). - OLD_SHELL:=$$(SHELL) - WRAPPER_SHELL:=$$(OLD_SHELL) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(TIME),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(OLD_SHELL) + # but with a limit of 20 on , to avoid cluttering logs too much + # (and causing a crash on Cygwin). + # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris. + # Only use time if it's GNU time which supports format and output file. + WRAPPER_SHELL:=/bin/bash $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log /bin/bash SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL) endif # Never remove warning messages; this is just for completeness diff -r 0273c023680c -r 6ed8434664ed corba/.hgtags --- a/corba/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/corba/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ 8dc9d7ccbb2d77fd89bc321bb02e67c152aca257 jdk8-b93 22f5d7f261d9d61a953d2d9a53f2e9ce0ca361d1 jdk8-b94 2cf36f43df36137980d9828cec27003ec10daeee jdk8-b95 +3357c2776431d51a8de326a85e0f41420e40774f jdk8-b96 +469995a8e97424f450c880606d689bf345277b19 jdk8-b97 +3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed hotspot/.hgtags --- a/hotspot/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -353,3 +353,9 @@ 69689078dff8b21e6df30870464f5d736eebdf72 hs25-b37 5d65c078cd0ac455aa5e58a09844c7acce54b487 jdk8-b95 2cc5a9d1ba66dfdff578918b393c727bd9450210 hs25-b38 +e6a4b8c71fa6f225bd989a34de2d0d0a656a8be8 jdk8-b96 +2b9380b0bf0b649f40704735773e8956c2d88ba0 hs25-b39 +d197d377ab2e016d024e8c86cb06a57bd7eae590 jdk8-b97 +c9dd82da51ed34a28f7c6b3245163ee962e94572 hs25-b40 +30b5b75c42ac5174b640fbef8aa87527668e8400 jdk8-b98 +2b9946e10587f74ef75ae8145bea484df4a2738b hs25-b41 diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Thu Jul 11 12:50:20 2013 -0700 @@ -31,13 +31,19 @@ import java.util.*; public class CLHSDB { + + public CLHSDB(JVMDebugger d) { + jvmDebugger = d; + } + public static void main(String[] args) { new CLHSDB(args).run(); } - private void run() { - // At this point, if pidText != null we are supposed to attach to it. - // Else, if execPath != null, it is the path of a jdk/bin/java + public void run() { + // If jvmDebugger is already set, we have been given a JVMDebugger. + // Otherwise, if pidText != null we are supposed to attach to it. + // Finally, if execPath != null, it is the path of a jdk/bin/java // and coreFilename is the pathname of a core file we are // supposed to attach to. @@ -49,7 +55,9 @@ } }); - if (pidText != null) { + if (jvmDebugger != null) { + attachDebugger(jvmDebugger); + } else if (pidText != null) { attachDebugger(pidText); } else if (execPath != null) { attachDebugger(execPath, coreFilename); @@ -96,6 +104,7 @@ // Internals only below this point // private HotSpotAgent agent; + private JVMDebugger jvmDebugger; private boolean attached; // These had to be made data members because they are referenced in inner classes. private String pidText; @@ -120,7 +129,7 @@ case (1): if (args[0].equals("help") || args[0].equals("-help")) { doUsage(); - System.exit(0); + return; } // If all numbers, it is a PID to attach to // Else, it is a pathname to a .../bin/java for a core file. @@ -142,10 +151,15 @@ default: System.out.println("HSDB Error: Too many options specified"); doUsage(); - System.exit(1); + return; } } + private void attachDebugger(JVMDebugger d) { + agent.attach(d); + attached = true; + } + /** NOTE we are in a different thread here than either the main thread or the Swing/AWT event handler thread, so we must be very careful when creating or removing widgets */ diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Thu Jul 11 12:50:20 2013 -0700 @@ -101,6 +101,9 @@ import sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine; public class CommandProcessor { + + volatile boolean quit; + public abstract static class DebuggerInterface { public abstract HotSpotAgent getAgent(); public abstract boolean isAttached(); @@ -1135,7 +1138,7 @@ usage(); } else { debugger.detach(); - System.exit(0); + quit = true; } } }, @@ -1714,7 +1717,7 @@ } protected void quit() { debugger.detach(); - System.exit(0); + quit = true; } protected BufferedReader getInputReader() { return in; @@ -1781,7 +1784,7 @@ public void run(boolean prompt) { // Process interactive commands. - while (true) { + while (!quit) { if (prompt) printPrompt(); String ln = null; try { diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Thu Jul 11 12:50:20 2013 -0700 @@ -59,8 +59,11 @@ // Internals only below this point // private HotSpotAgent agent; + private JVMDebugger jvmDebugger; private JDesktopPane desktop; private boolean attached; + private boolean argError; + private JFrame frame; /** List */ private java.util.List attachMenuItems; /** List */ @@ -85,6 +88,11 @@ System.out.println(" path-to-corefile: Debug this corefile. The default is 'core'"); System.out.println(" If no arguments are specified, you can select what to do from the GUI.\n"); HotSpotAgent.showUsage(); + argError = true; + } + + public HSDB(JVMDebugger d) { + jvmDebugger = d; } private HSDB(String[] args) { @@ -95,7 +103,6 @@ case (1): if (args[0].equals("help") || args[0].equals("-help")) { doUsage(); - System.exit(0); } // If all numbers, it is a PID to attach to // Else, it is a pathname to a .../bin/java for a core file. @@ -117,24 +124,29 @@ default: System.out.println("HSDB Error: Too many options specified"); doUsage(); - System.exit(1); } } - private void run() { - // At this point, if pidText != null we are supposed to attach to it. - // Else, if execPath != null, it is the path of a jdk/bin/java - // and coreFilename is the pathname of a core file we are - // supposed to attach to. + // close this tool without calling System.exit + protected void closeUI() { + workerThread.shutdown(); + frame.dispose(); + } + + public void run() { + // Don't start the UI if there were bad arguments. + if (argError) { + return; + } agent = new HotSpotAgent(); workerThread = new WorkerThread(); attachMenuItems = new java.util.ArrayList(); detachMenuItems = new java.util.ArrayList(); - JFrame frame = new JFrame("HSDB - HotSpot Debugger"); + frame = new JFrame("HSDB - HotSpot Debugger"); frame.setSize(800, 600); - frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JMenuBar menuBar = new JMenuBar(); @@ -197,7 +209,7 @@ item = createMenuItem("Exit", new ActionListener() { public void actionPerformed(ActionEvent e) { - System.exit(0); + closeUI(); } }); item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, ActionEvent.ALT_MASK)); @@ -406,7 +418,15 @@ } }); - if (pidText != null) { + // If jvmDebugger is already set, we have been given a JVMDebugger. + // Otherwise, if pidText != null we are supposed to attach to it. + // Finally, if execPath != null, it is the path of a jdk/bin/java + // and coreFilename is the pathname of a core file we are + // supposed to attach to. + + if (jvmDebugger != null) { + attach(jvmDebugger); + } else if (pidText != null) { attach(pidText); } else if (execPath != null) { attach(execPath, coreFilename); @@ -1113,6 +1133,12 @@ }); } + // Attach to existing JVMDebugger, which should be already attached to a core/process. + private void attach(JVMDebugger d) { + attached = true; + showThreadsDialog(); + } + /** NOTE we are in a different thread here than either the main thread or the Swing/AWT event handler thread, so we must be very careful when creating or removing widgets */ diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/HotSpotAgent.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,8 @@ package sun.jvm.hotspot; import java.rmi.RemoteException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import sun.jvm.hotspot.debugger.Debugger; import sun.jvm.hotspot.debugger.DebuggerException; @@ -63,7 +65,6 @@ private String os; private String cpu; - private String fileSep; // The system can work in several ways: // - Attaching to local process @@ -155,6 +156,14 @@ go(); } + /** This uses a JVMDebugger that is already attached to the core or process */ + public synchronized void attach(JVMDebugger d) + throws DebuggerException { + debugger = d; + isServer = false; + go(); + } + /** This attaches to a "debug server" on a remote machine; this remote server has already attached to a process or opened a core file and is waiting for RMI calls on the Debugger object to @@ -303,28 +312,37 @@ // server, but not client attaching to server) // - try { - os = PlatformInfo.getOS(); - cpu = PlatformInfo.getCPU(); - } - catch (UnsupportedPlatformException e) { - throw new DebuggerException(e); - } - fileSep = System.getProperty("file.separator"); + // Handle existing or alternate JVMDebugger: + // these will set os, cpu independently of our PlatformInfo implementation. + String alternateDebugger = System.getProperty("sa.altDebugger"); + if (debugger != null) { + setupDebuggerExisting(); + + } else if (alternateDebugger != null) { + setupDebuggerAlternate(alternateDebugger); - if (os.equals("solaris")) { - setupDebuggerSolaris(); - } else if (os.equals("win32")) { - setupDebuggerWin32(); - } else if (os.equals("linux")) { - setupDebuggerLinux(); - } else if (os.equals("bsd")) { - setupDebuggerBsd(); - } else if (os.equals("darwin")) { - setupDebuggerDarwin(); } else { - // Add support for more operating systems here - throw new DebuggerException("Operating system " + os + " not yet supported"); + // Otherwise, os, cpu are those of our current platform: + try { + os = PlatformInfo.getOS(); + cpu = PlatformInfo.getCPU(); + } catch (UnsupportedPlatformException e) { + throw new DebuggerException(e); + } + if (os.equals("solaris")) { + setupDebuggerSolaris(); + } else if (os.equals("win32")) { + setupDebuggerWin32(); + } else if (os.equals("linux")) { + setupDebuggerLinux(); + } else if (os.equals("bsd")) { + setupDebuggerBsd(); + } else if (os.equals("darwin")) { + setupDebuggerDarwin(); + } else { + // Add support for more operating systems here + throw new DebuggerException("Operating system " + os + " not yet supported"); + } } if (isServer) { @@ -423,6 +441,41 @@ // OS-specific debugger setup/connect routines // + // Use the existing JVMDebugger, as passed to our constructor. + // Retrieve os and cpu from that debugger, not the current platform. + private void setupDebuggerExisting() { + + os = debugger.getOS(); + cpu = debugger.getCPU(); + setupJVMLibNames(os); + machDesc = debugger.getMachineDescription(); + } + + // Given a classname, load an alternate implementation of JVMDebugger. + private void setupDebuggerAlternate(String alternateName) { + + try { + Class c = Class.forName(alternateName); + Constructor cons = c.getConstructor(); + debugger = (JVMDebugger) cons.newInstance(); + attachDebugger(); + setupDebuggerExisting(); + + } catch (ClassNotFoundException cnfe) { + throw new DebuggerException("Cannot find alternate SA Debugger: '" + alternateName + "'"); + } catch (NoSuchMethodException nsme) { + throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' has missing constructor."); + } catch (InstantiationException ie) { + throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", ie); + } catch (IllegalAccessException iae) { + throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae); + } catch (InvocationTargetException iae) { + throw new DebuggerException("Alternate SA Debugger: '" + alternateName + "' fails to initialise: ", iae); + } + + System.err.println("Loaded alternate HotSpot SA Debugger: " + alternateName); + } + // // Solaris // @@ -466,6 +519,11 @@ debugger = new RemoteDebuggerClient(remote); machDesc = ((RemoteDebuggerClient) debugger).getMachineDescription(); os = debugger.getOS(); + setupJVMLibNames(os); + cpu = debugger.getCPU(); + } + + private void setupJVMLibNames(String os) { if (os.equals("solaris")) { setupJVMLibNamesSolaris(); } else if (os.equals("win32")) { @@ -479,8 +537,6 @@ } else { throw new RuntimeException("Unknown OS type"); } - - cpu = debugger.getCPU(); } private void setupJVMLibNamesSolaris() { diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,11 +26,11 @@ import sun.jvm.hotspot.debugger.*; -class LinuxAddress implements Address { +public class LinuxAddress implements Address { protected LinuxDebugger debugger; protected long addr; - LinuxAddress(LinuxDebugger debugger, long addr) { + public LinuxAddress(LinuxDebugger debugger, long addr) { this.debugger = debugger; this.addr = addr; } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,8 +26,8 @@ import sun.jvm.hotspot.debugger.*; -class LinuxOopHandle extends LinuxAddress implements OopHandle { - LinuxOopHandle(LinuxDebugger debugger, long addr) { +public class LinuxOopHandle extends LinuxAddress implements OopHandle { + public LinuxOopHandle(LinuxDebugger debugger, long addr) { super(debugger, addr); } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Thu Jul 11 12:50:20 2013 -0700 @@ -49,7 +49,6 @@ higherDimension = new MetadataField(type.getAddressField("_higher_dimension"), 0); lowerDimension = new MetadataField(type.getAddressField("_lower_dimension"), 0); vtableLen = new CIntField(type.getCIntegerField("_vtable_len"), 0); - allocSize = new CIntField(type.getCIntegerField("_alloc_size"), 0); componentMirror = new OopField(type.getOopField("_component_mirror"), 0); javaLangCloneableName = null; javaLangObjectName = null; @@ -64,7 +63,6 @@ private static MetadataField higherDimension; private static MetadataField lowerDimension; private static CIntField vtableLen; - private static CIntField allocSize; private static OopField componentMirror; public Klass getJavaSuper() { @@ -76,7 +74,6 @@ public Klass getHigherDimension() { return (Klass) higherDimension.getValue(this); } public Klass getLowerDimension() { return (Klass) lowerDimension.getValue(this); } public long getVtableLen() { return vtableLen.getValue(this); } - public long getAllocSize() { return allocSize.getValue(this); } public Oop getComponentMirror() { return componentMirror.getValue(this); } // constant class names - javaLangCloneable, javaIoSerializable, javaLangObject @@ -147,7 +144,6 @@ visitor.doMetadata(higherDimension, true); visitor.doMetadata(lowerDimension, true); visitor.doCInt(vtableLen, true); - visitor.doCInt(allocSize, true); visitor.doOop(componentMirror, true); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Thu Jul 11 12:50:20 2013 -0700 @@ -57,7 +57,6 @@ accessFlags = new CIntField(type.getCIntegerField("_access_flags"), 0); subklass = new MetadataField(type.getAddressField("_subklass"), 0); nextSibling = new MetadataField(type.getAddressField("_next_sibling"), 0); - allocCount = new CIntField(type.getCIntegerField("_alloc_count"), 0); LH_INSTANCE_SLOW_PATH_BIT = db.lookupIntConstant("Klass::_lh_instance_slow_path_bit").intValue(); LH_LOG2_ELEMENT_SIZE_SHIFT = db.lookupIntConstant("Klass::_lh_log2_element_size_shift").intValue(); @@ -87,7 +86,6 @@ private static CIntField accessFlags; private static MetadataField subklass; private static MetadataField nextSibling; - private static CIntField allocCount; private Address getValue(AddressField field) { return addr.getAddressAt(field.getOffset()); @@ -108,7 +106,6 @@ public AccessFlags getAccessFlagsObj(){ return new AccessFlags(getAccessFlags()); } public Klass getSubklassKlass() { return (Klass) subklass.getValue(this); } public Klass getNextSiblingKlass() { return (Klass) nextSibling.getValue(this); } - public long getAllocCount() { return allocCount.getValue(this); } // computed access flags - takes care of inner classes etc. // This is closer to actual source level than getAccessFlags() etc. @@ -172,7 +169,6 @@ visitor.doCInt(accessFlags, true); visitor.doMetadata(subklass, true); visitor.doMetadata(nextSibling, true); - visitor.doCInt(allocCount, true); } public long getObjectSize() { diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Jul 11 12:50:20 2013 -0700 @@ -246,7 +246,7 @@ } } - private static final boolean disableDerivedPrinterTableCheck; + private static final boolean disableDerivedPointerTableCheck; private static final Properties saProps; static { @@ -256,12 +256,12 @@ url = VM.class.getClassLoader().getResource("sa.properties"); saProps.load(new BufferedInputStream(url.openStream())); } catch (Exception e) { - throw new RuntimeException("Unable to load properties " + + System.err.println("Unable to load properties " + (url == null ? "null" : url.toString()) + ": " + e.getMessage()); } - disableDerivedPrinterTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null; + disableDerivedPointerTableCheck = System.getProperty("sun.jvm.hotspot.runtime.VM.disableDerivedPointerTableCheck") != null; } private VM(TypeDataBase db, JVMDebugger debugger, boolean isBigEndian) { @@ -371,7 +371,8 @@ /** This is used by the debugging system */ public static void initialize(TypeDataBase db, JVMDebugger debugger) { if (soleInstance != null) { - throw new RuntimeException("Attempt to initialize VM twice"); + // Using multiple SA Tool classes in the same process creates a call here. + return; } soleInstance = new VM(db, debugger, debugger.getMachineDescription().isBigEndian()); @@ -683,7 +684,7 @@ /** Returns true if C2 derived pointer table should be used, false otherwise */ public boolean useDerivedPointerTable() { - return !disableDerivedPrinterTableCheck; + return !disableDerivedPointerTableCheck; } /** Returns the code cache; should not be used if is core build */ diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Thu Jul 11 12:50:20 2013 -0700 @@ -41,6 +41,14 @@ public class ClassLoaderStats extends Tool { boolean verbose = true; + public ClassLoaderStats() { + super(); + } + + public ClassLoaderStats(JVMDebugger d) { + super(d); + } + public static void main(String[] args) { ClassLoaderStats cls = new ClassLoaderStats(); cls.start(args); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,6 +24,7 @@ package sun.jvm.hotspot.tools; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.tools.*; import sun.jvm.hotspot.oops.*; @@ -42,6 +43,15 @@ * summary of these objects in the form of a histogram. */ public class FinalizerInfo extends Tool { + + public FinalizerInfo() { + super(); + } + + public FinalizerInfo(JVMDebugger d) { + super(d); + } + public static void main(String[] args) { FinalizerInfo finfo = new FinalizerInfo(); finfo.start(args); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,10 +25,19 @@ package sun.jvm.hotspot.tools; import java.io.PrintStream; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.runtime.*; public class FlagDumper extends Tool { + public FlagDumper() { + super(); + } + + public FlagDumper(JVMDebugger d) { + super(d); + } + public void run() { VM.Flag[] flags = VM.getVM().getCommandLineFlags(); PrintStream out = System.out; diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,7 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.utilities.HeapHprofBinWriter; +import sun.jvm.hotspot.debugger.JVMDebugger; import java.io.IOException; /* @@ -42,6 +43,11 @@ this.dumpFile = dumpFile; } + public HeapDumper(String dumpFile, JVMDebugger d) { + super(d); + this.dumpFile = dumpFile; + } + protected void printFlagsUsage() { System.out.println(" \tto dump heap to " + DEFAULT_DUMP_FILE); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Thu Jul 11 12:50:20 2013 -0700 @@ -29,12 +29,21 @@ import sun.jvm.hotspot.gc_implementation.g1.*; import sun.jvm.hotspot.gc_implementation.parallelScavenge.*; import sun.jvm.hotspot.gc_implementation.shared.*; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.memory.*; import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.runtime.*; public class HeapSummary extends Tool { + public HeapSummary() { + super(); + } + + public HeapSummary(JVMDebugger d) { + super(d); + } + public static void main(String[] args) { HeapSummary hs = new HeapSummary(); hs.start(args); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,12 +25,21 @@ package sun.jvm.hotspot.tools; import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.debugger.JVMDebugger; public class JInfo extends Tool { + public JInfo() { + super(); + } + public JInfo(int m) { mode = m; } + public JInfo(JVMDebugger d) { + super(d); + } + protected boolean needsJavaPrefix() { return false; } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,7 @@ package sun.jvm.hotspot.tools; import java.io.*; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.utilities.*; public class JMap extends Tool { @@ -36,6 +37,10 @@ this(MODE_PMAP); } + public JMap(JVMDebugger d) { + super(d); + } + protected boolean needsJavaPrefix() { return false; } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,9 +25,19 @@ package sun.jvm.hotspot.tools; import java.io.*; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.runtime.*; public class JSnap extends Tool { + + public JSnap() { + super(); + } + + public JSnap(JVMDebugger d) { + super(d); + } + public void run() { final PrintStream out = System.out; if (PerfMemory.initialized()) { diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,6 +24,8 @@ package sun.jvm.hotspot.tools; +import sun.jvm.hotspot.debugger.JVMDebugger; + public class JStack extends Tool { public JStack(boolean mixedMode, boolean concurrentLocks) { this.mixedMode = mixedMode; @@ -34,6 +36,10 @@ this(true, true); } + public JStack(JVMDebugger d) { + super(d); + } + protected boolean needsJavaPrefix() { return false; } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,6 +33,14 @@ an object histogram from a remote or crashed VM. */ public class ObjectHistogram extends Tool { + public ObjectHistogram() { + super(); + } + + public ObjectHistogram(JVMDebugger d) { + super(d); + } + public void run() { run(System.out, System.err); } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Thu Jul 11 12:50:20 2013 -0700 @@ -31,6 +31,15 @@ import sun.jvm.hotspot.runtime.*; public class PMap extends Tool { + + public PMap() { + super(); + } + + public PMap(JVMDebugger d) { + super(d); + } + public void run() { run(System.out); } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java Thu Jul 11 12:50:20 2013 -0700 @@ -45,6 +45,10 @@ this(true, true); } + public PStack(JVMDebugger d) { + super(d); + } + public void run() { run(System.out); } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Thu Jul 11 12:50:20 2013 -0700 @@ -45,6 +45,16 @@ run(System.out); } + public StackTrace(JVMDebugger d) { + super(d); + } + + public StackTrace(JVMDebugger d, boolean v, boolean concurrentLocks) { + super(d); + this.verbose = v; + this.concurrentLocks = concurrentLocks; + } + public void run(java.io.PrintStream tty) { // Ready to go with the database... try { diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Thu Jul 11 12:50:20 2013 -0700 @@ -27,10 +27,19 @@ import java.io.PrintStream; import java.util.*; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.runtime.*; public class SysPropsDumper extends Tool { + public SysPropsDumper() { + super(); + } + + public SysPropsDumper(JVMDebugger d) { + super(d); + } + public void run() { Properties sysProps = VM.getVM().getSystemProperties(); PrintStream out = System.out; diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Thu Jul 11 12:50:20 2013 -0700 @@ -35,6 +35,7 @@ public abstract class Tool implements Runnable { private HotSpotAgent agent; + private JVMDebugger jvmDebugger; private int debugeeType; // debugeeType is one of constants below @@ -42,6 +43,13 @@ protected static final int DEBUGEE_CORE = 1; protected static final int DEBUGEE_REMOTE = 2; + public Tool() { + } + + public Tool(JVMDebugger d) { + jvmDebugger = d; + } + public String getName() { return getClass().getName(); } @@ -90,7 +98,6 @@ protected void usage() { printUsage(); - System.exit(1); } /* @@ -106,13 +113,13 @@ protected void stop() { if (agent != null) { agent.detach(); - System.exit(0); } } protected void start(String[] args) { if ((args.length < 1) || (args.length > 2)) { usage(); + return; } // Attempt to handle -h or -help or some invalid flag @@ -185,13 +192,31 @@ } if (e.getMessage() != null) { err.print(e.getMessage()); + e.printStackTrace(); } err.println(); - System.exit(1); + return; } err.println("Debugger attached successfully."); + startInternal(); + } + // When using an existing JVMDebugger. + public void start() { + + if (jvmDebugger == null) { + throw new RuntimeException("Tool.start() called with no JVMDebugger set."); + } + agent = new HotSpotAgent(); + agent.attach(jvmDebugger); + startInternal(); + } + + // Remains of the start mechanism, common to both start methods. + private void startInternal() { + + PrintStream err = System.err; VM vm = VM.getVM(); if (vm.isCore()) { err.println("Core build detected."); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,7 @@ package sun.jvm.hotspot.tools.jcore; import java.io.*; +import java.lang.reflect.Constructor; import java.util.jar.JarOutputStream; import java.util.jar.JarEntry; import java.util.jar.Manifest; @@ -38,6 +39,16 @@ private ClassFilter classFilter; private String outputDirectory; private JarOutputStream jarStream; + private String pkgList; + + public ClassDump() { + super(); + } + + public ClassDump(JVMDebugger d, String pkgList) { + super(d); + this.pkgList = pkgList; + } public void setClassFilter(ClassFilter cf) { classFilter = cf; @@ -63,6 +74,25 @@ public void run() { // Ready to go with the database... try { + // The name of the filter always comes from a System property. + // If we have a pkgList, pass it, otherwise let the filter read + // its own System property for the list of classes. + String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter", + "sun.jvm.hotspot.tools.jcore.PackageNameFilter"); + try { + Class filterClass = Class.forName(filterClassName); + if (pkgList == null) { + classFilter = (ClassFilter) filterClass.newInstance(); + } else { + Constructor con = filterClass.getConstructor(String.class); + classFilter = (ClassFilter) con.newInstance(pkgList); + } + } catch(Exception exp) { + System.err.println("Warning: Can not create class filter!"); + } + + String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir", "."); + setOutputDirectory(outputDirectory); // walk through the system dictionary SystemDictionary dict = VM.getVM().getSystemDictionary(); @@ -139,26 +169,8 @@ } public static void main(String[] args) { - // load class filters - ClassFilter classFilter = null; - String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter"); - if (filterClassName != null) { - try { - Class filterClass = Class.forName(filterClassName); - classFilter = (ClassFilter) filterClass.newInstance(); - } catch(Exception exp) { - System.err.println("Warning: Can not create class filter!"); - } - } - - String outputDirectory = System.getProperty("sun.jvm.hotspot.tools.jcore.outputDir"); - if (outputDirectory == null) - outputDirectory = "."; - ClassDump cd = new ClassDump(); - cd.setClassFilter(classFilter); - cd.setOutputDirectory(outputDirectory); cd.start(args); cd.stop(); } diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,12 +24,22 @@ package sun.jvm.hotspot.tools.soql; +import sun.jvm.hotspot.debugger.JVMDebugger; import sun.jvm.hotspot.tools.*; import sun.jvm.hotspot.utilities.*; import sun.jvm.hotspot.utilities.soql.*; /** This is command line JavaScript debugger console */ public class JSDB extends Tool { + + public JSDB() { + super(); + } + + public JSDB(JVMDebugger d) { + super(d); + } + public static void main(String[] args) { JSDB jsdb = new JSDB(); jsdb.start(args); diff -r 0273c023680c -r 6ed8434664ed hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java --- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Thu Jul 11 12:50:20 2013 -0700 @@ -44,6 +44,14 @@ soql.stop(); } + public SOQL() { + super(); + } + + public SOQL(JVMDebugger d) { + super(d); + } + protected SOQLEngine soqlEngine; protected BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); protected PrintStream out = System.out; diff -r 0273c023680c -r 6ed8434664ed hotspot/make/bsd/makefiles/build_vm_def.sh --- a/hotspot/make/bsd/makefiles/build_vm_def.sh Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/bsd/makefiles/build_vm_def.sh Thu Jul 11 12:50:20 2013 -0700 @@ -7,6 +7,6 @@ NM=nm fi -$NM --defined-only $* | awk ' - { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 ";" } +$NM -Uj $* | awk ' + { if ($3 ~ /^_ZTV/ || $3 ~ /^gHotSpotVM/) print "\t" $3 } ' diff -r 0273c023680c -r 6ed8434664ed hotspot/make/bsd/makefiles/gcc.make --- a/hotspot/make/bsd/makefiles/gcc.make Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/bsd/makefiles/gcc.make Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -368,8 +368,8 @@ # Standard linker flags LFLAGS += - # Darwin doesn't use ELF and doesn't support version scripts - LDNOMAP = true + # The apple linker has its own variant of mapfiles/version-scripts + MAPFLAG = -Xlinker -exported_symbols_list -Xlinker FILENAME # Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj SONAMEFLAG = diff -r 0273c023680c -r 6ed8434664ed hotspot/make/bsd/makefiles/mapfile-vers-debug --- a/hotspot/make/bsd/makefiles/mapfile-vers-debug Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-debug Thu Jul 11 12:50:20 2013 -0700 @@ -1,7 +1,3 @@ -# -# @(#)mapfile-vers-debug 1.18 07/10/25 16:47:35 -# - # # Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -23,273 +19,243 @@ # 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. -# +# # +# Only used for OSX/Darwin builds # Define public interface. - -SUNWprivate_1.1 { - global: - # JNI - JNI_CreateJavaVM; - JNI_GetCreatedJavaVMs; - JNI_GetDefaultJavaVMInitArgs; + # _JNI + _JNI_CreateJavaVM + _JNI_GetCreatedJavaVMs + _JNI_GetDefaultJavaVMInitArgs - # JVM - JVM_Accept; - JVM_ActiveProcessorCount; - JVM_AllocateNewArray; - JVM_AllocateNewObject; - JVM_ArrayCopy; - JVM_AssertionStatusDirectives; - JVM_Available; - JVM_Bind; - JVM_ClassDepth; - JVM_ClassLoaderDepth; - JVM_Clone; - JVM_Close; - JVM_CX8Field; - JVM_CompileClass; - JVM_CompileClasses; - JVM_CompilerCommand; - JVM_Connect; - JVM_ConstantPoolGetClassAt; - JVM_ConstantPoolGetClassAtIfLoaded; - JVM_ConstantPoolGetDoubleAt; - JVM_ConstantPoolGetFieldAt; - JVM_ConstantPoolGetFieldAtIfLoaded; - JVM_ConstantPoolGetFloatAt; - JVM_ConstantPoolGetIntAt; - JVM_ConstantPoolGetLongAt; - JVM_ConstantPoolGetMethodAt; - JVM_ConstantPoolGetMethodAtIfLoaded; - JVM_ConstantPoolGetMemberRefInfoAt; - JVM_ConstantPoolGetSize; - JVM_ConstantPoolGetStringAt; - JVM_ConstantPoolGetUTF8At; - JVM_CountStackFrames; - JVM_CurrentClassLoader; - JVM_CurrentLoadedClass; - JVM_CurrentThread; - JVM_CurrentTimeMillis; - JVM_DefineClass; - JVM_DefineClassWithSource; - JVM_DefineClassWithSourceCond; - JVM_DesiredAssertionStatus; - JVM_DisableCompiler; - JVM_DoPrivileged; - JVM_DTraceGetVersion; - JVM_DTraceActivate; - JVM_DTraceIsProbeEnabled; - JVM_DTraceIsSupported; - JVM_DTraceDispose; - JVM_DumpAllStacks; - JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; - JVM_FillInStackTrace; - JVM_FindClassFromClass; - JVM_FindClassFromClassLoader; - JVM_FindClassFromBootLoader; - JVM_FindLibraryEntry; - JVM_FindLoadedClass; - JVM_FindPrimitiveClass; - JVM_FindSignal; - JVM_FreeMemory; - JVM_GC; - JVM_GetAllThreads; - JVM_GetArrayElement; - JVM_GetArrayLength; - JVM_GetCPClassNameUTF; - JVM_GetCPFieldClassNameUTF; - JVM_GetCPFieldModifiers; - JVM_GetCPFieldNameUTF; - JVM_GetCPFieldSignatureUTF; - JVM_GetCPMethodClassNameUTF; - JVM_GetCPMethodModifiers; - JVM_GetCPMethodNameUTF; - JVM_GetCPMethodSignatureUTF; - JVM_GetCallerClass; - JVM_GetClassAccessFlags; - JVM_GetClassAnnotations; - JVM_GetClassCPEntriesCount; - JVM_GetClassCPTypes; - JVM_GetClassConstantPool; - JVM_GetClassContext; - JVM_GetClassDeclaredConstructors; - JVM_GetClassDeclaredFields; - JVM_GetClassDeclaredMethods; - JVM_GetClassFieldsCount; - JVM_GetClassInterfaces; - JVM_GetClassLoader; - JVM_GetClassMethodsCount; - JVM_GetClassModifiers; - JVM_GetClassName; - JVM_GetClassNameUTF; - JVM_GetClassSignature; - JVM_GetClassSigners; - JVM_GetClassTypeAnnotations; - JVM_GetComponentType; - JVM_GetDeclaredClasses; - JVM_GetDeclaringClass; - JVM_GetEnclosingMethodInfo; - JVM_GetFieldAnnotations; - JVM_GetFieldIxModifiers; - JVM_GetFieldTypeAnnotations; - JVM_GetHostName; - JVM_GetInheritedAccessControlContext; - JVM_GetInterfaceVersion; - JVM_GetLastErrorString; - JVM_GetManagement; - JVM_GetMethodAnnotations; - JVM_GetMethodDefaultAnnotationValue; - JVM_GetMethodIxArgsSize; - JVM_GetMethodIxByteCode; - JVM_GetMethodIxByteCodeLength; - JVM_GetMethodIxExceptionIndexes; - JVM_GetMethodIxExceptionTableEntry; - JVM_GetMethodIxExceptionTableLength; - JVM_GetMethodIxExceptionsCount; - JVM_GetMethodIxLocalsCount; - JVM_GetMethodIxMaxStack; - JVM_GetMethodIxModifiers; - JVM_GetMethodIxNameUTF; - JVM_GetMethodIxSignatureUTF; - JVM_GetMethodParameterAnnotations; - JVM_GetMethodParameters; - JVM_GetMethodTypeAnnotations; - JVM_GetPrimitiveArrayElement; - JVM_GetProtectionDomain; - JVM_GetSockName; - JVM_GetSockOpt; - JVM_GetStackAccessControlContext; - JVM_GetStackTraceDepth; - JVM_GetStackTraceElement; - JVM_GetSystemPackage; - JVM_GetSystemPackages; - JVM_GetThreadStateNames; - JVM_GetThreadStateValues; - JVM_GetVersionInfo; - JVM_Halt; - JVM_HoldsLock; - JVM_IHashCode; - JVM_InitAgentProperties; - JVM_InitProperties; - JVM_InitializeCompiler; - JVM_InitializeSocketLibrary; - JVM_InternString; - JVM_Interrupt; - JVM_InvokeMethod; - JVM_IsArrayClass; - JVM_IsConstructorIx; - JVM_IsInterface; - JVM_IsInterrupted; - JVM_IsNaN; - JVM_IsPrimitiveClass; - JVM_IsSameClassPackage; - JVM_IsSilentCompiler; - JVM_IsSupportedJNIVersion; - JVM_IsThreadAlive; - JVM_IsVMGeneratedMethodIx; - JVM_LatestUserDefinedLoader; - JVM_Listen; - JVM_LoadClass0; - JVM_LoadLibrary; - JVM_Lseek; - JVM_MaxObjectInspectionAge; - JVM_MaxMemory; - JVM_MonitorNotify; - JVM_MonitorNotifyAll; - JVM_MonitorWait; - JVM_NanoTime; - JVM_NativePath; - JVM_NewArray; - JVM_NewInstanceFromConstructor; - JVM_NewMultiArray; - JVM_OnExit; - JVM_Open; - JVM_RaiseSignal; - JVM_RawMonitorCreate; - JVM_RawMonitorDestroy; - JVM_RawMonitorEnter; - JVM_RawMonitorExit; - JVM_Read; - JVM_Recv; - JVM_RecvFrom; - JVM_RegisterSignal; - JVM_ReleaseUTF; - JVM_ResolveClass; - JVM_ResumeThread; - JVM_Send; - JVM_SendTo; - JVM_SetArrayElement; - JVM_SetClassSigners; - JVM_SetLength; - JVM_SetPrimitiveArrayElement; - JVM_SetProtectionDomain; - JVM_SetSockOpt; - JVM_SetThreadPriority; - JVM_Sleep; - JVM_Socket; - JVM_SocketAvailable; - JVM_SocketClose; - JVM_SocketShutdown; - JVM_StartThread; - JVM_StopThread; - JVM_SuspendThread; - JVM_SupportsCX8; - JVM_Sync; - JVM_Timeout; - JVM_TotalMemory; - JVM_TraceInstructions; - JVM_TraceMethodCalls; - JVM_UnloadLibrary; - JVM_Write; - JVM_Yield; - JVM_handle_bsd_signal; + # _JVM + _JVM_Accept + _JVM_ActiveProcessorCount + _JVM_AllocateNewArray + _JVM_AllocateNewObject + _JVM_ArrayCopy + _JVM_AssertionStatusDirectives + _JVM_Available + _JVM_Bind + _JVM_ClassDepth + _JVM_ClassLoaderDepth + _JVM_Clone + _JVM_Close + _JVM_CX8Field + _JVM_CompileClass + _JVM_CompileClasses + _JVM_CompilerCommand + _JVM_Connect + _JVM_ConstantPoolGetClassAt + _JVM_ConstantPoolGetClassAtIfLoaded + _JVM_ConstantPoolGetDoubleAt + _JVM_ConstantPoolGetFieldAt + _JVM_ConstantPoolGetFieldAtIfLoaded + _JVM_ConstantPoolGetFloatAt + _JVM_ConstantPoolGetIntAt + _JVM_ConstantPoolGetLongAt + _JVM_ConstantPoolGetMethodAt + _JVM_ConstantPoolGetMethodAtIfLoaded + _JVM_ConstantPoolGetMemberRefInfoAt + _JVM_ConstantPoolGetSize + _JVM_ConstantPoolGetStringAt + _JVM_ConstantPoolGetUTF8At + _JVM_CountStackFrames + _JVM_CurrentClassLoader + _JVM_CurrentLoadedClass + _JVM_CurrentThread + _JVM_CurrentTimeMillis + _JVM_DefineClass + _JVM_DefineClassWithSource + _JVM_DefineClassWithSourceCond + _JVM_DesiredAssertionStatus + _JVM_DisableCompiler + _JVM_DoPrivileged + _JVM_DTraceGetVersion + _JVM_DTraceActivate + _JVM_DTraceIsProbeEnabled + _JVM_DTraceIsSupported + _JVM_DTraceDispose + _JVM_DumpAllStacks + _JVM_DumpThreads + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader + _JVM_FindLibraryEntry + _JVM_FindLoadedClass + _JVM_FindPrimitiveClass + _JVM_FindSignal + _JVM_FreeMemory + _JVM_GC + _JVM_GetAllThreads + _JVM_GetArrayElement + _JVM_GetArrayLength + _JVM_GetCPClassNameUTF + _JVM_GetCPFieldClassNameUTF + _JVM_GetCPFieldModifiers + _JVM_GetCPFieldNameUTF + _JVM_GetCPFieldSignatureUTF + _JVM_GetCPMethodClassNameUTF + _JVM_GetCPMethodModifiers + _JVM_GetCPMethodNameUTF + _JVM_GetCPMethodSignatureUTF + _JVM_GetCallerClass + _JVM_GetClassAccessFlags + _JVM_GetClassAnnotations + _JVM_GetClassCPEntriesCount + _JVM_GetClassCPTypes + _JVM_GetClassConstantPool + _JVM_GetClassContext + _JVM_GetClassDeclaredConstructors + _JVM_GetClassDeclaredFields + _JVM_GetClassDeclaredMethods + _JVM_GetClassFieldsCount + _JVM_GetClassInterfaces + _JVM_GetClassLoader + _JVM_GetClassMethodsCount + _JVM_GetClassModifiers + _JVM_GetClassName + _JVM_GetClassNameUTF + _JVM_GetClassSignature + _JVM_GetClassSigners + _JVM_GetClassTypeAnnotations + _JVM_GetComponentType + _JVM_GetDeclaredClasses + _JVM_GetDeclaringClass + _JVM_GetEnclosingMethodInfo + _JVM_GetFieldAnnotations + _JVM_GetFieldIxModifiers + _JVM_GetFieldTypeAnnotations + _JVM_GetHostName + _JVM_GetInheritedAccessControlContext + _JVM_GetInterfaceVersion + _JVM_GetLastErrorString + _JVM_GetManagement + _JVM_GetMethodAnnotations + _JVM_GetMethodDefaultAnnotationValue + _JVM_GetMethodIxArgsSize + _JVM_GetMethodIxByteCode + _JVM_GetMethodIxByteCodeLength + _JVM_GetMethodIxExceptionIndexes + _JVM_GetMethodIxExceptionTableEntry + _JVM_GetMethodIxExceptionTableLength + _JVM_GetMethodIxExceptionsCount + _JVM_GetMethodIxLocalsCount + _JVM_GetMethodIxMaxStack + _JVM_GetMethodIxModifiers + _JVM_GetMethodIxNameUTF + _JVM_GetMethodIxSignatureUTF + _JVM_GetMethodParameterAnnotations + _JVM_GetMethodParameters + _JVM_GetMethodTypeAnnotations + _JVM_GetPrimitiveArrayElement + _JVM_GetProtectionDomain + _JVM_GetSockName + _JVM_GetSockOpt + _JVM_GetStackAccessControlContext + _JVM_GetStackTraceDepth + _JVM_GetStackTraceElement + _JVM_GetSystemPackage + _JVM_GetSystemPackages + _JVM_GetThreadStateNames + _JVM_GetThreadStateValues + _JVM_GetVersionInfo + _JVM_Halt + _JVM_HoldsLock + _JVM_IHashCode + _JVM_InitAgentProperties + _JVM_InitProperties + _JVM_InitializeCompiler + _JVM_InitializeSocketLibrary + _JVM_InternString + _JVM_Interrupt + _JVM_InvokeMethod + _JVM_IsArrayClass + _JVM_IsConstructorIx + _JVM_IsInterface + _JVM_IsInterrupted + _JVM_IsNaN + _JVM_IsPrimitiveClass + _JVM_IsSameClassPackage + _JVM_IsSilentCompiler + _JVM_IsSupportedJNIVersion + _JVM_IsThreadAlive + _JVM_IsVMGeneratedMethodIx + _JVM_LatestUserDefinedLoader + _JVM_Listen + _JVM_LoadClass0 + _JVM_LoadLibrary + _JVM_Lseek + _JVM_MaxObjectInspectionAge + _JVM_MaxMemory + _JVM_MonitorNotify + _JVM_MonitorNotifyAll + _JVM_MonitorWait + _JVM_NanoTime + _JVM_NativePath + _JVM_NewArray + _JVM_NewInstanceFromConstructor + _JVM_NewMultiArray + _JVM_OnExit + _JVM_Open + _JVM_RaiseSignal + _JVM_RawMonitorCreate + _JVM_RawMonitorDestroy + _JVM_RawMonitorEnter + _JVM_RawMonitorExit + _JVM_Read + _JVM_Recv + _JVM_RecvFrom + _JVM_RegisterSignal + _JVM_ReleaseUTF + _JVM_ResolveClass + _JVM_ResumeThread + _JVM_Send + _JVM_SendTo + _JVM_SetArrayElement + _JVM_SetClassSigners + _JVM_SetLength + _JVM_SetNativeThreadName + _JVM_SetPrimitiveArrayElement + _JVM_SetSockOpt + _JVM_SetThreadPriority + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable + _JVM_SocketClose + _JVM_SocketShutdown + _JVM_StartThread + _JVM_StopThread + _JVM_SuspendThread + _JVM_SupportsCX8 + _JVM_Sync + _JVM_Timeout + _JVM_TotalMemory + _JVM_TraceInstructions + _JVM_TraceMethodCalls + _JVM_UnloadLibrary + _JVM_Write + _JVM_Yield + _JVM_handle_bsd_signal - # Old reflection routines - # These do not need to be present in the product build in JDK 1.4 - # but their code has not been removed yet because there will not - # be a substantial code savings until JVM_InvokeMethod and - # JVM_NewInstanceFromConstructor can also be removed; see - # reflectionCompat.hpp. - JVM_GetClassConstructor; - JVM_GetClassConstructors; - JVM_GetClassField; - JVM_GetClassFields; - JVM_GetClassMethod; - JVM_GetClassMethods; - JVM_GetField; - JVM_GetPrimitiveField; - JVM_NewInstance; - JVM_SetField; - JVM_SetPrimitiveField; - - # debug JVM - JVM_AccessVMBooleanFlag; - JVM_AccessVMIntFlag; - JVM_VMBreakPoint; + # debug _JVM + _JVM_AccessVMBooleanFlag + _JVM_AccessVMIntFlag + _JVM_VMBreakPoint # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - fork1; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; + _jio_fprintf + _jio_printf + _jio_snprintf + _jio_vfprintf + _jio_vsnprintf # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; + _AsyncGetCallTrace # INSERT VTABLE SYMBOLS HERE - local: - *; -}; - diff -r 0273c023680c -r 6ed8434664ed hotspot/make/bsd/makefiles/mapfile-vers-product --- a/hotspot/make/bsd/makefiles/mapfile-vers-product Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/bsd/makefiles/mapfile-vers-product Thu Jul 11 12:50:20 2013 -0700 @@ -1,7 +1,3 @@ -# -# @(#)mapfile-vers-product 1.19 08/02/12 10:56:37 -# - # # Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -23,268 +19,238 @@ # 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. -# +# # +# Only used for OSX/Darwin builds # Define public interface. - -SUNWprivate_1.1 { - global: - # JNI - JNI_CreateJavaVM; - JNI_GetCreatedJavaVMs; - JNI_GetDefaultJavaVMInitArgs; + # _JNI + _JNI_CreateJavaVM + _JNI_GetCreatedJavaVMs + _JNI_GetDefaultJavaVMInitArgs - # JVM - JVM_Accept; - JVM_ActiveProcessorCount; - JVM_AllocateNewArray; - JVM_AllocateNewObject; - JVM_ArrayCopy; - JVM_AssertionStatusDirectives; - JVM_Available; - JVM_Bind; - JVM_ClassDepth; - JVM_ClassLoaderDepth; - JVM_Clone; - JVM_Close; - JVM_CX8Field; - JVM_CompileClass; - JVM_CompileClasses; - JVM_CompilerCommand; - JVM_Connect; - JVM_ConstantPoolGetClassAt; - JVM_ConstantPoolGetClassAtIfLoaded; - JVM_ConstantPoolGetDoubleAt; - JVM_ConstantPoolGetFieldAt; - JVM_ConstantPoolGetFieldAtIfLoaded; - JVM_ConstantPoolGetFloatAt; - JVM_ConstantPoolGetIntAt; - JVM_ConstantPoolGetLongAt; - JVM_ConstantPoolGetMethodAt; - JVM_ConstantPoolGetMethodAtIfLoaded; - JVM_ConstantPoolGetMemberRefInfoAt; - JVM_ConstantPoolGetSize; - JVM_ConstantPoolGetStringAt; - JVM_ConstantPoolGetUTF8At; - JVM_CountStackFrames; - JVM_CurrentClassLoader; - JVM_CurrentLoadedClass; - JVM_CurrentThread; - JVM_CurrentTimeMillis; - JVM_DefineClass; - JVM_DefineClassWithSource; - JVM_DefineClassWithSourceCond; - JVM_DesiredAssertionStatus; - JVM_DisableCompiler; - JVM_DoPrivileged; - JVM_DTraceGetVersion; - JVM_DTraceActivate; - JVM_DTraceIsProbeEnabled; - JVM_DTraceIsSupported; - JVM_DTraceDispose; - JVM_DumpAllStacks; - JVM_DumpThreads; - JVM_EnableCompiler; - JVM_Exit; - JVM_FillInStackTrace; - JVM_FindClassFromClass; - JVM_FindClassFromClassLoader; - JVM_FindClassFromBootLoader; - JVM_FindLibraryEntry; - JVM_FindLoadedClass; - JVM_FindPrimitiveClass; - JVM_FindSignal; - JVM_FreeMemory; - JVM_GC; - JVM_GetAllThreads; - JVM_GetArrayElement; - JVM_GetArrayLength; - JVM_GetCPClassNameUTF; - JVM_GetCPFieldClassNameUTF; - JVM_GetCPFieldModifiers; - JVM_GetCPFieldNameUTF; - JVM_GetCPFieldSignatureUTF; - JVM_GetCPMethodClassNameUTF; - JVM_GetCPMethodModifiers; - JVM_GetCPMethodNameUTF; - JVM_GetCPMethodSignatureUTF; - JVM_GetCallerClass; - JVM_GetClassAccessFlags; - JVM_GetClassAnnotations; - JVM_GetClassCPEntriesCount; - JVM_GetClassCPTypes; - JVM_GetClassConstantPool; - JVM_GetClassContext; - JVM_GetClassDeclaredConstructors; - JVM_GetClassDeclaredFields; - JVM_GetClassDeclaredMethods; - JVM_GetClassFieldsCount; - JVM_GetClassInterfaces; - JVM_GetClassLoader; - JVM_GetClassMethodsCount; - JVM_GetClassModifiers; - JVM_GetClassName; - JVM_GetClassNameUTF; - JVM_GetClassSignature; - JVM_GetClassSigners; - JVM_GetClassTypeAnnotations; - JVM_GetComponentType; - JVM_GetDeclaredClasses; - JVM_GetDeclaringClass; - JVM_GetEnclosingMethodInfo; - JVM_GetFieldAnnotations; - JVM_GetFieldIxModifiers; - JVM_GetFieldTypeAnnotations; - JVM_GetHostName; - JVM_GetInheritedAccessControlContext; - JVM_GetInterfaceVersion; - JVM_GetLastErrorString; - JVM_GetManagement; - JVM_GetMethodAnnotations; - JVM_GetMethodDefaultAnnotationValue; - JVM_GetMethodIxArgsSize; - JVM_GetMethodIxByteCode; - JVM_GetMethodIxByteCodeLength; - JVM_GetMethodIxExceptionIndexes; - JVM_GetMethodIxExceptionTableEntry; - JVM_GetMethodIxExceptionTableLength; - JVM_GetMethodIxExceptionsCount; - JVM_GetMethodIxLocalsCount; - JVM_GetMethodIxMaxStack; - JVM_GetMethodIxModifiers; - JVM_GetMethodIxNameUTF; - JVM_GetMethodIxSignatureUTF; - JVM_GetMethodParameterAnnotations; - JVM_GetMethodParameters; - JVM_GetMethodTypeAnnotations; - JVM_GetPrimitiveArrayElement; - JVM_GetProtectionDomain; - JVM_GetSockName; - JVM_GetSockOpt; - JVM_GetStackAccessControlContext; - JVM_GetStackTraceDepth; - JVM_GetStackTraceElement; - JVM_GetSystemPackage; - JVM_GetSystemPackages; - JVM_GetThreadStateNames; - JVM_GetThreadStateValues; - JVM_GetVersionInfo; - JVM_Halt; - JVM_HoldsLock; - JVM_IHashCode; - JVM_InitAgentProperties; - JVM_InitProperties; - JVM_InitializeCompiler; - JVM_InitializeSocketLibrary; - JVM_InternString; - JVM_Interrupt; - JVM_InvokeMethod; - JVM_IsArrayClass; - JVM_IsConstructorIx; - JVM_IsInterface; - JVM_IsInterrupted; - JVM_IsNaN; - JVM_IsPrimitiveClass; - JVM_IsSameClassPackage; - JVM_IsSilentCompiler; - JVM_IsSupportedJNIVersion; - JVM_IsThreadAlive; - JVM_IsVMGeneratedMethodIx; - JVM_LatestUserDefinedLoader; - JVM_Listen; - JVM_LoadClass0; - JVM_LoadLibrary; - JVM_Lseek; - JVM_MaxObjectInspectionAge; - JVM_MaxMemory; - JVM_MonitorNotify; - JVM_MonitorNotifyAll; - JVM_MonitorWait; - JVM_NanoTime; - JVM_NativePath; - JVM_NewArray; - JVM_NewInstanceFromConstructor; - JVM_NewMultiArray; - JVM_OnExit; - JVM_Open; - JVM_RaiseSignal; - JVM_RawMonitorCreate; - JVM_RawMonitorDestroy; - JVM_RawMonitorEnter; - JVM_RawMonitorExit; - JVM_Read; - JVM_Recv; - JVM_RecvFrom; - JVM_RegisterSignal; - JVM_ReleaseUTF; - JVM_ResolveClass; - JVM_ResumeThread; - JVM_Send; - JVM_SendTo; - JVM_SetArrayElement; - JVM_SetClassSigners; - JVM_SetLength; - JVM_SetPrimitiveArrayElement; - JVM_SetProtectionDomain; - JVM_SetSockOpt; - JVM_SetThreadPriority; - JVM_Sleep; - JVM_Socket; - JVM_SocketAvailable; - JVM_SocketClose; - JVM_SocketShutdown; - JVM_StartThread; - JVM_StopThread; - JVM_SuspendThread; - JVM_SupportsCX8; - JVM_Sync; - JVM_Timeout; - JVM_TotalMemory; - JVM_TraceInstructions; - JVM_TraceMethodCalls; - JVM_UnloadLibrary; - JVM_Write; - JVM_Yield; - JVM_handle_bsd_signal; - - # Old reflection routines - # These do not need to be present in the product build in JDK 1.4 - # but their code has not been removed yet because there will not - # be a substantial code savings until JVM_InvokeMethod and - # JVM_NewInstanceFromConstructor can also be removed; see - # reflectionCompat.hpp. - JVM_GetClassConstructor; - JVM_GetClassConstructors; - JVM_GetClassField; - JVM_GetClassFields; - JVM_GetClassMethod; - JVM_GetClassMethods; - JVM_GetField; - JVM_GetPrimitiveField; - JVM_NewInstance; - JVM_SetField; - JVM_SetPrimitiveField; + # _JVM + _JVM_Accept + _JVM_ActiveProcessorCount + _JVM_AllocateNewArray + _JVM_AllocateNewObject + _JVM_ArrayCopy + _JVM_AssertionStatusDirectives + _JVM_Available + _JVM_Bind + _JVM_ClassDepth + _JVM_ClassLoaderDepth + _JVM_Clone + _JVM_Close + _JVM_CX8Field + _JVM_CompileClass + _JVM_CompileClasses + _JVM_CompilerCommand + _JVM_Connect + _JVM_ConstantPoolGetClassAt + _JVM_ConstantPoolGetClassAtIfLoaded + _JVM_ConstantPoolGetDoubleAt + _JVM_ConstantPoolGetFieldAt + _JVM_ConstantPoolGetFieldAtIfLoaded + _JVM_ConstantPoolGetFloatAt + _JVM_ConstantPoolGetIntAt + _JVM_ConstantPoolGetLongAt + _JVM_ConstantPoolGetMethodAt + _JVM_ConstantPoolGetMethodAtIfLoaded + _JVM_ConstantPoolGetMemberRefInfoAt + _JVM_ConstantPoolGetSize + _JVM_ConstantPoolGetStringAt + _JVM_ConstantPoolGetUTF8At + _JVM_CountStackFrames + _JVM_CurrentClassLoader + _JVM_CurrentLoadedClass + _JVM_CurrentThread + _JVM_CurrentTimeMillis + _JVM_DefineClass + _JVM_DefineClassWithSource + _JVM_DefineClassWithSourceCond + _JVM_DesiredAssertionStatus + _JVM_DisableCompiler + _JVM_DoPrivileged + _JVM_DTraceGetVersion + _JVM_DTraceActivate + _JVM_DTraceIsProbeEnabled + _JVM_DTraceIsSupported + _JVM_DTraceDispose + _JVM_DumpAllStacks + _JVM_DumpThreads + _JVM_EnableCompiler + _JVM_Exit + _JVM_FillInStackTrace + _JVM_FindClassFromClass + _JVM_FindClassFromClassLoader + _JVM_FindClassFromBootLoader + _JVM_FindLibraryEntry + _JVM_FindLoadedClass + _JVM_FindPrimitiveClass + _JVM_FindSignal + _JVM_FreeMemory + _JVM_GC + _JVM_GetAllThreads + _JVM_GetArrayElement + _JVM_GetArrayLength + _JVM_GetCPClassNameUTF + _JVM_GetCPFieldClassNameUTF + _JVM_GetCPFieldModifiers + _JVM_GetCPFieldNameUTF + _JVM_GetCPFieldSignatureUTF + _JVM_GetCPMethodClassNameUTF + _JVM_GetCPMethodModifiers + _JVM_GetCPMethodNameUTF + _JVM_GetCPMethodSignatureUTF + _JVM_GetCallerClass + _JVM_GetClassAccessFlags + _JVM_GetClassAnnotations + _JVM_GetClassCPEntriesCount + _JVM_GetClassCPTypes + _JVM_GetClassConstantPool + _JVM_GetClassContext + _JVM_GetClassDeclaredConstructors + _JVM_GetClassDeclaredFields + _JVM_GetClassDeclaredMethods + _JVM_GetClassFieldsCount + _JVM_GetClassInterfaces + _JVM_GetClassLoader + _JVM_GetClassMethodsCount + _JVM_GetClassModifiers + _JVM_GetClassName + _JVM_GetClassNameUTF + _JVM_GetClassSignature + _JVM_GetClassSigners + _JVM_GetClassTypeAnnotations + _JVM_GetComponentType + _JVM_GetDeclaredClasses + _JVM_GetDeclaringClass + _JVM_GetEnclosingMethodInfo + _JVM_GetFieldAnnotations + _JVM_GetFieldIxModifiers + _JVM_GetFieldTypeAnnotations + _JVM_GetHostName + _JVM_GetInheritedAccessControlContext + _JVM_GetInterfaceVersion + _JVM_GetLastErrorString + _JVM_GetManagement + _JVM_GetMethodAnnotations + _JVM_GetMethodDefaultAnnotationValue + _JVM_GetMethodIxArgsSize + _JVM_GetMethodIxByteCode + _JVM_GetMethodIxByteCodeLength + _JVM_GetMethodIxExceptionIndexes + _JVM_GetMethodIxExceptionTableEntry + _JVM_GetMethodIxExceptionTableLength + _JVM_GetMethodIxExceptionsCount + _JVM_GetMethodIxLocalsCount + _JVM_GetMethodIxMaxStack + _JVM_GetMethodIxModifiers + _JVM_GetMethodIxNameUTF + _JVM_GetMethodIxSignatureUTF + _JVM_GetMethodParameterAnnotations + _JVM_GetMethodParameters + _JVM_GetMethodTypeAnnotations + _JVM_GetPrimitiveArrayElement + _JVM_GetProtectionDomain + _JVM_GetSockName + _JVM_GetSockOpt + _JVM_GetStackAccessControlContext + _JVM_GetStackTraceDepth + _JVM_GetStackTraceElement + _JVM_GetSystemPackage + _JVM_GetSystemPackages + _JVM_GetThreadStateNames + _JVM_GetThreadStateValues + _JVM_GetVersionInfo + _JVM_Halt + _JVM_HoldsLock + _JVM_IHashCode + _JVM_InitAgentProperties + _JVM_InitProperties + _JVM_InitializeCompiler + _JVM_InitializeSocketLibrary + _JVM_InternString + _JVM_Interrupt + _JVM_InvokeMethod + _JVM_IsArrayClass + _JVM_IsConstructorIx + _JVM_IsInterface + _JVM_IsInterrupted + _JVM_IsNaN + _JVM_IsPrimitiveClass + _JVM_IsSameClassPackage + _JVM_IsSilentCompiler + _JVM_IsSupportedJNIVersion + _JVM_IsThreadAlive + _JVM_IsVMGeneratedMethodIx + _JVM_LatestUserDefinedLoader + _JVM_Listen + _JVM_LoadClass0 + _JVM_LoadLibrary + _JVM_Lseek + _JVM_MaxObjectInspectionAge + _JVM_MaxMemory + _JVM_MonitorNotify + _JVM_MonitorNotifyAll + _JVM_MonitorWait + _JVM_NanoTime + _JVM_NativePath + _JVM_NewArray + _JVM_NewInstanceFromConstructor + _JVM_NewMultiArray + _JVM_OnExit + _JVM_Open + _JVM_RaiseSignal + _JVM_RawMonitorCreate + _JVM_RawMonitorDestroy + _JVM_RawMonitorEnter + _JVM_RawMonitorExit + _JVM_Read + _JVM_Recv + _JVM_RecvFrom + _JVM_RegisterSignal + _JVM_ReleaseUTF + _JVM_ResolveClass + _JVM_ResumeThread + _JVM_Send + _JVM_SendTo + _JVM_SetArrayElement + _JVM_SetClassSigners + _JVM_SetLength + _JVM_SetNativeThreadName + _JVM_SetPrimitiveArrayElement + _JVM_SetSockOpt + _JVM_SetThreadPriority + _JVM_Sleep + _JVM_Socket + _JVM_SocketAvailable + _JVM_SocketClose + _JVM_SocketShutdown + _JVM_StartThread + _JVM_StopThread + _JVM_SuspendThread + _JVM_SupportsCX8 + _JVM_Sync + _JVM_Timeout + _JVM_TotalMemory + _JVM_TraceInstructions + _JVM_TraceMethodCalls + _JVM_UnloadLibrary + _JVM_Write + _JVM_Yield + _JVM_handle_bsd_signal # miscellaneous functions - jio_fprintf; - jio_printf; - jio_snprintf; - jio_vfprintf; - jio_vsnprintf; - fork1; - numa_warn; - numa_error; - - # Needed because there is no JVM interface for this. - sysThreadAvailableStackWithSlack; + _jio_fprintf + _jio_printf + _jio_snprintf + _jio_vfprintf + _jio_vsnprintf # This is for Forte Analyzer profiling support. - AsyncGetCallTrace; - - # INSERT VTABLE SYMBOLS HERE + _AsyncGetCallTrace - local: - *; -}; + # INSERT VTABLE SYMBOLS HERE diff -r 0273c023680c -r 6ed8434664ed hotspot/make/excludeSrc.make --- a/hotspot/make/excludeSrc.make Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/excludeSrc.make Thu Jul 11 12:50:20 2013 -0700 @@ -112,3 +112,5 @@ endif -include $(HS_ALT_MAKE)/excludeSrc.make + +.PHONY: $(HS_ALT_MAKE)/excludeSrc.make diff -r 0273c023680c -r 6ed8434664ed hotspot/make/hotspot_version --- a/hotspot/make/hotspot_version Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/hotspot_version Thu Jul 11 12:50:20 2013 -0700 @@ -35,7 +35,7 @@ HS_MAJOR_VER=25 HS_MINOR_VER=0 -HS_BUILD_NUMBER=38 +HS_BUILD_NUMBER=41 JDK_MAJOR_VER=1 JDK_MINOR_VER=8 diff -r 0273c023680c -r 6ed8434664ed hotspot/make/linux/makefiles/gcc.make --- a/hotspot/make/linux/makefiles/gcc.make Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/linux/makefiles/gcc.make Thu Jul 11 12:50:20 2013 -0700 @@ -350,9 +350,9 @@ ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),) ifeq ($(USE_CLANG), true) # Clang doesn't understand -gstabs - OPT_CFLAGS += -g + DEBUG_CFLAGS += -g else - OPT_CFLAGS += -gstabs + DEBUG_CFLAGS += -gstabs endif endif @@ -365,9 +365,9 @@ ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),) ifeq ($(USE_CLANG), true) # Clang doesn't understand -gstabs - OPT_CFLAGS += -g + FASTDEBUG_CFLAGS += -g else - OPT_CFLAGS += -gstabs + FASTDEBUG_CFLAGS += -gstabs endif endif diff -r 0273c023680c -r 6ed8434664ed hotspot/make/linux/makefiles/mapfile-vers-debug --- a/hotspot/make/linux/makefiles/mapfile-vers-debug Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-debug Thu Jul 11 12:50:20 2013 -0700 @@ -223,7 +223,6 @@ JVM_SetLength; JVM_SetNativeThreadName; JVM_SetPrimitiveArrayElement; - JVM_SetProtectionDomain; JVM_SetSockOpt; JVM_SetThreadPriority; JVM_Sleep; diff -r 0273c023680c -r 6ed8434664ed hotspot/make/linux/makefiles/mapfile-vers-product --- a/hotspot/make/linux/makefiles/mapfile-vers-product Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/linux/makefiles/mapfile-vers-product Thu Jul 11 12:50:20 2013 -0700 @@ -223,7 +223,6 @@ JVM_SetLength; JVM_SetNativeThreadName; JVM_SetPrimitiveArrayElement; - JVM_SetProtectionDomain; JVM_SetSockOpt; JVM_SetThreadPriority; JVM_Sleep; diff -r 0273c023680c -r 6ed8434664ed hotspot/make/linux/makefiles/vm.make --- a/hotspot/make/linux/makefiles/vm.make Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/linux/makefiles/vm.make Thu Jul 11 12:50:20 2013 -0700 @@ -107,6 +107,10 @@ # File specific flags CXXFLAGS += $(CXXFLAGS/BYFILE) +# Large File Support +ifneq ($(LP64), 1) +CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64 +endif # ifneq ($(LP64), 1) # CFLAGS_WARN holds compiler options to suppress/enable warnings. CFLAGS += $(CFLAGS_WARN/BYFILE) diff -r 0273c023680c -r 6ed8434664ed hotspot/make/solaris/makefiles/mapfile-vers --- a/hotspot/make/solaris/makefiles/mapfile-vers Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/solaris/makefiles/mapfile-vers Thu Jul 11 12:50:20 2013 -0700 @@ -223,7 +223,6 @@ JVM_SetLength; JVM_SetNativeThreadName; JVM_SetPrimitiveArrayElement; - JVM_SetProtectionDomain; JVM_SetSockOpt; JVM_SetThreadPriority; JVM_Sleep; diff -r 0273c023680c -r 6ed8434664ed hotspot/make/solaris/makefiles/vm.make --- a/hotspot/make/solaris/makefiles/vm.make Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/make/solaris/makefiles/vm.make Thu Jul 11 12:50:20 2013 -0700 @@ -95,6 +95,10 @@ # File specific flags CXXFLAGS += $(CXXFLAGS/BYFILE) +# Large File Support +ifneq ($(LP64), 1) +CXXFLAGS/ostream.o += -D_FILE_OFFSET_BITS=64 +endif # ifneq ($(LP64), 1) # CFLAGS_WARN holds compiler options to suppress/enable warnings. CFLAGS += $(CFLAGS_WARN) diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2946,6 +2946,9 @@ } } +void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) { + fatal("CRC32 intrinsic is not implemented on this platform"); +} void LIR_Assembler::emit_lock(LIR_OpLock* op) { Register obj = op->obj_opr()->as_register(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -784,6 +784,10 @@ set_no_result(x); } +void LIRGenerator::do_update_CRC32(Intrinsic* x) { + fatal("CRC32 intrinsic is not implemented on this platform"); +} + // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s void LIRGenerator::do_Convert(Convert* x) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -49,8 +49,9 @@ define_pd_global(bool, ResizeTLAB, true ); define_pd_global(intx, ReservedCodeCacheSize, 32*M ); define_pd_global(intx, CodeCacheExpansionSize, 32*K ); -define_pd_global(uintx,CodeCacheMinBlockLength, 1); -define_pd_global(uintx,MetaspaceSize, 12*M ); +define_pd_global(uintx, CodeCacheMinBlockLength, 1); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); +define_pd_global(uintx, MetaspaceSize, 12*M ); define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(intx, NewSizeThreadIncrease, 16*K ); define_pd_global(uint64_t,MaxRAM, 1ULL*G); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp --- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -86,7 +86,8 @@ // Ergonomics related flags define_pd_global(uint64_t,MaxRAM, 4ULL*G); #endif -define_pd_global(uintx,CodeCacheMinBlockLength, 4); +define_pd_global(uintx, CodeCacheMinBlockLength, 4); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); // Heap related flags define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/frame_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/frame_sparc.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -257,11 +257,6 @@ return false; } - // Could be a zombie method - if (sender_blob->is_zombie() || sender_blob->is_unloaded()) { - return false; - } - // It should be safe to construct the sender though it might not be valid frame sender(_SENDER_SP, younger_sp, adjusted_stack); @@ -680,7 +675,7 @@ // validate ConstantPoolCache* ConstantPoolCache* cp = *interpreter_frame_cache_addr(); - if (cp == NULL || !cp->is_metadata()) return false; + if (cp == NULL || !cp->is_metaspace_object()) return false; // validate locals diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1161,12 +1161,6 @@ while (offset() % modulus != 0) nop(); } - -void MacroAssembler::safepoint() { - relocate(breakpoint_Relocation::spec(breakpoint_Relocation::safepoint)); -} - - void RegistersForDebugging::print(outputStream* s) { FlagSetting fs(Debugging, true); int j; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/sparc/vm/relocInfo_sparc.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -193,36 +193,6 @@ return *(address*)addr(); } - -int Relocation::pd_breakpoint_size() { - // minimum breakpoint size, in short words - return NativeIllegalInstruction::instruction_size / sizeof(short); -} - -void Relocation::pd_swap_in_breakpoint(address x, short* instrs, int instrlen) { - Untested("pd_swap_in_breakpoint"); - // %%% probably do not need a general instrlen; just use the trap size - if (instrs != NULL) { - assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data"); - for (int i = 0; i < instrlen; i++) { - instrs[i] = ((short*)x)[i]; - } - } - NativeIllegalInstruction::insert(x); -} - - -void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) { - Untested("pd_swap_out_breakpoint"); - assert(instrlen * sizeof(short) == sizeof(int), "enough buf"); - union { int l; short s[1]; } u; - for (int i = 0; i < instrlen; i++) { - u.s[i] = instrs[i]; - } - NativeInstruction* ni = nativeInstruction_at(x); - ni->set_long_at(0, u.l); -} - void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/assembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1673,6 +1673,11 @@ emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66); } +void Assembler::movdqa(XMMRegister dst, Address src) { + NOT_LP64(assert(VM_Version::supports_sse2(), "")); + emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_66); +} + void Assembler::movdqu(XMMRegister dst, Address src) { NOT_LP64(assert(VM_Version::supports_sse2(), "")); emit_simd_arith_nonds(0x6F, dst, src, VEX_SIMD_F3); @@ -2286,6 +2291,38 @@ emit_int8(imm8); } +void Assembler::pextrd(Register dst, XMMRegister src, int imm8) { + assert(VM_Version::supports_sse4_1(), ""); + int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, false); + emit_int8(0x16); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + +void Assembler::pextrq(Register dst, XMMRegister src, int imm8) { + assert(VM_Version::supports_sse4_1(), ""); + int encode = simd_prefix_and_encode(as_XMMRegister(dst->encoding()), xnoreg, src, VEX_SIMD_66, VEX_OPCODE_0F_3A, true); + emit_int8(0x16); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + +void Assembler::pinsrd(XMMRegister dst, Register src, int imm8) { + assert(VM_Version::supports_sse4_1(), ""); + int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, false); + emit_int8(0x22); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + +void Assembler::pinsrq(XMMRegister dst, Register src, int imm8) { + assert(VM_Version::supports_sse4_1(), ""); + int encode = simd_prefix_and_encode(dst, dst, as_XMMRegister(src->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, true); + emit_int8(0x22); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8(imm8); +} + void Assembler::pmovzxbw(XMMRegister dst, Address src) { assert(VM_Version::supports_sse4_1(), ""); InstructionMark im(this); @@ -3691,6 +3728,16 @@ emit_int8((unsigned char)(0xC0 | encode)); } +// Carry-Less Multiplication Quadword +void Assembler::vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask) { + assert(VM_Version::supports_avx() && VM_Version::supports_clmul(), ""); + bool vector256 = false; + int encode = vex_prefix_and_encode(dst, nds, src, VEX_SIMD_66, vector256, VEX_OPCODE_0F_3A); + emit_int8(0x44); + emit_int8((unsigned char)(0xC0 | encode)); + emit_int8((unsigned char)mask); +} + void Assembler::vzeroupper() { assert(VM_Version::supports_avx(), ""); (void)vex_prefix_and_encode(xmm0, xmm0, xmm0, VEX_SIMD_NONE); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/assembler_x86.hpp --- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1266,6 +1266,7 @@ // Move Aligned Double Quadword void movdqa(XMMRegister dst, XMMRegister src); + void movdqa(XMMRegister dst, Address src); // Move Unaligned Double Quadword void movdqu(Address dst, XMMRegister src); @@ -1404,6 +1405,14 @@ void pcmpestri(XMMRegister xmm1, XMMRegister xmm2, int imm8); void pcmpestri(XMMRegister xmm1, Address src, int imm8); + // SSE 4.1 extract + void pextrd(Register dst, XMMRegister src, int imm8); + void pextrq(Register dst, XMMRegister src, int imm8); + + // SSE 4.1 insert + void pinsrd(XMMRegister dst, Register src, int imm8); + void pinsrq(XMMRegister dst, Register src, int imm8); + // SSE4.1 packed move void pmovzxbw(XMMRegister dst, XMMRegister src); void pmovzxbw(XMMRegister dst, Address src); @@ -1764,6 +1773,9 @@ // duplicate 4-bytes integer data from src into 8 locations in dest void vpbroadcastd(XMMRegister dst, XMMRegister src); + // Carry-Less Multiplication Quadword + void vpclmulqdq(XMMRegister dst, XMMRegister nds, XMMRegister src, int mask); + // AVX instruction which is used to clear upper 128 bits of YMM registers and // to avoid transaction penalty between AVX and SSE states. There is no // penalty if legacy SSE instructions are encoded using VEX prefix because diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3512,6 +3512,22 @@ __ bind(*stub->continuation()); } +void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) { + assert(op->crc()->is_single_cpu(), "crc must be register"); + assert(op->val()->is_single_cpu(), "byte value must be register"); + assert(op->result_opr()->is_single_cpu(), "result must be register"); + Register crc = op->crc()->as_register(); + Register val = op->val()->as_register(); + Register res = op->result_opr()->as_register(); + + assert_different_registers(val, crc, res); + + __ lea(res, ExternalAddress(StubRoutines::crc_table_addr())); + __ notl(crc); // ~crc + __ update_byte_crc32(crc, val, res); + __ notl(crc); // ~crc + __ mov(res, crc); +} void LIR_Assembler::emit_lock(LIR_OpLock* op) { Register obj = op->obj_opr()->as_register(); // may not be an oop diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -932,6 +932,81 @@ __ arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint } +void LIRGenerator::do_update_CRC32(Intrinsic* x) { + assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support"); + // Make all state_for calls early since they can emit code + LIR_Opr result = rlock_result(x); + int flags = 0; + switch (x->id()) { + case vmIntrinsics::_updateCRC32: { + LIRItem crc(x->argument_at(0), this); + LIRItem val(x->argument_at(1), this); + crc.load_item(); + val.load_item(); + __ update_crc32(crc.result(), val.result(), result); + break; + } + case vmIntrinsics::_updateBytesCRC32: + case vmIntrinsics::_updateByteBufferCRC32: { + bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32); + + LIRItem crc(x->argument_at(0), this); + LIRItem buf(x->argument_at(1), this); + LIRItem off(x->argument_at(2), this); + LIRItem len(x->argument_at(3), this); + buf.load_item(); + off.load_nonconstant(); + + LIR_Opr index = off.result(); + int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; + if(off.result()->is_constant()) { + index = LIR_OprFact::illegalOpr; + offset += off.result()->as_jint(); + } + LIR_Opr base_op = buf.result(); + +#ifndef _LP64 + if (!is_updateBytes) { // long b raw address + base_op = new_register(T_INT); + __ convert(Bytecodes::_l2i, buf.result(), base_op); + } +#else + if (index->is_valid()) { + LIR_Opr tmp = new_register(T_LONG); + __ convert(Bytecodes::_i2l, index, tmp); + index = tmp; + } +#endif + + LIR_Address* a = new LIR_Address(base_op, + index, + LIR_Address::times_1, + offset, + T_BYTE); + BasicTypeList signature(3); + signature.append(T_INT); + signature.append(T_ADDRESS); + signature.append(T_INT); + CallingConvention* cc = frame_map()->c_calling_convention(&signature); + const LIR_Opr result_reg = result_register_for(x->type()); + + LIR_Opr addr = new_pointer_register(); + __ leal(LIR_OprFact::address(a), addr); + + crc.load_item_force(cc->at(0)); + __ move(addr, cc->at(1)); + len.load_item_force(cc->at(2)); + + __ call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args()); + __ move(result_reg, result); + + break; + } + default: { + ShouldNotReachHere(); + } + } +} // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f // _i2b, _i2c, _i2s diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/c1_globals_x86.hpp --- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -50,8 +50,9 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M ); define_pd_global(bool, ProfileInterpreter, false); define_pd_global(intx, CodeCacheExpansionSize, 32*K ); -define_pd_global(uintx,CodeCacheMinBlockLength, 1); -define_pd_global(uintx,MetaspaceSize, 12*M ); +define_pd_global(uintx, CodeCacheMinBlockLength, 1); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); +define_pd_global(uintx, MetaspaceSize, 12*M ); define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(uint64_t,MaxRAM, 1ULL*G); define_pd_global(bool, CICompileOSR, true ); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/c2_globals_x86.hpp --- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -85,7 +85,8 @@ define_pd_global(bool, OptoBundling, false); define_pd_global(intx, ReservedCodeCacheSize, 48*M); -define_pd_global(uintx,CodeCacheMinBlockLength, 4); +define_pd_global(uintx, CodeCacheMinBlockLength, 4); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 400*K); // Heap related flags define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(16*M)); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/frame_x86.cpp --- a/hotspot/src/cpu/x86/vm/frame_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/frame_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -587,7 +587,7 @@ // validate ConstantPoolCache* ConstantPoolCache* cp = *interpreter_frame_cache_addr(); - if (cp == NULL || !cp->is_metadata()) return false; + if (cp == NULL || !cp->is_metaspace_object()) return false; // validate locals diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/globals_x86.hpp --- a/hotspot/src/cpu/x86/vm/globals_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -96,6 +96,9 @@ product(intx, UseAVX, 99, \ "Highest supported AVX instructions set on x86/x64") \ \ + product(bool, UseCLMUL, false, \ + "Control whether CLMUL instructions can be used on x86/x64") \ + \ diagnostic(bool, UseIncDec, true, \ "Use INC, DEC instructions on x86") \ \ diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp --- a/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/interpreterGenerator_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,6 +39,8 @@ address generate_empty_entry(void); address generate_accessor_entry(void); address generate_Reference_get_entry(); + address generate_CRC32_update_entry(); + address generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind); void lock_method(void); void generate_stack_overflow_check(void); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2794,6 +2794,15 @@ } } +void MacroAssembler::movdqa(XMMRegister dst, AddressLiteral src) { + if (reachable(src)) { + Assembler::movdqa(dst, as_Address(src)); + } else { + lea(rscratch1, src); + Assembler::movdqa(dst, Address(rscratch1, 0)); + } +} + void MacroAssembler::movsd(XMMRegister dst, AddressLiteral src) { if (reachable(src)) { Assembler::movsd(dst, as_Address(src)); @@ -6388,6 +6397,193 @@ bind(L_done); } +/** + * Emits code to update CRC-32 with a byte value according to constants in table + * + * @param [in,out]crc Register containing the crc. + * @param [in]val Register containing the byte to fold into the CRC. + * @param [in]table Register containing the table of crc constants. + * + * uint32_t crc; + * val = crc_table[(val ^ crc) & 0xFF]; + * crc = val ^ (crc >> 8); + * + */ +void MacroAssembler::update_byte_crc32(Register crc, Register val, Register table) { + xorl(val, crc); + andl(val, 0xFF); + shrl(crc, 8); // unsigned shift + xorl(crc, Address(table, val, Address::times_4, 0)); +} + +/** + * Fold 128-bit data chunk + */ +void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset) { + vpclmulhdq(xtmp, xK, xcrc); // [123:64] + vpclmulldq(xcrc, xK, xcrc); // [63:0] + vpxor(xcrc, xcrc, Address(buf, offset), false /* vector256 */); + pxor(xcrc, xtmp); +} + +void MacroAssembler::fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf) { + vpclmulhdq(xtmp, xK, xcrc); + vpclmulldq(xcrc, xK, xcrc); + pxor(xcrc, xbuf); + pxor(xcrc, xtmp); +} + +/** + * 8-bit folds to compute 32-bit CRC + * + * uint64_t xcrc; + * timesXtoThe32[xcrc & 0xFF] ^ (xcrc >> 8); + */ +void MacroAssembler::fold_8bit_crc32(XMMRegister xcrc, Register table, XMMRegister xtmp, Register tmp) { + movdl(tmp, xcrc); + andl(tmp, 0xFF); + movdl(xtmp, Address(table, tmp, Address::times_4, 0)); + psrldq(xcrc, 1); // unsigned shift one byte + pxor(xcrc, xtmp); +} + +/** + * uint32_t crc; + * timesXtoThe32[crc & 0xFF] ^ (crc >> 8); + */ +void MacroAssembler::fold_8bit_crc32(Register crc, Register table, Register tmp) { + movl(tmp, crc); + andl(tmp, 0xFF); + shrl(crc, 8); + xorl(crc, Address(table, tmp, Address::times_4, 0)); +} + +/** + * @param crc register containing existing CRC (32-bit) + * @param buf register pointing to input byte buffer (byte*) + * @param len register containing number of bytes + * @param table register that will contain address of CRC table + * @param tmp scratch register + */ +void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp) { + assert_different_registers(crc, buf, len, table, tmp, rax); + + Label L_tail, L_tail_restore, L_tail_loop, L_exit, L_align_loop, L_aligned; + Label L_fold_tail, L_fold_128b, L_fold_512b, L_fold_512b_loop, L_fold_tail_loop; + + lea(table, ExternalAddress(StubRoutines::crc_table_addr())); + notl(crc); // ~crc + cmpl(len, 16); + jcc(Assembler::less, L_tail); + + // Align buffer to 16 bytes + movl(tmp, buf); + andl(tmp, 0xF); + jccb(Assembler::zero, L_aligned); + subl(tmp, 16); + addl(len, tmp); + + align(4); + BIND(L_align_loop); + movsbl(rax, Address(buf, 0)); // load byte with sign extension + update_byte_crc32(crc, rax, table); + increment(buf); + incrementl(tmp); + jccb(Assembler::less, L_align_loop); + + BIND(L_aligned); + movl(tmp, len); // save + shrl(len, 4); + jcc(Assembler::zero, L_tail_restore); + + // Fold crc into first bytes of vector + movdqa(xmm1, Address(buf, 0)); + movdl(rax, xmm1); + xorl(crc, rax); + pinsrd(xmm1, crc, 0); + addptr(buf, 16); + subl(len, 4); // len > 0 + jcc(Assembler::less, L_fold_tail); + + movdqa(xmm2, Address(buf, 0)); + movdqa(xmm3, Address(buf, 16)); + movdqa(xmm4, Address(buf, 32)); + addptr(buf, 48); + subl(len, 3); + jcc(Assembler::lessEqual, L_fold_512b); + + // Fold total 512 bits of polynomial on each iteration, + // 128 bits per each of 4 parallel streams. + movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 32)); + + align(32); + BIND(L_fold_512b_loop); + fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0); + fold_128bit_crc32(xmm2, xmm0, xmm5, buf, 16); + fold_128bit_crc32(xmm3, xmm0, xmm5, buf, 32); + fold_128bit_crc32(xmm4, xmm0, xmm5, buf, 48); + addptr(buf, 64); + subl(len, 4); + jcc(Assembler::greater, L_fold_512b_loop); + + // Fold 512 bits to 128 bits. + BIND(L_fold_512b); + movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16)); + fold_128bit_crc32(xmm1, xmm0, xmm5, xmm2); + fold_128bit_crc32(xmm1, xmm0, xmm5, xmm3); + fold_128bit_crc32(xmm1, xmm0, xmm5, xmm4); + + // Fold the rest of 128 bits data chunks + BIND(L_fold_tail); + addl(len, 3); + jccb(Assembler::lessEqual, L_fold_128b); + movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr() + 16)); + + BIND(L_fold_tail_loop); + fold_128bit_crc32(xmm1, xmm0, xmm5, buf, 0); + addptr(buf, 16); + decrementl(len); + jccb(Assembler::greater, L_fold_tail_loop); + + // Fold 128 bits in xmm1 down into 32 bits in crc register. + BIND(L_fold_128b); + movdqu(xmm0, ExternalAddress(StubRoutines::x86::crc_by128_masks_addr())); + vpclmulqdq(xmm2, xmm0, xmm1, 0x1); + vpand(xmm3, xmm0, xmm2, false /* vector256 */); + vpclmulqdq(xmm0, xmm0, xmm3, 0x1); + psrldq(xmm1, 8); + psrldq(xmm2, 4); + pxor(xmm0, xmm1); + pxor(xmm0, xmm2); + + // 8 8-bit folds to compute 32-bit CRC. + for (int j = 0; j < 4; j++) { + fold_8bit_crc32(xmm0, table, xmm1, rax); + } + movdl(crc, xmm0); // mov 32 bits to general register + for (int j = 0; j < 4; j++) { + fold_8bit_crc32(crc, table, rax); + } + + BIND(L_tail_restore); + movl(len, tmp); // restore + BIND(L_tail); + andl(len, 0xf); + jccb(Assembler::zero, L_exit); + + // Fold the rest of bytes + align(4); + BIND(L_tail_loop); + movsbl(rax, Address(buf, 0)); // load byte with sign extension + update_byte_crc32(crc, rax, table); + increment(buf); + decrementl(len); + jccb(Assembler::greater, L_tail_loop); + + BIND(L_exit); + notl(crc); // ~c +} + #undef BIND #undef BLOCK_COMMENT diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp --- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -899,6 +899,11 @@ void movdqu(XMMRegister dst, XMMRegister src) { Assembler::movdqu(dst, src); } void movdqu(XMMRegister dst, AddressLiteral src); + // Move Aligned Double Quadword + void movdqa(XMMRegister dst, Address src) { Assembler::movdqa(dst, src); } + void movdqa(XMMRegister dst, XMMRegister src) { Assembler::movdqa(dst, src); } + void movdqa(XMMRegister dst, AddressLiteral src); + void movsd(XMMRegister dst, XMMRegister src) { Assembler::movsd(dst, src); } void movsd(Address dst, XMMRegister src) { Assembler::movsd(dst, src); } void movsd(XMMRegister dst, Address src) { Assembler::movsd(dst, src); } @@ -1027,6 +1032,16 @@ Assembler::vinsertf128h(dst, nds, src); } + // Carry-Less Multiplication Quadword + void vpclmulldq(XMMRegister dst, XMMRegister nds, XMMRegister src) { + // 0x00 - multiply lower 64 bits [0:63] + Assembler::vpclmulqdq(dst, nds, src, 0x00); + } + void vpclmulhdq(XMMRegister dst, XMMRegister nds, XMMRegister src) { + // 0x11 - multiply upper 64 bits [64:127] + Assembler::vpclmulqdq(dst, nds, src, 0x11); + } + // Data void cmov32( Condition cc, Register dst, Address src); @@ -1143,6 +1158,16 @@ XMMRegister tmp1, XMMRegister tmp2, XMMRegister tmp3, XMMRegister tmp4, Register tmp5, Register result); + // CRC32 code for java.util.zip.CRC32::updateBytes() instrinsic. + void update_byte_crc32(Register crc, Register val, Register table); + void kernel_crc32(Register crc, Register buf, Register len, Register table, Register tmp); + // Fold 128-bit data chunk + void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, Register buf, int offset); + void fold_128bit_crc32(XMMRegister xcrc, XMMRegister xK, XMMRegister xtmp, XMMRegister xbuf); + // Fold 8-bit data + void fold_8bit_crc32(Register crc, Register table, Register tmp); + void fold_8bit_crc32(XMMRegister crc, Register table, XMMRegister xtmp, Register tmp); + #undef VIRTUAL }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/relocInfo_x86.cpp --- a/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/relocInfo_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -177,30 +177,6 @@ return *pd_address_in_code(); } -int Relocation::pd_breakpoint_size() { - // minimum breakpoint size, in short words - return NativeIllegalInstruction::instruction_size / sizeof(short); -} - -void Relocation::pd_swap_in_breakpoint(address x, short* instrs, int instrlen) { - Untested("pd_swap_in_breakpoint"); - if (instrs != NULL) { - assert(instrlen * sizeof(short) == NativeIllegalInstruction::instruction_size, "enough instrlen in reloc. data"); - for (int i = 0; i < instrlen; i++) { - instrs[i] = ((short*)x)[i]; - } - } - NativeIllegalInstruction::insert(x); -} - - -void Relocation::pd_swap_out_breakpoint(address x, short* instrs, int instrlen) { - Untested("pd_swap_out_breakpoint"); - assert(NativeIllegalInstruction::instruction_size == sizeof(short), "right address unit for update"); - NativeInstruction* ni = nativeInstruction_at(x); - *(short*)ni->addr_at(0) = instrs[0]; -} - void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { #ifdef _LP64 if (!Assembler::is_polling_page_far()) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2713,6 +2713,59 @@ return start; } + /** + * Arguments: + * + * Inputs: + * rsp(4) - int crc + * rsp(8) - byte* buf + * rsp(12) - int length + * + * Ouput: + * rax - int crc result + */ + address generate_updateBytesCRC32() { + assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions"); + + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32"); + + address start = __ pc(); + + const Register crc = rdx; // crc + const Register buf = rsi; // source java byte array address + const Register len = rcx; // length + const Register table = rdi; // crc_table address (reuse register) + const Register tmp = rbx; + assert_different_registers(crc, buf, len, table, tmp, rax); + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + __ push(rsi); + __ push(rdi); + __ push(rbx); + + Address crc_arg(rbp, 8 + 0); + Address buf_arg(rbp, 8 + 4); + Address len_arg(rbp, 8 + 8); + + // Load up: + __ movl(crc, crc_arg); + __ movptr(buf, buf_arg); + __ movl(len, len_arg); + + __ kernel_crc32(crc, buf, len, table, tmp); + + __ movl(rax, crc); + __ pop(rbx); + __ pop(rdi); + __ pop(rsi); + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + } + public: // Information about frame layout at time of blocking runtime call. @@ -2887,6 +2940,12 @@ // Build this early so it's available for the interpreter StubRoutines::_throw_StackOverflowError_entry = generate_throw_exception("StackOverflowError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError)); + + if (UseCRC32Intrinsics) { + // set table address before stub generation which use it + StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table; + StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); + } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3584,7 +3584,45 @@ return start; } - + /** + * Arguments: + * + * Inputs: + * c_rarg0 - int crc + * c_rarg1 - byte* buf + * c_rarg2 - int length + * + * Ouput: + * rax - int crc result + */ + address generate_updateBytesCRC32() { + assert(UseCRC32Intrinsics, "need AVX and CLMUL instructions"); + + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "updateBytesCRC32"); + + address start = __ pc(); + // Win64: rcx, rdx, r8, r9 (c_rarg0, c_rarg1, ...) + // Unix: rdi, rsi, rdx, rcx, r8, r9 (c_rarg0, c_rarg1, ...) + // rscratch1: r10 + const Register crc = c_rarg0; // crc + const Register buf = c_rarg1; // source java byte array address + const Register len = c_rarg2; // length + const Register table = c_rarg3; // crc_table address (reuse register) + const Register tmp = r11; + assert_different_registers(crc, buf, len, table, tmp, rax); + + BLOCK_COMMENT("Entry:"); + __ enter(); // required for proper stackwalking of RuntimeStub frame + + __ kernel_crc32(crc, buf, len, table, tmp); + + __ movl(rax, crc); + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; + } #undef __ #define __ masm-> @@ -3736,6 +3774,11 @@ CAST_FROM_FN_PTR(address, SharedRuntime:: throw_StackOverflowError)); + if (UseCRC32Intrinsics) { + // set table address before stub generation which use it + StubRoutines::_crc_table_adr = (address)StubRoutines::x86::_crc_table; + StubRoutines::_updateBytesCRC32 = generate_updateBytesCRC32(); + } } void generate_all() { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "runtime/deoptimization.hpp" +#include "runtime/frame.inline.hpp" +#include "runtime/stubRoutines.hpp" +#include "runtime/thread.inline.hpp" + +// Implementation of the platform-specific part of StubRoutines - for +// a description of how to extend it, see the stubRoutines.hpp file. + +address StubRoutines::x86::_verify_mxcsr_entry = NULL; +address StubRoutines::x86::_key_shuffle_mask_addr = NULL; + +uint64_t StubRoutines::x86::_crc_by128_masks[] = +{ + /* The fields in this structure are arranged so that they can be + * picked up two at a time with 128-bit loads. + * + * Because of flipped bit order for this CRC polynomials + * the constant for X**N is left-shifted by 1. This is because + * a 64 x 64 polynomial multiply produces a 127-bit result + * but the highest term is always aligned to bit 0 in the container. + * Pre-shifting by one fixes this, at the cost of potentially making + * the 32-bit constant no longer fit in a 32-bit container (thus the + * use of uint64_t, though this is also the size used by the carry- + * less multiply instruction. + * + * In addition, the flipped bit order and highest-term-at-least-bit + * multiply changes the constants used. The 96-bit result will be + * aligned to the high-term end of the target 128-bit container, + * not the low-term end; that is, instead of a 512-bit or 576-bit fold, + * instead it is a 480 (=512-32) or 544 (=512+64-32) bit fold. + * + * This cause additional problems in the 128-to-64-bit reduction; see the + * code for details. By storing a mask in the otherwise unused half of + * a 128-bit constant, bits can be cleared before multiplication without + * storing and reloading. Note that staying on a 128-bit datapath means + * that some data is uselessly stored and some unused data is intersected + * with an irrelevant constant. + */ + + ((uint64_t) 0xffffffffUL), /* low of K_M_64 */ + ((uint64_t) 0xb1e6b092U << 1), /* high of K_M_64 */ + ((uint64_t) 0xba8ccbe8U << 1), /* low of K_160_96 */ + ((uint64_t) 0x6655004fU << 1), /* high of K_160_96 */ + ((uint64_t) 0xaa2215eaU << 1), /* low of K_544_480 */ + ((uint64_t) 0xe3720acbU << 1) /* high of K_544_480 */ +}; + +/** + * crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h + */ +juint StubRoutines::x86::_crc_table[] = +{ + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +}; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + * + */ + +#ifndef CPU_X86_VM_STUBROUTINES_X86_HPP +#define CPU_X86_VM_STUBROUTINES_X86_HPP + +// This file holds the platform specific parts of the StubRoutines +// definition. See stubRoutines.hpp for a description on how to +// extend it. + + private: + static address _verify_mxcsr_entry; + // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers + static address _key_shuffle_mask_addr; + // masks and table for CRC32 + static uint64_t _crc_by128_masks[]; + static juint _crc_table[]; + + public: + static address verify_mxcsr_entry() { return _verify_mxcsr_entry; } + static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; } + static address crc_by128_masks_addr() { return (address)_crc_by128_masks; } + +#endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,4 @@ // Implementation of the platform-specific part of StubRoutines - for // a description of how to extend it, see the stubRoutines.hpp file. -address StubRoutines::x86::_verify_mxcsr_entry = NULL; address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL; -address StubRoutines::x86::_key_shuffle_mask_addr = NULL; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_32.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,15 +39,12 @@ friend class VMStructs; private: - static address _verify_mxcsr_entry; static address _verify_fpu_cntrl_wrd_entry; - // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers - static address _key_shuffle_mask_addr; public: - static address verify_mxcsr_entry() { return _verify_mxcsr_entry; } static address verify_fpu_cntrl_wrd_entry() { return _verify_fpu_cntrl_wrd_entry; } - static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; } + +# include "stubRoutines_x86.hpp" }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,8 +34,6 @@ address StubRoutines::x86::_get_previous_fp_entry = NULL; address StubRoutines::x86::_get_previous_sp_entry = NULL; -address StubRoutines::x86::_verify_mxcsr_entry = NULL; - address StubRoutines::x86::_f2i_fixup = NULL; address StubRoutines::x86::_f2l_fixup = NULL; address StubRoutines::x86::_d2i_fixup = NULL; @@ -45,4 +43,3 @@ address StubRoutines::x86::_double_sign_mask = NULL; address StubRoutines::x86::_double_sign_flip = NULL; address StubRoutines::x86::_mxcsr_std = NULL; -address StubRoutines::x86::_key_shuffle_mask_addr = NULL; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp --- a/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/stubRoutines_x86_64.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,6 @@ private: static address _get_previous_fp_entry; static address _get_previous_sp_entry; - static address _verify_mxcsr_entry; static address _f2i_fixup; static address _f2l_fixup; @@ -54,8 +53,6 @@ static address _double_sign_mask; static address _double_sign_flip; static address _mxcsr_std; - // shuffle mask for fixing up 128-bit words consisting of big-endian 32-bit integers - static address _key_shuffle_mask_addr; public: @@ -69,11 +66,6 @@ return _get_previous_sp_entry; } - static address verify_mxcsr_entry() - { - return _verify_mxcsr_entry; - } - static address f2i_fixup() { return _f2i_fixup; @@ -119,7 +111,7 @@ return _mxcsr_std; } - static address key_shuffle_mask_addr() { return _key_shuffle_mask_addr; } +# include "stubRoutines_x86.hpp" }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -868,6 +868,120 @@ return generate_accessor_entry(); } +/** + * Method entry for static native methods: + * int java.util.zip.CRC32.update(int crc, int b) + */ +address InterpreterGenerator::generate_CRC32_update_entry() { + if (UseCRC32Intrinsics) { + address entry = __ pc(); + + // rbx,: Method* + // rsi: senderSP must preserved for slow path, set SP to it on fast path + // rdx: scratch + // rdi: scratch + + Label slow_path; + // If we need a safepoint check, generate full interpreter entry. + ExternalAddress state(SafepointSynchronize::address_of_state()); + __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), + SafepointSynchronize::_not_synchronized); + __ jcc(Assembler::notEqual, slow_path); + + // We don't generate local frame and don't align stack because + // we call stub code and there is no safepoint on this path. + + // Load parameters + const Register crc = rax; // crc + const Register val = rdx; // source java byte value + const Register tbl = rdi; // scratch + + // Arguments are reversed on java expression stack + __ movl(val, Address(rsp, wordSize)); // byte value + __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC + + __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr())); + __ notl(crc); // ~crc + __ update_byte_crc32(crc, val, tbl); + __ notl(crc); // ~crc + // result in rax + + // _areturn + __ pop(rdi); // get return address + __ mov(rsp, rsi); // set sp to sender sp + __ jmp(rdi); + + // generate a vanilla native entry as the slow path + __ bind(slow_path); + + (void) generate_native_entry(false); + + return entry; + } + return generate_native_entry(false); +} + +/** + * Method entry for static native methods: + * int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) + * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) + */ +address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { + if (UseCRC32Intrinsics) { + address entry = __ pc(); + + // rbx,: Method* + // rsi: senderSP must preserved for slow path, set SP to it on fast path + // rdx: scratch + // rdi: scratch + + Label slow_path; + // If we need a safepoint check, generate full interpreter entry. + ExternalAddress state(SafepointSynchronize::address_of_state()); + __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), + SafepointSynchronize::_not_synchronized); + __ jcc(Assembler::notEqual, slow_path); + + // We don't generate local frame and don't align stack because + // we call stub code and there is no safepoint on this path. + + // Load parameters + const Register crc = rax; // crc + const Register buf = rdx; // source java byte array address + const Register len = rdi; // length + + // Arguments are reversed on java expression stack + __ movl(len, Address(rsp, wordSize)); // Length + // Calculate address of start element + if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { + __ movptr(buf, Address(rsp, 3*wordSize)); // long buf + __ addptr(buf, Address(rsp, 2*wordSize)); // + offset + __ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC + } else { + __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array + __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size + __ addptr(buf, Address(rsp, 2*wordSize)); // + offset + __ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC + } + + __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len); + // result in rax + + // _areturn + __ pop(rdi); // get return address + __ mov(rsp, rsi); // set sp to sender sp + __ jmp(rdi); + + // generate a vanilla native entry as the slow path + __ bind(slow_path); + + (void) generate_native_entry(false); + + return entry; + } + return generate_native_entry(false); +} + // // Interpreter stub for calling a native method. (asm interpreter) // This sets up a somewhat different looking stack for calling the native method @@ -1501,15 +1615,16 @@ // determine code generation flags bool synchronized = false; address entry_point = NULL; + InterpreterGenerator* ig_this = (InterpreterGenerator*)this; switch (kind) { - case Interpreter::zerolocals : break; - case Interpreter::zerolocals_synchronized: synchronized = true; break; - case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break; - case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break; - case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break; - case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; - case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; + case Interpreter::zerolocals : break; + case Interpreter::zerolocals_synchronized: synchronized = true; break; + case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break; + case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break; + case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break; + case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break; + case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break; case Interpreter::java_lang_math_sin : // fall thru case Interpreter::java_lang_math_cos : // fall thru @@ -1519,9 +1634,15 @@ case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_sqrt : // fall thru case Interpreter::java_lang_math_pow : // fall thru - case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; + case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break; case Interpreter::java_lang_ref_reference_get - : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; + : entry_point = ig_this->generate_Reference_get_entry(); break; + case Interpreter::java_util_zip_CRC32_update + : entry_point = ig_this->generate_CRC32_update_entry(); break; + case Interpreter::java_util_zip_CRC32_updateBytes + : // fall thru + case Interpreter::java_util_zip_CRC32_updateByteBuffer + : entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break; default: fatal(err_msg("unexpected method kind: %d", kind)); break; @@ -1529,7 +1650,7 @@ if (entry_point) return entry_point; - return ((InterpreterGenerator*)this)->generate_normal_entry(synchronized); + return ig_this->generate_normal_entry(synchronized); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp --- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -840,6 +840,117 @@ return generate_accessor_entry(); } +/** + * Method entry for static native methods: + * int java.util.zip.CRC32.update(int crc, int b) + */ +address InterpreterGenerator::generate_CRC32_update_entry() { + if (UseCRC32Intrinsics) { + address entry = __ pc(); + + // rbx,: Method* + // rsi: senderSP must preserved for slow path, set SP to it on fast path + // rdx: scratch + // rdi: scratch + + Label slow_path; + // If we need a safepoint check, generate full interpreter entry. + ExternalAddress state(SafepointSynchronize::address_of_state()); + __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), + SafepointSynchronize::_not_synchronized); + __ jcc(Assembler::notEqual, slow_path); + + // We don't generate local frame and don't align stack because + // we call stub code and there is no safepoint on this path. + + // Load parameters + const Register crc = rax; // crc + const Register val = rdx; // source java byte value + const Register tbl = rdi; // scratch + + // Arguments are reversed on java expression stack + __ movl(val, Address(rsp, wordSize)); // byte value + __ movl(crc, Address(rsp, 2*wordSize)); // Initial CRC + + __ lea(tbl, ExternalAddress(StubRoutines::crc_table_addr())); + __ notl(crc); // ~crc + __ update_byte_crc32(crc, val, tbl); + __ notl(crc); // ~crc + // result in rax + + // _areturn + __ pop(rdi); // get return address + __ mov(rsp, rsi); // set sp to sender sp + __ jmp(rdi); + + // generate a vanilla native entry as the slow path + __ bind(slow_path); + + (void) generate_native_entry(false); + + return entry; + } + return generate_native_entry(false); +} + +/** + * Method entry for static native methods: + * int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) + * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) + */ +address InterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { + if (UseCRC32Intrinsics) { + address entry = __ pc(); + + // rbx,: Method* + // r13: senderSP must preserved for slow path, set SP to it on fast path + + Label slow_path; + // If we need a safepoint check, generate full interpreter entry. + ExternalAddress state(SafepointSynchronize::address_of_state()); + __ cmp32(ExternalAddress(SafepointSynchronize::address_of_state()), + SafepointSynchronize::_not_synchronized); + __ jcc(Assembler::notEqual, slow_path); + + // We don't generate local frame and don't align stack because + // we call stub code and there is no safepoint on this path. + + // Load parameters + const Register crc = c_rarg0; // crc + const Register buf = c_rarg1; // source java byte array address + const Register len = c_rarg2; // length + + // Arguments are reversed on java expression stack + __ movl(len, Address(rsp, wordSize)); // Length + // Calculate address of start element + if (kind == Interpreter::java_util_zip_CRC32_updateByteBuffer) { + __ movptr(buf, Address(rsp, 3*wordSize)); // long buf + __ addptr(buf, Address(rsp, 2*wordSize)); // + offset + __ movl(crc, Address(rsp, 5*wordSize)); // Initial CRC + } else { + __ movptr(buf, Address(rsp, 3*wordSize)); // byte[] array + __ addptr(buf, arrayOopDesc::base_offset_in_bytes(T_BYTE)); // + header size + __ addptr(buf, Address(rsp, 2*wordSize)); // + offset + __ movl(crc, Address(rsp, 4*wordSize)); // Initial CRC + } + + __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, StubRoutines::updateBytesCRC32()), crc, buf, len); + // result in rax + + // _areturn + __ pop(rdi); // get return address + __ mov(rsp, r13); // set sp to sender sp + __ jmp(rdi); + + // generate a vanilla native entry as the slow path + __ bind(slow_path); + + (void) generate_native_entry(false); + + return entry; + } + return generate_native_entry(false); +} // Interpreter stub for calling a native method. (asm interpreter) // This sets up a somewhat different looking stack for calling the @@ -1510,15 +1621,16 @@ // determine code generation flags bool synchronized = false; address entry_point = NULL; + InterpreterGenerator* ig_this = (InterpreterGenerator*)this; switch (kind) { - case Interpreter::zerolocals : break; - case Interpreter::zerolocals_synchronized: synchronized = true; break; - case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break; - case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break; - case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break; - case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; - case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; + case Interpreter::zerolocals : break; + case Interpreter::zerolocals_synchronized: synchronized = true; break; + case Interpreter::native : entry_point = ig_this->generate_native_entry(false); break; + case Interpreter::native_synchronized : entry_point = ig_this->generate_native_entry(true); break; + case Interpreter::empty : entry_point = ig_this->generate_empty_entry(); break; + case Interpreter::accessor : entry_point = ig_this->generate_accessor_entry(); break; + case Interpreter::abstract : entry_point = ig_this->generate_abstract_entry(); break; case Interpreter::java_lang_math_sin : // fall thru case Interpreter::java_lang_math_cos : // fall thru @@ -1528,9 +1640,15 @@ case Interpreter::java_lang_math_log10 : // fall thru case Interpreter::java_lang_math_sqrt : // fall thru case Interpreter::java_lang_math_pow : // fall thru - case Interpreter::java_lang_math_exp : entry_point = ((InterpreterGenerator*)this)->generate_math_entry(kind); break; + case Interpreter::java_lang_math_exp : entry_point = ig_this->generate_math_entry(kind); break; case Interpreter::java_lang_ref_reference_get - : entry_point = ((InterpreterGenerator*)this)->generate_Reference_get_entry(); break; + : entry_point = ig_this->generate_Reference_get_entry(); break; + case Interpreter::java_util_zip_CRC32_update + : entry_point = ig_this->generate_CRC32_update_entry(); break; + case Interpreter::java_util_zip_CRC32_updateBytes + : // fall thru + case Interpreter::java_util_zip_CRC32_updateByteBuffer + : entry_point = ig_this->generate_CRC32_updateBytes_entry(kind); break; default: fatal(err_msg("unexpected method kind: %d", kind)); break; @@ -1540,8 +1658,7 @@ return entry_point; } - return ((InterpreterGenerator*) this)-> - generate_normal_entry(synchronized); + return ig_this->generate_normal_entry(synchronized); } // These should never be compiled since the interpreter will prefer diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/vm_version_x86.cpp --- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -446,6 +446,7 @@ (supports_avx() ? ", avx" : ""), (supports_avx2() ? ", avx2" : ""), (supports_aes() ? ", aes" : ""), + (supports_clmul() ? ", clmul" : ""), (supports_erms() ? ", erms" : ""), (supports_mmx_ext() ? ", mmxext" : ""), (supports_3dnow_prefetch() ? ", 3dnowpref" : ""), @@ -489,6 +490,27 @@ FLAG_SET_DEFAULT(UseAES, false); } + // Use CLMUL instructions if available. + if (supports_clmul()) { + if (FLAG_IS_DEFAULT(UseCLMUL)) { + UseCLMUL = true; + } + } else if (UseCLMUL) { + if (!FLAG_IS_DEFAULT(UseCLMUL)) + warning("CLMUL instructions not available on this CPU (AVX may also be required)"); + FLAG_SET_DEFAULT(UseCLMUL, false); + } + + if (UseCLMUL && (UseAVX > 0) && (UseSSE > 2)) { + if (FLAG_IS_DEFAULT(UseCRC32Intrinsics)) { + UseCRC32Intrinsics = true; + } + } else if (UseCRC32Intrinsics) { + if (!FLAG_IS_DEFAULT(UseCRC32Intrinsics)) + warning("CRC32 Intrinsics requires AVX and CLMUL instructions (not available on this CPU)"); + FLAG_SET_DEFAULT(UseCRC32Intrinsics, false); + } + // The AES intrinsic stubs require AES instruction support (of course) // but also require sse3 mode for instructions it use. if (UseAES && (UseSSE > 2)) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/x86/vm/vm_version_x86.hpp --- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,8 @@ uint32_t value; struct { uint32_t sse3 : 1, - : 2, + clmul : 1, + : 1, monitor : 1, : 1, vmx : 1, @@ -249,7 +250,8 @@ CPU_AVX = (1 << 17), CPU_AVX2 = (1 << 18), CPU_AES = (1 << 19), - CPU_ERMS = (1 << 20) // enhanced 'rep movsb/stosb' instructions + CPU_ERMS = (1 << 20), // enhanced 'rep movsb/stosb' instructions + CPU_CLMUL = (1 << 21) // carryless multiply for CRC } cpuFeatureFlags; enum { @@ -429,6 +431,8 @@ result |= CPU_AES; if (_cpuid_info.sef_cpuid7_ebx.bits.erms != 0) result |= CPU_ERMS; + if (_cpuid_info.std_cpuid1_ecx.bits.clmul != 0) + result |= CPU_CLMUL; // AMD features. if (is_amd()) { @@ -555,6 +559,7 @@ static bool supports_tsc() { return (_cpuFeatures & CPU_TSC) != 0; } static bool supports_aes() { return (_cpuFeatures & CPU_AES) != 0; } static bool supports_erms() { return (_cpuFeatures & CPU_ERMS) != 0; } + static bool supports_clmul() { return (_cpuFeatures & CPU_CLMUL) != 0; } // Intel features static bool is_intel_family_core() { return is_intel() && diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/zero/vm/relocInfo_zero.cpp --- a/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/zero/vm/relocInfo_zero.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -52,22 +52,6 @@ return (address *) addr(); } -int Relocation::pd_breakpoint_size() { - ShouldNotCallThis(); -} - -void Relocation::pd_swap_in_breakpoint(address x, - short* instrs, - int instrlen) { - ShouldNotCallThis(); -} - -void Relocation::pd_swap_out_breakpoint(address x, - short* instrs, - int instrlen) { - ShouldNotCallThis(); -} - void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dst) { ShouldNotCallThis(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/cpu/zero/vm/shark_globals_zero.hpp --- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -58,7 +58,9 @@ define_pd_global(bool, ProfileInterpreter, false); define_pd_global(intx, CodeCacheExpansionSize, 32*K ); define_pd_global(uintx, CodeCacheMinBlockLength, 1 ); -define_pd_global(uintx, MetaspaceSize, 12*M ); +define_pd_global(uintx, CodeCacheMinimumUseSpace, 200*K); + +define_pd_global(uintx, MetaspaceSize, 12*M ); define_pd_global(bool, NeverActAsServerClassMachine, true ); define_pd_global(uint64_t, MaxRAM, 1ULL*G); define_pd_global(bool, CICompileOSR, true ); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1234,12 +1234,13 @@ Dl_info dlinfo; if (libjvm_base_addr == NULL) { - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); - libjvm_base_addr = (address)dlinfo.dli_fbase; + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { + libjvm_base_addr = (address)dlinfo.dli_fbase; + } assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); } - if (dladdr((void *)addr, &dlinfo)) { + if (dladdr((void *)addr, &dlinfo) != 0) { if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; } @@ -1251,35 +1252,40 @@ bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int *offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; char localbuf[MACH_MAXSYMLEN]; - // dladdr will find names of dynamic functions only, but does - // it set dli_fbase with mach_header address when it "fails" ? - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { - if (buf != NULL) { - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { + if (dladdr((void*)addr, &dlinfo) != 0) { + // see if we have a matching symbol + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); } + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; + return true; + } + // no matching symbol so try for just file info + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), + buf, buflen, offset, dlinfo.dli_fname)) { + return true; + } } - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; - return true; - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), - buf, buflen, offset, dlinfo.dli_fname)) { - return true; + + // Handle non-dynamic manually: + if (dlinfo.dli_fbase != NULL && + Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, + dlinfo.dli_fbase)) { + if (!Decoder::demangle(localbuf, buf, buflen)) { + jio_snprintf(buf, buflen, "%s", localbuf); + } + return true; } } - - // Handle non-dymanic manually: - if (dlinfo.dli_fbase != NULL && - Decoder::decode(addr, localbuf, MACH_MAXSYMLEN, offset, dlinfo.dli_fbase)) { - if(!Decoder::demangle(localbuf, buf, buflen)) { - jio_snprintf(buf, buflen, "%s", localbuf); - } - return true; - } - if (buf != NULL) buf[0] = '\0'; + buf[0] = '\0'; if (offset != NULL) *offset = -1; return false; } @@ -1287,17 +1293,24 @@ // ported from solaris version bool os::dll_address_to_library_name(address addr, char* buf, int buflen, int* offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; - if (dladdr((void*)addr, &dlinfo)){ - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); - if (offset) *offset = addr - (address)dlinfo.dli_fbase; - return true; - } else { - if (buf) buf[0] = '\0'; - if (offset) *offset = -1; - return false; + if (dladdr((void*)addr, &dlinfo) != 0) { + if (dlinfo.dli_fname != NULL) { + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); + } + if (dlinfo.dli_fbase != NULL && offset != NULL) { + *offset = addr - (address)dlinfo.dli_fbase; + } + return true; } + + buf[0] = '\0'; + if (offset) *offset = -1; + return false; } // Loads .dll/.so and @@ -1520,49 +1533,50 @@ } void os::print_dll_info(outputStream *st) { - st->print_cr("Dynamic libraries:"); + st->print_cr("Dynamic libraries:"); #ifdef RTLD_DI_LINKMAP - Dl_info dli; - void *handle; - Link_map *map; - Link_map *p; - - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - handle = dlopen(dli.dli_fname, RTLD_LAZY); - if (handle == NULL) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - dlinfo(handle, RTLD_DI_LINKMAP, &map); - if (map == NULL) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - - while (map->l_prev != NULL) - map = map->l_prev; - - while (map != NULL) { - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); - map = map->l_next; - } - - dlclose(handle); + Dl_info dli; + void *handle; + Link_map *map; + Link_map *p; + + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || + dli.dli_fname == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + handle = dlopen(dli.dli_fname, RTLD_LAZY); + if (handle == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + dlinfo(handle, RTLD_DI_LINKMAP, &map); + if (map == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + + while (map->l_prev != NULL) + map = map->l_prev; + + while (map != NULL) { + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); + map = map->l_next; + } + + dlclose(handle); #elif defined(__APPLE__) - uint32_t count; - uint32_t i; - - count = _dyld_image_count(); - for (i = 1; i < count; i++) { - const char *name = _dyld_get_image_name(i); - intptr_t slide = _dyld_get_image_vmaddr_slide(i); - st->print_cr(PTR_FORMAT " \t%s", slide, name); - } + uint32_t count; + uint32_t i; + + count = _dyld_image_count(); + for (i = 1; i < count; i++) { + const char *name = _dyld_get_image_name(i); + intptr_t slide = _dyld_get_image_vmaddr_slide(i); + st->print_cr(PTR_FORMAT " \t%s", slide, name); + } #else - st->print_cr("Error: Cannot print dynamic libraries."); + st->print_cr("Error: Cannot print dynamic libraries."); #endif } @@ -1707,8 +1721,11 @@ bool ret = dll_address_to_library_name( CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); - assert(ret != 0, "cannot locate libjvm"); - char *rp = realpath(dli_fname, buf); + assert(ret, "cannot locate libjvm"); + char *rp = NULL; + if (ret && dli_fname[0] != '\0') { + rp = realpath(dli_fname, buf); + } if (rp == NULL) return; @@ -3747,20 +3764,20 @@ bool os::find(address addr, outputStream* st) { Dl_info dlinfo; memset(&dlinfo, 0, sizeof(dlinfo)); - if (dladdr(addr, &dlinfo)) { + if (dladdr(addr, &dlinfo) != 0) { st->print(PTR_FORMAT ": ", addr); - if (dlinfo.dli_sname != NULL) { + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#x", dlinfo.dli_sname, addr - (intptr_t)dlinfo.dli_saddr); - } else if (dlinfo.dli_fname) { + } else if (dlinfo.dli_fbase != NULL) { st->print("", addr - (intptr_t)dlinfo.dli_fbase); } else { st->print(""); } - if (dlinfo.dli_fname) { + if (dlinfo.dli_fname != NULL) { st->print(" in %s", dlinfo.dli_fname); } - if (dlinfo.dli_fbase) { + if (dlinfo.dli_fbase != NULL) { st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); } st->cr(); @@ -3773,7 +3790,7 @@ if (!lowest) lowest = (address) dlinfo.dli_fbase; if (begin < lowest) begin = lowest; Dl_info dlinfo2; - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) end = (address) dlinfo2.dli_saddr; Disassembler::decode(begin, end, st); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1682,12 +1682,13 @@ Dl_info dlinfo; if (libjvm_base_addr == NULL) { - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); - libjvm_base_addr = (address)dlinfo.dli_fbase; + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { + libjvm_base_addr = (address)dlinfo.dli_fbase; + } assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); } - if (dladdr((void *)addr, &dlinfo)) { + if (dladdr((void *)addr, &dlinfo) != 0) { if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; } @@ -1696,24 +1697,30 @@ bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int *offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; - if (dladdr((void*)addr, &dlinfo) && dlinfo.dli_sname != NULL) { - if (buf != NULL) { - if(!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { + if (dladdr((void*)addr, &dlinfo) != 0) { + // see if we have a matching symbol + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); } + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; + return true; + } + // no matching symbol so try for just file info + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), + buf, buflen, offset, dlinfo.dli_fname)) { + return true; + } } - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; - return true; - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), - buf, buflen, offset, dlinfo.dli_fname)) { - return true; - } - } - - if (buf != NULL) buf[0] = '\0'; + } + + buf[0] = '\0'; if (offset != NULL) *offset = -1; return false; } @@ -1764,6 +1771,9 @@ bool os::dll_address_to_library_name(address addr, char* buf, int buflen, int* offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; struct _address_to_library_name data; @@ -1782,15 +1792,20 @@ // buf already contains library name if (offset) *offset = addr - data.base; return true; - } else if (dladdr((void*)addr, &dlinfo)){ - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); - if (offset) *offset = addr - (address)dlinfo.dli_fbase; - return true; - } else { - if (buf) buf[0] = '\0'; - if (offset) *offset = -1; - return false; - } + } + if (dladdr((void*)addr, &dlinfo) != 0) { + if (dlinfo.dli_fname != NULL) { + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); + } + if (dlinfo.dli_fbase != NULL && offset != NULL) { + *offset = addr - (address)dlinfo.dli_fbase; + } + return true; + } + + buf[0] = '\0'; + if (offset) *offset = -1; + return false; } // Loads .dll/.so and @@ -2317,8 +2332,11 @@ bool ret = dll_address_to_library_name( CAST_FROM_FN_PTR(address, os::jvm_path), dli_fname, sizeof(dli_fname), NULL); - assert(ret != 0, "cannot locate libjvm"); - char *rp = realpath(dli_fname, buf); + assert(ret, "cannot locate libjvm"); + char *rp = NULL; + if (ret && dli_fname[0] != '\0') { + rp = realpath(dli_fname, buf); + } if (rp == NULL) return; @@ -4730,20 +4748,20 @@ bool os::find(address addr, outputStream* st) { Dl_info dlinfo; memset(&dlinfo, 0, sizeof(dlinfo)); - if (dladdr(addr, &dlinfo)) { + if (dladdr(addr, &dlinfo) != 0) { st->print(PTR_FORMAT ": ", addr); - if (dlinfo.dli_sname != NULL) { + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#x", dlinfo.dli_sname, addr - (intptr_t)dlinfo.dli_saddr); - } else if (dlinfo.dli_fname) { + } else if (dlinfo.dli_fbase != NULL) { st->print("", addr - (intptr_t)dlinfo.dli_fbase); } else { st->print(""); } - if (dlinfo.dli_fname) { + if (dlinfo.dli_fname != NULL) { st->print(" in %s", dlinfo.dli_fname); } - if (dlinfo.dli_fbase) { + if (dlinfo.dli_fbase != NULL) { st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); } st->cr(); @@ -4756,7 +4774,7 @@ if (!lowest) lowest = (address) dlinfo.dli_fbase; if (begin < lowest) begin = lowest; Dl_info dlinfo2; - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) end = (address) dlinfo2.dli_saddr; Disassembler::decode(begin, end, st); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/solaris/dtrace/jhelper.d --- a/hotspot/src/os/solaris/dtrace/jhelper.d Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/solaris/dtrace/jhelper.d Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -332,12 +332,15 @@ this->nameSymbol = copyin_ptr(this->constantPool + this->nameIndex * sizeof (pointer) + SIZE_ConstantPool); + /* The symbol is a CPSlot and has lower bit set to indicate metadata */ + this->nameSymbol &= (~1); /* remove metadata lsb */ this->nameSymbolLength = copyin_uint16(this->nameSymbol + OFFSET_Symbol_length); this->signatureSymbol = copyin_ptr(this->constantPool + this->signatureIndex * sizeof (pointer) + SIZE_ConstantPool); + this->signatureSymbol &= (~1); /* remove metadata lsb */ this->signatureSymbolLength = copyin_uint16(this->signatureSymbol + OFFSET_Symbol_length); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/solaris/vm/globals_solaris.hpp --- a/hotspot/src/os/solaris/vm/globals_solaris.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/solaris/vm/globals_solaris.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -30,15 +30,6 @@ // #define RUNTIME_OS_FLAGS(develop, develop_pd, product, product_pd, diagnostic, notproduct) \ \ - product(bool, UseISM, false, \ - "Use Intimate Shared Memory (Solaris Only)") \ - \ - product(bool, UsePermISM, false, \ - "Obsolete flag for compatibility (same as UseISM)") \ - \ - product(bool, UseMPSS, true, \ - "Use Multiple Page Size Support (Solaris 9 Only)") \ - \ product(bool, UseExtendedFileIO, true, \ "Enable workaround for limitations of stdio FILE structure") diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -115,45 +115,6 @@ // for timer info max values which include all bits #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) -#ifdef _GNU_SOURCE -// See bug #6514594 -extern "C" int madvise(caddr_t, size_t, int); -extern "C" int memcntl(caddr_t addr, size_t len, int cmd, caddr_t arg, - int attr, int mask); -#endif //_GNU_SOURCE - -/* - MPSS Changes Start. - The JVM binary needs to be built and run on pre-Solaris 9 - systems, but the constants needed by MPSS are only in Solaris 9 - header files. They are textually replicated here to allow - building on earlier systems. Once building on Solaris 8 is - no longer a requirement, these #defines can be replaced by ordinary - system .h inclusion. - - In earlier versions of the JDK and Solaris, we used ISM for large pages. - But ISM requires shared memory to achieve this and thus has many caveats. - MPSS is a fully transparent and is a cleaner way to get large pages. - Although we still require keeping ISM for backward compatiblitiy as well as - giving the opportunity to use large pages on older systems it is - recommended that MPSS be used for Solaris 9 and above. - -*/ - -#ifndef MC_HAT_ADVISE - -struct memcntl_mha { - uint_t mha_cmd; /* command(s) */ - uint_t mha_flags; - size_t mha_pagesize; -}; -#define MC_HAT_ADVISE 7 /* advise hat map size */ -#define MHA_MAPSIZE_VA 0x1 /* set preferred page size */ -#define MAP_ALIGN 0x200 /* addr specifies alignment */ - -#endif -// MPSS Changes End. - // Here are some liblgrp types from sys/lgrp_user.h to be able to // compile on older systems without this header file. @@ -172,32 +133,6 @@ # define LGRP_RSRC_MEM 1 /* memory resources */ #endif -// Some more macros from sys/mman.h that are not present in Solaris 8. - -#ifndef MAX_MEMINFO_CNT -/* - * info_req request type definitions for meminfo - * request types starting with MEMINFO_V are used for Virtual addresses - * and should not be mixed with MEMINFO_PLGRP which is targeted for Physical - * addresses - */ -# define MEMINFO_SHIFT 16 -# define MEMINFO_MASK (0xFF << MEMINFO_SHIFT) -# define MEMINFO_VPHYSICAL (0x01 << MEMINFO_SHIFT) /* get physical addr */ -# define MEMINFO_VLGRP (0x02 << MEMINFO_SHIFT) /* get lgroup */ -# define MEMINFO_VPAGESIZE (0x03 << MEMINFO_SHIFT) /* size of phys page */ -# define MEMINFO_VREPLCNT (0x04 << MEMINFO_SHIFT) /* no. of replica */ -# define MEMINFO_VREPL (0x05 << MEMINFO_SHIFT) /* physical replica */ -# define MEMINFO_VREPL_LGRP (0x06 << MEMINFO_SHIFT) /* lgrp of replica */ -# define MEMINFO_PLGRP (0x07 << MEMINFO_SHIFT) /* lgroup for paddr */ - -/* maximum number of addresses meminfo() can process at a time */ -# define MAX_MEMINFO_CNT 256 - -/* maximum number of request types */ -# define MAX_MEMINFO_REQ 31 -#endif - // see thr_setprio(3T) for the basis of these numbers #define MinimumPriority 0 #define NormalPriority 64 @@ -1924,12 +1859,13 @@ Dl_info dlinfo; if (libjvm_base_addr == NULL) { - dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo); - libjvm_base_addr = (address)dlinfo.dli_fbase; + if (dladdr(CAST_FROM_FN_PTR(void *, os::address_is_in_vm), &dlinfo) != 0) { + libjvm_base_addr = (address)dlinfo.dli_fbase; + } assert(libjvm_base_addr !=NULL, "Cannot obtain base address for libjvm"); } - if (dladdr((void *)addr, &dlinfo)) { + if (dladdr((void *)addr, &dlinfo) != 0) { if (libjvm_base_addr == (address)dlinfo.dli_fbase) return true; } @@ -1941,114 +1877,133 @@ bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int * offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; // dladdr1_func was initialized in os::init() - if (dladdr1_func){ - // yes, we have dladdr1 - - // Support for dladdr1 is checked at runtime; it may be - // available even if the vm is built on a machine that does - // not have dladdr1 support. Make sure there is a value for - // RTLD_DL_SYMENT. - #ifndef RTLD_DL_SYMENT - #define RTLD_DL_SYMENT 1 - #endif + if (dladdr1_func != NULL) { + // yes, we have dladdr1 + + // Support for dladdr1 is checked at runtime; it may be + // available even if the vm is built on a machine that does + // not have dladdr1 support. Make sure there is a value for + // RTLD_DL_SYMENT. + #ifndef RTLD_DL_SYMENT + #define RTLD_DL_SYMENT 1 + #endif #ifdef _LP64 - Elf64_Sym * info; + Elf64_Sym * info; #else - Elf32_Sym * info; + Elf32_Sym * info; #endif - if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, - RTLD_DL_SYMENT)) { - if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { - if (buf != NULL) { - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) - jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); - } - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; - return true; - } - } - if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { - if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), - buf, buflen, offset, dlinfo.dli_fname)) { + if (dladdr1_func((void *)addr, &dlinfo, (void **)&info, + RTLD_DL_SYMENT) != 0) { + // see if we have a matching symbol that covers our address + if (dlinfo.dli_saddr != NULL && + (char *)dlinfo.dli_saddr + info->st_size > (char *)addr) { + if (dlinfo.dli_sname != NULL) { + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { + jio_snprintf(buf, buflen, "%s", dlinfo.dli_sname); + } + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; return true; } } - if (buf != NULL) buf[0] = '\0'; - if (offset != NULL) *offset = -1; - return false; - } else { - // no, only dladdr is available - if (dladdr((void *)addr, &dlinfo)) { - if (buf != NULL) { - if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) - jio_snprintf(buf, buflen, dlinfo.dli_sname); - } - if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; - return true; - } else if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != 0) { + // no matching symbol so try for just file info + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), - buf, buflen, offset, dlinfo.dli_fname)) { + buf, buflen, offset, dlinfo.dli_fname)) { return true; } } - if (buf != NULL) buf[0] = '\0'; - if (offset != NULL) *offset = -1; - return false; - } + } + buf[0] = '\0'; + if (offset != NULL) *offset = -1; + return false; + } + + // no, only dladdr is available + if (dladdr((void *)addr, &dlinfo) != 0) { + // see if we have a matching symbol + if (dlinfo.dli_saddr != NULL && dlinfo.dli_sname != NULL) { + if (!Decoder::demangle(dlinfo.dli_sname, buf, buflen)) { + jio_snprintf(buf, buflen, dlinfo.dli_sname); + } + if (offset != NULL) *offset = addr - (address)dlinfo.dli_saddr; + return true; + } + // no matching symbol so try for just file info + if (dlinfo.dli_fname != NULL && dlinfo.dli_fbase != NULL) { + if (Decoder::decode((address)(addr - (address)dlinfo.dli_fbase), + buf, buflen, offset, dlinfo.dli_fname)) { + return true; + } + } + } + buf[0] = '\0'; + if (offset != NULL) *offset = -1; + return false; } bool os::dll_address_to_library_name(address addr, char* buf, int buflen, int* offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + Dl_info dlinfo; - if (dladdr((void*)addr, &dlinfo)){ - if (buf) jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); - if (offset) *offset = addr - (address)dlinfo.dli_fbase; - return true; - } else { - if (buf) buf[0] = '\0'; - if (offset) *offset = -1; - return false; - } + if (dladdr((void*)addr, &dlinfo) != 0) { + if (dlinfo.dli_fname != NULL) { + jio_snprintf(buf, buflen, "%s", dlinfo.dli_fname); + } + if (dlinfo.dli_fbase != NULL && offset != NULL) { + *offset = addr - (address)dlinfo.dli_fbase; + } + return true; + } + + buf[0] = '\0'; + if (offset) *offset = -1; + return false; } // Prints the names and full paths of all opened dynamic libraries // for current process void os::print_dll_info(outputStream * st) { - Dl_info dli; - void *handle; - Link_map *map; - Link_map *p; - - st->print_cr("Dynamic libraries:"); st->flush(); - - if (!dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli)) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - handle = dlopen(dli.dli_fname, RTLD_LAZY); - if (handle == NULL) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - dlinfo(handle, RTLD_DI_LINKMAP, &map); - if (map == NULL) { - st->print_cr("Error: Cannot print dynamic libraries."); - return; - } - - while (map->l_prev != NULL) - map = map->l_prev; - - while (map != NULL) { - st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); - map = map->l_next; - } - - dlclose(handle); + Dl_info dli; + void *handle; + Link_map *map; + Link_map *p; + + st->print_cr("Dynamic libraries:"); st->flush(); + + if (dladdr(CAST_FROM_FN_PTR(void *, os::print_dll_info), &dli) == 0 || + dli.dli_fname == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + handle = dlopen(dli.dli_fname, RTLD_LAZY); + if (handle == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + dlinfo(handle, RTLD_DI_LINKMAP, &map); + if (map == NULL) { + st->print_cr("Error: Cannot print dynamic libraries."); + return; + } + + while (map->l_prev != NULL) + map = map->l_prev; + + while (map != NULL) { + st->print_cr(PTR_FORMAT " \t%s", map->l_addr, map->l_name); + map = map->l_next; + } + + dlclose(handle); } // Loads .dll/.so and @@ -2475,7 +2430,12 @@ Dl_info dlinfo; int ret = dladdr(CAST_FROM_FN_PTR(void *, os::jvm_path), &dlinfo); assert(ret != 0, "cannot locate libjvm"); - realpath((char *)dlinfo.dli_fname, buf); + if (ret != 0 && dlinfo.dli_fname != NULL) { + realpath((char *)dlinfo.dli_fname, buf); + } else { + buf[0] = '\0'; + return; + } if (Arguments::created_by_gamma_launcher()) { // Support for the gamma launcher. Typical value for buf is @@ -2859,7 +2819,7 @@ size_t alignment_hint, bool exec) { int err = Solaris::commit_memory_impl(addr, bytes, exec); if (err == 0) { - if (UseMPSS && alignment_hint > (size_t)vm_page_size()) { + if (UseLargePages && (alignment_hint > (size_t)vm_page_size())) { // If the large page size has been set and the VM // is using large pages, use the large page size // if it is smaller than the alignment hint. This is @@ -2878,7 +2838,7 @@ page_size = alignment_hint; } // Since this is a hint, ignore any failures. - (void)Solaris::set_mpss_range(addr, bytes, page_size); + (void)Solaris::setup_large_pages(addr, bytes, page_size); } } return err; @@ -2921,8 +2881,8 @@ void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned."); assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned."); - if (UseLargePages && UseMPSS) { - Solaris::set_mpss_range(addr, bytes, alignment_hint); + if (UseLargePages) { + Solaris::setup_large_pages(addr, bytes, alignment_hint); } } @@ -3321,47 +3281,8 @@ } // Large page support - -// UseLargePages is the master flag to enable/disable large page memory. -// UseMPSS and UseISM are supported for compatibility reasons. Their combined -// effects can be described in the following table: -// -// UseLargePages UseMPSS UseISM -// false * * => UseLargePages is the master switch, turning -// it off will turn off both UseMPSS and -// UseISM. VM will not use large page memory -// regardless the settings of UseMPSS/UseISM. -// true false false => Unless future Solaris provides other -// mechanism to use large page memory, this -// combination is equivalent to -UseLargePages, -// VM will not use large page memory -// true true false => JVM will use MPSS for large page memory. -// This is the default behavior. -// true false true => JVM will use ISM for large page memory. -// true true true => JVM will use ISM if it is available. -// Otherwise, JVM will fall back to MPSS. -// Becaues ISM is now available on all -// supported Solaris versions, this combination -// is equivalent to +UseISM -UseMPSS. - static size_t _large_page_size = 0; -bool os::Solaris::ism_sanity_check(bool warn, size_t * page_size) { - // x86 uses either 2M or 4M page, depending on whether PAE (Physical Address - // Extensions) mode is enabled. AMD64/EM64T uses 2M page in 64bit mode. Sparc - // can support multiple page sizes. - - // Don't bother to probe page size because getpagesizes() comes with MPSS. - // ISM is only recommended on old Solaris where there is no MPSS support. - // Simply choose a conservative value as default. - *page_size = LargePageSizeInBytes ? LargePageSizeInBytes : - SPARC_ONLY(4 * M) IA32_ONLY(4 * M) AMD64_ONLY(2 * M) - ARM_ONLY(2 * M); - - // ISM is available on all supported Solaris versions - return true; -} - // Insertion sort for small arrays (descending order). static void insertion_sort_descending(size_t* array, int len) { for (int i = 0; i < len; i++) { @@ -3374,7 +3295,7 @@ } } -bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) { +bool os::Solaris::mpss_sanity_check(bool warn, size_t* page_size) { const unsigned int usable_count = VM_Version::page_size_count(); if (usable_count == 1) { return false; @@ -3440,41 +3361,24 @@ } void os::large_page_init() { - if (!UseLargePages) { - UseISM = false; - UseMPSS = false; - return; - } - - // print a warning if any large page related flag is specified on command line - bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) || - !FLAG_IS_DEFAULT(UseISM) || - !FLAG_IS_DEFAULT(UseMPSS) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes); - UseISM = UseISM && - Solaris::ism_sanity_check(warn_on_failure, &_large_page_size); - if (UseISM) { - // ISM disables MPSS to be compatible with old JDK behavior - UseMPSS = false; - _page_sizes[0] = _large_page_size; - _page_sizes[1] = vm_page_size(); - } - - UseMPSS = UseMPSS && - Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size); - - UseLargePages = UseISM || UseMPSS; -} - -bool os::Solaris::set_mpss_range(caddr_t start, size_t bytes, size_t align) { + if (UseLargePages) { + // print a warning if any large page related flag is specified on command line + bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) || + !FLAG_IS_DEFAULT(LargePageSizeInBytes); + + UseLargePages = Solaris::mpss_sanity_check(warn_on_failure, &_large_page_size); + } +} + +bool os::Solaris::setup_large_pages(caddr_t start, size_t bytes, size_t align) { // Signal to OS that we want large pages for addresses // from addr, addr + bytes struct memcntl_mha mpss_struct; mpss_struct.mha_cmd = MHA_MAPSIZE_VA; mpss_struct.mha_pagesize = align; mpss_struct.mha_flags = 0; - if (memcntl(start, bytes, MC_HAT_ADVISE, - (caddr_t) &mpss_struct, 0, 0) < 0) { + // Upon successful completion, memcntl() returns 0 + if (memcntl(start, bytes, MC_HAT_ADVISE, (caddr_t) &mpss_struct, 0, 0)) { debug_only(warning("Attempt to use MPSS failed.")); return false; } @@ -3482,72 +3386,13 @@ } char* os::reserve_memory_special(size_t size, char* addr, bool exec) { - // "exec" is passed in but not used. Creating the shared image for - // the code cache doesn't have an SHM_X executable permission to check. - assert(UseLargePages && UseISM, "only for ISM large pages"); - - char* retAddr = NULL; - int shmid; - key_t ismKey; - - bool warn_on_failure = UseISM && - (!FLAG_IS_DEFAULT(UseLargePages) || - !FLAG_IS_DEFAULT(UseISM) || - !FLAG_IS_DEFAULT(LargePageSizeInBytes) - ); - char msg[128]; - - ismKey = IPC_PRIVATE; - - // Create a large shared memory region to attach to based on size. - // Currently, size is the total size of the heap - shmid = shmget(ismKey, size, SHM_R | SHM_W | IPC_CREAT); - if (shmid == -1){ - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno); - warning(msg); - } - return NULL; - } - - // Attach to the region - retAddr = (char *) shmat(shmid, 0, SHM_SHARE_MMU | SHM_R | SHM_W); - int err = errno; - - // Remove shmid. If shmat() is successful, the actual shared memory segment - // will be deleted when it's detached by shmdt() or when the process - // terminates. If shmat() is not successful this will remove the shared - // segment immediately. - shmctl(shmid, IPC_RMID, NULL); - - if (retAddr == (char *) -1) { - if (warn_on_failure) { - jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err); - warning(msg); - } - return NULL; - } - if ((retAddr != NULL) && UseNUMAInterleaving) { - numa_make_global(retAddr, size); - } - - // The memory is committed - MemTracker::record_virtual_memory_reserve_and_commit((address)retAddr, size, mtNone, CURRENT_PC); - - return retAddr; + fatal("os::reserve_memory_special should not be called on Solaris."); + return NULL; } bool os::release_memory_special(char* base, size_t bytes) { - MemTracker::Tracker tkr = MemTracker::get_virtual_memory_release_tracker(); - // detaching the SHM segment will also delete it, see reserve_memory_special() - int rslt = shmdt(base); - if (rslt == 0) { - tkr.record((address)base, bytes); - return true; - } else { - tkr.discard(); - return false; - } + fatal("os::release_memory_special should not be called on Solaris."); + return false; } size_t os::large_page_size() { @@ -3557,11 +3402,11 @@ // MPSS allows application to commit large page memory on demand; with ISM // the entire memory region must be allocated as shared memory. bool os::can_commit_large_page_memory() { - return UseISM ? false : true; + return true; } bool os::can_execute_large_page_memory() { - return UseISM ? false : true; + return true; } static int os_sleep(jlong millis, bool interruptible) { @@ -3835,28 +3680,6 @@ static const int criticalPrio = 60; // FX/60 is critical thread class/priority on T4 static int java_MaxPriority_to_os_priority = 0; // Saved mapping -// Call the version of priocntl suitable for all supported versions -// of Solaris. We need to call through this wrapper so that we can -// build on Solaris 9 and run on Solaris 8, 9 and 10. -// -// This code should be removed if we ever stop supporting Solaris 8 -// and earlier releases. - -static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg); -typedef long (*priocntl_type)(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg); -static priocntl_type priocntl_ptr = priocntl_stub; - -// Stub to set the value of the real pointer, and then call the real -// function. - -static long priocntl_stub(int pcver, idtype_t idtype, id_t id, int cmd, caddr_t arg) { - // Try Solaris 8- name only. - priocntl_type tmp = (priocntl_type)dlsym(RTLD_DEFAULT, "__priocntl"); - guarantee(tmp != NULL, "priocntl function not found."); - priocntl_ptr = tmp; - return (*priocntl_ptr)(PC_VERSION, idtype, id, cmd, arg); -} - // lwp_priocntl_init // @@ -3864,9 +3687,7 @@ // // Return errno or 0 if OK. // -static -int lwp_priocntl_init () -{ +static int lwp_priocntl_init () { int rslt; pcinfo_t ClassInfo; pcparms_t ParmInfo; @@ -3906,7 +3727,7 @@ strcpy(ClassInfo.pc_clname, "TS"); ClassInfo.pc_cid = -1; - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); if (rslt < 0) return errno; assert(ClassInfo.pc_cid != -1, "cid for TS class is -1"); tsLimits.schedPolicy = ClassInfo.pc_cid; @@ -3915,7 +3736,7 @@ strcpy(ClassInfo.pc_clname, "IA"); ClassInfo.pc_cid = -1; - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); if (rslt < 0) return errno; assert(ClassInfo.pc_cid != -1, "cid for IA class is -1"); iaLimits.schedPolicy = ClassInfo.pc_cid; @@ -3924,7 +3745,7 @@ strcpy(ClassInfo.pc_clname, "RT"); ClassInfo.pc_cid = -1; - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); if (rslt < 0) return errno; assert(ClassInfo.pc_cid != -1, "cid for RT class is -1"); rtLimits.schedPolicy = ClassInfo.pc_cid; @@ -3933,7 +3754,7 @@ strcpy(ClassInfo.pc_clname, "FX"); ClassInfo.pc_cid = -1; - rslt = (*priocntl_ptr)(PC_VERSION, P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); + rslt = priocntl(P_ALL, 0, PC_GETCID, (caddr_t)&ClassInfo); if (rslt < 0) return errno; assert(ClassInfo.pc_cid != -1, "cid for FX class is -1"); fxLimits.schedPolicy = ClassInfo.pc_cid; @@ -3944,7 +3765,7 @@ // This will normally be IA, TS or, rarely, FX or RT. memset(&ParmInfo, 0, sizeof(ParmInfo)); ParmInfo.pc_cid = PC_CLNULL; - rslt = (*priocntl_ptr) (PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); + rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); if (rslt < 0) return errno; myClass = ParmInfo.pc_cid; @@ -3952,7 +3773,7 @@ // about the class. ClassInfo.pc_cid = myClass; ClassInfo.pc_clname[0] = 0; - rslt = (*priocntl_ptr) (PC_VERSION, (idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo); + rslt = priocntl((idtype)0, 0, PC_GETCLINFO, (caddr_t)&ClassInfo); if (rslt < 0) return errno; if (ThreadPriorityVerbose) { @@ -3961,7 +3782,7 @@ memset(&ParmInfo, 0, sizeof(pcparms_t)); ParmInfo.pc_cid = PC_CLNULL; - rslt = (*priocntl_ptr)(PC_VERSION, P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); + rslt = priocntl(P_PID, P_MYID, PC_GETPARMS, (caddr_t)&ParmInfo); if (rslt < 0) return errno; if (ParmInfo.pc_cid == rtLimits.schedPolicy) { @@ -4065,7 +3886,7 @@ memset(&ParmInfo, 0, sizeof(pcparms_t)); ParmInfo.pc_cid = PC_CLNULL; - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo); + rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ParmInfo); if (rslt < 0) return errno; int cur_class = ParmInfo.pc_cid; @@ -4133,7 +3954,7 @@ return EINVAL; // no clue, punt } - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo); + rslt = priocntl(P_LWPID, lwpid, PC_SETPARMS, (caddr_t)&ParmInfo); if (ThreadPriorityVerbose && rslt) { tty->print_cr ("PC_SETPARMS ->%d %d\n", rslt, errno); } @@ -4152,7 +3973,7 @@ memset(&ReadBack, 0, sizeof(pcparms_t)); ReadBack.pc_cid = PC_CLNULL; - rslt = (*priocntl_ptr)(PC_VERSION, P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack); + rslt = priocntl(P_LWPID, lwpid, PC_GETPARMS, (caddr_t)&ReadBack); assert(rslt >= 0, "priocntl failed"); Actual = Expected = 0xBAD; assert(ParmInfo.pc_cid == ReadBack.pc_cid, "cid's don't match"); @@ -5244,11 +5065,6 @@ return _getisax(array, n); } -// Symbol doesn't exist in Solaris 8 pset.h -#ifndef PS_MYID -#define PS_MYID -3 -#endif - // int pset_getloadavg(psetid_t pset, double loadavg[], int nelem); typedef long (*pset_getloadavg_type)(psetid_t pset, double loadavg[], int nelem); static pset_getloadavg_type pset_getloadavg_ptr = NULL; @@ -5418,20 +5234,6 @@ UseNUMA = false; } } - // ISM is not compatible with the NUMA allocator - it always allocates - // pages round-robin across the lgroups. - if (UseNUMA && UseLargePages && UseISM) { - if (!FLAG_IS_DEFAULT(UseNUMA)) { - if (FLAG_IS_DEFAULT(UseLargePages) && FLAG_IS_DEFAULT(UseISM)) { - UseLargePages = false; - } else { - warning("UseNUMA is not compatible with ISM large pages, disabling NUMA allocator"); - UseNUMA = false; - } - } else { - UseNUMA = false; - } - } if (!UseNUMA && ForceNUMA) { UseNUMA = true; } @@ -6077,24 +5879,20 @@ bool os::find(address addr, outputStream* st) { Dl_info dlinfo; memset(&dlinfo, 0, sizeof(dlinfo)); - if (dladdr(addr, &dlinfo)) { -#ifdef _LP64 - st->print("0x%016lx: ", addr); -#else - st->print("0x%08x: ", addr); -#endif - if (dlinfo.dli_sname != NULL) + if (dladdr(addr, &dlinfo) != 0) { + st->print(PTR_FORMAT ": ", addr); + if (dlinfo.dli_sname != NULL && dlinfo.dli_saddr != NULL) { st->print("%s+%#lx", dlinfo.dli_sname, addr-(intptr_t)dlinfo.dli_saddr); - else if (dlinfo.dli_fname) + } else if (dlinfo.dli_fbase != NULL) st->print("", addr-(intptr_t)dlinfo.dli_fbase); else st->print(""); - if (dlinfo.dli_fname) st->print(" in %s", dlinfo.dli_fname); -#ifdef _LP64 - if (dlinfo.dli_fbase) st->print(" at 0x%016lx", dlinfo.dli_fbase); -#else - if (dlinfo.dli_fbase) st->print(" at 0x%08x", dlinfo.dli_fbase); -#endif + if (dlinfo.dli_fname != NULL) { + st->print(" in %s", dlinfo.dli_fname); + } + if (dlinfo.dli_fbase != NULL) { + st->print(" at " PTR_FORMAT, dlinfo.dli_fbase); + } st->cr(); if (Verbose) { @@ -6105,7 +5903,7 @@ if (!lowest) lowest = (address) dlinfo.dli_fbase; if (begin < lowest) begin = lowest; Dl_info dlinfo2; - if (dladdr(end, &dlinfo2) && dlinfo2.dli_saddr != dlinfo.dli_saddr + if (dladdr(end, &dlinfo2) != 0 && dlinfo2.dli_saddr != dlinfo.dli_saddr && end > dlinfo2.dli_saddr && dlinfo2.dli_saddr > begin) end = (address) dlinfo2.dli_saddr; Disassembler::decode(begin, end, st); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/solaris/vm/os_solaris.hpp --- a/hotspot/src/os/solaris/vm/os_solaris.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/solaris/vm/os_solaris.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -106,8 +106,8 @@ static meminfo_func_t _meminfo; - // Large Page Support--mpss. - static bool set_mpss_range(caddr_t start, size_t bytes, size_t align); + // Large Page Support + static bool setup_large_pages(caddr_t start, size_t bytes, size_t align); static void init_thread_fpu_state(void); @@ -174,7 +174,6 @@ static char* mmap_chunk(char *addr, size_t size, int flags, int prot); static char* anon_mmap(char* requested_addr, size_t bytes, size_t alignment_hint, bool fixed); static bool mpss_sanity_check(bool warn, size_t * page_size); - static bool ism_sanity_check (bool warn, size_t * page_size); // Workaround for 4352906. thr_stksegment sometimes returns // a bad value for the primordial thread's stack base when diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/solaris/vm/os_solaris.inline.hpp --- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -89,7 +89,7 @@ inline struct dirent* os::readdir(DIR* dirp, dirent* dbuf) { assert(dirp != NULL, "just checking"); -#if defined(_LP64) || defined(_GNU_SOURCE) +#if defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 dirent* p; int status; @@ -98,9 +98,9 @@ return NULL; } else return p; -#else // defined(_LP64) || defined(_GNU_SOURCE) +#else // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 return ::readdir_r(dirp, dbuf); -#endif // defined(_LP64) || defined(_GNU_SOURCE) +#endif // defined(_LP64) || defined(_GNU_SOURCE) || _FILE_OFFSET_BITS==64 } inline int os::closedir(DIR *dirp) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1420,34 +1420,40 @@ bool os::dll_address_to_library_name(address addr, char* buf, int buflen, int* offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + // NOTE: the reason we don't use SymGetModuleInfo() is it doesn't always // return the full path to the DLL file, sometimes it returns path // to the corresponding PDB file (debug info); sometimes it only // returns partial path, which makes life painful. - struct _modinfo mi; - mi.addr = addr; - mi.full_path = buf; - mi.buflen = buflen; - int pid = os::current_process_id(); - if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { - // buf already contains path name - if (offset) *offset = addr - mi.base_addr; - return true; - } else { - if (buf) buf[0] = '\0'; - if (offset) *offset = -1; - return false; - } + struct _modinfo mi; + mi.addr = addr; + mi.full_path = buf; + mi.buflen = buflen; + int pid = os::current_process_id(); + if (enumerate_modules(pid, _locate_module_by_addr, (void *)&mi)) { + // buf already contains path name + if (offset) *offset = addr - mi.base_addr; + return true; + } + + buf[0] = '\0'; + if (offset) *offset = -1; + return false; } bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int *offset) { + // buf is not optional, but offset is optional + assert(buf != NULL, "sanity check"); + if (Decoder::decode(addr, buf, buflen, offset)) { return true; } if (offset != NULL) *offset = -1; - if (buf != NULL) buf[0] = '\0'; + buf[0] = '\0'; return false; } @@ -2689,6 +2695,19 @@ } #endif +#ifndef PRODUCT +void os::win32::call_test_func_with_wrapper(void (*funcPtr)(void)) { + // Install a win32 structured exception handler around the test + // function call so the VM can generate an error dump if needed. + __try { + (*funcPtr)(); + } __except(topLevelExceptionFilter( + (_EXCEPTION_POINTERS*)_exception_info())) { + // Nothing to do. + } +} +#endif + // Virtual Memory int os::vm_page_size() { return os::win32::vm_page_size(); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/windows/vm/os_windows.hpp --- a/hotspot/src/os/windows/vm/os_windows.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,6 +94,10 @@ static address fast_jni_accessor_wrapper(BasicType); #endif +#ifndef PRODUCT + static void call_test_func_with_wrapper(void (*funcPtr)(void)); +#endif + // filter function to ignore faults on serializations page static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e); }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os/windows/vm/os_windows.inline.hpp --- a/hotspot/src/os/windows/vm/os_windows.inline.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os/windows/vm/os_windows.inline.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -106,4 +106,10 @@ inline int os::close(int fd) { return ::close(fd); } + +#ifndef PRODUCT + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) \ + os::win32::call_test_func_with_wrapper(f) +#endif + #endif // OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp --- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -289,6 +289,16 @@ } #endif // AMD64 +#ifndef AMD64 + // Halt if SI_KERNEL before more crashes get misdiagnosed as Java bugs + // This can happen in any running code (currently more frequently in + // interpreter code but has been seen in compiled code) + if (sig == SIGSEGV && info->si_addr == 0 && info->si_code == SI_KERNEL) { + fatal("An irrecoverable SI_KERNEL SIGSEGV has occurred due " + "to unstable signal handling in this distribution."); + } +#endif // AMD64 + // Handle ALL stack overflow variations here if (sig == SIGSEGV) { address addr = (address) info->si_addr; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/adlc/forms.hpp --- a/hotspot/src/share/vm/adlc/forms.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/adlc/forms.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -146,7 +146,7 @@ // Public Methods Form(int formType=0, int line=0) : _next(NULL), _linenum(line), _ftype(formType) { }; - ~Form() {}; + virtual ~Form() {}; virtual bool ideal_only() const { assert(0,"Check of ideal status on non-instruction/operand form.\n"); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_GraphBuilder.cpp --- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -3461,6 +3461,14 @@ preserves_state = true; break; + case vmIntrinsics::_updateCRC32: + case vmIntrinsics::_updateBytesCRC32: + case vmIntrinsics::_updateByteBufferCRC32: + if (!UseCRC32Intrinsics) return false; + cantrap = false; + preserves_state = true; + break; + case vmIntrinsics::_loadFence : case vmIntrinsics::_storeFence: case vmIntrinsics::_fullFence : diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_LIR.cpp --- a/hotspot/src/share/vm/c1/c1_LIR.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -430,6 +430,11 @@ _stub = new ArrayCopyStub(this); } +LIR_OpUpdateCRC32::LIR_OpUpdateCRC32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) + : LIR_Op(lir_updatecrc32, res, NULL) + , _crc(crc) + , _val(val) { +} //-------------------verify-------------------------- @@ -876,6 +881,20 @@ } +// LIR_OpUpdateCRC32 + case lir_updatecrc32: { + assert(op->as_OpUpdateCRC32() != NULL, "must be"); + LIR_OpUpdateCRC32* opUp = (LIR_OpUpdateCRC32*)op; + + assert(opUp->_crc->is_valid(), "used"); do_input(opUp->_crc); do_temp(opUp->_crc); + assert(opUp->_val->is_valid(), "used"); do_input(opUp->_val); do_temp(opUp->_val); + assert(opUp->_result->is_valid(), "used"); do_output(opUp->_result); + assert(opUp->_info == NULL, "no info for LIR_OpUpdateCRC32"); + + break; + } + + // LIR_OpLock case lir_lock: case lir_unlock: { @@ -1056,6 +1075,10 @@ masm->emit_code_stub(stub()); } +void LIR_OpUpdateCRC32::emit_code(LIR_Assembler* masm) { + masm->emit_updatecrc32(this); +} + void LIR_Op0::emit_code(LIR_Assembler* masm) { masm->emit_op0(this); } @@ -1763,6 +1786,8 @@ case lir_dynamic_call: s = "dynamic"; break; // LIR_OpArrayCopy case lir_arraycopy: s = "arraycopy"; break; + // LIR_OpUpdateCRC32 + case lir_updatecrc32: s = "updatecrc32"; break; // LIR_OpLock case lir_lock: s = "lock"; break; case lir_unlock: s = "unlock"; break; @@ -1815,6 +1840,13 @@ tmp()->print(out); out->print(" "); } +// LIR_OpUpdateCRC32 +void LIR_OpUpdateCRC32::print_instr(outputStream* out) const { + crc()->print(out); out->print(" "); + val()->print(out); out->print(" "); + result_opr()->print(out); out->print(" "); +} + // LIR_OpCompareAndSwap void LIR_OpCompareAndSwap::print_instr(outputStream* out) const { addr()->print(out); out->print(" "); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_LIR.hpp --- a/hotspot/src/share/vm/c1/c1_LIR.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIR.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -877,6 +877,7 @@ class LIR_OpJavaCall; class LIR_OpRTCall; class LIR_OpArrayCopy; +class LIR_OpUpdateCRC32; class LIR_OpLock; class LIR_OpTypeCheck; class LIR_OpCompareAndSwap; @@ -982,6 +983,9 @@ , begin_opArrayCopy , lir_arraycopy , end_opArrayCopy + , begin_opUpdateCRC32 + , lir_updatecrc32 + , end_opUpdateCRC32 , begin_opLock , lir_lock , lir_unlock @@ -1137,6 +1141,7 @@ virtual LIR_Op2* as_Op2() { return NULL; } virtual LIR_Op3* as_Op3() { return NULL; } virtual LIR_OpArrayCopy* as_OpArrayCopy() { return NULL; } + virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return NULL; } virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; } virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; } virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; } @@ -1293,6 +1298,25 @@ void print_instr(outputStream* out) const PRODUCT_RETURN; }; +// LIR_OpUpdateCRC32 +class LIR_OpUpdateCRC32: public LIR_Op { + friend class LIR_OpVisitState; + +private: + LIR_Opr _crc; + LIR_Opr _val; + +public: + + LIR_OpUpdateCRC32(LIR_Opr crc, LIR_Opr val, LIR_Opr res); + + LIR_Opr crc() const { return _crc; } + LIR_Opr val() const { return _val; } + + virtual void emit_code(LIR_Assembler* masm); + virtual LIR_OpUpdateCRC32* as_OpUpdateCRC32() { return this; } + void print_instr(outputStream* out) const PRODUCT_RETURN; +}; // -------------------------------------------------- // LIR_Op0 @@ -2212,6 +2236,8 @@ void arraycopy(LIR_Opr src, LIR_Opr src_pos, LIR_Opr dst, LIR_Opr dst_pos, LIR_Opr length, LIR_Opr tmp, ciArrayKlass* expected_type, int flags, CodeEmitInfo* info) { append(new LIR_OpArrayCopy(src, src_pos, dst, dst_pos, length, tmp, expected_type, flags, info)); } + void update_crc32(LIR_Opr crc, LIR_Opr val, LIR_Opr res) { append(new LIR_OpUpdateCRC32(crc, val, res)); } + void fpop_raw() { append(new LIR_Op0(lir_fpop_raw)); } void instanceof(LIR_Opr result, LIR_Opr object, ciKlass* klass, LIR_Opr tmp1, LIR_Opr tmp2, LIR_Opr tmp3, bool fast_check, CodeEmitInfo* info_for_patch, ciMethod* profiled_method, int profiled_bci); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_LIRAssembler.hpp --- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,6 +195,7 @@ void emit_opBranch(LIR_OpBranch* op); void emit_opLabel(LIR_OpLabel* op); void emit_arraycopy(LIR_OpArrayCopy* op); + void emit_updatecrc32(LIR_OpUpdateCRC32* op); void emit_opConvert(LIR_OpConvert* op); void emit_alloc_obj(LIR_OpAllocObj* op); void emit_alloc_array(LIR_OpAllocArray* op); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_LIRGenerator.cpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -2994,6 +2994,12 @@ do_Reference_get(x); break; + case vmIntrinsics::_updateCRC32: + case vmIntrinsics::_updateBytesCRC32: + case vmIntrinsics::_updateByteBufferCRC32: + do_update_CRC32(x); + break; + default: ShouldNotReachHere(); break; } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_LIRGenerator.hpp --- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -247,6 +247,7 @@ void do_NIOCheckIndex(Intrinsic* x); void do_FPIntrinsics(Intrinsic* x); void do_Reference_get(Intrinsic* x); + void do_update_CRC32(Intrinsic* x); void do_UnsafePrefetch(UnsafePrefetch* x, bool is_store); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/c1/c1_Runtime1.cpp --- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -299,6 +299,7 @@ #ifdef TRACE_HAVE_INTRINSICS FUNCTION_CASE(entry, TRACE_TIME_METHOD); #endif + FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32()); #undef FUNCTION_CASE diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/ci/ciObjectFactory.cpp --- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -265,8 +265,6 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) { ASSERT_IN_VM; - assert(key == NULL || key->is_metadata(), "must be"); - #ifdef ASSERT if (CIObjectFactoryVerify) { Metadata* last = NULL; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/classfile/defaultMethods.cpp --- a/hotspot/src/share/vm/classfile/defaultMethods.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -318,17 +318,17 @@ } }; + // A method family contains a set of all methods that implement a single -// language-level method. Because of erasure, these methods may have different -// signatures. As members of the set are collected while walking over the +// erased method. As members of the set are collected while walking over the // hierarchy, they are tagged with a qualification state. The qualification // state for an erased method is set to disqualified if there exists a path // from the root of hierarchy to the method that contains an interleaving -// language-equivalent method defined in an interface. +// erased method defined in an interface. + class MethodFamily : public ResourceObj { private: - generic::MethodDescriptor* _descriptor; // language-level description GrowableArray > _members; ResourceHashtable _member_index; @@ -358,15 +358,8 @@ public: - MethodFamily(generic::MethodDescriptor* canonical_desc) - : _descriptor(canonical_desc), _selected_target(NULL), - _exception_message(NULL) {} - - generic::MethodDescriptor* descriptor() const { return _descriptor; } - - bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { - return descriptor()->covariant_match(md, ctx); - } + MethodFamily() + : _selected_target(NULL), _exception_message(NULL) {} void set_target_if_empty(Method* m) { if (_selected_target == NULL && !m->is_overpass()) { @@ -441,16 +434,10 @@ } #ifndef PRODUCT - void print_on(outputStream* str) const { - print_on(str, 0); - } - - void print_on(outputStream* str, int indent) const { + void print_sig_on(outputStream* str, Symbol* signature, int indent) const { streamIndentor si(str, indent * 2); - generic::Context ctx(NULL); // empty, as _descriptor already canonicalized - TempNewSymbol family = descriptor()->reify_signature(&ctx, Thread::current()); - str->indent().print_cr("Logical Method %s:", family->as_C_string()); + str->indent().print_cr("Logical Method %s:", signature->as_C_string()); streamIndentor si2(str); for (int i = 0; i < _members.length(); ++i) { @@ -516,36 +503,92 @@ return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); } +// A generic method family contains a set of all methods that implement a single +// language-level method. Because of erasure, these methods may have different +// signatures. As members of the set are collected while walking over the +// hierarchy, they are tagged with a qualification state. The qualification +// state for an erased method is set to disqualified if there exists a path +// from the root of hierarchy to the method that contains an interleaving +// language-equivalent method defined in an interface. +class GenericMethodFamily : public MethodFamily { + private: + + generic::MethodDescriptor* _descriptor; // language-level description + + public: + + GenericMethodFamily(generic::MethodDescriptor* canonical_desc) + : _descriptor(canonical_desc) {} + + generic::MethodDescriptor* descriptor() const { return _descriptor; } + + bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { + return descriptor()->covariant_match(md, ctx); + } + +#ifndef PRODUCT + Symbol* get_generic_sig() const { + + generic::Context ctx(NULL); // empty, as _descriptor already canonicalized + TempNewSymbol sig = descriptor()->reify_signature(&ctx, Thread::current()); + return sig; + } +#endif // ndef PRODUCT +}; + class StateRestorer; -// StatefulMethodFamily is a wrapper around MethodFamily that maintains the +// StatefulMethodFamily is a wrapper around a MethodFamily that maintains the // qualification state during hierarchy visitation, and applies that state -// when adding members to the MethodFamily. +// when adding members to the MethodFamily class StatefulMethodFamily : public ResourceObj { friend class StateRestorer; private: - MethodFamily* _method; QualifiedState _qualification_state; void set_qualification_state(QualifiedState state) { _qualification_state = state; } + protected: + MethodFamily* _method_family; + public: - StatefulMethodFamily(generic::MethodDescriptor* md, generic::Context* ctx) { - _method = new MethodFamily(md->canonicalize(ctx)); - _qualification_state = QUALIFIED; + StatefulMethodFamily() { + _method_family = new MethodFamily(); + _qualification_state = QUALIFIED; + } + + StatefulMethodFamily(MethodFamily* mf) { + _method_family = mf; + _qualification_state = QUALIFIED; } - void set_target_if_empty(Method* m) { _method->set_target_if_empty(m); } + void set_target_if_empty(Method* m) { _method_family->set_target_if_empty(m); } + + MethodFamily* get_method_family() { return _method_family; } + + StateRestorer* record_method_and_dq_further(Method* mo); +}; + - MethodFamily* get_method_family() { return _method; } +// StatefulGenericMethodFamily is a wrapper around GenericMethodFamily that maintains the +// qualification state during hierarchy visitation, and applies that state +// when adding members to the GenericMethodFamily. +class StatefulGenericMethodFamily : public StatefulMethodFamily { + + public: + StatefulGenericMethodFamily(generic::MethodDescriptor* md, generic::Context* ctx) + : StatefulMethodFamily(new GenericMethodFamily(md->canonicalize(ctx))) { + + } + GenericMethodFamily* get_method_family() { + return (GenericMethodFamily*)_method_family; + } bool descriptor_matches(generic::MethodDescriptor* md, generic::Context* ctx) { - return _method->descriptor_matches(md, ctx); + return get_method_family()->descriptor_matches(md, ctx); } - - StateRestorer* record_method_and_dq_further(Method* mo); }; class StateRestorer : public PseudoScopeMark { @@ -563,9 +606,9 @@ StateRestorer* StatefulMethodFamily::record_method_and_dq_further(Method* mo) { StateRestorer* mark = new StateRestorer(this, _qualification_state); if (_qualification_state == QUALIFIED) { - _method->record_qualified_method(mo); + _method_family->record_qualified_method(mo); } else { - _method->record_disqualified_method(mo); + _method_family->record_disqualified_method(mo); } // Everything found "above"??? this method in the hierarchy walk is set to // disqualified @@ -573,15 +616,15 @@ return mark; } -class StatefulMethodFamilies : public ResourceObj { +class StatefulGenericMethodFamilies : public ResourceObj { private: - GrowableArray _methods; + GrowableArray _methods; public: - StatefulMethodFamily* find_matching( + StatefulGenericMethodFamily* find_matching( generic::MethodDescriptor* md, generic::Context* ctx) { for (int i = 0; i < _methods.length(); ++i) { - StatefulMethodFamily* existing = _methods.at(i); + StatefulGenericMethodFamily* existing = _methods.at(i); if (existing->descriptor_matches(md, ctx)) { return existing; } @@ -589,17 +632,17 @@ return NULL; } - StatefulMethodFamily* find_matching_or_create( + StatefulGenericMethodFamily* find_matching_or_create( generic::MethodDescriptor* md, generic::Context* ctx) { - StatefulMethodFamily* method = find_matching(md, ctx); + StatefulGenericMethodFamily* method = find_matching(md, ctx); if (method == NULL) { - method = new StatefulMethodFamily(md, ctx); + method = new StatefulGenericMethodFamily(md, ctx); _methods.append(method); } return method; } - void extract_families_into(GrowableArray* array) { + void extract_families_into(GrowableArray* array) { for (int i = 0; i < _methods.length(); ++i) { array->append(_methods.at(i)->get_method_family()); } @@ -683,26 +726,79 @@ return slots; } +// Iterates over the superinterface type hierarchy looking for all methods +// with a specific erased signature. +class FindMethodsByErasedSig : public HierarchyVisitor { + private: + // Context data + Symbol* _method_name; + Symbol* _method_signature; + StatefulMethodFamily* _family; + + public: + FindMethodsByErasedSig(Symbol* name, Symbol* signature) : + _method_name(name), _method_signature(signature), + _family(NULL) {} + + void get_discovered_family(MethodFamily** family) { + if (_family != NULL) { + *family = _family->get_method_family(); + } else { + *family = NULL; + } + } + + void* new_node_data(InstanceKlass* cls) { return new PseudoScope(); } + void free_node_data(void* node_data) { + PseudoScope::cast(node_data)->destroy(); + } + + // Find all methods on this hierarchy that match this + // method's erased (name, signature) + bool visit() { + PseudoScope* scope = PseudoScope::cast(current_data()); + InstanceKlass* iklass = current_class(); + + Method* m = iklass->find_method(_method_name, _method_signature); + if (m != NULL) { + if (_family == NULL) { + _family = new StatefulMethodFamily(); + } + + if (iklass->is_interface()) { + StateRestorer* restorer = _family->record_method_and_dq_further(m); + scope->add_mark(restorer); + } else { + // This is the rule that methods in classes "win" (bad word) over + // methods in interfaces. This works because of single inheritance + _family->set_target_if_empty(m); + } + } + return true; + } + +}; + // Iterates over the type hierarchy looking for all methods with a specific // method name. The result of this is a set of method families each of // which is populated with a set of methods that implement the same // language-level signature. -class FindMethodsByName : public HierarchyVisitor { +class FindMethodsByGenericSig : public HierarchyVisitor { private: // Context data Thread* THREAD; generic::DescriptorCache* _cache; Symbol* _method_name; generic::Context* _ctx; - StatefulMethodFamilies _families; + StatefulGenericMethodFamilies _families; public: - FindMethodsByName(generic::DescriptorCache* cache, Symbol* name, + FindMethodsByGenericSig(generic::DescriptorCache* cache, Symbol* name, generic::Context* ctx, Thread* thread) : _cache(cache), _method_name(name), _ctx(ctx), THREAD(thread) {} - void get_discovered_families(GrowableArray* methods) { + void get_discovered_families(GrowableArray* methods) { _families.extract_families_into(methods); } @@ -733,7 +829,7 @@ // Find all methods on this hierarchy that match this method // (name, signature). This class collects other families of this // method name. - StatefulMethodFamily* family = + StatefulGenericMethodFamily* family = _families.find_matching_or_create(md, _ctx); if (klass->is_interface()) { @@ -752,8 +848,8 @@ }; #ifndef PRODUCT -static void print_families( - GrowableArray* methods, Symbol* match) { +static void print_generic_families( + GrowableArray* methods, Symbol* match) { streamIndentor si(tty, 4); if (methods->length() == 0) { tty->indent(); @@ -761,21 +857,86 @@ } for (int i = 0; i < methods->length(); ++i) { tty->indent(); - MethodFamily* lm = methods->at(i); + GenericMethodFamily* lm = methods->at(i); if (lm->contains_signature(match)) { tty->print_cr(""); } else { tty->print_cr(""); } - lm->print_on(tty, 1); + lm->print_sig_on(tty, lm->get_generic_sig(), 1); } } #endif // ndef PRODUCT +static void create_overpasses( + GrowableArray* slots, InstanceKlass* klass, TRAPS); + +static void generate_generic_defaults( + InstanceKlass* klass, GrowableArray* empty_slots, + EmptyVtableSlot* slot, int current_slot_index, TRAPS) { + + if (slot->is_bound()) { +#ifndef PRODUCT + if (TraceDefaultMethods) { + streamIndentor si(tty, 4); + tty->indent().print_cr("Already bound to logical method:"); + GenericMethodFamily* lm = (GenericMethodFamily*)(slot->get_binding()); + lm->print_sig_on(tty, lm->get_generic_sig(), 1); + } +#endif // ndef PRODUCT + return; // covered by previous processing + } + + generic::DescriptorCache cache; + + generic::Context ctx(&cache); + FindMethodsByGenericSig visitor(&cache, slot->name(), &ctx, CHECK); + visitor.run(klass); + + GrowableArray discovered_families; + visitor.get_discovered_families(&discovered_families); + +#ifndef PRODUCT + if (TraceDefaultMethods) { + print_generic_families(&discovered_families, slot->signature()); + } +#endif // ndef PRODUCT + + // Find and populate any other slots that match the discovered families + for (int j = current_slot_index; j < empty_slots->length(); ++j) { + EmptyVtableSlot* open_slot = empty_slots->at(j); + + if (slot->name() == open_slot->name()) { + for (int k = 0; k < discovered_families.length(); ++k) { + GenericMethodFamily* lm = discovered_families.at(k); + + if (lm->contains_signature(open_slot->signature())) { + lm->determine_target(klass, CHECK); + open_slot->bind_family(lm); + } + } + } + } +} + +static void generate_erased_defaults( + InstanceKlass* klass, GrowableArray* empty_slots, + EmptyVtableSlot* slot, TRAPS) { + + // sets up a set of methods with the same exact erased signature + FindMethodsByErasedSig visitor(slot->name(), slot->signature()); + visitor.run(klass); + + MethodFamily* family; + visitor.get_discovered_family(&family); + if (family != NULL) { + family->determine_target(klass, CHECK); + slot->bind_family(family); + } +} + static void merge_in_new_methods(InstanceKlass* klass, GrowableArray* new_methods, TRAPS); -static void create_overpasses( - GrowableArray* slots, InstanceKlass* klass, TRAPS); // This is the guts of the default methods implementation. This is called just // after the classfile has been parsed if some ancestor has default methods. @@ -807,8 +968,6 @@ // whatever scope it's in. ResourceMark rm(THREAD); - generic::DescriptorCache cache; - // Keep entire hierarchy alive for the duration of the computation KeepAliveRegistrar keepAlive(THREAD); KeepAliveVisitor loadKeepAlive(&keepAlive); @@ -837,47 +996,13 @@ tty->print_cr(""); } #endif // ndef PRODUCT - if (slot->is_bound()) { -#ifndef PRODUCT - if (TraceDefaultMethods) { - streamIndentor si(tty, 4); - tty->indent().print_cr("Already bound to logical method:"); - slot->get_binding()->print_on(tty, 1); - } -#endif // ndef PRODUCT - continue; // covered by previous processing + + if (ParseGenericDefaults) { + generate_generic_defaults(klass, empty_slots, slot, i, CHECK); + } else { + generate_erased_defaults(klass, empty_slots, slot, CHECK); } - - generic::Context ctx(&cache); - FindMethodsByName visitor(&cache, slot->name(), &ctx, CHECK); - visitor.run(klass); - - GrowableArray discovered_families; - visitor.get_discovered_families(&discovered_families); - -#ifndef PRODUCT - if (TraceDefaultMethods) { - print_families(&discovered_families, slot->signature()); - } -#endif // ndef PRODUCT - - // Find and populate any other slots that match the discovered families - for (int j = i; j < empty_slots->length(); ++j) { - EmptyVtableSlot* open_slot = empty_slots->at(j); - - if (slot->name() == open_slot->name()) { - for (int k = 0; k < discovered_families.length(); ++k) { - MethodFamily* lm = discovered_families.at(k); - - if (lm->contains_signature(open_slot->signature())) { - lm->determine_target(klass, CHECK); - open_slot->bind_family(lm); - } - } - } - } - } - + } #ifndef PRODUCT if (TraceDefaultMethods) { tty->print_cr("Creating overpasses..."); @@ -893,7 +1018,6 @@ #endif // ndef PRODUCT } - /** * Generic analysis was used upon interface '_target' and found a unique * default method candidate with generic signature '_method_desc'. This @@ -912,16 +1036,84 @@ * the selected method along that path. */ class ShadowChecker : public HierarchyVisitor { - private: - generic::DescriptorCache* _cache; + protected: Thread* THREAD; InstanceKlass* _target; Symbol* _method_name; InstanceKlass* _method_holder; + bool _found_shadow; + + + public: + + ShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder, + InstanceKlass* target) + : THREAD(thread), _method_name(name), _method_holder(holder), + _target(target), _found_shadow(false) {} + + void* new_node_data(InstanceKlass* cls) { return NULL; } + void free_node_data(void* data) { return; } + + bool visit() { + InstanceKlass* ik = current_class(); + if (ik == _target && current_depth() == 1) { + return false; // This was the specified super -- no need to search it + } + if (ik == _method_holder || ik == _target) { + // We found a path that should be examined to see if it shadows _method + if (path_has_shadow()) { + _found_shadow = true; + cancel_iteration(); + } + return false; // no need to continue up hierarchy + } + return true; + } + + virtual bool path_has_shadow() = 0; + bool found_shadow() { return _found_shadow; } +}; + +// Used for Invokespecial. +// Invokespecial is allowed to invoke a concrete interface method +// and can be used to disambuiguate among qualified candidates, +// which are methods in immediate superinterfaces, +// but may not be used to invoke a candidate that would be shadowed +// from the perspective of the caller. +// Invokespecial is also used in the overpass generation today +// We re-run the shadowchecker because we can't distinguish this case, +// but it should return the same answer, since the overpass target +// is now the invokespecial caller. +class ErasedShadowChecker : public ShadowChecker { + private: + bool path_has_shadow() { + + for (int i = current_depth() - 1; i > 0; --i) { + InstanceKlass* ik = class_at_depth(i); + + if (ik->is_interface()) { + int end; + int start = ik->find_method_by_name(_method_name, &end); + if (start != -1) { + return true; + } + } + } + return false; + } + public: + + ErasedShadowChecker(Thread* thread, Symbol* name, InstanceKlass* holder, + InstanceKlass* target) + : ShadowChecker(thread, name, holder, target) {} +}; + +class GenericShadowChecker : public ShadowChecker { + private: + generic::DescriptorCache* _cache; generic::MethodDescriptor* _method_desc; - bool _found_shadow; bool path_has_shadow() { generic::Context ctx(_cache); @@ -950,104 +1142,42 @@ public: - ShadowChecker(generic::DescriptorCache* cache, Thread* thread, + GenericShadowChecker(generic::DescriptorCache* cache, Thread* thread, Symbol* name, InstanceKlass* holder, generic::MethodDescriptor* desc, InstanceKlass* target) - : _cache(cache), THREAD(thread), _method_name(name), _method_holder(holder), - _method_desc(desc), _target(target), _found_shadow(false) {} - - void* new_node_data(InstanceKlass* cls) { return NULL; } - void free_node_data(void* data) { return; } - - bool visit() { - InstanceKlass* ik = current_class(); - if (ik == _target && current_depth() == 1) { - return false; // This was the specified super -- no need to search it - } - if (ik == _method_holder || ik == _target) { - // We found a path that should be examined to see if it shadows _method - if (path_has_shadow()) { - _found_shadow = true; - cancel_iteration(); - } - return false; // no need to continue up hierarchy - } - return true; - } - - bool found_shadow() { return _found_shadow; } + : ShadowChecker(thread, name, holder, target) { + _cache = cache; + _method_desc = desc; + } }; -// This is called during linktime when we find an invokespecial call that -// refers to a direct superinterface. It indicates that we should find the -// default method in the hierarchy of that superinterface, and if that method -// would have been a candidate from the point of view of 'this' class, then we -// return that method. -Method* DefaultMethods::find_super_default( - Klass* cls, Klass* super, Symbol* method_name, Symbol* sig, TRAPS) { + - ResourceMark rm(THREAD); - - assert(cls != NULL && super != NULL, "Need real classes"); - - InstanceKlass* current_class = InstanceKlass::cast(cls); - InstanceKlass* direction = InstanceKlass::cast(super); +// Find the unique qualified candidate from the perspective of the super_class +// which is the resolved_klass, which must be an immediate superinterface +// of klass +Method* find_erased_super_default(InstanceKlass* current_class, InstanceKlass* super_class, Symbol* method_name, Symbol* sig, TRAPS) { - // Keep entire hierarchy alive for the duration of the computation - KeepAliveRegistrar keepAlive(THREAD); - KeepAliveVisitor loadKeepAlive(&keepAlive); - loadKeepAlive.run(current_class); + FindMethodsByErasedSig visitor(method_name, sig); + visitor.run(super_class); // find candidates from resolved_klass -#ifndef PRODUCT - if (TraceDefaultMethods) { - tty->print_cr("Finding super default method %s.%s%s from %s", - direction->name()->as_C_string(), - method_name->as_C_string(), sig->as_C_string(), - current_class->name()->as_C_string()); - } -#endif // ndef PRODUCT + MethodFamily* family; + visitor.get_discovered_family(&family); - if (!direction->is_interface()) { - // We should not be here - return NULL; + if (family != NULL) { + family->determine_target(current_class, CHECK_NULL); // get target from current_class } - generic::DescriptorCache cache; - generic::Context ctx(&cache); - - // Prime the initial generic context for current -> direction - ctx.apply_type_arguments(current_class, direction, CHECK_NULL); - - FindMethodsByName visitor(&cache, method_name, &ctx, CHECK_NULL); - visitor.run(direction); - - GrowableArray families; - visitor.get_discovered_families(&families); - -#ifndef PRODUCT - if (TraceDefaultMethods) { - print_families(&families, sig); - } -#endif // ndef PRODUCT - - MethodFamily* selected_family = NULL; - - for (int i = 0; i < families.length(); ++i) { - MethodFamily* lm = families.at(i); - if (lm->contains_signature(sig)) { - lm->determine_target(current_class, CHECK_NULL); - selected_family = lm; - } - } - - if (selected_family->has_target()) { - Method* target = selected_family->get_selected_target(); + if (family->has_target()) { + Method* target = family->get_selected_target(); InstanceKlass* holder = InstanceKlass::cast(target->method_holder()); // Verify that the identified method is valid from the context of - // the current class - ShadowChecker checker(&cache, THREAD, target->name(), - holder, selected_family->descriptor(), direction); + // the current class, which is the caller class for invokespecial + // link resolution, i.e. ensure there it is not shadowed. + // You can use invokespecial to disambiguate interface methods, but + // you can not use it to skip over an interface method that would shadow it. + ErasedShadowChecker checker(THREAD, target->name(), holder, super_class); checker.run(current_class); if (checker.found_shadow()) { @@ -1061,20 +1191,143 @@ } else { #ifndef PRODUCT if (TraceDefaultMethods) { - tty->print(" Returning "); - print_method(tty, target, true); - tty->print_cr(""); + family->print_sig_on(tty, target->signature(), 1); } #endif // ndef PRODUCT return target; } } else { + assert(family->throws_exception(), "must have target or throw"); + THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), + family->get_exception_message()->as_C_string(), NULL); + } +} + +// super_class is assumed to be the direct super of current_class +Method* find_generic_super_default( InstanceKlass* current_class, + InstanceKlass* super_class, + Symbol* method_name, Symbol* sig, TRAPS) { + generic::DescriptorCache cache; + generic::Context ctx(&cache); + + // Prime the initial generic context for current -> super_class + ctx.apply_type_arguments(current_class, super_class, CHECK_NULL); + + FindMethodsByGenericSig visitor(&cache, method_name, &ctx, CHECK_NULL); + visitor.run(super_class); + + GrowableArray families; + visitor.get_discovered_families(&families); + +#ifndef PRODUCT + if (TraceDefaultMethods) { + print_generic_families(&families, sig); + } +#endif // ndef PRODUCT + + GenericMethodFamily* selected_family = NULL; + + for (int i = 0; i < families.length(); ++i) { + GenericMethodFamily* lm = families.at(i); + if (lm->contains_signature(sig)) { + lm->determine_target(current_class, CHECK_NULL); + selected_family = lm; + } + } + + if (selected_family->has_target()) { + Method* target = selected_family->get_selected_target(); + InstanceKlass* holder = InstanceKlass::cast(target->method_holder()); + + // Verify that the identified method is valid from the context of + // the current class + GenericShadowChecker checker(&cache, THREAD, target->name(), + holder, selected_family->descriptor(), super_class); + checker.run(current_class); + + if (checker.found_shadow()) { +#ifndef PRODUCT + if (TraceDefaultMethods) { + tty->print_cr(" Only candidate found was shadowed."); + } +#endif // ndef PRODUCT + THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), + "Accessible default method not found", NULL); + } else { + return target; + } + } else { assert(selected_family->throws_exception(), "must have target or throw"); THROW_MSG_(vmSymbols::java_lang_AbstractMethodError(), selected_family->get_exception_message()->as_C_string(), NULL); } } +// This is called during linktime when we find an invokespecial call that +// refers to a direct superinterface. It indicates that we should find the +// default method in the hierarchy of that superinterface, and if that method +// would have been a candidate from the point of view of 'this' class, then we +// return that method. +// This logic assumes that the super is a direct superclass of the caller +Method* DefaultMethods::find_super_default( + Klass* cls, Klass* super, Symbol* method_name, Symbol* sig, TRAPS) { + + ResourceMark rm(THREAD); + + assert(cls != NULL && super != NULL, "Need real classes"); + + InstanceKlass* current_class = InstanceKlass::cast(cls); + InstanceKlass* super_class = InstanceKlass::cast(super); + + // Keep entire hierarchy alive for the duration of the computation + KeepAliveRegistrar keepAlive(THREAD); + KeepAliveVisitor loadKeepAlive(&keepAlive); + loadKeepAlive.run(current_class); // get hierarchy from current class + +#ifndef PRODUCT + if (TraceDefaultMethods) { + tty->print_cr("Finding super default method %s.%s%s from %s", + super_class->name()->as_C_string(), + method_name->as_C_string(), sig->as_C_string(), + current_class->name()->as_C_string()); + } +#endif // ndef PRODUCT + + assert(super_class->is_interface(), "only call for default methods"); + + Method* target = NULL; + if (ParseGenericDefaults) { + target = find_generic_super_default(current_class, super_class, + method_name, sig, CHECK_NULL); + } else { + target = find_erased_super_default(current_class, super_class, + method_name, sig, CHECK_NULL); + } + +#ifndef PRODUCT + if (target != NULL) { + if (TraceDefaultMethods) { + tty->print(" Returning "); + print_method(tty, target, true); + tty->print_cr(""); + } + } +#endif // ndef PRODUCT + return target; +} + +#ifndef PRODUCT +// Return true is broad type is a covariant return of narrow type +static bool covariant_return_type(BasicType narrow, BasicType broad) { + if (narrow == broad) { + return true; + } + if (broad == T_OBJECT) { + return true; + } + return false; +} +#endif // ndef PRODUCT static int assemble_redirect( BytecodeConstantPool* cp, BytecodeBuffer* buffer, @@ -1103,7 +1356,7 @@ out.next(); } assert(out.at_return_type(), "Parameter counts do not match"); - assert(in.type() == out.type(), "Return types are not compatible"); + assert(covariant_return_type(out.type(), in.type()), "Return types are not compatible"); if (parameter_count == 1 && (in.type() == T_LONG || in.type() == T_DOUBLE)) { ++parameter_count; // need room for return value @@ -1144,10 +1397,15 @@ Symbol* sig, AccessFlags flags, int max_stack, int params, ConstMethod::MethodType mt, TRAPS) { - address code_start = static_cast
(bytecodes->adr_at(0)); - int code_length = bytecodes->length(); + address code_start = 0; + int code_length = 0; InlineTableSizes sizes; + if (bytecodes != NULL && bytecodes->length() > 0) { + code_start = static_cast
(bytecodes->adr_at(0)); + code_length = bytecodes->length(); + } + Method* m = Method::allocate(cp->pool_holder()->class_loader_data(), code_length, flags, &sizes, mt, CHECK_NULL); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/classfile/dictionary.cpp --- a/hotspot/src/share/vm/classfile/dictionary.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/classfile/dictionary.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -555,7 +555,7 @@ loader_data->class_loader() == NULL || loader_data->class_loader()->is_instance(), "checking type of class_loader"); - e->verify(); + e->verify(/*check_dictionary*/false); probe->verify_protection_domain_set(); element_count++; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/classfile/javaClasses.hpp --- a/hotspot/src/share/vm/classfile/javaClasses.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/classfile/javaClasses.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -234,6 +234,7 @@ static GrowableArray* _fixup_mirror_list; static void set_init_lock(oop java_class, oop init_lock); + static void set_protection_domain(oop java_class, oop protection_domain); public: static void compute_offsets(); @@ -272,7 +273,6 @@ // Support for embedded per-class oops static oop protection_domain(oop java_class); - static void set_protection_domain(oop java_class, oop protection_domain); static oop init_lock(oop java_class); static objArrayOop signers(oop java_class); static void set_signers(oop java_class, objArrayOop signers); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/classfile/vmSymbols.hpp --- a/hotspot/src/share/vm/classfile/vmSymbols.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -771,6 +771,17 @@ do_name( decrypt_name, "decrypt") \ do_signature(byteArray_int_int_byteArray_int_signature, "([BII[BI)V") \ \ + /* support for java.util.zip */ \ + do_class(java_util_zip_CRC32, "java/util/zip/CRC32") \ + do_intrinsic(_updateCRC32, java_util_zip_CRC32, update_name, int2_int_signature, F_SN) \ + do_name( update_name, "update") \ + do_intrinsic(_updateBytesCRC32, java_util_zip_CRC32, updateBytes_name, updateBytes_signature, F_SN) \ + do_name( updateBytes_name, "updateBytes") \ + do_signature(updateBytes_signature, "(I[BII)I") \ + do_intrinsic(_updateByteBufferCRC32, java_util_zip_CRC32, updateByteBuffer_name, updateByteBuffer_signature, F_SN) \ + do_name( updateByteBuffer_name, "updateByteBuffer") \ + do_signature(updateByteBuffer_signature, "(IJII)I") \ + \ /* support for sun.misc.Unsafe */ \ do_class(sun_misc_Unsafe, "sun/misc/Unsafe") \ \ diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/code/debugInfo.hpp --- a/hotspot/src/share/vm/code/debugInfo.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/code/debugInfo.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -274,7 +274,7 @@ Method* read_method() { Method* o = (Method*)(code()->metadata_at(read_int())); assert(o == NULL || - o->is_metadata(), "meta data only"); + o->is_metaspace_object(), "meta data only"); return o; } ScopeValue* read_object_value(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/code/dependencies.cpp --- a/hotspot/src/share/vm/code/dependencies.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/code/dependencies.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -655,8 +655,8 @@ } else { o = _deps->oop_recorder()->metadata_at(i); } - assert(o == NULL || o->is_metadata(), - err_msg("Should be perm " PTR_FORMAT, o)); + assert(o == NULL || o->is_metaspace_object(), + err_msg("Should be metadata " PTR_FORMAT, o)); return o; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/code/nmethod.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1081,11 +1081,6 @@ metadata_Relocation* reloc = iter.metadata_reloc(); reloc->fix_metadata_relocation(); } - - // There must not be any interfering patches or breakpoints. - assert(!(iter.type() == relocInfo::breakpoint_type - && iter.breakpoint_reloc()->active()), - "no active breakpoint"); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/code/relocInfo.cpp --- a/hotspot/src/share/vm/code/relocInfo.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/code/relocInfo.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -338,31 +338,6 @@ _limit = limit; } - -void PatchingRelocIterator:: prepass() { - // turn breakpoints off during patching - _init_state = (*this); // save cursor - while (next()) { - if (type() == relocInfo::breakpoint_type) { - breakpoint_reloc()->set_active(false); - } - } - (RelocIterator&)(*this) = _init_state; // reset cursor for client -} - - -void PatchingRelocIterator:: postpass() { - // turn breakpoints back on after patching - (RelocIterator&)(*this) = _init_state; // reset cursor again - while (next()) { - if (type() == relocInfo::breakpoint_type) { - breakpoint_Relocation* bpt = breakpoint_reloc(); - bpt->set_active(bpt->enabled()); - } - } -} - - // All the strange bit-encodings are in here. // The idea is to encode relocation data which are small integers // very efficiently (a single extra halfword). Larger chunks of @@ -704,51 +679,6 @@ _target = address_from_scaled_offset(offset, base); } - -void breakpoint_Relocation::pack_data_to(CodeSection* dest) { - short* p = (short*) dest->locs_end(); - address point = dest->locs_point(); - - *p++ = _bits; - - assert(_target != NULL, "sanity"); - - if (internal()) normalize_address(_target, dest); - - jint target_bits = - (jint)( internal() ? scaled_offset (_target, point) - : runtime_address_to_index(_target) ); - if (settable()) { - // save space for set_target later - p = add_jint(p, target_bits); - } else { - p = add_var_int(p, target_bits); - } - - for (int i = 0; i < instrlen(); i++) { - // put placeholder words until bytes can be saved - p = add_short(p, (short)0x7777); - } - - dest->set_locs_end((relocInfo*) p); -} - - -void breakpoint_Relocation::unpack_data() { - _bits = live_bits(); - - int targetlen = datalen() - 1 - instrlen(); - jint target_bits = 0; - if (targetlen == 0) target_bits = 0; - else if (targetlen == 1) target_bits = *(data()+1); - else if (targetlen == 2) target_bits = relocInfo::jint_from_data(data()+1); - else { ShouldNotReachHere(); } - - _target = internal() ? address_from_scaled_offset(target_bits, addr()) - : index_to_runtime_address (target_bits); -} - - //// miscellaneous methods oop* oop_Relocation::oop_addr() { int n = _oop_index; @@ -933,81 +863,6 @@ return target; } - -breakpoint_Relocation::breakpoint_Relocation(int kind, address target, bool internal) { - bool active = false; - bool enabled = (kind == initialization); - bool removable = (kind != safepoint); - bool settable = (target == NULL); - - int bits = kind; - if (enabled) bits |= enabled_state; - if (internal) bits |= internal_attr; - if (removable) bits |= removable_attr; - if (settable) bits |= settable_attr; - - _bits = bits | high_bit; - _target = target; - - assert(this->kind() == kind, "kind encoded"); - assert(this->enabled() == enabled, "enabled encoded"); - assert(this->active() == active, "active encoded"); - assert(this->internal() == internal, "internal encoded"); - assert(this->removable() == removable, "removable encoded"); - assert(this->settable() == settable, "settable encoded"); -} - - -address breakpoint_Relocation::target() const { - return _target; -} - - -void breakpoint_Relocation::set_target(address x) { - assert(settable(), "must be settable"); - jint target_bits = - (jint)(internal() ? scaled_offset (x, addr()) - : runtime_address_to_index(x)); - short* p = &live_bits() + 1; - p = add_jint(p, target_bits); - assert(p == instrs(), "new target must fit"); - _target = x; -} - - -void breakpoint_Relocation::set_enabled(bool b) { - if (enabled() == b) return; - - if (b) { - set_bits(bits() | enabled_state); - } else { - set_active(false); // remove the actual breakpoint insn, if any - set_bits(bits() & ~enabled_state); - } -} - - -void breakpoint_Relocation::set_active(bool b) { - assert(!b || enabled(), "cannot activate a disabled breakpoint"); - - if (active() == b) return; - - // %%% should probably seize a lock here (might not be the right lock) - //MutexLockerEx ml_patch(Patching_lock, true); - //if (active() == b) return; // recheck state after locking - - if (b) { - set_bits(bits() | active_state); - if (instrlen() == 0) - fatal("breakpoints in original code must be undoable"); - pd_swap_in_breakpoint (addr(), instrs(), instrlen()); - } else { - set_bits(bits() & ~active_state); - pd_swap_out_breakpoint(addr(), instrs(), instrlen()); - } -} - - //--------------------------------------------------------------------------------- // Non-product code diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/code/relocInfo.hpp --- a/hotspot/src/share/vm/code/relocInfo.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/code/relocInfo.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -49,9 +49,6 @@ // RelocIterator // A StackObj which iterates over the relocations associated with // a range of code addresses. Can be used to operate a copy of code. -// PatchingRelocIterator -// Specialized subtype of RelocIterator which removes breakpoints -// temporarily during iteration, then restores them. // BoundRelocation // An _internal_ type shared by packers and unpackers of relocations. // It pastes together a RelocationHolder with some pointers into @@ -204,15 +201,6 @@ // immediate field must not straddle a unit of memory coherence. // //%note reloc_3 // -// relocInfo::breakpoint_type -- a conditional breakpoint in the code -// Value: none -// Instruction types: any whatsoever -// Data: [b [T]t i...] -// The b is a bit-packed word representing the breakpoint's attributes. -// The t is a target address which the breakpoint calls (when it is enabled). -// The i... is a place to store one or two instruction words overwritten -// by a trap, so that the breakpoint may be subsequently removed. -// // relocInfo::static_stub_type -- an extra stub for each static_call_type // Value: none // Instruction types: a virtual call: { set_oop; jump; } @@ -271,8 +259,8 @@ section_word_type = 9, // internal, but a cross-section reference poll_type = 10, // polling instruction for safepoints poll_return_type = 11, // polling instruction for safepoints at return - breakpoint_type = 12, // an initialization barrier or safepoint - metadata_type = 13, // metadata that used to be oops + metadata_type = 12, // metadata that used to be oops + yet_unused_type_1 = 13, // Still unused yet_unused_type_2 = 14, // Still unused data_prefix_tag = 15, // tag for a prefix (carries data arguments) type_mask = 15 // A mask which selects only the above values @@ -312,7 +300,6 @@ visitor(internal_word) \ visitor(poll) \ visitor(poll_return) \ - visitor(breakpoint) \ visitor(section_word) \ @@ -454,7 +441,7 @@ public: enum { // Conservatively large estimate of maximum length (in shorts) - // of any relocation record (probably breakpoints are largest). + // of any relocation record. // Extended format is length prefix, data words, and tag/offset suffix. length_limit = 1 + 1 + (3*BytesPerWord/BytesPerShort) + 1, have_format = format_width > 0 @@ -571,8 +558,6 @@ void initialize(nmethod* nm, address begin, address limit); - friend class PatchingRelocIterator; - // make an uninitialized one, for PatchingRelocIterator: RelocIterator() { initialize_misc(); } public: @@ -779,9 +764,6 @@ void pd_verify_data_value (address x, intptr_t off) { pd_set_data_value(x, off, true); } address pd_call_destination (address orig_addr = NULL); void pd_set_call_destination (address x); - void pd_swap_in_breakpoint (address x, short* instrs, int instrlen); - void pd_swap_out_breakpoint (address x, short* instrs, int instrlen); - static int pd_breakpoint_size (); // this extracts the address of an address in the code stream instead of the reloc data address* pd_address_in_code (); @@ -1302,87 +1284,6 @@ void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest); }; - -class breakpoint_Relocation : public Relocation { - relocInfo::relocType type() { return relocInfo::breakpoint_type; } - - enum { - // attributes which affect the interpretation of the data: - removable_attr = 0x0010, // buffer [i...] allows for undoing the trap - internal_attr = 0x0020, // the target is an internal addr (local stub) - settable_attr = 0x0040, // the target is settable - - // states which can change over time: - enabled_state = 0x0100, // breakpoint must be active in running code - active_state = 0x0200, // breakpoint instruction actually in code - - kind_mask = 0x000F, // mask for extracting kind - high_bit = 0x4000 // extra bit which is always set - }; - - public: - enum { - // kinds: - initialization = 1, - safepoint = 2 - }; - - // If target is NULL, 32 bits are reserved for a later set_target(). - static RelocationHolder spec(int kind, address target = NULL, bool internal_target = false) { - RelocationHolder rh = newHolder(); - new(rh) breakpoint_Relocation(kind, target, internal_target); - return rh; - } - - private: - // We require every bits value to NOT to fit into relocInfo::datalen_width, - // because we are going to actually store state in the reloc, and so - // cannot allow it to be compressed (and hence copied by the iterator). - - short _bits; // bit-encoded kind, attrs, & state - address _target; - - breakpoint_Relocation(int kind, address target, bool internal_target); - - friend class RelocIterator; - breakpoint_Relocation() { } - - short bits() const { return _bits; } - short& live_bits() const { return data()[0]; } - short* instrs() const { return data() + datalen() - instrlen(); } - int instrlen() const { return removable() ? pd_breakpoint_size() : 0; } - - void set_bits(short x) { - assert(live_bits() == _bits, "must be the only mutator of reloc info"); - live_bits() = _bits = x; - } - - public: - address target() const; - void set_target(address x); - - int kind() const { return bits() & kind_mask; } - bool enabled() const { return (bits() & enabled_state) != 0; } - bool active() const { return (bits() & active_state) != 0; } - bool internal() const { return (bits() & internal_attr) != 0; } - bool removable() const { return (bits() & removable_attr) != 0; } - bool settable() const { return (bits() & settable_attr) != 0; } - - void set_enabled(bool b); // to activate, you must also say set_active - void set_active(bool b); // actually inserts bpt (must be enabled 1st) - - // data is packed as 16 bits, followed by the target (1 or 2 words), followed - // if necessary by empty storage for saving away original instruction bytes. - void pack_data_to(CodeSection* dest); - void unpack_data(); - - // during certain operations, breakpoints must be out of the way: - void fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) { - assert(!active(), "cannot perform relocation on enabled breakpoints"); - } -}; - - // We know all the xxx_Relocation classes, so now we can define these: #define EACH_CASE(name) \ inline name##_Relocation* RelocIterator::name##_reloc() { \ @@ -1401,25 +1302,4 @@ initialize(nm, begin, limit); } -// if you are going to patch code, you should use this subclass of -// RelocIterator -class PatchingRelocIterator : public RelocIterator { - private: - RelocIterator _init_state; - - void prepass(); // deactivates all breakpoints - void postpass(); // reactivates all enabled breakpoints - - // do not copy these puppies; it would have unpredictable side effects - // these are private and have no bodies defined because they should not be called - PatchingRelocIterator(const RelocIterator&); - void operator=(const RelocIterator&); - - public: - PatchingRelocIterator(nmethod* nm, address begin = NULL, address limit = NULL) - : RelocIterator(nm, begin, limit) { prepass(); } - - ~PatchingRelocIterator() { postpass(); } -}; - #endif // SHARE_VM_CODE_RELOCINFO_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -2017,12 +2017,6 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(CFLS_OOP_SINCE_SAVE_MARKS_DEFN) - -void CompactibleFreeListSpace::object_iterate_since_last_GC(ObjectClosure* cl) { - // ugghh... how would one do this efficiently for a non-contiguous space? - guarantee(false, "NYI"); -} - bool CompactibleFreeListSpace::linearAllocationWouldFail() const { return _smallLinearAllocBlock._word_size == 0; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -396,7 +396,6 @@ // iteration support for promotion void save_marks(); bool no_allocs_since_save_marks(); - void object_iterate_since_last_GC(ObjectClosure* cl); // iteration support for sweeping void save_sweep_limit() { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -3130,26 +3130,6 @@ ALL_SINCE_SAVE_MARKS_CLOSURES(CMS_SINCE_SAVE_MARKS_DEFN) void -ConcurrentMarkSweepGeneration::object_iterate_since_last_GC(ObjectClosure* blk) -{ - // Not currently implemented; need to do the following. -- ysr. - // dld -- I think that is used for some sort of allocation profiler. So it - // really means the objects allocated by the mutator since the last - // GC. We could potentially implement this cheaply by recording only - // the direct allocations in a side data structure. - // - // I think we probably ought not to be required to support these - // iterations at any arbitrary point; I think there ought to be some - // call to enable/disable allocation profiling in a generation/space, - // and the iterator ought to return the objects allocated in the - // gen/space since the enable call, or the last iterator call (which - // will probably be at a GC.) That way, for gens like CM&S that would - // require some extra data structure to support this, we only pay the - // cost when it's in use... - cmsSpace()->object_iterate_since_last_GC(blk); -} - -void ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) { cl->set_generation(this); younger_refs_in_space_iterate(_cmsSpace, cl); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp --- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1273,7 +1273,6 @@ // Iteration support and related enquiries void save_marks(); bool no_allocs_since_save_marks(); - void object_iterate_since_last_GC(ObjectClosure* cl); void younger_refs_iterate(OopsInGenClosure* cl); // Iteration support specific to CMS generations diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CardCounts.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -152,12 +152,9 @@ if (card_num < _committed_max_card_num) { count = (uint) _card_counts[card_num]; if (count < G1ConcRSHotCardLimit) { - _card_counts[card_num] += 1; + _card_counts[card_num] = + (jubyte)(MIN2((uintx)(_card_counts[card_num] + 1), G1ConcRSHotCardLimit)); } - assert(_card_counts[card_num] <= G1ConcRSHotCardLimit, - err_msg("Refinement count overflow? " - "new count: "UINT32_FORMAT, - (uint) _card_counts[card_num])); } } return count; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -54,7 +54,6 @@ #include "memory/referenceProcessor.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.pcgc.inline.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/vmThread.hpp" size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0; @@ -2665,11 +2664,6 @@ heap_region_iterate(&blk); } -void G1CollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { - // FIXME: is this right? - guarantee(false, "object_iterate_since_last_GC not supported by G1 heap"); -} - // Calls a SpaceClosure on a HeapRegion. class SpaceClosureRegionClosure: public HeapRegionClosure { @@ -3598,8 +3592,6 @@ void G1CollectedHeap::gc_prologue(bool full /* Ignored */) { // always_do_update_barrier = false; assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer"); - // Call allocation profiler - AllocationProfiler::iterate_since_last_gc(); // Fill TLAB's and such ensure_parsability(true); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1360,11 +1360,6 @@ object_iterate(cl); } - // Iterate over all objects allocated since the last collection, calling - // "cl.do_object" on each. The heap must have been initialized properly - // to support this function, or else this call will fail. - virtual void object_iterate_since_last_GC(ObjectClosure* cl); - // Iterate over all spaces in use in the heap, in ascending address order. virtual void space_iterate(SpaceClosure* cl); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -43,7 +43,6 @@ #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fprofiler.hpp" #include "runtime/synchronizer.hpp" diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -47,7 +47,7 @@ JavaThread* jt = (JavaThread*)thr; jt->satb_mark_queue().enqueue(pre_val); } else { - MutexLocker x(Shared_SATB_Q_lock); + MutexLockerEx x(Shared_SATB_Q_lock, Mutex::_no_safepoint_check_flag); JavaThread::satb_mark_queue_set().shared_satb_queue()->enqueue(pre_val); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp --- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -798,7 +798,7 @@ if (!g1->is_obj_dead_cond(obj, this, vo)) { if (obj->is_oop()) { Klass* klass = obj->klass(); - if (!klass->is_metadata()) { + if (!klass->is_metaspace_object()) { gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" " "not metadata", klass, obj); *failures = true; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -70,6 +70,17 @@ _virtual_space = vs; } +void ASPSOldGen::initialize_work(const char* perf_data_name, int level) { + + PSOldGen::initialize_work(perf_data_name, level); + + // The old gen can grow to gen_size_limit(). _reserve reflects only + // the current maximum that can be committed. + assert(_reserved.byte_size() <= gen_size_limit(), "Consistency check"); + + initialize_performance_counters(perf_data_name, level); +} + void ASPSOldGen::reset_after_change() { _reserved = MemRegion((HeapWord*)virtual_space()->low_boundary(), (HeapWord*)virtual_space()->high_boundary()); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -50,6 +50,8 @@ size_t max_gen_size() { return _reserved.byte_size(); } void set_gen_size_limit(size_t v) { _gen_size_limit = v; } + virtual void initialize_work(const char* perf_data_name, int level); + // After a shrink or expand reset the generation void reset_after_change(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp --- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psOldGen.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -110,7 +110,7 @@ virtual void initialize(ReservedSpace rs, size_t alignment, const char* perf_data_name, int level); void initialize_virtual_space(ReservedSpace rs, size_t alignment); - void initialize_work(const char* perf_data_name, int level); + virtual void initialize_work(const char* perf_data_name, int level); virtual void initialize_performance_counters(const char* perf_data_name, int level); MemRegion reserved() const { return _reserved; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -23,12 +23,14 @@ */ #include "precompiled.hpp" +#include "gc_implementation/shared/copyFailedInfo.hpp" #include "gc_implementation/shared/gcHeapSummary.hpp" #include "gc_implementation/shared/gcTimer.hpp" #include "gc_implementation/shared/gcTrace.hpp" -#include "gc_implementation/shared/copyFailedInfo.hpp" +#include "gc_implementation/shared/objectCountEventSender.hpp" #include "memory/heapInspection.hpp" #include "memory/referenceProcessorStats.hpp" +#include "runtime/os.hpp" #include "utilities/globalDefinitions.hpp" #if INCLUDE_ALL_GCS @@ -38,7 +40,7 @@ #define assert_unset_gc_id() assert(_shared_gc_info.id() == SharedGCInfo::UNSET_GCID, "GC already started?") #define assert_set_gc_id() assert(_shared_gc_info.id() != SharedGCInfo::UNSET_GCID, "GC not started?") -static jlong GCTracer_next_gc_id = 0; +static GCId GCTracer_next_gc_id = 0; static GCId create_new_gc_id() { return GCTracer_next_gc_id++; } @@ -91,26 +93,38 @@ } #if INCLUDE_SERVICES -void ObjectCountEventSenderClosure::do_cinfo(KlassInfoEntry* entry) { - if (should_send_event(entry)) { - send_event(entry); - } -} +class ObjectCountEventSenderClosure : public KlassInfoClosure { + const GCId _gc_id; + const double _size_threshold_percentage; + const size_t _total_size_in_words; + const jlong _timestamp; -void ObjectCountEventSenderClosure::send_event(KlassInfoEntry* entry) { - _gc_tracer->send_object_count_after_gc_event(entry->klass(), entry->count(), - entry->words() * BytesPerWord); -} + public: + ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) : + _gc_id(gc_id), + _size_threshold_percentage(ObjectCountCutOffPercent / 100), + _total_size_in_words(total_size_in_words), + _timestamp(timestamp) + {} -bool ObjectCountEventSenderClosure::should_send_event(KlassInfoEntry* entry) const { - double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; - return percentage_of_heap > _size_threshold_percentage; -} + virtual void do_cinfo(KlassInfoEntry* entry) { + if (should_send_event(entry)) { + ObjectCountEventSender::send(entry, _gc_id, _timestamp); + } + } + + private: + bool should_send_event(const KlassInfoEntry* entry) const { + double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; + return percentage_of_heap >= _size_threshold_percentage; + } +}; void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) { assert_set_gc_id(); + assert(is_alive_cl != NULL, "Must supply function to check liveness"); - if (should_send_object_count_after_gc_event()) { + if (ObjectCountEventSender::should_send_event()) { ResourceMark rm; KlassInfoTable cit(false); @@ -118,12 +132,13 @@ HeapInspection hi(false, false, false, NULL); hi.populate_table(&cit, is_alive_cl); - ObjectCountEventSenderClosure event_sender(this, cit.size_of_instances_in_words()); + jlong timestamp = os::elapsed_counter(); + ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp); cit.iterate(&event_sender); } } } -#endif +#endif // INCLUDE_SERVICES void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const { assert_set_gc_id(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp --- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -30,7 +30,6 @@ #include "gc_implementation/shared/gcWhen.hpp" #include "gc_implementation/shared/copyFailedInfo.hpp" #include "memory/allocation.hpp" -#include "memory/klassInfoClosure.hpp" #include "memory/referenceType.hpp" #if INCLUDE_ALL_GCS #include "gc_implementation/g1/g1YCTypes.hpp" @@ -113,7 +112,6 @@ #endif // INCLUDE_ALL_GCS class GCTracer : public ResourceObj { - friend class ObjectCountEventSenderClosure; protected: SharedGCInfo _shared_gc_info; @@ -123,7 +121,6 @@ void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const; void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; - bool has_reported_gc_start() const; protected: @@ -137,25 +134,6 @@ void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; void send_reference_stats_event(ReferenceType type, size_t count) const; void send_phase_events(TimePartitions* time_partitions) const; - void send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const NOT_SERVICES_RETURN; - bool should_send_object_count_after_gc_event() const; -}; - -class ObjectCountEventSenderClosure : public KlassInfoClosure { - GCTracer* _gc_tracer; - const double _size_threshold_percentage; - const size_t _total_size_in_words; - public: - ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) : - _gc_tracer(gc_tracer), - _size_threshold_percentage(ObjectCountCutOffPercent / 100), - _total_size_in_words(total_size_in_words) - {} - virtual void do_cinfo(KlassInfoEntry* entry); - protected: - virtual void send_event(KlassInfoEntry* entry); - private: - bool should_send_event(KlassInfoEntry* entry) const; }; class YoungGCTracer : public GCTracer { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp --- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -123,27 +123,6 @@ } } -#if INCLUDE_SERVICES -void GCTracer::send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const { - EventObjectCountAfterGC e; - if (e.should_commit()) { - e.set_gcId(_shared_gc_info.id()); - e.set_class(klass); - e.set_count(count); - e.set_totalSize(total_size); - e.commit(); - } -} -#endif - -bool GCTracer::should_send_object_count_after_gc_event() const { -#if INCLUDE_TRACE - return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId); -#else - return false; -#endif -} - #if INCLUDE_ALL_GCS void G1NewTracer::send_g1_young_gc_event() { EventGCG1GarbageCollection e(UNTIMED); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + + +#include "precompiled.hpp" +#include "gc_implementation/shared/objectCountEventSender.hpp" +#include "memory/heapInspection.hpp" +#include "trace/tracing.hpp" +#include "utilities/globalDefinitions.hpp" + +#if INCLUDE_SERVICES + +void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) { + assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId), + "Only call this method if the event is enabled"); + + EventObjectCountAfterGC event(UNTIMED); + event.set_gcId(gc_id); + event.set_class(entry->klass()); + event.set_count(entry->count()); + event.set_totalSize(entry->words() * BytesPerWord); + event.set_endtime(timestamp); + event.commit(); +} + +bool ObjectCountEventSender::should_send_event() { +#if INCLUDE_TRACE + return Tracing::is_event_enabled(EventObjectCountAfterGC::eventId); +#else + return false; +#endif // INCLUDE_TRACE +} + +#endif // INCLUDE_SERVICES diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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. + * + */ + +#ifndef SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP +#define SHARE_VM_OBJECT_COUNT_EVENT_SENDER_HPP + +#include "gc_implementation/shared/gcTrace.hpp" +#include "memory/allocation.hpp" +#include "utilities/macros.hpp" + +#if INCLUDE_SERVICES + +class KlassInfoEntry; + +class ObjectCountEventSender : public AllStatic { + public: + static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp); + static bool should_send_event(); +}; + +#endif // INCLUDE_SERVICES + +#endif // SHARE_VM_OBJECT_COUNT_EVENT_SENDER diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/gc_interface/collectedHeap.cpp --- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -85,16 +85,16 @@ MetaspaceSummary CollectedHeap::create_metaspace_summary() { const MetaspaceSizes meta_space( - 0, /*MetaspaceAux::capacity_in_bytes(),*/ - 0, /*MetaspaceAux::used_in_bytes(),*/ + MetaspaceAux::allocated_capacity_bytes(), + MetaspaceAux::allocated_used_bytes(), MetaspaceAux::reserved_in_bytes()); const MetaspaceSizes data_space( - 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::NonClassType),*/ - 0, /*MetaspaceAux::used_in_bytes(Metaspace::NonClassType),*/ + MetaspaceAux::allocated_capacity_bytes(Metaspace::NonClassType), + MetaspaceAux::allocated_used_bytes(Metaspace::NonClassType), MetaspaceAux::reserved_in_bytes(Metaspace::NonClassType)); const MetaspaceSizes class_space( - 0, /*MetaspaceAux::capacity_in_bytes(Metaspace::ClassType),*/ - 0, /*MetaspaceAux::used_in_bytes(Metaspace::ClassType),*/ + MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType), + MetaspaceAux::allocated_used_bytes(Metaspace::ClassType), MetaspaceAux::reserved_in_bytes(Metaspace::ClassType)); return MetaspaceSummary(meta_space, data_space, class_space); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/interpreter/abstractInterpreter.hpp --- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -102,6 +102,9 @@ java_lang_math_pow, // implementation of java.lang.Math.pow (x,y) java_lang_math_exp, // implementation of java.lang.Math.exp (x) java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get() + java_util_zip_CRC32_update, // implementation of java.util.zip.CRC32.update() + java_util_zip_CRC32_updateBytes, // implementation of java.util.zip.CRC32.updateBytes() + java_util_zip_CRC32_updateByteBuffer, // implementation of java.util.zip.CRC32.updateByteBuffer() number_of_method_entries, invalid = -1 }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -481,9 +481,9 @@ // So we have a second version of the assertion which handles the case where EnableInvokeDynamic was // switched off because of the wrong classes. if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) { - assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit"); + assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit"); } else { - const int extra_stack_entries = Method::extra_stack_entries_for_indy; + const int extra_stack_entries = Method::extra_stack_entries_for_jsr292; assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries + 1), "bad stack limit"); } @@ -1581,7 +1581,7 @@ #define ARRAY_LOADTO32(T, T2, format, stackRes, extra) \ { \ ARRAY_INTRO(-2); \ - extra; \ + (void)extra; \ SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), \ -2); \ UPDATE_PC_AND_TOS_AND_CONTINUE(1, -1); \ @@ -1592,8 +1592,8 @@ { \ ARRAY_INTRO(-2); \ SET_ ## stackRes(*(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)), -1); \ - extra; \ - UPDATE_PC_AND_CONTINUE(1); \ + (void)extra; \ + UPDATE_PC_AND_CONTINUE(1); \ } CASE(_iaload): @@ -1617,7 +1617,7 @@ #define ARRAY_STOREFROM32(T, T2, format, stackSrc, extra) \ { \ ARRAY_INTRO(-3); \ - extra; \ + (void)extra; \ *(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \ UPDATE_PC_AND_TOS_AND_CONTINUE(1, -3); \ } @@ -1626,7 +1626,7 @@ #define ARRAY_STOREFROM64(T, T2, stackSrc, extra) \ { \ ARRAY_INTRO(-4); \ - extra; \ + (void)extra; \ *(T2 *)(((address) arrObj->base(T)) + index * sizeof(T2)) = stackSrc( -1); \ UPDATE_PC_AND_TOS_AND_CONTINUE(1, -4); \ } @@ -2233,7 +2233,7 @@ } Method* method = cache->f1_as_method(); - VERIFY_OOP(method); + if (VerifyOops) method->verify(); if (cache->has_appendix()) { ConstantPool* constants = METHOD->constants(); @@ -2265,8 +2265,7 @@ } Method* method = cache->f1_as_method(); - - VERIFY_OOP(method); + if (VerifyOops) method->verify(); if (cache->has_appendix()) { ConstantPool* constants = METHOD->constants(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/interpreter/interpreter.cpp --- a/hotspot/src/share/vm/interpreter/interpreter.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/interpreter.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -195,6 +195,17 @@ return kind; } +#ifndef CC_INTERP + if (UseCRC32Intrinsics && m->is_native()) { + // Use optimized stub code for CRC32 native methods. + switch (m->intrinsic_id()) { + case vmIntrinsics::_updateCRC32 : return java_util_zip_CRC32_update; + case vmIntrinsics::_updateBytesCRC32 : return java_util_zip_CRC32_updateBytes; + case vmIntrinsics::_updateByteBufferCRC32 : return java_util_zip_CRC32_updateByteBuffer; + } + } +#endif + // Native method? // Note: This test must come _before_ the test for intrinsic // methods. See also comments below. @@ -297,6 +308,9 @@ case java_lang_math_sqrt : tty->print("java_lang_math_sqrt" ); break; case java_lang_math_log : tty->print("java_lang_math_log" ); break; case java_lang_math_log10 : tty->print("java_lang_math_log10" ); break; + case java_util_zip_CRC32_update : tty->print("java_util_zip_CRC32_update"); break; + case java_util_zip_CRC32_updateBytes : tty->print("java_util_zip_CRC32_updateBytes"); break; + case java_util_zip_CRC32_updateByteBuffer : tty->print("java_util_zip_CRC32_updateByteBuffer"); break; default: if (kind >= method_handle_invoke_FIRST && kind <= method_handle_invoke_LAST) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/interpreter/templateInterpreter.cpp --- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -373,6 +373,12 @@ method_entry(java_lang_math_pow ) method_entry(java_lang_ref_reference_get) + if (UseCRC32Intrinsics) { + method_entry(java_util_zip_CRC32_update) + method_entry(java_util_zip_CRC32_updateBytes) + method_entry(java_util_zip_CRC32_updateByteBuffer) + } + initialize_method_handle_entries(); // all native method kinds (must be one contiguous block) diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/allocation.cpp --- a/hotspot/src/share/vm/memory/allocation.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/allocation.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -71,13 +71,6 @@ return MetaspaceShared::is_in_shared_space(this); } -bool MetaspaceObj::is_metadata() const { - // GC Verify checks use this in guarantees. - // TODO: either replace them with is_metaspace_object() or remove them. - // is_metaspace_object() is slower than this test. This test doesn't - // seem very useful for metaspace objects anymore though. - return !Universe::heap()->is_in_reserved(this); -} bool MetaspaceObj::is_metaspace_object() const { return Metaspace::contains((void*)this); @@ -243,10 +236,11 @@ size_t _num_used; // number of chunks currently checked out const size_t _size; // size of each chunk (must be uniform) - // Our three static pools + // Our four static pools static ChunkPool* _large_pool; static ChunkPool* _medium_pool; static ChunkPool* _small_pool; + static ChunkPool* _tiny_pool; // return first element or null void* get_first() { @@ -326,15 +320,18 @@ static ChunkPool* large_pool() { assert(_large_pool != NULL, "must be initialized"); return _large_pool; } static ChunkPool* medium_pool() { assert(_medium_pool != NULL, "must be initialized"); return _medium_pool; } static ChunkPool* small_pool() { assert(_small_pool != NULL, "must be initialized"); return _small_pool; } + static ChunkPool* tiny_pool() { assert(_tiny_pool != NULL, "must be initialized"); return _tiny_pool; } static void initialize() { _large_pool = new ChunkPool(Chunk::size + Chunk::aligned_overhead_size()); _medium_pool = new ChunkPool(Chunk::medium_size + Chunk::aligned_overhead_size()); _small_pool = new ChunkPool(Chunk::init_size + Chunk::aligned_overhead_size()); + _tiny_pool = new ChunkPool(Chunk::tiny_size + Chunk::aligned_overhead_size()); } static void clean() { enum { BlocksToKeep = 5 }; + _tiny_pool->free_all_but(BlocksToKeep); _small_pool->free_all_but(BlocksToKeep); _medium_pool->free_all_but(BlocksToKeep); _large_pool->free_all_but(BlocksToKeep); @@ -344,6 +341,7 @@ ChunkPool* ChunkPool::_large_pool = NULL; ChunkPool* ChunkPool::_medium_pool = NULL; ChunkPool* ChunkPool::_small_pool = NULL; +ChunkPool* ChunkPool::_tiny_pool = NULL; void chunkpool_init() { ChunkPool::initialize(); @@ -383,6 +381,7 @@ case Chunk::size: return ChunkPool::large_pool()->allocate(bytes, alloc_failmode); case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode); case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes, alloc_failmode); + case Chunk::tiny_size: return ChunkPool::tiny_pool()->allocate(bytes, alloc_failmode); default: { void* p = os::malloc(bytes, mtChunk, CALLER_PC); if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { @@ -399,6 +398,7 @@ case Chunk::size: ChunkPool::large_pool()->free(c); break; case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break; case Chunk::init_size: ChunkPool::small_pool()->free(c); break; + case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break; default: os::free(c, mtChunk); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/allocation.hpp --- a/hotspot/src/share/vm/memory/allocation.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/allocation.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -264,7 +264,6 @@ class MetaspaceObj { public: - bool is_metadata() const; bool is_metaspace_object() const; // more specific test but slower bool is_shared() const; void print_address_on(outputStream* st) const; // nonvirtual address printing @@ -354,7 +353,8 @@ slack = 20, // suspected sizeof(Chunk) + internal malloc headers #endif - init_size = 1*K - slack, // Size of first chunk + tiny_size = 256 - slack, // Size of first chunk (tiny) + init_size = 1*K - slack, // Size of first chunk (normal aka small) medium_size= 10*K - slack, // Size of medium-sized chunk size = 32*K - slack, // Default size of an Arena chunk (following the first) non_pool_size = init_size + 32 // An initial size which is not one of above diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/defNewGeneration.cpp --- a/hotspot/src/share/vm/memory/defNewGeneration.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -450,11 +450,6 @@ } } -void DefNewGeneration::object_iterate_since_last_GC(ObjectClosure* cl) { - // $$$ This may be wrong in case of "scavenge failure"? - eden()->object_iterate(cl); -} - void DefNewGeneration::younger_refs_iterate(OopsInGenClosure* cl) { assert(false, "NYI -- are you sure you want to call this?"); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/defNewGeneration.hpp --- a/hotspot/src/share/vm/memory/defNewGeneration.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -252,7 +252,6 @@ // Iteration void object_iterate(ObjectClosure* blk); - void object_iterate_since_last_GC(ObjectClosure* cl); void younger_refs_iterate(OopsInGenClosure* cl); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/filemap.cpp --- a/hotspot/src/share/vm/memory/filemap.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/filemap.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -549,3 +549,13 @@ return false; } + +void FileMapInfo::print_shared_spaces() { + gclog_or_tty->print_cr("Shared Spaces:"); + for (int i = 0; i < MetaspaceShared::n_regions; i++) { + struct FileMapInfo::FileMapHeader::space_info* si = &_header._space[i]; + gclog_or_tty->print(" %s " INTPTR_FORMAT "-" INTPTR_FORMAT, + shared_region_name[i], + si->_base, si->_base + si->_used); + } +} diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/filemap.hpp --- a/hotspot/src/share/vm/memory/filemap.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/filemap.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -149,6 +149,7 @@ // Return true if given address is in the mapped shared space. bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); + void print_shared_spaces() NOT_CDS_RETURN; }; #endif // SHARE_VM_MEMORY_FILEMAP_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/genCollectedHeap.cpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -42,7 +42,6 @@ #include "memory/space.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.inline2.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fprofiler.hpp" #include "runtime/handles.hpp" @@ -873,12 +872,6 @@ } } -void GenCollectedHeap::object_iterate_since_last_GC(ObjectClosure* cl) { - for (int i = 0; i < _n_gens; i++) { - _gens[i]->object_iterate_since_last_GC(cl); - } -} - Space* GenCollectedHeap::space_containing(const void* addr) const { for (int i = 0; i < _n_gens; i++) { Space* res = _gens[i]->space_containing(addr); @@ -1186,8 +1179,6 @@ CollectedHeap::accumulate_statistics_all_tlabs(); ensure_parsability(true); // retire TLABs - // Call allocation profiler - AllocationProfiler::iterate_since_last_gc(); // Walk generations GenGCPrologueClosure blk(full); generation_iterate(&blk, false); // not old-to-young. diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/genCollectedHeap.hpp --- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -222,7 +222,6 @@ void oop_iterate(MemRegion mr, ExtendedOopClosure* cl); void object_iterate(ObjectClosure* cl); void safe_object_iterate(ObjectClosure* cl); - void object_iterate_since_last_GC(ObjectClosure* cl); Space* space_containing(const void* addr) const; // A CollectedHeap is divided into a dense sequence of "blocks"; that is, diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/generation.cpp --- a/hotspot/src/share/vm/memory/generation.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/generation.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -811,16 +811,6 @@ blk->do_space(_the_space); } -void OneContigSpaceCardGeneration::object_iterate_since_last_GC(ObjectClosure* blk) { - // Deal with delayed initialization of _the_space, - // and lack of initialization of _last_gc. - if (_last_gc.space() == NULL) { - assert(the_space() != NULL, "shouldn't be NULL"); - _last_gc = the_space()->bottom_mark(); - } - the_space()->object_iterate_from(_last_gc, blk); -} - void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) { blk->set_generation(this); younger_refs_in_space_iterate(_the_space, blk); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/generation.hpp --- a/hotspot/src/share/vm/memory/generation.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/generation.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -551,12 +551,6 @@ // the heap. This defaults to object_iterate() unless overridden. virtual void safe_object_iterate(ObjectClosure* cl); - // Iterate over all objects allocated in the generation since the last - // collection, calling "cl.do_object" on each. The generation must have - // been initialized properly to support this function, or else this call - // will fail. - virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0; - // Apply "cl->do_oop" to (the address of) all and only all the ref fields // in the current generation that contain pointers to objects in younger // generations. Objects allocated since the last "save_marks" call are @@ -724,7 +718,6 @@ // Iteration void object_iterate(ObjectClosure* blk); void space_iterate(SpaceClosure* blk, bool usedOnly = false); - void object_iterate_since_last_GC(ObjectClosure* cl); void younger_refs_iterate(OopsInGenClosure* blk); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/heapInspection.cpp --- a/hotspot/src/share/vm/memory/heapInspection.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/heapInspection.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -157,7 +157,6 @@ } uint KlassInfoTable::hash(const Klass* p) { - assert(p->is_metadata(), "all klasses are metadata"); return (uint)(((uintptr_t)p - (uintptr_t)_ref) >> 2); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/heapInspection.hpp --- a/hotspot/src/share/vm/memory/heapInspection.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/heapInspection.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -26,7 +26,6 @@ #define SHARE_VM_MEMORY_HEAPINSPECTION_HPP #include "memory/allocation.inline.hpp" -#include "memory/klassInfoClosure.hpp" #include "oops/oop.inline.hpp" #include "oops/annotations.hpp" #include "utilities/macros.hpp" @@ -204,6 +203,12 @@ const char* name() const; }; +class KlassInfoClosure : public StackObj { + public: + // Called for each KlassInfoEntry. + virtual void do_cinfo(KlassInfoEntry* cie) = 0; +}; + class KlassInfoBucket: public CHeapObj { private: KlassInfoEntry* _list; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/klassInfoClosure.hpp --- a/hotspot/src/share/vm/memory/klassInfoClosure.hpp Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * 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. - * - */ - -#ifndef SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP -#define SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP - -class KlassInfoEntry; - -class KlassInfoClosure : public StackObj { - public: - // Called for each KlassInfoEntry. - virtual void do_cinfo(KlassInfoEntry* cie) = 0; -}; - -#endif // SHARE_VM_MEMORY_KLASSINFOCLOSURE_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/metaspace.cpp --- a/hotspot/src/share/vm/memory/metaspace.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/metaspace.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -70,7 +70,7 @@ SpecializedChunk = 128, ClassSmallChunk = 256, SmallChunk = 512, - ClassMediumChunk = 1 * K, + ClassMediumChunk = 4 * K, MediumChunk = 8 * K, HumongousChunkGranularity = 8 }; @@ -580,7 +580,6 @@ // Number of small chunks to allocate to a manager // If class space manager, small chunks are unlimited static uint const _small_chunk_limit; - bool has_small_chunk_limit() { return !vs_list()->is_class(); } // Sum of all space in allocated chunks size_t _allocated_blocks_words; @@ -1298,13 +1297,18 @@ bool MetaspaceGC::should_expand(VirtualSpaceList* vsl, size_t word_size) { - size_t committed_capacity_bytes = MetaspaceAux::allocated_capacity_bytes(); // If the user wants a limit, impose one. - size_t max_metaspace_size_bytes = MaxMetaspaceSize; - size_t metaspace_size_bytes = MetaspaceSize; - if (!FLAG_IS_DEFAULT(MaxMetaspaceSize) && - MetaspaceAux::reserved_in_bytes() >= MaxMetaspaceSize) { - return false; + // The reason for someone using this flag is to limit reserved space. So + // for non-class virtual space, compare against virtual spaces that are reserved. + // For class virtual space, we only compare against the committed space, not + // reserved space, because this is a larger space prereserved for compressed + // class pointers. + if (!FLAG_IS_DEFAULT(MaxMetaspaceSize)) { + size_t real_allocated = Metaspace::space_list()->virtual_space_total() + + MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); + if (real_allocated >= MaxMetaspaceSize) { + return false; + } } // Class virtual space should always be expanded. Call GC for the other @@ -1318,11 +1322,12 @@ } - // If the capacity is below the minimum capacity, allow the // expansion. Also set the high-water-mark (capacity_until_GC) // to that minimum capacity so that a GC will not be induced // until that minimum capacity is exceeded. + size_t committed_capacity_bytes = MetaspaceAux::allocated_capacity_bytes(); + size_t metaspace_size_bytes = MetaspaceSize; if (committed_capacity_bytes < metaspace_size_bytes || capacity_until_GC() == 0) { set_capacity_until_GC(metaspace_size_bytes); @@ -1556,19 +1561,7 @@ // ChunkManager methods -// Verification of _free_chunks_total and _free_chunks_count does not -// work with the CMS collector because its use of additional locks -// complicate the mutex deadlock detection but it can still be useful -// for detecting errors in the chunk accounting with other collectors. - size_t ChunkManager::free_chunks_total() { -#ifdef ASSERT - if (!UseConcMarkSweepGC && !SpaceManager::expand_lock()->is_locked()) { - MutexLockerEx cl(SpaceManager::expand_lock(), - Mutex::_no_safepoint_check_flag); - slow_locked_verify_free_chunks_total(); - } -#endif return _free_chunks_total; } @@ -1866,13 +1859,11 @@ Metachunk* chunk = chunks_in_use(index); // Count the free space in all the chunk but not the // current chunk from which allocations are still being done. - if (chunk != NULL) { - Metachunk* prev = chunk; - while (chunk != NULL && chunk != current_chunk()) { + while (chunk != NULL) { + if (chunk != current_chunk()) { result += chunk->free_word_size(); - prev = chunk; - chunk = chunk->next(); } + chunk = chunk->next(); } return result; } @@ -1961,8 +1952,7 @@ // chunks will be allocated. size_t chunk_word_size; if (chunks_in_use(MediumIndex) == NULL && - (!has_small_chunk_limit() || - sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit)) { + sum_count_in_chunks_in_use(SmallIndex) < _small_chunk_limit) { chunk_word_size = (size_t) small_chunk_size(); if (word_size + Metachunk::overhead() > small_chunk_size()) { chunk_word_size = medium_chunk_size(); @@ -2608,14 +2598,14 @@ "->" SIZE_FORMAT "(" SIZE_FORMAT ")", prev_metadata_used, - allocated_capacity_bytes(), + allocated_used_bytes(), reserved_in_bytes()); } else { gclog_or_tty->print(" " SIZE_FORMAT "K" "->" SIZE_FORMAT "K" "(" SIZE_FORMAT "K)", prev_metadata_used / K, - allocated_capacity_bytes() / K, + allocated_used_bytes() / K, reserved_in_bytes()/ K); } @@ -2671,10 +2661,10 @@ // Print total fragmentation for class and data metaspaces separately void MetaspaceAux::print_waste(outputStream* out) { - size_t specialized_waste = 0, small_waste = 0, medium_waste = 0, large_waste = 0; - size_t specialized_count = 0, small_count = 0, medium_count = 0, large_count = 0; - size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0, cls_large_waste = 0; - size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_large_count = 0; + size_t specialized_waste = 0, small_waste = 0, medium_waste = 0; + size_t specialized_count = 0, small_count = 0, medium_count = 0, humongous_count = 0; + size_t cls_specialized_waste = 0, cls_small_waste = 0, cls_medium_waste = 0; + size_t cls_specialized_count = 0, cls_small_count = 0, cls_medium_count = 0, cls_humongous_count = 0; ClassLoaderDataGraphMetaspaceIterator iter; while (iter.repeat()) { @@ -2686,8 +2676,7 @@ small_count += msp->vsm()->sum_count_in_chunks_in_use(SmallIndex); medium_waste += msp->vsm()->sum_waste_in_chunks_in_use(MediumIndex); medium_count += msp->vsm()->sum_count_in_chunks_in_use(MediumIndex); - large_waste += msp->vsm()->sum_waste_in_chunks_in_use(HumongousIndex); - large_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex); + humongous_count += msp->vsm()->sum_count_in_chunks_in_use(HumongousIndex); cls_specialized_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(SpecializedIndex); cls_specialized_count += msp->class_vsm()->sum_count_in_chunks_in_use(SpecializedIndex); @@ -2695,20 +2684,23 @@ cls_small_count += msp->class_vsm()->sum_count_in_chunks_in_use(SmallIndex); cls_medium_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(MediumIndex); cls_medium_count += msp->class_vsm()->sum_count_in_chunks_in_use(MediumIndex); - cls_large_waste += msp->class_vsm()->sum_waste_in_chunks_in_use(HumongousIndex); - cls_large_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex); + cls_humongous_count += msp->class_vsm()->sum_count_in_chunks_in_use(HumongousIndex); } } out->print_cr("Total fragmentation waste (words) doesn't count free space"); out->print_cr(" data: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", " SIZE_FORMAT " small(s) " SIZE_FORMAT ", " - SIZE_FORMAT " medium(s) " SIZE_FORMAT, + SIZE_FORMAT " medium(s) " SIZE_FORMAT ", " + "large count " SIZE_FORMAT, specialized_count, specialized_waste, small_count, - small_waste, medium_count, medium_waste); + small_waste, medium_count, medium_waste, humongous_count); out->print_cr(" class: " SIZE_FORMAT " specialized(s) " SIZE_FORMAT ", " - SIZE_FORMAT " small(s) " SIZE_FORMAT, + SIZE_FORMAT " small(s) " SIZE_FORMAT ", " + SIZE_FORMAT " medium(s) " SIZE_FORMAT ", " + "large count " SIZE_FORMAT, cls_specialized_count, cls_specialized_waste, - cls_small_count, cls_small_waste); + cls_small_count, cls_small_waste, + cls_medium_count, cls_medium_waste, cls_humongous_count); } // Dump global metaspace things from the end of ClassLoaderDataGraph @@ -3049,18 +3041,24 @@ if (Verbose && TraceMetadataChunkAllocation) { gclog_or_tty->print_cr("Metaspace allocation failed for size " SIZE_FORMAT, word_size); - if (loader_data->metaspace_or_null() != NULL) loader_data->metaspace_or_null()->dump(gclog_or_tty); + if (loader_data->metaspace_or_null() != NULL) loader_data->dump(gclog_or_tty); MetaspaceAux::dump(gclog_or_tty); } // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support - report_java_out_of_memory("Metadata space"); + const char* space_string = (mdtype == ClassType) ? "Class Metadata space" : + "Metadata space"; + report_java_out_of_memory(space_string); if (JvmtiExport::should_post_resource_exhausted()) { JvmtiExport::post_resource_exhausted( JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR, - "Metadata space"); + space_string); } - THROW_OOP_0(Universe::out_of_memory_error_perm_gen()); + if (mdtype == ClassType) { + THROW_OOP_0(Universe::out_of_memory_error_class_metaspace()); + } else { + THROW_OOP_0(Universe::out_of_memory_error_metaspace()); + } } } return Metablock::initialize(result, word_size); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/metaspaceShared.cpp --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -826,35 +826,15 @@ bool reading() const { return true; } }; - -// Save bounds of shared spaces mapped in. -static char* _ro_base = NULL; -static char* _rw_base = NULL; -static char* _md_base = NULL; -static char* _mc_base = NULL; - // Return true if given address is in the mapped shared space. bool MetaspaceShared::is_in_shared_space(const void* p) { - if (_ro_base == NULL || _rw_base == NULL) { - return false; - } else { - return ((p >= _ro_base && p < (_ro_base + SharedReadOnlySize)) || - (p >= _rw_base && p < (_rw_base + SharedReadWriteSize))); - } + return UseSharedSpaces && FileMapInfo::current_info()->is_in_shared_space(p); } void MetaspaceShared::print_shared_spaces() { - gclog_or_tty->print_cr("Shared Spaces:"); - gclog_or_tty->print(" read-only " INTPTR_FORMAT "-" INTPTR_FORMAT, - _ro_base, _ro_base + SharedReadOnlySize); - gclog_or_tty->print(" read-write " INTPTR_FORMAT "-" INTPTR_FORMAT, - _rw_base, _rw_base + SharedReadWriteSize); - gclog_or_tty->cr(); - gclog_or_tty->print(" misc-data " INTPTR_FORMAT "-" INTPTR_FORMAT, - _md_base, _md_base + SharedMiscDataSize); - gclog_or_tty->print(" misc-code " INTPTR_FORMAT "-" INTPTR_FORMAT, - _mc_base, _mc_base + SharedMiscCodeSize); - gclog_or_tty->cr(); + if (UseSharedSpaces) { + FileMapInfo::current_info()->print_shared_spaces(); + } } @@ -874,6 +854,11 @@ assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces"); + char* _ro_base = NULL; + char* _rw_base = NULL; + char* _md_base = NULL; + char* _mc_base = NULL; + // Map each shared region if ((_ro_base = mapinfo->map_region(ro)) != NULL && (_rw_base = mapinfo->map_region(rw)) != NULL && diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/referenceProcessorStats.hpp --- a/hotspot/src/share/vm/memory/referenceProcessorStats.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/referenceProcessorStats.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/sharedHeap.hpp --- a/hotspot/src/share/vm/memory/sharedHeap.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/sharedHeap.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -166,11 +166,6 @@ // Same as above, restricted to a memory region. virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0; - // Iterate over all objects allocated since the last collection, calling - // "cl->do_object" on each. The heap must have been initialized properly - // to support this function, or else this call will fail. - virtual void object_iterate_since_last_GC(ObjectClosure* cl) = 0; - // Iterate over all spaces in use in the heap, in an undefined order. virtual void space_iterate(SpaceClosure* cl) = 0; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/universe.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -52,7 +52,6 @@ #include "oops/oop.inline.hpp" #include "oops/typeArrayKlass.hpp" #include "prims/jvmtiRedefineClassesTrace.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/arguments.hpp" #include "runtime/deoptimization.hpp" #include "runtime/fprofiler.hpp" @@ -111,7 +110,8 @@ LatestMethodOopCache* Universe::_pd_implies_cache = NULL; ActiveMethodOopsCache* Universe::_reflect_invoke_cache = NULL; oop Universe::_out_of_memory_error_java_heap = NULL; -oop Universe::_out_of_memory_error_perm_gen = NULL; +oop Universe::_out_of_memory_error_metaspace = NULL; +oop Universe::_out_of_memory_error_class_metaspace = NULL; oop Universe::_out_of_memory_error_array_size = NULL; oop Universe::_out_of_memory_error_gc_overhead_limit = NULL; objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; @@ -180,7 +180,8 @@ f->do_oop((oop*)&_the_null_string); f->do_oop((oop*)&_the_min_jint_string); f->do_oop((oop*)&_out_of_memory_error_java_heap); - f->do_oop((oop*)&_out_of_memory_error_perm_gen); + f->do_oop((oop*)&_out_of_memory_error_metaspace); + f->do_oop((oop*)&_out_of_memory_error_class_metaspace); f->do_oop((oop*)&_out_of_memory_error_array_size); f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit); f->do_oop((oop*)&_preallocated_out_of_memory_error_array); @@ -563,7 +564,8 @@ // a potential loop which could happen if an out of memory occurs when attempting // to allocate the backtrace. return ((throwable() != Universe::_out_of_memory_error_java_heap) && - (throwable() != Universe::_out_of_memory_error_perm_gen) && + (throwable() != Universe::_out_of_memory_error_metaspace) && + (throwable() != Universe::_out_of_memory_error_class_metaspace) && (throwable() != Universe::_out_of_memory_error_array_size) && (throwable() != Universe::_out_of_memory_error_gc_overhead_limit)); } @@ -1014,7 +1016,8 @@ k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_OutOfMemoryError(), true, CHECK_false); k_h = instanceKlassHandle(THREAD, k); Universe::_out_of_memory_error_java_heap = k_h->allocate_instance(CHECK_false); - Universe::_out_of_memory_error_perm_gen = k_h->allocate_instance(CHECK_false); + Universe::_out_of_memory_error_metaspace = k_h->allocate_instance(CHECK_false); + Universe::_out_of_memory_error_class_metaspace = k_h->allocate_instance(CHECK_false); Universe::_out_of_memory_error_array_size = k_h->allocate_instance(CHECK_false); Universe::_out_of_memory_error_gc_overhead_limit = k_h->allocate_instance(CHECK_false); @@ -1047,7 +1050,9 @@ java_lang_Throwable::set_message(Universe::_out_of_memory_error_java_heap, msg()); msg = java_lang_String::create_from_str("Metadata space", CHECK_false); - java_lang_Throwable::set_message(Universe::_out_of_memory_error_perm_gen, msg()); + java_lang_Throwable::set_message(Universe::_out_of_memory_error_metaspace, msg()); + msg = java_lang_String::create_from_str("Class Metadata space", CHECK_false); + java_lang_Throwable::set_message(Universe::_out_of_memory_error_class_metaspace, msg()); msg = java_lang_String::create_from_str("Requested array size exceeds VM limit", CHECK_false); java_lang_Throwable::set_message(Universe::_out_of_memory_error_array_size, msg()); @@ -1147,6 +1152,7 @@ // Initialize performance counters for metaspaces MetaspaceCounters::initialize_performance_counters(); + MemoryService::add_metaspace_memory_pools(); GC_locker::unlock(); // allow gc after bootstrapping diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/memory/universe.hpp --- a/hotspot/src/share/vm/memory/universe.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/memory/universe.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -178,10 +178,12 @@ static LatestMethodOopCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector static LatestMethodOopCache* _pd_implies_cache; // method for checking protection domain attributes static ActiveMethodOopsCache* _reflect_invoke_cache; // method for security checks - static oop _out_of_memory_error_java_heap; // preallocated error object (no backtrace) - static oop _out_of_memory_error_perm_gen; // preallocated error object (no backtrace) - static oop _out_of_memory_error_array_size;// preallocated error object (no backtrace) - static oop _out_of_memory_error_gc_overhead_limit; // preallocated error object (no backtrace) + // preallocated error objects (no backtrace) + static oop _out_of_memory_error_java_heap; + static oop _out_of_memory_error_metaspace; + static oop _out_of_memory_error_class_metaspace; + static oop _out_of_memory_error_array_size; + static oop _out_of_memory_error_gc_overhead_limit; static Array* _the_empty_int_array; // Canonicalized int array static Array* _the_empty_short_array; // Canonicalized short array @@ -352,7 +354,8 @@ // may or may not have a backtrace. If error has a backtrace then the stack trace is already // filled in. static oop out_of_memory_error_java_heap() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); } - static oop out_of_memory_error_perm_gen() { return gen_out_of_memory_error(_out_of_memory_error_perm_gen); } + static oop out_of_memory_error_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_metaspace); } + static oop out_of_memory_error_class_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_class_metaspace); } static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); } static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/arrayKlass.cpp --- a/hotspot/src/share/vm/oops/arrayKlass.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/arrayKlass.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -71,7 +71,6 @@ } ArrayKlass::ArrayKlass(Symbol* name) { - set_alloc_size(0); set_name(name); set_super(Universe::is_bootstrapping() ? (Klass*)NULL : SystemDictionary::Object_klass()); @@ -161,12 +160,6 @@ } } - -void ArrayKlass::with_array_klasses_do(void f(Klass* k)) { - array_klasses_do(f); -} - - // GC support void ArrayKlass::oops_do(OopClosure* cl) { @@ -221,8 +214,8 @@ // Verification -void ArrayKlass::verify_on(outputStream* st) { - Klass::verify_on(st); +void ArrayKlass::verify_on(outputStream* st, bool check_dictionary) { + Klass::verify_on(st, check_dictionary); if (component_mirror() != NULL) { guarantee(component_mirror()->klass() != NULL, "should have a class"); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/arrayKlass.hpp --- a/hotspot/src/share/vm/oops/arrayKlass.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/arrayKlass.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -39,7 +39,6 @@ Klass* volatile _higher_dimension; // Refers the (n+1)'th-dimensional array (if present). Klass* volatile _lower_dimension; // Refers the (n-1)'th-dimensional array (if present). int _vtable_len; // size of vtable for this klass - juint _alloc_size; // allocation profiling support oop _component_mirror; // component type, as a java/lang/Class protected: @@ -65,10 +64,6 @@ void set_lower_dimension(Klass* k) { _lower_dimension = k; } Klass** adr_lower_dimension() { return (Klass**)&this->_lower_dimension;} - // Allocation profiling support - juint alloc_size() const { return _alloc_size; } - void set_alloc_size(juint n) { _alloc_size = n; } - // offset of first element, including any padding for the sake of alignment int array_header_in_bytes() const { return layout_helper_header_size(layout_helper()); } int log2_element_size() const { return layout_helper_log2_element_size(layout_helper()); } @@ -126,7 +121,6 @@ // Iterators void array_klasses_do(void f(Klass* k)); void array_klasses_do(void f(Klass* k, TRAPS), TRAPS); - void with_array_klasses_do(void f(Klass* k)); // GC support virtual void oops_do(OopClosure* cl); @@ -152,7 +146,7 @@ void oop_print_on(oop obj, outputStream* st); // Verification - void verify_on(outputStream* st); + void verify_on(outputStream* st, bool check_dictionary); void oop_verify_on(oop obj, outputStream* st); }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/compiledICHolder.cpp --- a/hotspot/src/share/vm/oops/compiledICHolder.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/compiledICHolder.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -48,8 +48,6 @@ // Verification void CompiledICHolder::verify_on(outputStream* st) { - guarantee(holder_method()->is_metadata(), "should be in metaspace"); guarantee(holder_method()->is_method(), "should be method"); - guarantee(holder_klass()->is_metadata(), "should be in metaspace"); guarantee(holder_klass()->is_klass(), "should be klass"); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/constMethod.cpp --- a/hotspot/src/share/vm/oops/constMethod.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/constMethod.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -440,7 +440,6 @@ void ConstMethod::verify_on(outputStream* st) { guarantee(is_constMethod(), "object must be constMethod"); - guarantee(is_metadata(), err_msg("Should be metadata " PTR_FORMAT, this)); // Verification can occur during oop construction before the method or // other fields have been initialized. diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/constantPool.cpp --- a/hotspot/src/share/vm/oops/constantPool.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/constantPool.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -2095,12 +2095,10 @@ CPSlot entry = slot_at(i); if (tag.is_klass()) { if (entry.is_resolved()) { - guarantee(entry.get_klass()->is_metadata(), "should be metadata"); guarantee(entry.get_klass()->is_klass(), "should be klass"); } } else if (tag.is_unresolved_klass()) { if (entry.is_resolved()) { - guarantee(entry.get_klass()->is_metadata(), "should be metadata"); guarantee(entry.get_klass()->is_klass(), "should be klass"); } } else if (tag.is_symbol()) { @@ -2112,13 +2110,11 @@ if (cache() != NULL) { // Note: cache() can be NULL before a class is completely setup or // in temporary constant pools used during constant pool merging - guarantee(cache()->is_metadata(), "should be metadata"); guarantee(cache()->is_constantPoolCache(), "should be constant pool cache"); } if (pool_holder() != NULL) { // Note: pool_holder() can be NULL in temporary constant pools // used during constant pool merging - guarantee(pool_holder()->is_metadata(), "should be metadata"); guarantee(pool_holder()->is_klass(), "should be klass"); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1321,12 +1321,6 @@ ArrayKlass::cast(array_klasses())->array_klasses_do(f); } - -void InstanceKlass::with_array_klasses_do(void f(Klass* k)) { - f(this); - array_klasses_do(f); -} - #ifdef ASSERT static int linear_search(Array* methods, Symbol* name, Symbol* signature) { int len = methods->length(); @@ -3088,27 +3082,26 @@ virtual void do_oop(narrowOop* p) { VerifyFieldClosure::do_oop_work(p); } }; -void InstanceKlass::verify_on(outputStream* st) { - Klass::verify_on(st); - Thread *thread = Thread::current(); - +void InstanceKlass::verify_on(outputStream* st, bool check_dictionary) { #ifndef PRODUCT - // Avoid redundant verifies + // Avoid redundant verifies, this really should be in product. if (_verify_count == Universe::verify_count()) return; _verify_count = Universe::verify_count(); #endif - // Verify that klass is present in SystemDictionary - if (is_loaded() && !is_anonymous()) { + + // Verify Klass + Klass::verify_on(st, check_dictionary); + + // Verify that klass is present in SystemDictionary if not already + // verifying the SystemDictionary. + if (is_loaded() && !is_anonymous() && check_dictionary) { Symbol* h_name = name(); SystemDictionary::verify_obj_klass_present(h_name, class_loader_data()); } - // Verify static fields - VerifyFieldClosure blk; - // Verify vtables if (is_linked()) { - ResourceMark rm(thread); + ResourceMark rm; // $$$ This used to be done only for m/s collections. Doing it // always seemed a valid generalization. (DLD -- 6/00) vtable()->verify(st); @@ -3116,7 +3109,6 @@ // Verify first subklass if (subklass_oop() != NULL) { - guarantee(subklass_oop()->is_metadata(), "should be in metaspace"); guarantee(subklass_oop()->is_klass(), "should be klass"); } @@ -3128,7 +3120,6 @@ fatal(err_msg("subclass points to itself " PTR_FORMAT, sib)); } - guarantee(sib->is_metadata(), "should be in metaspace"); guarantee(sib->is_klass(), "should be klass"); guarantee(sib->super() == super, "siblings should have same superklass"); } @@ -3164,7 +3155,6 @@ if (methods() != NULL) { Array* methods = this->methods(); for (int j = 0; j < methods->length(); j++) { - guarantee(methods->at(j)->is_metadata(), "should be in metaspace"); guarantee(methods->at(j)->is_method(), "non-method in methods array"); } for (int j = 0; j < methods->length() - 1; j++) { @@ -3202,16 +3192,13 @@ // Verify other fields if (array_klasses() != NULL) { - guarantee(array_klasses()->is_metadata(), "should be in metaspace"); guarantee(array_klasses()->is_klass(), "should be klass"); } if (constants() != NULL) { - guarantee(constants()->is_metadata(), "should be in metaspace"); guarantee(constants()->is_constantPool(), "should be constant pool"); } const Klass* host = host_klass(); if (host != NULL) { - guarantee(host->is_metadata(), "should be in metaspace"); guarantee(host->is_klass(), "should be klass"); } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/instanceKlass.hpp --- a/hotspot/src/share/vm/oops/instanceKlass.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -794,7 +794,6 @@ void methods_do(void f(Method* method)); void array_klasses_do(void f(Klass* k)); void array_klasses_do(void f(Klass* k, TRAPS), TRAPS); - void with_array_klasses_do(void f(Klass* k)); bool super_types_do(SuperTypeClosure* blk); // Casting from Klass* @@ -874,10 +873,6 @@ } } - // Allocation profiling support - juint alloc_size() const { return _alloc_count * size_helper(); } - void set_alloc_size(juint n) {} - // Use this to return the size of an instance in heap words: int size_helper() const { return layout_helper_to_size_helper(layout_helper()); @@ -1050,7 +1045,7 @@ const char* internal_name() const; // Verification - void verify_on(outputStream* st); + void verify_on(outputStream* st, bool check_dictionary); void oop_verify_on(oop obj, outputStream* st); }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/klass.cpp --- a/hotspot/src/share/vm/oops/klass.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/klass.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -168,7 +168,6 @@ set_subklass(NULL); set_next_sibling(NULL); set_next_link(NULL); - set_alloc_count(0); TRACE_INIT_ID(this); set_prototype_header(markOopDesc::prototype()); @@ -377,7 +376,6 @@ } bool Klass::is_loader_alive(BoolObjectClosure* is_alive) { - assert(is_metadata(), "p is not meta-data"); assert(ClassLoaderDataGraph::contains((address)this), "is in the metaspace"); #ifdef ASSERT @@ -544,12 +542,6 @@ return NULL; } - -void Klass::with_array_klasses_do(void f(Klass* k)) { - f(this); -} - - oop Klass::class_loader() const { return class_loader_data()->class_loader(); } const char* Klass::external_name() const { @@ -648,27 +640,24 @@ // Verification -void Klass::verify_on(outputStream* st) { - guarantee(!Universe::heap()->is_in_reserved(this), "Shouldn't be"); - guarantee(this->is_metadata(), "should be in metaspace"); +void Klass::verify_on(outputStream* st, bool check_dictionary) { + // This can be expensive, but it is worth checking that this klass is actually + // in the CLD graph but not in production. assert(ClassLoaderDataGraph::contains((address)this), "Should be"); guarantee(this->is_klass(),"should be klass"); if (super() != NULL) { - guarantee(super()->is_metadata(), "should be in metaspace"); guarantee(super()->is_klass(), "should be klass"); } if (secondary_super_cache() != NULL) { Klass* ko = secondary_super_cache(); - guarantee(ko->is_metadata(), "should be in metaspace"); guarantee(ko->is_klass(), "should be klass"); } for ( uint i = 0; i < primary_super_limit(); i++ ) { Klass* ko = _primary_supers[i]; if (ko != NULL) { - guarantee(ko->is_metadata(), "should be in metaspace"); guarantee(ko->is_klass(), "should be klass"); } } @@ -680,7 +669,6 @@ void Klass::oop_verify_on(oop obj, outputStream* st) { guarantee(obj->is_oop(), "should be oop"); - guarantee(obj->klass()->is_metadata(), "should not be in Java heap"); guarantee(obj->klass()->is_klass(), "klass field is not a klass"); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/klass.hpp --- a/hotspot/src/share/vm/oops/klass.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/klass.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -79,7 +79,6 @@ // [last_biased_lock_bulk_revocation_time] (64 bits) // [prototype_header] // [biased_lock_revocation_count] -// [alloc_count ] // [_modified_oops] // [_accumulated_modified_oops] // [trace_id] @@ -171,8 +170,6 @@ markOop _prototype_header; // Used when biased locking is both enabled and disabled for this type jint _biased_lock_revocation_count; - juint _alloc_count; // allocation profiling support - TRACE_DEFINE_KLASS_TRACE_ID; // Remembered sets support for the oops in the klasses. @@ -290,11 +287,6 @@ void set_next_sibling(Klass* s); public: - // Allocation profiling support - juint alloc_count() const { return _alloc_count; } - void set_alloc_count(juint n) { _alloc_count = n; } - virtual juint alloc_size() const = 0; - virtual void set_alloc_size(juint n) = 0; // Compiler support static ByteSize super_offset() { return in_ByteSize(offset_of(Klass, _super)); } @@ -677,7 +669,6 @@ #endif // INCLUDE_ALL_GCS virtual void array_klasses_do(void f(Klass* k)) {} - virtual void with_array_klasses_do(void f(Klass* k)); // Return self, except for abstract classes with exactly 1 // implementor. Then return the 1 concrete implementation. @@ -703,8 +694,8 @@ virtual const char* internal_name() const = 0; // Verification - virtual void verify_on(outputStream* st); - void verify() { verify_on(tty); } + virtual void verify_on(outputStream* st, bool check_dictionary); + void verify(bool check_dictionary = true) { verify_on(tty, check_dictionary); } #ifndef PRODUCT void verify_vtable_index(int index); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/method.cpp --- a/hotspot/src/share/vm/oops/method.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/method.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1969,14 +1969,9 @@ void Method::verify_on(outputStream* st) { guarantee(is_method(), "object must be method"); - guarantee(is_metadata(), "should be metadata"); guarantee(constants()->is_constantPool(), "should be constant pool"); - guarantee(constants()->is_metadata(), "should be metadata"); guarantee(constMethod()->is_constMethod(), "should be ConstMethod*"); - guarantee(constMethod()->is_metadata(), "should be metadata"); MethodData* md = method_data(); guarantee(md == NULL || - md->is_metadata(), "should be metadata"); - guarantee(md == NULL || md->is_methodData(), "should be method data"); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/objArrayKlass.cpp --- a/hotspot/src/share/vm/oops/objArrayKlass.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -676,11 +676,9 @@ // Verification -void ObjArrayKlass::verify_on(outputStream* st) { - ArrayKlass::verify_on(st); - guarantee(element_klass()->is_metadata(), "should be in metaspace"); +void ObjArrayKlass::verify_on(outputStream* st, bool check_dictionary) { + ArrayKlass::verify_on(st, check_dictionary); guarantee(element_klass()->is_klass(), "should be klass"); - guarantee(bottom_klass()->is_metadata(), "should be in metaspace"); guarantee(bottom_klass()->is_klass(), "should be klass"); Klass* bk = bottom_klass(); guarantee(bk->oop_is_instance() || bk->oop_is_typeArray(), "invalid bottom klass"); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/objArrayKlass.hpp --- a/hotspot/src/share/vm/oops/objArrayKlass.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/objArrayKlass.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -151,7 +151,7 @@ const char* internal_name() const; // Verification - void verify_on(outputStream* st); + void verify_on(outputStream* st, bool check_dictionary); void oop_verify_on(oop obj, outputStream* st); }; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/symbol.cpp --- a/hotspot/src/share/vm/oops/symbol.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/symbol.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -32,7 +32,9 @@ #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" -Symbol::Symbol(const u1* name, int length, int refcount) : _refcount(refcount), _length(length) { +Symbol::Symbol(const u1* name, int length, int refcount) { + _refcount = refcount; + _length = length; _identity_hash = os::random(); for (int i = 0; i < _length; i++) { byte_at_put(i, name[i]); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/oops/symbol.hpp --- a/hotspot/src/share/vm/oops/symbol.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/oops/symbol.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -27,6 +27,7 @@ #include "utilities/utf8.hpp" #include "memory/allocation.hpp" +#include "runtime/atomic.hpp" // A Symbol is a canonicalized string. // All Symbols reside in global SymbolTable and are reference counted. @@ -101,14 +102,22 @@ // type without virtual functions. class ClassLoaderData; -class Symbol : public MetaspaceObj { +// We separate the fields in SymbolBase from Symbol::_body so that +// Symbol::size(int) can correctly calculate the space needed. +class SymbolBase : public MetaspaceObj { + public: + ATOMIC_SHORT_PAIR( + volatile short _refcount, // needs atomic operation + unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op) + ); + int _identity_hash; +}; + +class Symbol : private SymbolBase { friend class VMStructs; friend class SymbolTable; friend class MoveSymbols; private: - volatile int _refcount; - int _identity_hash; - unsigned short _length; // number of UTF8 characters in the symbol jbyte _body[1]; enum { @@ -117,7 +126,7 @@ }; static int size(int length) { - size_t sz = heap_word_size(sizeof(Symbol) + (length > 0 ? length - 1 : 0)); + size_t sz = heap_word_size(sizeof(SymbolBase) + (length > 0 ? length : 0)); return align_object_size(sz); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/escape.cpp --- a/hotspot/src/share/vm/opto/escape.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/escape.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -933,6 +933,7 @@ (call->as_CallLeaf()->_name != NULL && (strcmp(call->as_CallLeaf()->_name, "g1_wb_pre") == 0 || strcmp(call->as_CallLeaf()->_name, "g1_wb_post") == 0 || + strcmp(call->as_CallLeaf()->_name, "updateBytesCRC32") == 0 || strcmp(call->as_CallLeaf()->_name, "aescrypt_encryptBlock") == 0 || strcmp(call->as_CallLeaf()->_name, "aescrypt_decryptBlock") == 0 || strcmp(call->as_CallLeaf()->_name, "cipherBlockChaining_encryptAESCrypt") == 0 || diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/graphKit.cpp --- a/hotspot/src/share/vm/opto/graphKit.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/graphKit.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -3332,9 +3332,14 @@ if (ptr == NULL) { // reduce dumb test in callers return NULL; } - ptr = ptr->uncast(); // strip a raw-to-oop cast - if (ptr == NULL) return NULL; - + if (ptr->is_CheckCastPP()) { // strip only one raw-to-oop cast + ptr = ptr->in(1); + if (ptr == NULL) return NULL; + } + // Return NULL for allocations with several casts: + // j.l.reflect.Array.newInstance(jobject, jint) + // Object.clone() + // to keep more precise type from last cast. if (ptr->is_Proj()) { Node* allo = ptr->in(0); if (allo != NULL && allo->is_Allocate()) { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/library_call.cpp --- a/hotspot/src/share/vm/opto/library_call.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/library_call.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -291,6 +291,9 @@ Node* inline_cipherBlockChaining_AESCrypt_predicate(bool decrypting); Node* get_key_start_from_aescrypt_object(Node* aescrypt_object); bool inline_encodeISOArray(); + bool inline_updateCRC32(); + bool inline_updateBytesCRC32(); + bool inline_updateByteBufferCRC32(); }; @@ -488,6 +491,12 @@ is_predicted = true; break; + case vmIntrinsics::_updateCRC32: + case vmIntrinsics::_updateBytesCRC32: + case vmIntrinsics::_updateByteBufferCRC32: + if (!UseCRC32Intrinsics) return NULL; + break; + default: assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility"); assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?"); @@ -807,6 +816,13 @@ case vmIntrinsics::_encodeISOArray: return inline_encodeISOArray(); + case vmIntrinsics::_updateCRC32: + return inline_updateCRC32(); + case vmIntrinsics::_updateBytesCRC32: + return inline_updateBytesCRC32(); + case vmIntrinsics::_updateByteBufferCRC32: + return inline_updateByteBufferCRC32(); + default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. @@ -884,7 +900,7 @@ IfNode* iff = create_and_map_if(control(), test, true_prob, COUNT_UNKNOWN); - Node* if_slow = _gvn.transform( new (C) IfTrueNode(iff) ); + Node* if_slow = _gvn.transform(new (C) IfTrueNode(iff)); if (if_slow == top()) { // The slow branch is never taken. No need to build this guard. return NULL; @@ -893,7 +909,7 @@ if (region != NULL) region->add_req(if_slow); - Node* if_fast = _gvn.transform( new (C) IfFalseNode(iff) ); + Node* if_fast = _gvn.transform(new (C) IfFalseNode(iff)); set_control(if_fast); return if_slow; @@ -912,8 +928,8 @@ return NULL; // already stopped if (_gvn.type(index)->higher_equal(TypeInt::POS)) // [0,maxint] return NULL; // index is already adequately typed - Node* cmp_lt = _gvn.transform( new (C) CmpINode(index, intcon(0)) ); - Node* bol_lt = _gvn.transform( new (C) BoolNode(cmp_lt, BoolTest::lt) ); + Node* cmp_lt = _gvn.transform(new (C) CmpINode(index, intcon(0))); + Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt)); Node* is_neg = generate_guard(bol_lt, region, PROB_MIN); if (is_neg != NULL && pos_index != NULL) { // Emulate effect of Parse::adjust_map_after_if. @@ -930,9 +946,9 @@ return NULL; // already stopped if (_gvn.type(index)->higher_equal(TypeInt::POS1)) // [1,maxint] return NULL; // index is already adequately typed - Node* cmp_le = _gvn.transform( new (C) CmpINode(index, intcon(0)) ); + Node* cmp_le = _gvn.transform(new (C) CmpINode(index, intcon(0))); BoolTest::mask le_or_eq = (never_negative ? BoolTest::eq : BoolTest::le); - Node* bol_le = _gvn.transform( new (C) BoolNode(cmp_le, le_or_eq) ); + Node* bol_le = _gvn.transform(new (C) BoolNode(cmp_le, le_or_eq)); Node* is_notp = generate_guard(bol_le, NULL, PROB_MIN); if (is_notp != NULL && pos_index != NULL) { // Emulate effect of Parse::adjust_map_after_if. @@ -968,9 +984,9 @@ return NULL; // common case of whole-array copy Node* last = subseq_length; if (!zero_offset) // last += offset - last = _gvn.transform( new (C) AddINode(last, offset)); - Node* cmp_lt = _gvn.transform( new (C) CmpUNode(array_length, last) ); - Node* bol_lt = _gvn.transform( new (C) BoolNode(cmp_lt, BoolTest::lt) ); + last = _gvn.transform(new (C) AddINode(last, offset)); + Node* cmp_lt = _gvn.transform(new (C) CmpUNode(array_length, last)); + Node* bol_lt = _gvn.transform(new (C) BoolNode(cmp_lt, BoolTest::lt)); Node* is_over = generate_guard(bol_lt, region, PROB_MIN); return is_over; } @@ -1151,8 +1167,8 @@ Node* argument_cnt = load_String_length(no_ctrl, argument); // Check for receiver count != argument count - Node* cmp = _gvn.transform( new(C) CmpINode(receiver_cnt, argument_cnt) ); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::ne) ); + Node* cmp = _gvn.transform(new(C) CmpINode(receiver_cnt, argument_cnt)); + Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::ne)); Node* if_ne = generate_slow_guard(bol, NULL); if (if_ne != NULL) { phi->init_req(4, intcon(0)); @@ -1258,7 +1274,7 @@ Node* sourceOffset = load_String_offset(no_ctrl, string_object); Node* sourceCount = load_String_length(no_ctrl, string_object); - Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) ); + Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true))); jint target_length = target_array->length(); const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin)); const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot); @@ -1365,8 +1381,8 @@ Node* substr_cnt = load_String_length(no_ctrl, arg); // Check for substr count > string count - Node* cmp = _gvn.transform( new(C) CmpINode(substr_cnt, source_cnt) ); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::gt) ); + Node* cmp = _gvn.transform(new(C) CmpINode(substr_cnt, source_cnt)); + Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::gt)); Node* if_gt = generate_slow_guard(bol, NULL); if (if_gt != NULL) { result_phi->init_req(2, intcon(-1)); @@ -1375,8 +1391,8 @@ if (!stopped()) { // Check for substr count == 0 - cmp = _gvn.transform( new(C) CmpINode(substr_cnt, intcon(0)) ); - bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); + cmp = _gvn.transform(new(C) CmpINode(substr_cnt, intcon(0))); + bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq)); Node* if_zero = generate_slow_guard(bol, NULL); if (if_zero != NULL) { result_phi->init_req(3, intcon(0)); @@ -1552,7 +1568,7 @@ // Check PI/4 : abs(arg) Node *cmp = _gvn.transform(new (C) CmpDNode(pi4,abs)); // Check: If PI/4 < abs(arg) then go slow - Node *bol = _gvn.transform( new (C) BoolNode( cmp, BoolTest::lt ) ); + Node *bol = _gvn.transform(new (C) BoolNode( cmp, BoolTest::lt )); // Branch either way IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); set_control(opt_iff(r,iff)); @@ -1617,8 +1633,8 @@ // to the runtime to properly handle corner cases IfNode* iff = create_and_xform_if(control(), bolisnum, PROB_STATIC_FREQUENT, COUNT_UNKNOWN); - Node* if_slow = _gvn.transform( new (C) IfFalseNode(iff) ); - Node* if_fast = _gvn.transform( new (C) IfTrueNode(iff) ); + Node* if_slow = _gvn.transform(new (C) IfFalseNode(iff)); + Node* if_fast = _gvn.transform(new (C) IfTrueNode(iff)); if (!if_slow->is_top()) { RegionNode* result_region = new (C) RegionNode(3); @@ -1704,42 +1720,42 @@ // Check x:0 Node *cmp = _gvn.transform(new (C) CmpDNode(x, zeronode)); // Check: If (x<=0) then go complex path - Node *bol1 = _gvn.transform( new (C) BoolNode( cmp, BoolTest::le ) ); + Node *bol1 = _gvn.transform(new (C) BoolNode( cmp, BoolTest::le )); // Branch either way IfNode *if1 = create_and_xform_if(control(),bol1, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN); // Fast path taken; set region slot 3 - Node *fast_taken = _gvn.transform( new (C) IfFalseNode(if1) ); + Node *fast_taken = _gvn.transform(new (C) IfFalseNode(if1)); r->init_req(3,fast_taken); // Capture fast-control // Fast path not-taken, i.e. slow path - Node *complex_path = _gvn.transform( new (C) IfTrueNode(if1) ); + Node *complex_path = _gvn.transform(new (C) IfTrueNode(if1)); // Set fast path result - Node *fast_result = _gvn.transform( new (C) PowDNode(C, control(), x, y) ); + Node *fast_result = _gvn.transform(new (C) PowDNode(C, control(), x, y)); phi->init_req(3, fast_result); // Complex path // Build the second if node (if y is long) // Node for (long)y - Node *longy = _gvn.transform( new (C) ConvD2LNode(y)); + Node *longy = _gvn.transform(new (C) ConvD2LNode(y)); // Node for (double)((long) y) - Node *doublelongy= _gvn.transform( new (C) ConvL2DNode(longy)); + Node *doublelongy= _gvn.transform(new (C) ConvL2DNode(longy)); // Check (double)((long) y) : y Node *cmplongy= _gvn.transform(new (C) CmpDNode(doublelongy, y)); // Check if (y isn't long) then go to slow path - Node *bol2 = _gvn.transform( new (C) BoolNode( cmplongy, BoolTest::ne ) ); + Node *bol2 = _gvn.transform(new (C) BoolNode( cmplongy, BoolTest::ne )); // Branch either way IfNode *if2 = create_and_xform_if(complex_path,bol2, PROB_STATIC_INFREQUENT, COUNT_UNKNOWN); - Node* ylong_path = _gvn.transform( new (C) IfFalseNode(if2)); - - Node *slow_path = _gvn.transform( new (C) IfTrueNode(if2) ); + Node* ylong_path = _gvn.transform(new (C) IfFalseNode(if2)); + + Node *slow_path = _gvn.transform(new (C) IfTrueNode(if2)); // Calculate DPow(abs(x), y)*(1 & (long)y) // Node for constant 1 Node *conone = longcon(1); // 1& (long)y - Node *signnode= _gvn.transform( new (C) AndLNode(conone, longy) ); + Node *signnode= _gvn.transform(new (C) AndLNode(conone, longy)); // A huge number is always even. Detect a huge number by checking // if y + 1 == y and set integer to be tested for parity to 0. @@ -1747,9 +1763,9 @@ // (long)9.223372036854776E18 = max_jlong // (double)(long)9.223372036854776E18 = 9.223372036854776E18 // max_jlong is odd but 9.223372036854776E18 is even - Node* yplus1 = _gvn.transform( new (C) AddDNode(y, makecon(TypeD::make(1)))); + Node* yplus1 = _gvn.transform(new (C) AddDNode(y, makecon(TypeD::make(1)))); Node *cmpyplus1= _gvn.transform(new (C) CmpDNode(yplus1, y)); - Node *bolyplus1 = _gvn.transform( new (C) BoolNode( cmpyplus1, BoolTest::eq ) ); + Node *bolyplus1 = _gvn.transform(new (C) BoolNode( cmpyplus1, BoolTest::eq )); Node* correctedsign = NULL; if (ConditionalMoveLimit != 0) { correctedsign = _gvn.transform( CMoveNode::make(C, NULL, bolyplus1, signnode, longcon(0), TypeLong::LONG)); @@ -1757,8 +1773,8 @@ IfNode *ifyplus1 = create_and_xform_if(ylong_path,bolyplus1, PROB_FAIR, COUNT_UNKNOWN); RegionNode *r = new (C) RegionNode(3); Node *phi = new (C) PhiNode(r, TypeLong::LONG); - r->init_req(1, _gvn.transform( new (C) IfFalseNode(ifyplus1))); - r->init_req(2, _gvn.transform( new (C) IfTrueNode(ifyplus1))); + r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyplus1))); + r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyplus1))); phi->init_req(1, signnode); phi->init_req(2, longcon(0)); correctedsign = _gvn.transform(phi); @@ -1771,11 +1787,11 @@ // Check (1&(long)y)==0? Node *cmpeq1 = _gvn.transform(new (C) CmpLNode(correctedsign, conzero)); // Check if (1&(long)y)!=0?, if so the result is negative - Node *bol3 = _gvn.transform( new (C) BoolNode( cmpeq1, BoolTest::ne ) ); + Node *bol3 = _gvn.transform(new (C) BoolNode( cmpeq1, BoolTest::ne )); // abs(x) - Node *absx=_gvn.transform( new (C) AbsDNode(x)); + Node *absx=_gvn.transform(new (C) AbsDNode(x)); // abs(x)^y - Node *absxpowy = _gvn.transform( new (C) PowDNode(C, control(), absx, y) ); + Node *absxpowy = _gvn.transform(new (C) PowDNode(C, control(), absx, y)); // -abs(x)^y Node *negabsxpowy = _gvn.transform(new (C) NegDNode (absxpowy)); // (1&(long)y)==1?-DPow(abs(x), y):DPow(abs(x), y) @@ -1786,8 +1802,8 @@ IfNode *ifyeven = create_and_xform_if(ylong_path,bol3, PROB_FAIR, COUNT_UNKNOWN); RegionNode *r = new (C) RegionNode(3); Node *phi = new (C) PhiNode(r, Type::DOUBLE); - r->init_req(1, _gvn.transform( new (C) IfFalseNode(ifyeven))); - r->init_req(2, _gvn.transform( new (C) IfTrueNode(ifyeven))); + r->init_req(1, _gvn.transform(new (C) IfFalseNode(ifyeven))); + r->init_req(2, _gvn.transform(new (C) IfTrueNode(ifyeven))); phi->init_req(1, absxpowy); phi->init_req(2, negabsxpowy); signresult = _gvn.transform(phi); @@ -1920,7 +1936,7 @@ int cmp_op = Op_CmpI; Node* xkey = xvalue; Node* ykey = yvalue; - Node* ideal_cmpxy = _gvn.transform( new(C) CmpINode(xkey, ykey) ); + Node* ideal_cmpxy = _gvn.transform(new(C) CmpINode(xkey, ykey)); if (ideal_cmpxy->is_Cmp()) { // E.g., if we have CmpI(length - offset, count), // it might idealize to CmpI(length, count + offset) @@ -2013,7 +2029,7 @@ default: if (cmpxy == NULL) cmpxy = ideal_cmpxy; - best_bol = _gvn.transform( new(C) BoolNode(cmpxy, BoolTest::lt) ); + best_bol = _gvn.transform(new(C) BoolNode(cmpxy, BoolTest::lt)); // and fall through: case BoolTest::lt: // x < y case BoolTest::le: // x <= y @@ -2073,7 +2089,7 @@ return Type::AnyPtr; } else if (base_type == TypePtr::NULL_PTR) { // Since this is a NULL+long form, we have to switch to a rawptr. - base = _gvn.transform( new (C) CastX2PNode(offset) ); + base = _gvn.transform(new (C) CastX2PNode(offset)); offset = MakeConX(0); return Type::RawPtr; } else if (base_type->base() == Type::RawPtr) { @@ -2467,7 +2483,7 @@ case T_ADDRESS: // Repackage the long as a pointer. val = ConvL2X(val); - val = _gvn.transform( new (C) CastX2PNode(val) ); + val = _gvn.transform(new (C) CastX2PNode(val)); break; } @@ -2775,7 +2791,7 @@ // SCMemProjNodes represent the memory state of a LoadStore. Their // main role is to prevent LoadStore nodes from being optimized away // when their results aren't used. - Node* proj = _gvn.transform( new (C) SCMemProjNode(load_store)); + Node* proj = _gvn.transform(new (C) SCMemProjNode(load_store)); set_memory(proj, alias_idx); // Add the trailing membar surrounding the access @@ -3010,8 +3026,8 @@ Node* rec_thr = argument(0); Node* tls_ptr = NULL; Node* cur_thr = generate_current_thread(tls_ptr); - Node* cmp_thr = _gvn.transform( new (C) CmpPNode(cur_thr, rec_thr) ); - Node* bol_thr = _gvn.transform( new (C) BoolNode(cmp_thr, BoolTest::ne) ); + Node* cmp_thr = _gvn.transform(new (C) CmpPNode(cur_thr, rec_thr)); + Node* bol_thr = _gvn.transform(new (C) BoolNode(cmp_thr, BoolTest::ne)); generate_slow_guard(bol_thr, slow_region); @@ -3022,36 +3038,36 @@ // Set the control input on the field _interrupted read to prevent it floating up. Node* int_bit = make_load(control(), p, TypeInt::BOOL, T_INT); - Node* cmp_bit = _gvn.transform( new (C) CmpINode(int_bit, intcon(0)) ); - Node* bol_bit = _gvn.transform( new (C) BoolNode(cmp_bit, BoolTest::ne) ); + Node* cmp_bit = _gvn.transform(new (C) CmpINode(int_bit, intcon(0))); + Node* bol_bit = _gvn.transform(new (C) BoolNode(cmp_bit, BoolTest::ne)); IfNode* iff_bit = create_and_map_if(control(), bol_bit, PROB_UNLIKELY_MAG(3), COUNT_UNKNOWN); // First fast path: if (!TLS._interrupted) return false; - Node* false_bit = _gvn.transform( new (C) IfFalseNode(iff_bit) ); + Node* false_bit = _gvn.transform(new (C) IfFalseNode(iff_bit)); result_rgn->init_req(no_int_result_path, false_bit); result_val->init_req(no_int_result_path, intcon(0)); // drop through to next case - set_control( _gvn.transform(new (C) IfTrueNode(iff_bit)) ); + set_control( _gvn.transform(new (C) IfTrueNode(iff_bit))); // (c) Or, if interrupt bit is set and clear_int is false, use 2nd fast path. Node* clr_arg = argument(1); - Node* cmp_arg = _gvn.transform( new (C) CmpINode(clr_arg, intcon(0)) ); - Node* bol_arg = _gvn.transform( new (C) BoolNode(cmp_arg, BoolTest::ne) ); + Node* cmp_arg = _gvn.transform(new (C) CmpINode(clr_arg, intcon(0))); + Node* bol_arg = _gvn.transform(new (C) BoolNode(cmp_arg, BoolTest::ne)); IfNode* iff_arg = create_and_map_if(control(), bol_arg, PROB_FAIR, COUNT_UNKNOWN); // Second fast path: ... else if (!clear_int) return true; - Node* false_arg = _gvn.transform( new (C) IfFalseNode(iff_arg) ); + Node* false_arg = _gvn.transform(new (C) IfFalseNode(iff_arg)); result_rgn->init_req(no_clear_result_path, false_arg); result_val->init_req(no_clear_result_path, intcon(1)); // drop through to next case - set_control( _gvn.transform(new (C) IfTrueNode(iff_arg)) ); + set_control( _gvn.transform(new (C) IfTrueNode(iff_arg))); // (d) Otherwise, go to the slow path. slow_region->add_req(control()); - set_control( _gvn.transform(slow_region) ); + set_control( _gvn.transform(slow_region)); if (stopped()) { // There is no slow path. @@ -3107,7 +3123,7 @@ if (region == NULL) never_see_null = true; Node* p = basic_plus_adr(mirror, offset); const TypeKlassPtr* kls_type = TypeKlassPtr::OBJECT_OR_NULL; - Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type) ); + Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type)); Node* null_ctl = top(); kls = null_check_oop(kls, &null_ctl, never_see_null); if (region != NULL) { @@ -3129,9 +3145,9 @@ Node* mods = make_load(NULL, modp, TypeInt::INT, T_INT); Node* mask = intcon(modifier_mask); Node* bits = intcon(modifier_bits); - Node* mbit = _gvn.transform( new (C) AndINode(mods, mask) ); - Node* cmp = _gvn.transform( new (C) CmpINode(mbit, bits) ); - Node* bol = _gvn.transform( new (C) BoolNode(cmp, BoolTest::ne) ); + Node* mbit = _gvn.transform(new (C) AndINode(mods, mask)); + Node* cmp = _gvn.transform(new (C) CmpINode(mbit, bits)); + Node* bol = _gvn.transform(new (C) BoolNode(cmp, BoolTest::ne)); return generate_fair_guard(bol, region); } Node* LibraryCallKit::generate_interface_guard(Node* kls, RegionNode* region) { @@ -3282,7 +3298,7 @@ phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror()))); // If we fall through, it's a plain class. Get its _super. p = basic_plus_adr(kls, in_bytes(Klass::super_offset())); - kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL) ); + kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL)); null_ctl = top(); kls = null_check_oop(kls, &null_ctl); if (null_ctl != top()) { @@ -3395,8 +3411,8 @@ set_control(region->in(_prim_0_path)); // go back to first null check if (!stopped()) { // Since superc is primitive, make a guard for the superc==subc case. - Node* cmp_eq = _gvn.transform( new (C) CmpPNode(args[0], args[1]) ); - Node* bol_eq = _gvn.transform( new (C) BoolNode(cmp_eq, BoolTest::eq) ); + Node* cmp_eq = _gvn.transform(new (C) CmpPNode(args[0], args[1])); + Node* bol_eq = _gvn.transform(new (C) BoolNode(cmp_eq, BoolTest::eq)); generate_guard(bol_eq, region, PROB_FAIR); if (region->req() == PATH_LIMIT+1) { // A guard was added. If the added guard is taken, superc==subc. @@ -3461,11 +3477,11 @@ ? ((jint)Klass::_lh_array_tag_type_value << Klass::_lh_array_tag_shift) : Klass::_lh_neutral_value); - Node* cmp = _gvn.transform( new(C) CmpINode(layout_val, intcon(nval)) ); + Node* cmp = _gvn.transform(new(C) CmpINode(layout_val, intcon(nval))); BoolTest::mask btest = BoolTest::lt; // correct for testing is_[obj]array // invert the test if we are looking for a non-array if (not_array) btest = BoolTest(btest).negate(); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, btest) ); + Node* bol = _gvn.transform(new(C) BoolNode(cmp, btest)); return generate_fair_guard(bol, region); } @@ -3525,7 +3541,7 @@ // Return the combined state. set_i_o( _gvn.transform(result_io) ); - set_all_memory( _gvn.transform(result_mem) ); + set_all_memory( _gvn.transform(result_mem)); C->set_has_split_ifs(true); // Has chance for split-if optimization set_result(result_reg, result_val); @@ -3678,8 +3694,8 @@ const TypePtr* native_call_addr = TypeMetadataPtr::make(method); Node* native_call = makecon(native_call_addr); - Node* chk_native = _gvn.transform( new(C) CmpPNode(target_call, native_call) ); - Node* test_native = _gvn.transform( new(C) BoolNode(chk_native, BoolTest::ne) ); + Node* chk_native = _gvn.transform(new(C) CmpPNode(target_call, native_call)); + Node* test_native = _gvn.transform(new(C) BoolNode(chk_native, BoolTest::ne)); return generate_slow_guard(test_native, slow_region); } @@ -3800,10 +3816,10 @@ // Test the header to see if it is unlocked. Node *lock_mask = _gvn.MakeConX(markOopDesc::biased_lock_mask_in_place); - Node *lmasked_header = _gvn.transform( new (C) AndXNode(header, lock_mask) ); + Node *lmasked_header = _gvn.transform(new (C) AndXNode(header, lock_mask)); Node *unlocked_val = _gvn.MakeConX(markOopDesc::unlocked_value); - Node *chk_unlocked = _gvn.transform( new (C) CmpXNode( lmasked_header, unlocked_val)); - Node *test_unlocked = _gvn.transform( new (C) BoolNode( chk_unlocked, BoolTest::ne) ); + Node *chk_unlocked = _gvn.transform(new (C) CmpXNode( lmasked_header, unlocked_val)); + Node *test_unlocked = _gvn.transform(new (C) BoolNode( chk_unlocked, BoolTest::ne)); generate_slow_guard(test_unlocked, slow_region); @@ -3813,17 +3829,17 @@ // vm: see markOop.hpp. Node *hash_mask = _gvn.intcon(markOopDesc::hash_mask); Node *hash_shift = _gvn.intcon(markOopDesc::hash_shift); - Node *hshifted_header= _gvn.transform( new (C) URShiftXNode(header, hash_shift) ); + Node *hshifted_header= _gvn.transform(new (C) URShiftXNode(header, hash_shift)); // This hack lets the hash bits live anywhere in the mark object now, as long // as the shift drops the relevant bits into the low 32 bits. Note that // Java spec says that HashCode is an int so there's no point in capturing // an 'X'-sized hashcode (32 in 32-bit build or 64 in 64-bit build). hshifted_header = ConvX2I(hshifted_header); - Node *hash_val = _gvn.transform( new (C) AndINode(hshifted_header, hash_mask) ); + Node *hash_val = _gvn.transform(new (C) AndINode(hshifted_header, hash_mask)); Node *no_hash_val = _gvn.intcon(markOopDesc::no_hash); - Node *chk_assigned = _gvn.transform( new (C) CmpINode( hash_val, no_hash_val)); - Node *test_assigned = _gvn.transform( new (C) BoolNode( chk_assigned, BoolTest::eq) ); + Node *chk_assigned = _gvn.transform(new (C) CmpINode( hash_val, no_hash_val)); + Node *test_assigned = _gvn.transform(new (C) BoolNode( chk_assigned, BoolTest::eq)); generate_slow_guard(test_assigned, slow_region); @@ -3854,7 +3870,7 @@ // Return the combined state. set_i_o( _gvn.transform(result_io) ); - set_all_memory( _gvn.transform(result_mem) ); + set_all_memory( _gvn.transform(result_mem)); set_result(result_reg, result_val); return true; @@ -3982,7 +3998,7 @@ Node *opt_isnan = _gvn.transform(ifisnan); assert( opt_isnan->is_If(), "Expect an IfNode"); IfNode *opt_ifisnan = (IfNode*)opt_isnan; - Node *iftrue = _gvn.transform( new (C) IfTrueNode(opt_ifisnan) ); + Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan)); set_control(iftrue); @@ -4023,7 +4039,7 @@ Node *opt_isnan = _gvn.transform(ifisnan); assert( opt_isnan->is_If(), "Expect an IfNode"); IfNode *opt_ifisnan = (IfNode*)opt_isnan; - Node *iftrue = _gvn.transform( new (C) IfTrueNode(opt_ifisnan) ); + Node *iftrue = _gvn.transform(new (C) IfTrueNode(opt_ifisnan)); set_control(iftrue); @@ -4152,8 +4168,8 @@ // Compute the length also, if needed: Node* countx = size; - countx = _gvn.transform( new (C) SubXNode(countx, MakeConX(base_off)) ); - countx = _gvn.transform( new (C) URShiftXNode(countx, intcon(LogBytesPerLong) )); + countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(base_off))); + countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong) )); const TypePtr* raw_adr_type = TypeRawPtr::BOTTOM; bool disjoint_bases = true; @@ -4357,9 +4373,9 @@ } // Return the combined state. - set_control( _gvn.transform(result_reg) ); - set_i_o( _gvn.transform(result_i_o) ); - set_all_memory( _gvn.transform(result_mem) ); + set_control( _gvn.transform(result_reg)); + set_i_o( _gvn.transform(result_i_o)); + set_all_memory( _gvn.transform(result_mem)); } // original reexecute is set back here set_result(_gvn.transform(result_val)); @@ -4684,8 +4700,8 @@ // are dest_head = dest[0..off] and dest_tail = dest[off+len..dest.length]. Node* dest_size = alloc->in(AllocateNode::AllocSize); Node* dest_length = alloc->in(AllocateNode::ALength); - Node* dest_tail = _gvn.transform( new(C) AddINode(dest_offset, - copy_length) ); + Node* dest_tail = _gvn.transform(new(C) AddINode(dest_offset, + copy_length)); // If there is a head section that needs zeroing, do it now. if (find_int_con(dest_offset, -1) != 0) { @@ -4701,8 +4717,8 @@ // the copy to a more hardware-friendly word size of 64 bits. Node* tail_ctl = NULL; if (!stopped() && !dest_tail->eqv_uncast(dest_length)) { - Node* cmp_lt = _gvn.transform( new(C) CmpINode(dest_tail, dest_length) ); - Node* bol_lt = _gvn.transform( new(C) BoolNode(cmp_lt, BoolTest::lt) ); + Node* cmp_lt = _gvn.transform(new(C) CmpINode(dest_tail, dest_length)); + Node* bol_lt = _gvn.transform(new(C) BoolNode(cmp_lt, BoolTest::lt)); tail_ctl = generate_slow_guard(bol_lt, NULL); assert(tail_ctl != NULL || !stopped(), "must be an outcome"); } @@ -4745,7 +4761,7 @@ dest_size); done_ctl->init_req(2, control()); done_mem->init_req(2, memory(adr_type)); - set_control( _gvn.transform(done_ctl) ); + set_control( _gvn.transform(done_ctl)); set_memory( _gvn.transform(done_mem), adr_type ); } } @@ -4832,18 +4848,18 @@ // Clean up after the checked call. // The returned value is either 0 or -1^K, // where K = number of partially transferred array elements. - Node* cmp = _gvn.transform( new(C) CmpINode(checked_value, intcon(0)) ); - Node* bol = _gvn.transform( new(C) BoolNode(cmp, BoolTest::eq) ); + Node* cmp = _gvn.transform(new(C) CmpINode(checked_value, intcon(0))); + Node* bol = _gvn.transform(new(C) BoolNode(cmp, BoolTest::eq)); IfNode* iff = create_and_map_if(control(), bol, PROB_MAX, COUNT_UNKNOWN); // If it is 0, we are done, so transfer to the end. - Node* checks_done = _gvn.transform( new(C) IfTrueNode(iff) ); + Node* checks_done = _gvn.transform(new(C) IfTrueNode(iff)); result_region->init_req(checked_path, checks_done); result_i_o ->init_req(checked_path, checked_i_o); result_memory->init_req(checked_path, checked_mem); // If it is not zero, merge into the slow call. - set_control( _gvn.transform( new(C) IfFalseNode(iff) )); + set_control( _gvn.transform(new(C) IfFalseNode(iff) )); RegionNode* slow_reg2 = new(C) RegionNode(3); PhiNode* slow_i_o2 = new(C) PhiNode(slow_reg2, Type::ABIO); PhiNode* slow_mem2 = new(C) PhiNode(slow_reg2, Type::MEMORY, adr_type); @@ -4866,16 +4882,16 @@ } else { // We must continue the copy exactly where it failed, or else // another thread might see the wrong number of writes to dest. - Node* checked_offset = _gvn.transform( new(C) XorINode(checked_value, intcon(-1)) ); + Node* checked_offset = _gvn.transform(new(C) XorINode(checked_value, intcon(-1))); Node* slow_offset = new(C) PhiNode(slow_reg2, TypeInt::INT); slow_offset->init_req(1, intcon(0)); slow_offset->init_req(2, checked_offset); slow_offset = _gvn.transform(slow_offset); // Adjust the arguments by the conditionally incoming offset. - Node* src_off_plus = _gvn.transform( new(C) AddINode(src_offset, slow_offset) ); - Node* dest_off_plus = _gvn.transform( new(C) AddINode(dest_offset, slow_offset) ); - Node* length_minus = _gvn.transform( new(C) SubINode(copy_length, slow_offset) ); + Node* src_off_plus = _gvn.transform(new(C) AddINode(src_offset, slow_offset)); + Node* dest_off_plus = _gvn.transform(new(C) AddINode(dest_offset, slow_offset)); + Node* length_minus = _gvn.transform(new(C) SubINode(copy_length, slow_offset)); // Tweak the node variables to adjust the code produced below: src_offset = src_off_plus; @@ -4914,7 +4930,7 @@ } // Finished; return the combined state. - set_control( _gvn.transform(result_region) ); + set_control( _gvn.transform(result_region)); set_i_o( _gvn.transform(result_i_o) ); set_memory( _gvn.transform(result_memory), adr_type ); @@ -5096,10 +5112,10 @@ int end_round = (-1 << scale) & (BytesPerLong - 1); Node* end = ConvI2X(slice_len); if (scale != 0) - end = _gvn.transform( new(C) LShiftXNode(end, intcon(scale) )); + end = _gvn.transform(new(C) LShiftXNode(end, intcon(scale) )); end_base += end_round; - end = _gvn.transform( new(C) AddXNode(end, MakeConX(end_base)) ); - end = _gvn.transform( new(C) AndXNode(end, MakeConX(~end_round)) ); + end = _gvn.transform(new(C) AddXNode(end, MakeConX(end_base))); + end = _gvn.transform(new(C) AndXNode(end, MakeConX(~end_round))); mem = ClearArrayNode::clear_memory(control(), mem, dest, start_con, end, &_gvn); } else if (start_con < 0 && dest_size != top()) { @@ -5108,8 +5124,8 @@ Node* start = slice_idx; start = ConvI2X(start); if (scale != 0) - start = _gvn.transform( new(C) LShiftXNode( start, intcon(scale) )); - start = _gvn.transform( new(C) AddXNode(start, MakeConX(abase)) ); + start = _gvn.transform(new(C) LShiftXNode( start, intcon(scale) )); + start = _gvn.transform(new(C) AddXNode(start, MakeConX(abase))); if ((bump_bit | clear_low) != 0) { int to_clear = (bump_bit | clear_low); // Align up mod 8, then store a jint zero unconditionally @@ -5120,14 +5136,14 @@ assert((abase & to_clear) == 0, "array base must be long-aligned"); } else { // Bump 'start' up to (or past) the next jint boundary: - start = _gvn.transform( new(C) AddXNode(start, MakeConX(bump_bit)) ); + start = _gvn.transform(new(C) AddXNode(start, MakeConX(bump_bit))); assert((abase & clear_low) == 0, "array base must be int-aligned"); } // Round bumped 'start' down to jlong boundary in body of array. - start = _gvn.transform( new(C) AndXNode(start, MakeConX(~to_clear)) ); + start = _gvn.transform(new(C) AndXNode(start, MakeConX(~to_clear))); if (bump_bit != 0) { // Store a zero to the immediately preceding jint: - Node* x1 = _gvn.transform( new(C) AddXNode(start, MakeConX(-bump_bit)) ); + Node* x1 = _gvn.transform(new(C) AddXNode(start, MakeConX(-bump_bit))); Node* p1 = basic_plus_adr(dest, x1); mem = StoreNode::make(_gvn, control(), mem, p1, adr_type, intcon(0), T_INT); mem = _gvn.transform(mem); @@ -5194,8 +5210,8 @@ Node* sptr = basic_plus_adr(src, src_off); Node* dptr = basic_plus_adr(dest, dest_off); Node* countx = dest_size; - countx = _gvn.transform( new (C) SubXNode(countx, MakeConX(dest_off)) ); - countx = _gvn.transform( new (C) URShiftXNode(countx, intcon(LogBytesPerLong)) ); + countx = _gvn.transform(new (C) SubXNode(countx, MakeConX(dest_off))); + countx = _gvn.transform(new (C) URShiftXNode(countx, intcon(LogBytesPerLong))); bool disjoint_bases = true; // since alloc != NULL generate_unchecked_arraycopy(adr_type, T_LONG, disjoint_bases, @@ -5360,6 +5376,117 @@ return true; } +/** + * Calculate CRC32 for byte. + * int java.util.zip.CRC32.update(int crc, int b) + */ +bool LibraryCallKit::inline_updateCRC32() { + assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support"); + assert(callee()->signature()->size() == 2, "update has 2 parameters"); + // no receiver since it is static method + Node* crc = argument(0); // type: int + Node* b = argument(1); // type: int + + /* + * int c = ~ crc; + * b = timesXtoThe32[(b ^ c) & 0xFF]; + * b = b ^ (c >>> 8); + * crc = ~b; + */ + + Node* M1 = intcon(-1); + crc = _gvn.transform(new (C) XorINode(crc, M1)); + Node* result = _gvn.transform(new (C) XorINode(crc, b)); + result = _gvn.transform(new (C) AndINode(result, intcon(0xFF))); + + Node* base = makecon(TypeRawPtr::make(StubRoutines::crc_table_addr())); + Node* offset = _gvn.transform(new (C) LShiftINode(result, intcon(0x2))); + Node* adr = basic_plus_adr(top(), base, ConvI2X(offset)); + result = make_load(control(), adr, TypeInt::INT, T_INT); + + crc = _gvn.transform(new (C) URShiftINode(crc, intcon(8))); + result = _gvn.transform(new (C) XorINode(crc, result)); + result = _gvn.transform(new (C) XorINode(result, M1)); + set_result(result); + return true; +} + +/** + * Calculate CRC32 for byte[] array. + * int java.util.zip.CRC32.updateBytes(int crc, byte[] buf, int off, int len) + */ +bool LibraryCallKit::inline_updateBytesCRC32() { + assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support"); + assert(callee()->signature()->size() == 4, "updateBytes has 4 parameters"); + // no receiver since it is static method + Node* crc = argument(0); // type: int + Node* src = argument(1); // type: oop + Node* offset = argument(2); // type: int + Node* length = argument(3); // type: int + + const Type* src_type = src->Value(&_gvn); + const TypeAryPtr* top_src = src_type->isa_aryptr(); + if (top_src == NULL || top_src->klass() == NULL) { + // failed array check + return false; + } + + // Figure out the size and type of the elements we will be copying. + BasicType src_elem = src_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type(); + if (src_elem != T_BYTE) { + return false; + } + + // 'src_start' points to src array + scaled offset + Node* src_start = array_element_address(src, offset, src_elem); + + // We assume that range check is done by caller. + // TODO: generate range check (offset+length < src.length) in debug VM. + + // Call the stub. + address stubAddr = StubRoutines::updateBytesCRC32(); + const char *stubName = "updateBytesCRC32"; + + Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(), + stubAddr, stubName, TypePtr::BOTTOM, + crc, src_start, length); + Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + set_result(result); + return true; +} + +/** + * Calculate CRC32 for ByteBuffer. + * int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) + */ +bool LibraryCallKit::inline_updateByteBufferCRC32() { + assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support"); + assert(callee()->signature()->size() == 5, "updateByteBuffer has 4 parameters and one is long"); + // no receiver since it is static method + Node* crc = argument(0); // type: int + Node* src = argument(1); // type: long + Node* offset = argument(3); // type: int + Node* length = argument(4); // type: int + + src = ConvL2X(src); // adjust Java long to machine word + Node* base = _gvn.transform(new (C) CastX2PNode(src)); + offset = ConvI2X(offset); + + // 'src_start' points to src array + scaled offset + Node* src_start = basic_plus_adr(top(), base, offset); + + // Call the stub. + address stubAddr = StubRoutines::updateBytesCRC32(); + const char *stubName = "updateBytesCRC32"; + + Node* call = make_runtime_call(RC_LEAF|RC_NO_FP, OptoRuntime::updateBytesCRC32_Type(), + stubAddr, stubName, TypePtr::BOTTOM, + crc, src_start, length); + Node* result = _gvn.transform(new (C) ProjNode(call, TypeFunc::Parms)); + set_result(result); + return true; +} + //----------------------------inline_reference_get---------------------------- // public T java.lang.ref.Reference.get(); bool LibraryCallKit::inline_reference_get() { diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/memnode.cpp --- a/hotspot/src/share/vm/opto/memnode.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/memnode.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -2943,11 +2943,19 @@ Node* my_mem = in(MemBarNode::Precedent); // The MembarAquire may keep an unused LoadNode alive through the Precedent edge if ((my_mem != NULL) && (opc == Op_MemBarAcquire) && (my_mem->outcnt() == 1)) { - assert(my_mem->unique_out() == this, "sanity"); - phase->hash_delete(this); - del_req(Precedent); - phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later - my_mem = NULL; + // if the Precedent is a decodeN and its input (a Load) is used at more than one place, + // replace this Precedent (decodeN) with the Load instead. + if ((my_mem->Opcode() == Op_DecodeN) && (my_mem->in(1)->outcnt() > 1)) { + Node* load_node = my_mem->in(1); + set_req(MemBarNode::Precedent, load_node); + phase->is_IterGVN()->_worklist.push(my_mem); + my_mem = load_node; + } else { + assert(my_mem->unique_out() == this, "sanity"); + del_req(Precedent); + phase->is_IterGVN()->_worklist.push(my_mem); // remove dead node later + my_mem = NULL; + } } if (my_mem != NULL && my_mem->is_Mem()) { const TypeOopPtr* t_oop = my_mem->in(MemNode::Address)->bottom_type()->isa_oopptr(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/runtime.cpp --- a/hotspot/src/share/vm/opto/runtime.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/runtime.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -829,6 +829,28 @@ return TypeFunc::make(domain, range); } +/** + * int updateBytesCRC32(int crc, byte* b, int len) + */ +const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { + // create input type (domain) + int num_args = 3; + int argcnt = num_args; + const Type** fields = TypeTuple::fields(argcnt); + int argp = TypeFunc::Parms; + fields[argp++] = TypeInt::INT; // crc + fields[argp++] = TypePtr::NOTNULL; // src + fields[argp++] = TypeInt::INT; // len + assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); + const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); + + // result type needed + fields = TypeTuple::fields(1); + fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result + const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); + return TypeFunc::make(domain, range); +} + // for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning void const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { // create input type (domain) diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/opto/runtime.hpp --- a/hotspot/src/share/vm/opto/runtime.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/opto/runtime.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -284,6 +284,8 @@ static const TypeFunc* aescrypt_block_Type(); static const TypeFunc* cipherBlockChaining_aescrypt_Type(); + static const TypeFunc* updateBytesCRC32_Type(); + // leaf on stack replacement interpreter accessor types static const TypeFunc* osr_end_Type(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/prims/jni.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -879,7 +879,7 @@ env, capacity); #endif /* USDT2 */ //%note jni_11 - if (capacity < 0 && capacity > MAX_REASONABLE_LOCAL_CAPACITY) { + if (capacity < 0 || capacity > MAX_REASONABLE_LOCAL_CAPACITY) { #ifndef USDT2 DTRACE_PROBE1(hotspot_jni, PushLocalFrame__return, JNI_ERR); #else /* USDT2 */ @@ -5097,7 +5097,7 @@ // function used to determine this will always return false. Atomic::xchg // does not have this problem. if (Atomic::xchg(1, &vm_created) == 1) { - return JNI_ERR; // already created, or create attempt in progress + return JNI_EEXIST; // already created, or create attempt in progress } if (Atomic::xchg(0, &safe_to_recreate_vm) == 0) { return JNI_ERR; // someone tried and failed and retry not allowed. @@ -5138,9 +5138,21 @@ event.commit(); } +#ifndef PRODUCT + #ifndef TARGET_OS_FAMILY_windows + #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f() + #endif + // Check if we should compile all classes on bootclasspath - NOT_PRODUCT(if (CompileTheWorld) ClassLoader::compile_the_world();) - NOT_PRODUCT(if (ReplayCompiles) ciReplay::replay(thread);) + if (CompileTheWorld) ClassLoader::compile_the_world(); + if (ReplayCompiles) ciReplay::replay(thread); + + // Some platforms (like Win*) need a wrapper around these test + // functions in order to properly handle error conditions. + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(test_error_handler); + CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(execute_internal_vm_tests); +#endif + // Since this is not a JVM_ENTRY we have to set the thread state manually before leaving. ThreadStateTransition::transition_and_fence(thread, _thread_in_vm, _thread_in_native); } else { @@ -5157,8 +5169,6 @@ OrderAccess::release_store(&vm_created, 0); } - NOT_PRODUCT(test_error_handler(ErrorHandlerTest)); - NOT_PRODUCT(execute_internal_vm_tests()); return result; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/prims/jvm.cpp --- a/hotspot/src/share/vm/prims/jvm.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/prims/jvm.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1121,26 +1121,6 @@ JVM_END -// Obsolete since 1.2 (Class.setProtectionDomain removed), although -// still defined in core libraries as of 1.5. -JVM_ENTRY(void, JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain)) - JVMWrapper("JVM_SetProtectionDomain"); - if (JNIHandles::resolve(cls) == NULL) { - THROW(vmSymbols::java_lang_NullPointerException()); - } - if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { - // Call is ignored for primitive types - Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); - - // cls won't be an array, as this called only from ClassLoader.defineClass - if (k->oop_is_instance()) { - oop pd = JNIHandles::resolve(protection_domain); - assert(pd == NULL || pd->is_oop(), "just checking"); - java_lang_Class::set_protection_domain(k->java_mirror(), pd); - } - } -JVM_END - static bool is_authorized(Handle context, instanceKlassHandle klass, TRAPS) { // If there is a security manager and protection domain, check the access // in the protection domain, otherwise it is authorized. diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/prims/jvm.h --- a/hotspot/src/share/vm/prims/jvm.h Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/prims/jvm.h Thu Jul 11 12:50:20 2013 -0700 @@ -471,9 +471,6 @@ JNIEXPORT jobject JNICALL JVM_GetProtectionDomain(JNIEnv *env, jclass cls); -JNIEXPORT void JNICALL -JVM_SetProtectionDomain(JNIEnv *env, jclass cls, jobject protection_domain); - JNIEXPORT jboolean JNICALL JVM_IsArrayClass(JNIEnv *env, jclass cls); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/prims/methodHandles.cpp --- a/hotspot/src/share/vm/prims/methodHandles.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/prims/methodHandles.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1137,7 +1137,12 @@ if (VerifyMethodHandles && caller_jh != NULL && java_lang_invoke_MemberName::clazz(mname()) != NULL) { Klass* reference_klass = java_lang_Class::as_Klass(java_lang_invoke_MemberName::clazz(mname())); - if (reference_klass != NULL) { + if (reference_klass != NULL && reference_klass->oop_is_objArray()) { + reference_klass = ObjArrayKlass::cast(reference_klass)->bottom_klass(); + } + + // Reflection::verify_class_access can only handle instance classes. + if (reference_klass != NULL && reference_klass->oop_is_instance()) { // Emulate LinkResolver::check_klass_accessability. Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh)); if (!Reflection::verify_class_access(caller, diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/aprofiler.cpp --- a/hotspot/src/share/vm/runtime/aprofiler.cpp Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "classfile/systemDictionary.hpp" -#include "gc_interface/collectedHeap.inline.hpp" -#include "memory/resourceArea.hpp" -#include "memory/space.hpp" -#include "oops/oop.inline.hpp" -#include "oops/oop.inline2.hpp" -#include "runtime/aprofiler.hpp" - - -bool AllocationProfiler::_active = false; -GrowableArray* AllocationProfiler::_print_array = NULL; - - -class AllocProfClosure : public ObjectClosure { - public: - void do_object(oop obj) { - Klass* k = obj->klass(); - k->set_alloc_count(k->alloc_count() + 1); - k->set_alloc_size(k->alloc_size() + obj->size()); - } -}; - - -void AllocationProfiler::iterate_since_last_gc() { - if (is_active()) { - AllocProfClosure blk; - GenCollectedHeap* heap = GenCollectedHeap::heap(); - heap->object_iterate_since_last_GC(&blk); - } -} - - -void AllocationProfiler::engage() { - _active = true; -} - - -void AllocationProfiler::disengage() { - _active = false; -} - - -void AllocationProfiler::add_class_to_array(Klass* k) { - _print_array->append(k); -} - - -void AllocationProfiler::add_classes_to_array(Klass* k) { - // Iterate over klass and all array klasses for klass - k->with_array_klasses_do(&AllocationProfiler::add_class_to_array); -} - - -int AllocationProfiler::compare_classes(Klass** k1, Klass** k2) { - // Sort by total allocation size - return (*k2)->alloc_size() - (*k1)->alloc_size(); -} - - -int AllocationProfiler::average(size_t alloc_size, int alloc_count) { - return (int) ((double) (alloc_size * BytesPerWord) / MAX2(alloc_count, 1) + 0.5); -} - - -void AllocationProfiler::sort_and_print_array(size_t cutoff) { - _print_array->sort(&AllocationProfiler::compare_classes); - tty->print_cr("________________Size" - "__Instances" - "__Average" - "__Class________________"); - size_t total_alloc_size = 0; - int total_alloc_count = 0; - for (int index = 0; index < _print_array->length(); index++) { - Klass* k = _print_array->at(index); - size_t alloc_size = k->alloc_size(); - if (alloc_size > cutoff) { - int alloc_count = k->alloc_count(); -#ifdef PRODUCT - const char* name = k->external_name(); -#else - const char* name = k->internal_name(); -#endif - tty->print_cr("%20u %10u %8u %s", - alloc_size * BytesPerWord, - alloc_count, - average(alloc_size, alloc_count), - name); - total_alloc_size += alloc_size; - total_alloc_count += alloc_count; - } - k->set_alloc_count(0); - k->set_alloc_size(0); - } - tty->print_cr("%20u %10u %8u --total--", - total_alloc_size * BytesPerWord, - total_alloc_count, - average(total_alloc_size, total_alloc_count)); - tty->cr(); -} - - -void AllocationProfiler::print(size_t cutoff) { - ResourceMark rm; - assert(!is_active(), "AllocationProfiler cannot be active while printing profile"); - - tty->cr(); - tty->print_cr("Allocation profile (sizes in bytes, cutoff = " SIZE_FORMAT " bytes):", cutoff * BytesPerWord); - tty->cr(); - - // Print regular instance klasses and basic type array klasses - _print_array = new GrowableArray(SystemDictionary::number_of_classes()*2); - SystemDictionary::classes_do(&add_classes_to_array); - Universe::basic_type_classes_do(&add_classes_to_array); - sort_and_print_array(cutoff); - - // This used to print metadata in the permgen but since there isn't a permgen - // anymore, it is not yet implemented. -} diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/aprofiler.hpp --- a/hotspot/src/share/vm/runtime/aprofiler.hpp Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * 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. - * - */ - -#ifndef SHARE_VM_RUNTIME_APROFILER_HPP -#define SHARE_VM_RUNTIME_APROFILER_HPP - -#include "memory/allocation.hpp" -#include "memory/universe.hpp" -#include "oops/klass.hpp" -#include "utilities/top.hpp" - -// A simple allocation profiler for Java. The profiler collects and prints -// the number and total size of instances allocated per class, including -// array classes. -// -// The profiler is currently global for all threads. It can be changed to a -// per threads profiler by keeping a more elaborate data structure and calling -// iterate_since_last_scavenge at thread switches. - - -class AllocationProfiler: AllStatic { - friend class GenCollectedHeap; - friend class G1CollectedHeap; - friend class MarkSweep; - private: - static bool _active; // tells whether profiler is active - static GrowableArray* _print_array; // temporary array for printing - - // Utility printing functions - static void add_class_to_array(Klass* k); - static void add_classes_to_array(Klass* k); - static int compare_classes(Klass** k1, Klass** k2); - static int average(size_t alloc_size, int alloc_count); - static void sort_and_print_array(size_t cutoff); - - // Call for collecting allocation information. Called at scavenge, mark-sweep and disengage. - static void iterate_since_last_gc(); - - public: - // Start profiler - static void engage(); - // Stop profiler - static void disengage(); - // Tells whether profiler is active - static bool is_active() { return _active; } - // Print profile - static void print(size_t cutoff); // Cutoff in total allocation size (in words) -}; - -#endif // SHARE_VM_RUNTIME_APROFILER_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -68,7 +68,6 @@ SystemProperty* Arguments::_system_properties = NULL; const char* Arguments::_gc_log_filename = NULL; bool Arguments::_has_profile = false; -bool Arguments::_has_alloc_profile = false; uintx Arguments::_min_heap_size = 0; Arguments::Mode Arguments::_mode = _mixed; bool Arguments::_java_compiler = false; @@ -261,6 +260,9 @@ { "PrintRevisitStats", JDK_Version::jdk(8), JDK_Version::jdk(9) }, { "UseVectoredExceptions", JDK_Version::jdk(8), JDK_Version::jdk(9) }, { "UseSplitVerifier", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "UseISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "UsePermISM", JDK_Version::jdk(8), JDK_Version::jdk(9) }, + { "UseMPSS", JDK_Version::jdk(8), JDK_Version::jdk(9) }, #ifdef PRODUCT { "DesiredMethodLimit", JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, @@ -849,7 +851,7 @@ arg_len = equal_sign - argname; } - Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true); + Flag* found_flag = Flag::find_flag((const char*)argname, arg_len, true); if (found_flag != NULL) { char locked_message_buf[BUFLEN]; found_flag->get_locked_message(locked_message_buf, BUFLEN); @@ -870,6 +872,14 @@ } else { jio_fprintf(defaultStream::error_stream(), "Unrecognized VM option '%s'\n", argname); + Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true); + if (fuzzy_matched != NULL) { + jio_fprintf(defaultStream::error_stream(), + "Did you mean '%s%s%s'?\n", + (fuzzy_matched->is_bool()) ? "(+/-)" : "", + fuzzy_matched->name, + (fuzzy_matched->is_bool()) ? "" : "="); + } } // allow for commandline "commenting out" options like -XX:#+Verbose @@ -1571,7 +1581,9 @@ // By default HeapBaseMinAddress is 2G on all platforms except Solaris x86. // G1 currently needs a lot of C-heap, so on Solaris we have to give G1 // some extra space for the C-heap compared to other collectors. - FLAG_SET_ERGO(uintx, HeapBaseMinAddress, 1*G); + // Use FLAG_SET_DEFAULT here rather than FLAG_SET_ERGO to make sure that + // code that checks for default values work correctly. + FLAG_SET_DEFAULT(HeapBaseMinAddress, 1*G); } } @@ -1845,8 +1857,13 @@ "please refer to the release notes for the combinations " "allowed\n"); status = false; + } else if (ReservedCodeCacheSize > 2*G) { + // Code cache size larger than MAXINT is not supported. + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, + (2*G)/M); + status = false; } - return status; } @@ -1976,23 +1993,6 @@ status = status && check_gc_consistency(); status = status && check_stack_pages(); - if (_has_alloc_profile) { - if (UseParallelGC || UseParallelOldGC) { - jio_fprintf(defaultStream::error_stream(), - "error: invalid argument combination.\n" - "Allocation profiling (-Xaprof) cannot be used together with " - "Parallel GC (-XX:+UseParallelGC or -XX:+UseParallelOldGC).\n"); - status = false; - } - if (UseConcMarkSweepGC) { - jio_fprintf(defaultStream::error_stream(), - "error: invalid argument combination.\n" - "Allocation profiling (-Xaprof) cannot be used together with " - "the CMS collector (-XX:+UseConcMarkSweepGC).\n"); - status = false; - } - } - if (CMSIncrementalMode) { if (!UseConcMarkSweepGC) { jio_fprintf(defaultStream::error_stream(), @@ -2211,13 +2211,31 @@ status = false; } - if (ReservedCodeCacheSize < InitialCodeCacheSize) { + // Check lower bounds of the code cache + // Template Interpreter code is approximately 3X larger in debug builds. + uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace; + if (InitialCodeCacheSize < (uintx)os::vm_page_size()) { jio_fprintf(defaultStream::error_stream(), - "Invalid ReservedCodeCacheSize: %dK. Should be greater than InitialCodeCacheSize=%dK\n", + "Invalid InitialCodeCacheSize=%dK. Must be at least %dK.\n", InitialCodeCacheSize/K, + os::vm_page_size()/K); + status = false; + } else if (ReservedCodeCacheSize < InitialCodeCacheSize) { + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize: %dK. Must be at least InitialCodeCacheSize=%dK.\n", ReservedCodeCacheSize/K, InitialCodeCacheSize/K); status = false; + } else if (ReservedCodeCacheSize < min_code_cache_size) { + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize=%dK. Must be at least %uK.\n", ReservedCodeCacheSize/K, + min_code_cache_size/K); + status = false; + } else if (ReservedCodeCacheSize > 2*G) { + // Code cache size larger than MAXINT is not supported. + jio_fprintf(defaultStream::error_stream(), + "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M, + (2*G)/M); + status = false; } - return status; } @@ -2616,10 +2634,20 @@ // -Xoss } else if (match_option(option, "-Xoss", &tail)) { // HotSpot does not have separate native and Java stacks, ignore silently for compatibility - // -Xmaxjitcodesize + } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) { + julong long_CodeCacheExpansionSize = 0; + ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size()); + if (errcode != arg_in_range) { + jio_fprintf(defaultStream::error_stream(), + "Invalid argument: %s. Must be at least %luK.\n", option->optionString, + os::vm_page_size()/K); + return JNI_EINVAL; + } + FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize); } else if (match_option(option, "-Xmaxjitcodesize", &tail) || match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) { julong long_ReservedCodeCacheSize = 0; + ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1); if (errcode != arg_in_range) { jio_fprintf(defaultStream::error_stream(), @@ -2667,9 +2695,6 @@ "Flat profiling is not supported in this VM.\n"); return JNI_ERR; #endif // INCLUDE_FPROF - // -Xaprof - } else if (match_option(option, "-Xaprof", &tail)) { - _has_alloc_profile = true; // -Xconcurrentio } else if (match_option(option, "-Xconcurrentio", &tail)) { FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true); @@ -2924,13 +2949,6 @@ FLAG_SET_CMDLINE(bool, UseTLAB, true); } else if (match_option(option, "-XX:-UseTLE", &tail)) { FLAG_SET_CMDLINE(bool, UseTLAB, false); -SOLARIS_ONLY( - } else if (match_option(option, "-XX:+UsePermISM", &tail)) { - warning("-XX:+UsePermISM is obsolete."); - FLAG_SET_CMDLINE(bool, UseISM, true); - } else if (match_option(option, "-XX:-UsePermISM", &tail)) { - FLAG_SET_CMDLINE(bool, UseISM, false); -) } else if (match_option(option, "-XX:+DisplayVMOutputToStderr", &tail)) { FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, false); FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, true); @@ -3103,8 +3121,6 @@ // Note that large pages are enabled/disabled for both the // Java heap and the code cache. FLAG_SET_DEFAULT(UseLargePages, false); - SOLARIS_ONLY(FLAG_SET_DEFAULT(UseMPSS, false)); - SOLARIS_ONLY(FLAG_SET_DEFAULT(UseISM, false)); } // Tiered compilation is undefined with C1. diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -262,7 +262,6 @@ // Option flags static bool _has_profile; - static bool _has_alloc_profile; static const char* _gc_log_filename; static uintx _min_heap_size; @@ -464,9 +463,8 @@ // -Xloggc:, if not specified will be NULL static const char* gc_log_filename() { return _gc_log_filename; } - // -Xprof/-Xaprof + // -Xprof static bool has_profile() { return _has_profile; } - static bool has_alloc_profile() { return _has_alloc_profile; } // -Xms, -Xmx static uintx min_heap_size() { return _min_heap_size; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/atomic.cpp --- a/hotspot/src/share/vm/runtime/atomic.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/atomic.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -80,3 +80,32 @@ } return old; } + +void Atomic::inc(volatile short* dest) { + // Most platforms do not support atomic increment on a 2-byte value. However, + // if the value occupies the most significant 16 bits of an aligned 32-bit + // word, then we can do this with an atomic add of 0x10000 to the 32-bit word. + // + // The least significant parts of this 32-bit word will never be affected, even + // in case of overflow/underflow. + // + // Use the ATOMIC_SHORT_PAIR macro to get the desired alignment. +#ifdef VM_LITTLE_ENDIAN + assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); + (void)Atomic::add(0x10000, (volatile int*)(dest-1)); +#else + assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); + (void)Atomic::add(0x10000, (volatile int*)(dest)); +#endif +} + +void Atomic::dec(volatile short* dest) { +#ifdef VM_LITTLE_ENDIAN + assert((intx(dest) & 0x03) == 0x02, "wrong alignment"); + (void)Atomic::add(-0x10000, (volatile int*)(dest-1)); +#else + assert((intx(dest) & 0x03) == 0x00, "wrong alignment"); + (void)Atomic::add(-0x10000, (volatile int*)(dest)); +#endif +} + diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/atomic.hpp --- a/hotspot/src/share/vm/runtime/atomic.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/atomic.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -64,11 +64,13 @@ // Atomically increment location inline static void inc (volatile jint* dest); + static void inc (volatile jshort* dest); inline static void inc_ptr(volatile intptr_t* dest); inline static void inc_ptr(volatile void* dest); // Atomically decrement a location inline static void dec (volatile jint* dest); + static void dec (volatile jshort* dest); inline static void dec_ptr(volatile intptr_t* dest); inline static void dec_ptr(volatile void* dest); @@ -95,4 +97,24 @@ inline static void* cmpxchg_ptr(void* exchange_value, volatile void* dest, void* compare_value); }; +// To use Atomic::inc(jshort* dest) and Atomic::dec(jshort* dest), the address must be specially +// aligned, such that (*dest) occupies the upper 16 bits of an aligned 32-bit word. The best way to +// achieve is to place your short value next to another short value, which doesn't need atomic ops. +// +// Example +// ATOMIC_SHORT_PAIR( +// volatile short _refcount, // needs atomic operation +// unsigned short _length // number of UTF8 characters in the symbol (does not need atomic op) +// ); + +#ifdef VM_LITTLE_ENDIAN +#define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + non_atomic_decl; \ + atomic_decl +#else +#define ATOMIC_SHORT_PAIR(atomic_decl, non_atomic_decl) \ + atomic_decl ; \ + non_atomic_decl +#endif + #endif // SHARE_VM_RUNTIME_ATOMIC_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/frame.cpp --- a/hotspot/src/share/vm/runtime/frame.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/frame.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -387,7 +387,6 @@ Method* frame::interpreter_frame_method() const { assert(is_interpreted_frame(), "interpreted frame expected"); Method* m = *interpreter_frame_method_addr(); - assert(m->is_metadata(), "bad Method* in interpreter frame"); assert(m->is_method(), "not a Method*"); return m; } @@ -713,7 +712,8 @@ Method* m = ((nmethod *)_cb)->method(); if (m != NULL) { m->name_and_sig_as_C_string(buf, buflen); - st->print("J %s", buf); + st->print("J %s @ " PTR_FORMAT " [" PTR_FORMAT "+" SIZE_FORMAT "]", + buf, _pc, _cb->code_begin(), _pc - _cb->code_begin()); } else { st->print("J " PTR_FORMAT, pc()); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/globals.cpp --- a/hotspot/src/share/vm/runtime/globals.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/globals.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -73,12 +73,6 @@ strcmp(kind, "{C2 diagnostic}") == 0 || strcmp(kind, "{ARCH diagnostic}") == 0 || strcmp(kind, "{Shark diagnostic}") == 0) { - if (strcmp(name, "EnableInvokeDynamic") == 0 && UnlockExperimentalVMOptions && !UnlockDiagnosticVMOptions) { - // transitional logic to allow tests to run until they are changed - static int warned; - if (++warned == 1) warning("Use -XX:+UnlockDiagnosticVMOptions before EnableInvokeDynamic flag"); - return true; - } return UnlockDiagnosticVMOptions; } else if (strcmp(kind, "{experimental}") == 0 || strcmp(kind, "{C2 experimental}") == 0 || @@ -282,14 +276,14 @@ Flag* Flag::flags = flagTable; size_t Flag::numFlags = (sizeof(flagTable) / sizeof(Flag)); -inline bool str_equal(const char* s, char* q, size_t len) { +inline bool str_equal(const char* s, const char* q, size_t len) { // s is null terminated, q is not! if (strlen(s) != (unsigned int) len) return false; return strncmp(s, q, len) == 0; } // Search the flag table for a named flag -Flag* Flag::find_flag(char* name, size_t length, bool allow_locked) { +Flag* Flag::find_flag(const char* name, size_t length, bool allow_locked) { for (Flag* current = &flagTable[0]; current->name != NULL; current++) { if (str_equal(current->name, name, length)) { // Found a matching entry. Report locked flags only if allowed. @@ -307,6 +301,52 @@ return NULL; } +// Compute string similarity based on Dice's coefficient +static float str_similar(const char* str1, const char* str2, size_t len2) { + int len1 = (int) strlen(str1); + int total = len1 + (int) len2; + + int hit = 0; + + for (int i = 0; i < len1 -1; ++i) { + for (int j = 0; j < (int) len2 -1; ++j) { + if ((str1[i] == str2[j]) && (str1[i+1] == str2[j+1])) { + ++hit; + break; + } + } + } + + return 2.0f * (float) hit / (float) total; +} + +Flag* Flag::fuzzy_match(const char* name, size_t length, bool allow_locked) { + float VMOptionsFuzzyMatchSimilarity = 0.7f; + Flag* match = NULL; + float score; + float max_score = -1; + + for (Flag* current = &flagTable[0]; current->name != NULL; current++) { + score = str_similar(current->name, name, length); + if (score > max_score) { + max_score = score; + match = current; + } + } + + if (!(match->is_unlocked() || match->is_unlocker())) { + if (!allow_locked) { + return NULL; + } + } + + if (max_score < VMOptionsFuzzyMatchSimilarity) { + return NULL; + } + + return match; +} + // Returns the address of the index'th element static Flag* address_of_flag(CommandLineFlagWithType flag) { assert((size_t)flag < Flag::numFlags, "bad command line flag index"); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/globals.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -175,6 +175,7 @@ define_pd_global(intx, ReservedCodeCacheSize, 32*M); define_pd_global(intx, CodeCacheExpansionSize, 32*K); define_pd_global(intx, CodeCacheMinBlockLength, 1); +define_pd_global(intx, CodeCacheMinimumUseSpace, 200*K); define_pd_global(uintx,MetaspaceSize, ScaleForWordSize(4*M)); define_pd_global(bool, NeverActAsServerClassMachine, true); define_pd_global(uint64_t,MaxRAM, 1ULL*G); @@ -220,7 +221,8 @@ // number of flags static size_t numFlags; - static Flag* find_flag(char* name, size_t length, bool allow_locked = false); + static Flag* find_flag(const char* name, size_t length, bool allow_locked = false); + static Flag* fuzzy_match(const char* name, size_t length, bool allow_locked = false); bool is_bool() const { return strcmp(type, "bool") == 0; } bool get_bool() const { return *((bool*) addr); } @@ -644,6 +646,9 @@ product(bool, UseAESIntrinsics, false, \ "use intrinsics for AES versions of crypto") \ \ + product(bool, UseCRC32Intrinsics, false, \ + "use intrinsics for java.util.zip.CRC32") \ + \ develop(bool, TraceCallFixup, false, \ "traces all call fixups") \ \ @@ -3160,6 +3165,9 @@ product_pd(uintx, InitialCodeCacheSize, \ "Initial code cache size (in bytes)") \ \ + develop_pd(uintx, CodeCacheMinimumUseSpace, \ + "Minimum code cache size (in bytes) required to start VM.") \ + \ product_pd(uintx, ReservedCodeCacheSize, \ "Reserved code cache size (in bytes) - maximum code cache size") \ \ @@ -3672,6 +3680,9 @@ develop(bool, VerifyGenericSignatures, false, \ "Abort VM on erroneous or inconsistent generic signatures") \ \ + product(bool, ParseGenericDefaults, false, \ + "Parse generic signatures for default method handling") \ + \ product(bool, UseVMInterruptibleIO, false, \ "(Unstable, Solaris-specific) Thread interrupt before or with " \ "EINTR for I/O operations results in OS_INTRPT. The default value"\ diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/handles.hpp --- a/hotspot/src/share/vm/runtime/handles.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/handles.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -227,7 +227,7 @@ HandleArea* _prev; // link to outer (older) area public: // Constructor - HandleArea(HandleArea* prev) { + HandleArea(HandleArea* prev) : Arena(Chunk::tiny_size) { debug_only(_handle_mark_nesting = 0); debug_only(_no_handle_mark_nesting = 0); _prev = prev; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/java.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -42,7 +42,6 @@ #include "oops/oop.inline.hpp" #include "oops/symbol.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/arguments.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/compilationPolicy.hpp" @@ -509,16 +508,6 @@ } } - - if (Arguments::has_alloc_profile()) { - HandleMark hm; - // Do one last collection to enumerate all the objects - // allocated since the last one. - Universe::heap()->collect(GCCause::_allocation_profiler); - AllocationProfiler::disengage(); - AllocationProfiler::print(0); - } - if (PrintBytecodeHistogram) { BytecodeHistogram::print(); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/os.hpp --- a/hotspot/src/share/vm/runtime/os.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/os.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -507,16 +507,16 @@ // Symbol lookup, find nearest function name; basically it implements // dladdr() for all platforms. Name of the nearest function is copied - // to buf. Distance from its base address is returned as offset. + // to buf. Distance from its base address is optionally returned as offset. // If function name is not found, buf[0] is set to '\0' and offset is - // set to -1. + // set to -1 (if offset is non-NULL). static bool dll_address_to_function_name(address addr, char* buf, int buflen, int* offset); // Locate DLL/DSO. On success, full path of the library is copied to - // buf, and offset is set to be the distance between addr and the - // library's base address. On failure, buf[0] is set to '\0' and - // offset is set to -1. + // buf, and offset is optionally set to be the distance between addr + // and the library's base address. On failure, buf[0] is set to '\0' + // and offset is set to -1 (if offset is non-NULL). static bool dll_address_to_library_name(address addr, char* buf, int buflen, int* offset); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/reflection.cpp --- a/hotspot/src/share/vm/runtime/reflection.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/reflection.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -458,7 +458,7 @@ // doesn't have a classloader. if ((current_class == NULL) || (current_class == new_class) || - (InstanceKlass::cast(new_class)->is_public()) || + (new_class->is_public()) || is_same_class_package(current_class, new_class)) { return true; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/sharedRuntime.cpp --- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -813,8 +813,11 @@ // 3. Implict null exception in nmethod if (!cb->is_nmethod()) { - guarantee(cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(), - "exception happened outside interpreter, nmethods and vtable stubs (1)"); + bool is_in_blob = cb->is_adapter_blob() || cb->is_method_handles_adapter_blob(); + if (!is_in_blob) { + cb->print(); + fatal(err_msg("exception happened outside interpreter, nmethods and vtable stubs at pc " INTPTR_FORMAT, pc)); + } Events::log_exception(thread, "NullPointerException in code blob at " INTPTR_FORMAT, pc); // There is no handler here, so we will simply unwind. return StubRoutines::throw_NullPointerException_at_call_entry(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/stubRoutines.cpp --- a/hotspot/src/share/vm/runtime/stubRoutines.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,6 +125,9 @@ address StubRoutines::_cipherBlockChaining_encryptAESCrypt = NULL; address StubRoutines::_cipherBlockChaining_decryptAESCrypt = NULL; +address StubRoutines::_updateBytesCRC32 = NULL; +address StubRoutines::_crc_table_adr = NULL; + double (* StubRoutines::_intrinsic_log )(double) = NULL; double (* StubRoutines::_intrinsic_log10 )(double) = NULL; double (* StubRoutines::_intrinsic_exp )(double) = NULL; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/stubRoutines.hpp --- a/hotspot/src/share/vm/runtime/stubRoutines.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -204,6 +204,9 @@ static address _cipherBlockChaining_encryptAESCrypt; static address _cipherBlockChaining_decryptAESCrypt; + static address _updateBytesCRC32; + static address _crc_table_adr; + // These are versions of the java.lang.Math methods which perform // the same operations as the intrinsic version. They are used for // constant folding in the compiler to ensure equivalence. If the @@ -342,6 +345,9 @@ static address cipherBlockChaining_encryptAESCrypt() { return _cipherBlockChaining_encryptAESCrypt; } static address cipherBlockChaining_decryptAESCrypt() { return _cipherBlockChaining_decryptAESCrypt; } + static address updateBytesCRC32() { return _updateBytesCRC32; } + static address crc_table_addr() { return _crc_table_adr; } + static address select_fill_function(BasicType t, bool aligned, const char* &name); static address zero_aligned_words() { return _zero_aligned_words; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/thread.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -45,7 +45,6 @@ #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" #include "prims/privilegedStack.hpp" -#include "runtime/aprofiler.hpp" #include "runtime/arguments.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/deoptimization.hpp" @@ -220,7 +219,7 @@ set_osthread(NULL); set_resource_area(new (mtThread)ResourceArea()); set_handle_area(new (mtThread) HandleArea(NULL)); - set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray(300, true)); + set_metadata_handles(new (ResourceObj::C_HEAP, mtClass) GrowableArray(30, true)); set_active_handles(NULL); set_free_handle_block(NULL); set_last_handle_mark(NULL); @@ -3677,7 +3676,6 @@ } if (Arguments::has_profile()) FlatProfiler::engage(main_thread, true); - if (Arguments::has_alloc_profile()) AllocationProfiler::engage(); if (MemProfiling) MemProfiler::engage(); StatSampler::engage(); if (CheckJNICalls) JniPeriodicChecker::engage(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -263,7 +263,7 @@ unchecked_c2_static_field) \ \ /******************************************************************/ \ - /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \ + /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \ /******************************************************************/ \ \ volatile_nonstatic_field(oopDesc, _mark, markOop) \ @@ -274,21 +274,20 @@ volatile_nonstatic_field(ArrayKlass, _higher_dimension, Klass*) \ volatile_nonstatic_field(ArrayKlass, _lower_dimension, Klass*) \ nonstatic_field(ArrayKlass, _vtable_len, int) \ - nonstatic_field(ArrayKlass, _alloc_size, juint) \ nonstatic_field(ArrayKlass, _component_mirror, oop) \ - nonstatic_field(CompiledICHolder, _holder_method, Method*) \ + nonstatic_field(CompiledICHolder, _holder_method, Method*) \ nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \ nonstatic_field(ConstantPool, _tags, Array*) \ - nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ + nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \ nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \ nonstatic_field(ConstantPool, _operands, Array*) \ nonstatic_field(ConstantPool, _length, int) \ nonstatic_field(ConstantPool, _resolved_references, jobject) \ nonstatic_field(ConstantPool, _reference_map, Array*) \ nonstatic_field(ConstantPoolCache, _length, int) \ - nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \ + nonstatic_field(ConstantPoolCache, _constant_pool, ConstantPool*) \ nonstatic_field(InstanceKlass, _array_klasses, Klass*) \ - nonstatic_field(InstanceKlass, _methods, Array*) \ + nonstatic_field(InstanceKlass, _methods, Array*) \ nonstatic_field(InstanceKlass, _local_interfaces, Array*) \ nonstatic_field(InstanceKlass, _transitive_interfaces, Array*) \ nonstatic_field(InstanceKlass, _fields, Array*) \ @@ -336,9 +335,8 @@ nonstatic_field(Klass, _access_flags, AccessFlags) \ nonstatic_field(Klass, _subklass, Klass*) \ nonstatic_field(Klass, _next_sibling, Klass*) \ - nonstatic_field(Klass, _alloc_count, juint) \ nonstatic_field(MethodData, _size, int) \ - nonstatic_field(MethodData, _method, Method*) \ + nonstatic_field(MethodData, _method, Method*) \ nonstatic_field(MethodData, _data_size, int) \ nonstatic_field(MethodData, _data[0], intptr_t) \ nonstatic_field(MethodData, _nof_decompiles, uint) \ @@ -379,7 +377,7 @@ nonstatic_field(ConstMethod, _size_of_parameters, u2) \ nonstatic_field(ObjArrayKlass, _element_klass, Klass*) \ nonstatic_field(ObjArrayKlass, _bottom_klass, Klass*) \ - volatile_nonstatic_field(Symbol, _refcount, int) \ + volatile_nonstatic_field(Symbol, _refcount, short) \ nonstatic_field(Symbol, _identity_hash, int) \ nonstatic_field(Symbol, _length, unsigned short) \ unchecked_nonstatic_field(Symbol, _body, sizeof(jbyte)) /* NOTE: no type */ \ @@ -437,10 +435,6 @@ static_field(Universe, _main_thread_group, oop) \ static_field(Universe, _system_thread_group, oop) \ static_field(Universe, _the_empty_class_klass_array, objArrayOop) \ - static_field(Universe, _out_of_memory_error_java_heap, oop) \ - static_field(Universe, _out_of_memory_error_perm_gen, oop) \ - static_field(Universe, _out_of_memory_error_array_size, oop) \ - static_field(Universe, _out_of_memory_error_gc_overhead_limit, oop) \ static_field(Universe, _null_ptr_exception_instance, oop) \ static_field(Universe, _arithmetic_exception_instance, oop) \ static_field(Universe, _vm_exception, oop) \ diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/management.cpp --- a/hotspot/src/share/vm/services/management.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/management.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -894,12 +894,6 @@ } } - // In our current implementation, we make sure that all non-heap - // pools have defined init and max sizes. Heap pools do not matter, - // as we never use total_init and total_max for them. - assert(heap || !has_undefined_init_size, "Undefined init size"); - assert(heap || !has_undefined_max_size, "Undefined max size"); - MemoryUsage usage((heap ? InitialHeapSize : total_init), total_used, total_committed, diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memBaseline.cpp --- a/hotspot/src/share/vm/services/memBaseline.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memBaseline.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -486,7 +486,7 @@ const MemPointerRecord* mp1 = (const MemPointerRecord*)p1; const MemPointerRecord* mp2 = (const MemPointerRecord*)p2; int delta = UNSIGNED_COMPARE(mp1->addr(), mp2->addr()); - assert(delta != 0, "dup pointer"); + assert(p1 == p2 || delta != 0, "dup pointer"); return delta; } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memReporter.cpp --- a/hotspot/src/share/vm/services/memReporter.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memReporter.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -188,8 +188,8 @@ (MallocCallsitePointer*)prev_malloc_itr.current(); while (cur_malloc_callsite != NULL || prev_malloc_callsite != NULL) { - if (prev_malloc_callsite == NULL || - cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) { + if (prev_malloc_callsite == NULL) { + assert(cur_malloc_callsite != NULL, "sanity check"); // this is a new callsite _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), amount_in_current_scale(cur_malloc_callsite->amount()), @@ -197,22 +197,42 @@ diff_in_current_scale(cur_malloc_callsite->amount(), 0), diff(cur_malloc_callsite->count(), 0)); cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); - } else if (cur_malloc_callsite == NULL || - cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) { + } else if (cur_malloc_callsite == NULL) { + assert(prev_malloc_callsite != NULL, "Sanity check"); // this callsite is already gone _outputer.diff_malloc_callsite(prev_malloc_callsite->addr(), - amount_in_current_scale(0), 0, + 0, 0, diff_in_current_scale(0, prev_malloc_callsite->amount()), diff(0, prev_malloc_callsite->count())); prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); - } else { // the same callsite - _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), - amount_in_current_scale(cur_malloc_callsite->amount()), - cur_malloc_callsite->count(), - diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()), - diff(cur_malloc_callsite->count(), prev_malloc_callsite->count())); - cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); - prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } else { + assert(cur_malloc_callsite != NULL, "Sanity check"); + assert(prev_malloc_callsite != NULL, "Sanity check"); + if (cur_malloc_callsite->addr() < prev_malloc_callsite->addr()) { + // this is a new callsite + _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), + amount_in_current_scale(cur_malloc_callsite->amount()), + cur_malloc_callsite->count(), + diff_in_current_scale(cur_malloc_callsite->amount(), 0), + diff(cur_malloc_callsite->count(), 0)); + cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); + } else if (cur_malloc_callsite->addr() > prev_malloc_callsite->addr()) { + // this callsite is already gone + _outputer.diff_malloc_callsite(prev_malloc_callsite->addr(), + 0, 0, + diff_in_current_scale(0, prev_malloc_callsite->amount()), + diff(0, prev_malloc_callsite->count())); + prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } else { + // the same callsite + _outputer.diff_malloc_callsite(cur_malloc_callsite->addr(), + amount_in_current_scale(cur_malloc_callsite->amount()), + cur_malloc_callsite->count(), + diff_in_current_scale(cur_malloc_callsite->amount(), prev_malloc_callsite->amount()), + diff(cur_malloc_callsite->count(), prev_malloc_callsite->count())); + cur_malloc_callsite = (MallocCallsitePointer*)cur_malloc_itr.next(); + prev_malloc_callsite = (MallocCallsitePointer*)prev_malloc_itr.next(); + } } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memTracker.hpp --- a/hotspot/src/share/vm/services/memTracker.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memTracker.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -470,7 +470,21 @@ static void check_NMT_load(Thread* thr) { assert(thr != NULL, "Sanity check"); if (_slowdown_calling_thread && thr != _worker_thread) { +#ifdef _WINDOWS + // On Windows, os::NakedYield() does not work as well + // as os::yield_all() os::yield_all(); +#else + // On Solaris, os::yield_all() depends on os::sleep() + // which requires JavaTherad in _thread_in_vm state. + // Transits thread to _thread_in_vm state can be dangerous + // if caller holds lock, as it may deadlock with Threads_lock. + // So use NaKedYield instead. + // + // Linux and BSD, NakedYield() and yield_all() implementations + // are the same. + os::NakedYield(); +#endif } } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryManager.cpp --- a/hotspot/src/share/vm/services/memoryManager.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryManager.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -61,6 +61,10 @@ return (MemoryManager*) new CodeCacheMemoryManager(); } +MemoryManager* MemoryManager::get_metaspace_memory_manager() { + return (MemoryManager*) new MetaspaceMemoryManager(); +} + GCMemoryManager* MemoryManager::get_copy_memory_manager() { return (GCMemoryManager*) new CopyMemoryManager(); } diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryManager.hpp --- a/hotspot/src/share/vm/services/memoryManager.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryManager.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -56,6 +56,7 @@ enum Name { Abstract, CodeCache, + Metaspace, Copy, MarkSweepCompact, ParNew, @@ -88,6 +89,7 @@ // Static factory methods to get a memory manager of a specific type static MemoryManager* get_code_cache_memory_manager(); + static MemoryManager* get_metaspace_memory_manager(); static GCMemoryManager* get_copy_memory_manager(); static GCMemoryManager* get_msc_memory_manager(); static GCMemoryManager* get_parnew_memory_manager(); @@ -108,6 +110,14 @@ const char* name() { return "CodeCacheManager"; } }; +class MetaspaceMemoryManager : public MemoryManager { +public: + MetaspaceMemoryManager() : MemoryManager() {} + + MemoryManager::Name kind() { return MemoryManager::Metaspace; } + const char *name() { return "Metaspace Manager"; } +}; + class GCStatInfo : public ResourceObj { private: size_t _index; diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryPool.cpp --- a/hotspot/src/share/vm/services/memoryPool.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryPool.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" +#include "memory/metaspace.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/javaCalls.hpp" @@ -33,6 +34,7 @@ #include "services/memoryManager.hpp" #include "services/memoryPool.hpp" #include "utilities/macros.hpp" +#include "utilities/globalDefinitions.hpp" MemoryPool::MemoryPool(const char* name, PoolType type, @@ -256,3 +258,39 @@ return MemoryUsage(initial_size(), used, committed, maxSize); } + +MetaspacePool::MetaspacePool() : + MemoryPool("Metaspace", NonHeap, capacity_in_bytes(), calculate_max_size(), true, false) { } + +MemoryUsage MetaspacePool::get_memory_usage() { + size_t committed = align_size_down_(capacity_in_bytes(), os::vm_page_size()); + return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size()); +} + +size_t MetaspacePool::used_in_bytes() { + return MetaspaceAux::allocated_used_bytes(Metaspace::NonClassType); +} + +size_t MetaspacePool::capacity_in_bytes() const { + return MetaspaceAux::allocated_capacity_bytes(Metaspace::NonClassType); +} + +size_t MetaspacePool::calculate_max_size() const { + return FLAG_IS_CMDLINE(MaxMetaspaceSize) ? MaxMetaspaceSize : max_uintx; +} + +CompressedKlassSpacePool::CompressedKlassSpacePool() : + MemoryPool("Compressed Class Space", NonHeap, capacity_in_bytes(), ClassMetaspaceSize, true, false) { } + +size_t CompressedKlassSpacePool::used_in_bytes() { + return MetaspaceAux::allocated_used_bytes(Metaspace::ClassType); +} + +size_t CompressedKlassSpacePool::capacity_in_bytes() const { + return MetaspaceAux::allocated_capacity_bytes(Metaspace::ClassType); +} + +MemoryUsage CompressedKlassSpacePool::get_memory_usage() { + size_t committed = align_size_down_(capacity_in_bytes(), os::vm_page_size()); + return MemoryUsage(initial_size(), used_in_bytes(), committed, max_size()); +} diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryPool.hpp --- a/hotspot/src/share/vm/services/memoryPool.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryPool.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -222,4 +222,21 @@ size_t used_in_bytes() { return _codeHeap->allocated_capacity(); } }; +class MetaspacePool : public MemoryPool { + size_t calculate_max_size() const; + size_t capacity_in_bytes() const; + public: + MetaspacePool(); + MemoryUsage get_memory_usage(); + size_t used_in_bytes(); +}; + +class CompressedKlassSpacePool : public MemoryPool { + size_t capacity_in_bytes() const; + public: + CompressedKlassSpacePool(); + MemoryUsage get_memory_usage(); + size_t used_in_bytes(); +}; + #endif // SHARE_VM_SERVICES_MEMORYPOOL_HPP diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryService.cpp --- a/hotspot/src/share/vm/services/memoryService.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryService.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -35,6 +35,7 @@ #include "memory/memRegion.hpp" #include "memory/tenuredGeneration.hpp" #include "oops/oop.inline.hpp" +#include "runtime/globals.hpp" #include "runtime/javaCalls.hpp" #include "services/classLoadingService.hpp" #include "services/lowMemoryDetector.hpp" @@ -60,9 +61,11 @@ GrowableArray* MemoryService::_managers_list = new (ResourceObj::C_HEAP, mtInternal) GrowableArray(init_managers_list_size, true); -GCMemoryManager* MemoryService::_minor_gc_manager = NULL; -GCMemoryManager* MemoryService::_major_gc_manager = NULL; -MemoryPool* MemoryService::_code_heap_pool = NULL; +GCMemoryManager* MemoryService::_minor_gc_manager = NULL; +GCMemoryManager* MemoryService::_major_gc_manager = NULL; +MemoryPool* MemoryService::_code_heap_pool = NULL; +MemoryPool* MemoryService::_metaspace_pool = NULL; +MemoryPool* MemoryService::_compressed_class_pool = NULL; class GcThreadCountClosure: public ThreadClosure { private: @@ -399,6 +402,22 @@ _managers_list->append(mgr); } +void MemoryService::add_metaspace_memory_pools() { + MemoryManager* mgr = MemoryManager::get_metaspace_memory_manager(); + + _metaspace_pool = new MetaspacePool(); + mgr->add_pool(_metaspace_pool); + _pools_list->append(_metaspace_pool); + + if (UseCompressedKlassPointers) { + _compressed_class_pool = new CompressedKlassSpacePool(); + mgr->add_pool(_compressed_class_pool); + _pools_list->append(_compressed_class_pool); + } + + _managers_list->append(mgr); +} + MemoryManager* MemoryService::get_memory_manager(instanceHandle mh) { for (int i = 0; i < _managers_list->length(); i++) { MemoryManager* mgr = _managers_list->at(i); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/services/memoryService.hpp --- a/hotspot/src/share/vm/services/memoryService.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/services/memoryService.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -73,6 +73,9 @@ // Code heap memory pool static MemoryPool* _code_heap_pool; + static MemoryPool* _metaspace_pool; + static MemoryPool* _compressed_class_pool; + static void add_generation_memory_pool(Generation* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr); @@ -121,6 +124,7 @@ public: static void set_universe_heap(CollectedHeap* heap); static void add_code_heap_memory_pool(CodeHeap* heap); + static void add_metaspace_memory_pools(); static MemoryPool* get_memory_pool(instanceHandle pool); static MemoryManager* get_memory_manager(instanceHandle mgr); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/shark/sharkBuilder.cpp --- a/hotspot/src/share/vm/shark/sharkBuilder.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/shark/sharkBuilder.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -471,7 +471,7 @@ Value* SharkBuilder::CreateInlineMetadata(Metadata* metadata, llvm::PointerType* type, const char* name) { assert(metadata != NULL, "inlined metadata must not be NULL"); - assert(metadata->is_metadata(), "sanity check"); + assert(metadata->is_metaspace_object(), "sanity check"); return CreateLoad( CreateIntToPtr( code_buffer_address(code_buffer()->inline_Metadata(metadata)), diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/trace/trace.xml --- a/hotspot/src/share/vm/trace/trace.xml Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/trace/trace.xml Thu Jul 11 12:50:20 2013 -0700 @@ -158,7 +158,7 @@ - + @@ -203,7 +203,7 @@ - + @@ -211,7 +211,7 @@ - + @@ -240,14 +240,14 @@ - + - + - + diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/utilities/debug.cpp --- a/hotspot/src/share/vm/utilities/debug.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/utilities/debug.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -314,8 +314,8 @@ #ifndef PRODUCT #include -void test_error_handler(size_t test_num) -{ +void test_error_handler() { + uintx test_num = ErrorHandlerTest; if (test_num == 0) return; // If asserts are disabled, use the corresponding guarantee instead. @@ -327,6 +327,8 @@ const char* const eol = os::line_separator(); const char* const msg = "this message should be truncated during formatting"; + char * const dataPtr = NULL; // bad data pointer + const void (*funcPtr)(void) = (const void(*)()) 0xF; // bad function pointer // Keep this in sync with test/runtime/6888954/vmerrors.sh. switch (n) { @@ -348,11 +350,16 @@ case 9: ShouldNotCallThis(); case 10: ShouldNotReachHere(); case 11: Unimplemented(); - // This is last because it does not generate an hs_err* file on Windows. - case 12: os::signal_raise(SIGSEGV); + // There's no guarantee the bad data pointer will crash us + // so "break" out to the ShouldNotReachHere(). + case 12: *dataPtr = '\0'; break; + // There's no guarantee the bad function pointer will crash us + // so "break" out to the ShouldNotReachHere(). + case 13: (*funcPtr)(); break; - default: ShouldNotReachHere(); + default: tty->print_cr("ERROR: %d: unexpected test_num value.", n); } + ShouldNotReachHere(); } #endif // !PRODUCT diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/utilities/debug.hpp --- a/hotspot/src/share/vm/utilities/debug.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/utilities/debug.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -243,7 +243,7 @@ void set_error_reported(); /* Test assert(), fatal(), guarantee(), etc. */ -NOT_PRODUCT(void test_error_handler(size_t test_num);) +NOT_PRODUCT(void test_error_handler();) void pd_ps(frame f); void pd_obfuscate_location(char *buf, size_t buflen); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -799,6 +799,14 @@ VMError* volatile VMError::first_error = NULL; volatile jlong VMError::first_error_tid = -1; +// An error could happen before tty is initialized or after it has been +// destroyed. Here we use a very simple unbuffered fdStream for printing. +// Only out.print_raw() and out.print_raw_cr() should be used, as other +// printing methods need to allocate large buffer on stack. To format a +// string, use jio_snprintf() with a static buffer or use staticBufferStream. +fdStream VMError::out(defaultStream::output_fd()); +fdStream VMError::log; // error log used by VMError::report_and_die() + /** Expand a pattern into a buffer starting at pos and open a file using constructed path */ static int expand_and_open(const char* pattern, char* buf, size_t buflen, size_t pos) { int fd = -1; @@ -853,13 +861,6 @@ // Don't allocate large buffer on stack static char buffer[O_BUFLEN]; - // An error could happen before tty is initialized or after it has been - // destroyed. Here we use a very simple unbuffered fdStream for printing. - // Only out.print_raw() and out.print_raw_cr() should be used, as other - // printing methods need to allocate large buffer on stack. To format a - // string, use jio_snprintf() with a static buffer or use staticBufferStream. - static fdStream out(defaultStream::output_fd()); - // How many errors occurred in error handler when reporting first_error. static int recursive_error_count; @@ -868,7 +869,6 @@ static bool out_done = false; // done printing to standard out static bool log_done = false; // done saving error log static bool transmit_report_done = false; // done error reporting - static fdStream log; // error log // disble NMT to avoid further exception MemTracker::shutdown(MemTracker::NMT_error_reporting); @@ -908,10 +908,11 @@ // This is not the first error, see if it happened in a different thread // or in the same thread during error reporting. if (first_error_tid != mytid) { - jio_snprintf(buffer, sizeof(buffer), + char msgbuf[64]; + jio_snprintf(msgbuf, sizeof(msgbuf), "[thread " INT64_FORMAT " also had an error]", mytid); - out.print_raw_cr(buffer); + out.print_raw_cr(msgbuf); // error reporting is not MT-safe, block current thread os::infinite_sleep(); diff -r 0273c023680c -r 6ed8434664ed hotspot/src/share/vm/utilities/vmError.hpp --- a/hotspot/src/share/vm/utilities/vmError.hpp Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/src/share/vm/utilities/vmError.hpp Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -96,6 +96,9 @@ return (id != OOM_MALLOC_ERROR) && (id != OOM_MMAP_ERROR); } + static fdStream out; + static fdStream log; // error log used by VMError::report_and_die() + public: // Constructor for crashes diff -r 0273c023680c -r 6ed8434664ed hotspot/test/compiler/7088419/CRCTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/7088419/CRCTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 7088419 + @run main CRCTest + @summary Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32 and java.util.zip.Adler32 + */ + +import java.nio.ByteBuffer; +import java.util.zip.CRC32; +import java.util.zip.Checksum; + +public class CRCTest { + + public static void main(String[] args) throws Exception { + + byte[] b = initializedBytes(4096 * 4096); + + { + CRC32 crc1 = new CRC32(); + CRC32 crc2 = new CRC32(); + CRC32 crc3 = new CRC32(); + CRC32 crc4 = new CRC32(); + + crc1.update(b, 0, b.length); + updateSerial(crc2, b, 0, b.length); + updateDirect(crc3, b, 0, b.length); + updateSerialSlow(crc4, b, 0, b.length); + + check(crc1, crc2); + check(crc3, crc4); + check(crc1, crc3); + + crc1.update(17); + crc2.update(17); + crc3.update(17); + crc4.update(17); + + crc1.update(b, 1, b.length-2); + updateSerial(crc2, b, 1, b.length-2); + updateDirect(crc3, b, 1, b.length-2); + updateSerialSlow(crc4, b, 1, b.length-2); + + check(crc1, crc2); + check(crc3, crc4); + check(crc1, crc3); + + report("finished huge crc", crc1, crc2, crc3, crc4); + + for (int i = 0; i < 256; i++) { + for (int j = 0; j < 256; j += 1) { + crc1.update(b, i, j); + updateSerial(crc2, b, i, j); + updateDirect(crc3, b, i, j); + updateSerialSlow(crc4, b, i, j); + + check(crc1, crc2); + check(crc3, crc4); + check(crc1, crc3); + + } + } + + report("finished small survey crc", crc1, crc2, crc3, crc4); + } + + } + + private static void report(String s, Checksum crc1, Checksum crc2, + Checksum crc3, Checksum crc4) { + System.out.println(s + ", crc1 = " + crc1.getValue() + + ", crc2 = " + crc2.getValue()+ + ", crc3 = " + crc3.getValue()+ + ", crc4 = " + crc4.getValue()); + } + + private static void check(Checksum crc1, Checksum crc2) throws Exception { + if (crc1.getValue() != crc2.getValue()) { + String s = "value 1 = " + crc1.getValue() + ", value 2 = " + crc2.getValue(); + System.err.println(s); + throw new Exception(s); + } + } + + private static byte[] initializedBytes(int M) { + byte[] bytes = new byte[M]; + for (int i = 0; i < bytes.length; i++) { + bytes[i] = (byte) i; + } + return bytes; + } + + private static void updateSerial(Checksum crc, byte[] b, int start, int length) { + for (int i = 0; i < length; i++) + crc.update(b[i+start]); + } + + private static void updateSerialSlow(Checksum crc, byte[] b, int start, int length) { + for (int i = 0; i < length; i++) + crc.update(b[i+start]); + crc.getValue(); + } + + private static void updateDirect(CRC32 crc3, byte[] b, int start, int length) { + ByteBuffer buf = ByteBuffer.allocateDirect(length); + buf.put(b, start, length); + buf.flip(); + crc3.update(buf); + } +} diff -r 0273c023680c -r 6ed8434664ed hotspot/test/compiler/8005956/PolynomialRoot.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/compiler/8005956/PolynomialRoot.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,783 @@ +//package com.polytechnik.utils; +/* + * (C) Vladislav Malyshkin 2010 + * This file is under GPL version 3. + * + */ + +/** Polynomial root. + * @version $Id: PolynomialRoot.java,v 1.105 2012/08/18 00:00:05 mal Exp $ + * @author Vladislav Malyshkin mal@gromco.com + */ + +/** +* @test +* @bug 8005956 +* @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block +* +* @run main/timeout=300 PolynomialRoot +*/ + +public class PolynomialRoot { + + +public static int findPolynomialRoots(final int n, + final double [] p, + final double [] re_root, + final double [] im_root) +{ + if(n==4) + { + return root4(p,re_root,im_root); + } + else if(n==3) + { + return root3(p,re_root,im_root); + } + else if(n==2) + { + return root2(p,re_root,im_root); + } + else if(n==1) + { + return root1(p,re_root,im_root); + } + else + { + throw new RuntimeException("n="+n+" is not supported yet"); + } +} + + + +static final double SQRT3=Math.sqrt(3.0),SQRT2=Math.sqrt(2.0); + + +private static final boolean PRINT_DEBUG=false; + +public static int root4(final double [] p,final double [] re_root,final double [] im_root) +{ + if(PRINT_DEBUG) System.err.println("=====================root4:p="+java.util.Arrays.toString(p)); + final double vs=p[4]; + if(PRINT_DEBUG) System.err.println("p[4]="+p[4]); + if(!(Math.abs(vs)>EPS)) + { + re_root[0]=re_root[1]=re_root[2]=re_root[3]= + im_root[0]=im_root[1]=im_root[2]=im_root[3]=Double.NaN; + return -1; + } + +/* zsolve_quartic.c - finds the complex roots of + * x^4 + a x^3 + b x^2 + c x + d = 0 + */ + final double a=p[3]/vs,b=p[2]/vs,c=p[1]/vs,d=p[0]/vs; + if(PRINT_DEBUG) System.err.println("input a="+a+" b="+b+" c="+c+" d="+d); + + + final double r4 = 1.0 / 4.0; + final double q2 = 1.0 / 2.0, q4 = 1.0 / 4.0, q8 = 1.0 / 8.0; + final double q1 = 3.0 / 8.0, q3 = 3.0 / 16.0; + final int mt; + + /* Deal easily with the cases where the quartic is degenerate. The + * ordering of solutions is done explicitly. */ + if (0 == b && 0 == c) + { + if (0 == d) + { + re_root[0]=-a; + im_root[0]=im_root[1]=im_root[2]=im_root[3]=0; + re_root[1]=re_root[2]=re_root[3]=0; + return 4; + } + else if (0 == a) + { + if (d > 0) + { + final double sq4 = Math.sqrt(Math.sqrt(d)); + re_root[0]=sq4*SQRT2/2; + im_root[0]=re_root[0]; + re_root[1]=-re_root[0]; + im_root[1]=re_root[0]; + re_root[2]=-re_root[0]; + im_root[2]=-re_root[0]; + re_root[3]=re_root[0]; + im_root[3]=-re_root[0]; + if(PRINT_DEBUG) System.err.println("Path a=0 d>0"); + } + else + { + final double sq4 = Math.sqrt(Math.sqrt(-d)); + re_root[0]=sq4; + im_root[0]=0; + re_root[1]=0; + im_root[1]=sq4; + re_root[2]=0; + im_root[2]=-sq4; + re_root[3]=-sq4; + im_root[3]=0; + if(PRINT_DEBUG) System.err.println("Path a=0 d<0"); + } + return 4; + } + } + + if (0.0 == c && 0.0 == d) + { + root2(new double []{p[2],p[3],p[4]},re_root,im_root); + re_root[2]=im_root[2]=re_root[3]=im_root[3]=0; + return 4; + } + + if(PRINT_DEBUG) System.err.println("G Path c="+c+" d="+d); + final double [] u=new double[3]; + + if(PRINT_DEBUG) System.err.println("Generic Path"); + /* For non-degenerate solutions, proceed by constructing and + * solving the resolvent cubic */ + final double aa = a * a; + final double pp = b - q1 * aa; + final double qq = c - q2 * a * (b - q4 * aa); + final double rr = d - q4 * a * (c - q4 * a * (b - q3 * aa)); + final double rc = q2 * pp , rc3 = rc / 3; + final double sc = q4 * (q4 * pp * pp - rr); + final double tc = -(q8 * qq * q8 * qq); + if(PRINT_DEBUG) System.err.println("aa="+aa+" pp="+pp+" qq="+qq+" rr="+rr+" rc="+rc+" sc="+sc+" tc="+tc); + final boolean flag_realroots; + + /* This code solves the resolvent cubic in a convenient fashion + * for this implementation of the quartic. If there are three real + * roots, then they are placed directly into u[]. If two are + * complex, then the real root is put into u[0] and the real + * and imaginary part of the complex roots are placed into + * u[1] and u[2], respectively. */ + { + final double qcub = (rc * rc - 3 * sc); + final double rcub = (rc*(2 * rc * rc - 9 * sc) + 27 * tc); + + final double Q = qcub / 9; + final double R = rcub / 54; + + final double Q3 = Q * Q * Q; + final double R2 = R * R; + + final double CR2 = 729 * rcub * rcub; + final double CQ3 = 2916 * qcub * qcub * qcub; + + if(PRINT_DEBUG) System.err.println("CR2="+CR2+" CQ3="+CQ3+" R="+R+" Q="+Q); + + if (0 == R && 0 == Q) + { + flag_realroots=true; + u[0] = -rc3; + u[1] = -rc3; + u[2] = -rc3; + } + else if (CR2 == CQ3) + { + flag_realroots=true; + final double sqrtQ = Math.sqrt (Q); + if (R > 0) + { + u[0] = -2 * sqrtQ - rc3; + u[1] = sqrtQ - rc3; + u[2] = sqrtQ - rc3; + } + else + { + u[0] = -sqrtQ - rc3; + u[1] = -sqrtQ - rc3; + u[2] = 2 * sqrtQ - rc3; + } + } + else if (R2 < Q3) + { + flag_realroots=true; + final double ratio = (R >= 0?1:-1) * Math.sqrt (R2 / Q3); + final double theta = Math.acos (ratio); + final double norm = -2 * Math.sqrt (Q); + + u[0] = norm * Math.cos (theta / 3) - rc3; + u[1] = norm * Math.cos ((theta + 2.0 * Math.PI) / 3) - rc3; + u[2] = norm * Math.cos ((theta - 2.0 * Math.PI) / 3) - rc3; + } + else + { + flag_realroots=false; + final double A = -(R >= 0?1:-1)*Math.pow(Math.abs(R)+Math.sqrt(R2-Q3),1.0/3.0); + final double B = Q / A; + + u[0] = A + B - rc3; + u[1] = -0.5 * (A + B) - rc3; + u[2] = -(SQRT3*0.5) * Math.abs (A - B); + } + if(PRINT_DEBUG) System.err.println("u[0]="+u[0]+" u[1]="+u[1]+" u[2]="+u[2]+" qq="+qq+" disc="+((CR2 - CQ3) / 2125764.0)); + } + /* End of solution to resolvent cubic */ + + /* Combine the square roots of the roots of the cubic + * resolvent appropriately. Also, calculate 'mt' which + * designates the nature of the roots: + * mt=1 : 4 real roots + * mt=2 : 0 real roots + * mt=3 : 2 real roots + */ + + + final double w1_re,w1_im,w2_re,w2_im,w3_re,w3_im,mod_w1w2,mod_w1w2_squared; + if (flag_realroots) + { + mod_w1w2=-1; + mt = 2; + int jmin=0; + double vmin=Math.abs(u[jmin]); + for(int j=1;j<3;j++) + { + final double vx=Math.abs(u[j]); + if(vx=0) + { + w1_re=Math.sqrt(u1); + w1_im=0; + } + else + { + w1_re=0; + w1_im=Math.sqrt(-u1); + } + if(u2>=0) + { + w2_re=Math.sqrt(u2); + w2_im=0; + } + else + { + w2_re=0; + w2_im=Math.sqrt(-u2); + } + if(PRINT_DEBUG) System.err.println("u1="+u1+" u2="+u2+" jmin="+jmin); + } + else + { + mt = 3; + final double w_mod2_sq=u[1]*u[1]+u[2]*u[2],w_mod2=Math.sqrt(w_mod2_sq),w_mod=Math.sqrt(w_mod2); + if(w_mod2_sq<=0) + { + w1_re=w1_im=0; + } + else + { + // calculate square root of a complex number (u[1],u[2]) + // the result is in the (w1_re,w1_im) + final double absu1=Math.abs(u[1]),absu2=Math.abs(u[2]),w; + if(absu1>=absu2) + { + final double t=absu2/absu1; + w=Math.sqrt(absu1*0.5 * (1.0 + Math.sqrt(1.0 + t * t))); + if(PRINT_DEBUG) System.err.println(" Path1 "); + } + else + { + final double t=absu1/absu2; + w=Math.sqrt(absu2*0.5 * (t + Math.sqrt(1.0 + t * t))); + if(PRINT_DEBUG) System.err.println(" Path1a "); + } + if(u[1]>=0) + { + w1_re=w; + w1_im=u[2]/(2*w); + if(PRINT_DEBUG) System.err.println(" Path2 "); + } + else + { + final double vi = (u[2] >= 0) ? w : -w; + w1_re=u[2]/(2*vi); + w1_im=vi; + if(PRINT_DEBUG) System.err.println(" Path2a "); + } + } + final double absu0=Math.abs(u[0]); + if(w_mod2>=absu0) + { + mod_w1w2=w_mod2; + mod_w1w2_squared=w_mod2_sq; + w2_re=w1_re; + w2_im=-w1_im; + } + else + { + mod_w1w2=-1; + mod_w1w2_squared=w_mod2*absu0; + if(u[0]>=0) + { + w2_re=Math.sqrt(absu0); + w2_im=0; + } + else + { + w2_re=0; + w2_im=Math.sqrt(absu0); + } + } + if(PRINT_DEBUG) System.err.println("u[0]="+u[0]+"u[1]="+u[1]+" u[2]="+u[2]+" absu0="+absu0+" w_mod="+w_mod+" w_mod2="+w_mod2); + } + + /* Solve the quadratic in order to obtain the roots + * to the quartic */ + if(mod_w1w2>0) + { + // a shorcut to reduce rounding error + w3_re=qq/(-8)/mod_w1w2; + w3_im=0; + } + else if(mod_w1w2_squared>0) + { + // regular path + final double mqq8n=qq/(-8)/mod_w1w2_squared; + w3_re=mqq8n*(w1_re*w2_re-w1_im*w2_im); + w3_im=-mqq8n*(w1_re*w2_im+w2_re*w1_im); + } + else + { + // typically occur when qq==0 + w3_re=w3_im=0; + } + + final double h = r4 * a; + if(PRINT_DEBUG) System.err.println("w1_re="+w1_re+" w1_im="+w1_im+" w2_re="+w2_re+" w2_im="+w2_im+" w3_re="+w3_re+" w3_im="+w3_im+" h="+h); + + re_root[0]=w1_re+w2_re+w3_re-h; + im_root[0]=w1_im+w2_im+w3_im; + re_root[1]=-(w1_re+w2_re)+w3_re-h; + im_root[1]=-(w1_im+w2_im)+w3_im; + re_root[2]=w2_re-w1_re-w3_re-h; + im_root[2]=w2_im-w1_im-w3_im; + re_root[3]=w1_re-w2_re-w3_re-h; + im_root[3]=w1_im-w2_im-w3_im; + + return 4; +} + + + + static void setRandomP(final double [] p,final int n,java.util.Random r) + { + if(r.nextDouble()<0.1) + { + // integer coefficiens + for(int j=0;j=0;k--) + { + final double res1=(res*rex-ims*imx)+p[k]; + final double ims1=(ims*rex+res*imx); + res=res1; + ims=ims1; + sabs+=xabs*sabs+p[k]; + } + sabs=Math.abs(sabs); + if(false && sabs>1/eps? + (!(Math.abs(res/sabs)<=eps)||!(Math.abs(ims/sabs)<=eps)) + : + (!(Math.abs(res)<=eps)||!(Math.abs(ims)<=eps))) + { + throw new RuntimeException( + getPolinomTXT(p)+"\n"+ + "\t x.r="+rex+" x.i="+imx+"\n"+ + "res/sabs="+(res/sabs)+" ims/sabs="+(ims/sabs)+ + " sabs="+sabs+ + "\nres="+res+" ims="+ims+" n="+n+" eps="+eps+" "+ + " sabs>1/eps="+(sabs>1/eps)+ + " f1="+(!(Math.abs(res/sabs)<=eps)||!(Math.abs(ims/sabs)<=eps))+ + " f2="+(!(Math.abs(res)<=eps)||!(Math.abs(ims)<=eps))+ + " "+txt); + } + } + + static String getPolinomTXT(final double [] p) + { + final StringBuilder buf=new StringBuilder(); + buf.append("order="+(p.length-1)+"\t"); + for(int k=0;k-1;) + { + for(int dr=3;dr-->0;) + { + setRandomP(p,n,rn); + for(int j=0;j<=dg;j++) + { + p[j]=0; + } + if(dr==0) + { + p[0]=-1+2.0*rn.nextDouble(); + } + else if(dr==1) + { + p[0]=p[1]=0; + } + + findPolynomialRoots(n,p,rex,imx); + + for(int j=0;j'?"); + if (outputWithError.getExitValue() == 0) { + throw new RuntimeException("Not expected to get exit value 0"); + } + + // The last JAVA process should run successfully for the purpose of sanity check + pb = ProcessTools.createJavaProcessBuilder( + "-XX:+PrintGC", + "-version" + ); + OutputAnalyzer outputWithNoError = new OutputAnalyzer(pb.start()); + outputWithNoError.shouldNotContain("Did you mean '(+/-)PrintGC'?"); + outputWithNoError.shouldHaveExitValue(0); + } +} + diff -r 0273c023680c -r 6ed8434664ed hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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.util.List; +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryManagerMXBean; +import java.lang.management.MemoryPoolMXBean; +import java.lang.management.MemoryUsage; + +import java.lang.management.RuntimeMXBean; +import java.lang.management.ManagementFactory; + +/* @test TestMetaspaceMemoryPool + * @bug 8000754 + * @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a + * MemoryManagerMXBean is created. + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers TestMetaspaceMemoryPool + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:ClassMetaspaceSize=60m TestMetaspaceMemoryPool + */ +public class TestMetaspaceMemoryPool { + public static void main(String[] args) { + verifyThatMetaspaceMemoryManagerExists(); + verifyMemoryPool(getMemoryPool("Metaspace"), isFlagDefined("MaxMetaspaceSize")); + + if (runsOn64bit()) { + if (usesCompressedOops()) { + MemoryPoolMXBean cksPool = getMemoryPool("Compressed Class Space"); + verifyMemoryPool(cksPool, true); + } + } + } + + private static boolean runsOn64bit() { + return !System.getProperty("sun.arch.data.model").equals("32"); + } + + private static boolean usesCompressedOops() { + return isFlagDefined("+UseCompressedOops"); + } + + private static boolean isFlagDefined(String name) { + RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); + List args = runtimeMxBean.getInputArguments(); + for (String arg : args) { + if (arg.startsWith("-XX:" + name)) { + return true; + } + } + return false; + } + + private static void verifyThatMetaspaceMemoryManagerExists() { + List managers = ManagementFactory.getMemoryManagerMXBeans(); + for (MemoryManagerMXBean manager : managers) { + if (manager.getName().equals("Metaspace Manager")) { + return; + } + } + + throw new RuntimeException("Expected to find a metaspace memory manager"); + } + + private static MemoryPoolMXBean getMemoryPool(String name) { + List pools = ManagementFactory.getMemoryPoolMXBeans(); + for (MemoryPoolMXBean pool : pools) { + if (pool.getName().equals(name)) { + return pool; + } + } + + throw new RuntimeException("Expected to find a memory pool with name " + name); + } + + private static void verifyMemoryPool(MemoryPoolMXBean pool, boolean isMaxDefined) { + MemoryUsage mu = pool.getUsage(); + assertDefined(mu.getInit(), "init"); + assertDefined(mu.getUsed(), "used"); + assertDefined(mu.getCommitted(), "committed"); + + if (isMaxDefined) { + assertDefined(mu.getMax(), "max"); + } else { + assertUndefined(mu.getMax(), "max"); + } + } + + private static void assertDefined(long value, String name) { + assertTrue(value != -1, "Expected " + name + " to be defined"); + } + + private static void assertUndefined(long value, String name) { + assertEquals(value, -1, "Expected " + name + " to be undefined"); + } + + private static void assertEquals(long actual, long expected, String msg) { + assertTrue(actual == expected, msg); + } + + private static void assertTrue(boolean condition, String msg) { + if (!condition) { + throw new RuntimeException(msg); + } + } +} diff -r 0273c023680c -r 6ed8434664ed hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 AdaptiveGCBoundary + * @summary UseAdaptiveGCBoundary is broken + * @bug 8014546 + * @key gc + * @key regression + * @library /testlibrary + * @run main/othervm AdaptiveGCBoundary + * @author jon.masamitsu@oracle.com + */ + +import com.oracle.java.testlibrary.*; + +public class AdaptiveGCBoundary { + public static void main(String args[]) throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-showversion", + "-XX:+UseParallelGC", + "-XX:+UseAdaptiveGCBoundary", + "-XX:+PrintCommandLineFlags", + SystemGCCaller.class.getName() + ); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + output.shouldContain("+UseAdaptiveGCBoundary"); + + output.shouldNotContain("error"); + + output.shouldHaveExitValue(0); + } + static class SystemGCCaller { + public static void main(String [] args) { + System.gc(); + } + } +} diff -r 0273c023680c -r 6ed8434664ed hotspot/test/runtime/6888954/vmerrors.sh --- a/hotspot/test/runtime/6888954/vmerrors.sh Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/test/runtime/6888954/vmerrors.sh Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,6 @@ # @test # @bug 6888954 +# @bug 8015884 # @summary exercise HotSpot error handling code # @author John Coomes # @run shell vmerrors.sh @@ -27,9 +28,24 @@ rc=0 assert_re='(assert|guarantee)[(](str|num).*failed: *' +# for bad_data_ptr_re: +# EXCEPTION_ACCESS_VIOLATION - Win-* +# SIGILL - MacOS X +# SIGSEGV - Linux-*, Solaris SPARC-*, Solaris X86-* +# +bad_data_ptr_re='(SIGILL|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' +# +# for bad_func_ptr_re: +# EXCEPTION_ACCESS_VIOLATION - Win-* +# SIGBUS - Solaris SPARC-64 +# SIGSEGV - Linux-*, Solaris SPARC-32, Solaris X86-* +# +# Note: would like to use "pc=0x00*0f," in the pattern, but Solaris SPARC-* +# gets its signal at a PC in test_error_handler(). +# +bad_func_ptr_re='(SIGBUS|SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' guarantee_re='guarantee[(](str|num).*failed: *' fatal_re='fatal error: *' -signal_re='(SIGSEGV|EXCEPTION_ACCESS_VIOLATION).* at pc=' tail_1='.*expected null' tail_2='.*num=' @@ -39,8 +55,9 @@ "${fatal_re}${tail_1}" "${fatal_re}${tail_2}" \ "${fatal_re}.*truncated" "ChunkPool::allocate" \ "ShouldNotCall" "ShouldNotReachHere" \ - "Unimplemented" "$signal_re" - + "Unimplemented" "$bad_data_ptr_re" \ + "$bad_func_ptr_re" + do i2=$i [ $i -lt 10 ] && i2=0$i diff -r 0273c023680c -r 6ed8434664ed hotspot/test/runtime/7196045/Test7196045.java --- a/hotspot/test/runtime/7196045/Test7196045.java Tue Jul 02 17:38:10 2013 -0700 +++ b/hotspot/test/runtime/7196045/Test7196045.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,7 +26,7 @@ * @test * @bug 7196045 * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API. - * @run main/othervm Test7196045 + * @run main/othervm -XX:+UsePerfData Test7196045 */ import java.lang.management.ManagementFactory; diff -r 0273c023680c -r 6ed8434664ed hotspot/test/runtime/8001071/Test8001071.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8001071/Test8001071.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 sun.misc.Unsafe; +import java.lang.reflect.Field; + +@SuppressWarnings("sunapi") +public class Test8001071 { + public static Unsafe unsafe; + + static { + try { + Field f = Unsafe.class.getDeclaredField("theUnsafe"); + f.setAccessible(true); + unsafe = (Unsafe) f.get(null); + } catch ( Exception e ) { + e.printStackTrace(); + } + } + + public static void main(String args[]) { + unsafe.getObject(new Test8001071(), Short.MAX_VALUE); + } + +} diff -r 0273c023680c -r 6ed8434664ed hotspot/test/runtime/8001071/Test8001071.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/8001071/Test8001071.sh Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,63 @@ +#!/bin/sh + +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# 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 8001071 +## @summary Add simple range check into VM implemenation of Unsafe access methods +## @compile Test8001071.java +## @run shell Test8001071.sh +## @author filipp.zhinkin@oracle.com + +VERSION=`${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1` + +if [ -n "`echo $VERSION | grep debug`" -o -n "`echo $VERSION | grep jvmg`" ]; then + echo "Build type check passed" + echo "Continue testing" +else + echo "Fastdebug build is required for this test" + exit 0 +fi + +${TESTJAVA}/bin/java -cp ${TESTCLASSES} ${TESTVMOPTS} Test8001071 2>&1 + +HS_ERR_FILE=hs_err_pid*.log + +if [ ! -f $HS_ERR_FILE ] +then + echo "hs_err_pid log file was not found" + echo "Test failed" + exit 1 +fi + +grep "assert(byte_offset < p_size) failed: Unsafe access: offset.*> object's size.*" $HS_ERR_FILE + +if [ "0" = "$?" ]; +then + echo "Range check assertion failed as expected" + echo "Test passed" + exit 0 +else + echo "Range check assertion was not failed" + echo "Test failed" + exit 1 +fi diff -r 0273c023680c -r 6ed8434664ed jaxp/.hgtags --- a/jaxp/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ d583a491d63c49eeda4869525048075da1cb596e jdk8-b93 c84658e1740df64931005a9bc4c8ecef38eb47c3 jdk8-b94 b8c5f4b6f0fffb44618fc609a584953c4ed67c0b jdk8-b95 +6121efd299235b057f3de94b0a4158c388c2907c jdk8-b96 +6c830db28d21108f32af990ecf4d80a75887980d jdk8-b97 +15e5bb51bc0cd89304dc2f7f29b4c8002e632353 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/DatatypeMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/JAXPValidationMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSerializerMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2009, 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_de.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_de.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_de.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_es.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_es.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_es.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_fr.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_it.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_it.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_it.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ja.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ko.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ko.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_ko.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_pt_BR.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_pt_BR.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_pt_BR.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_sv.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_sv.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_sv.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_CN.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_CN.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_CN.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_TW.properties --- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_TW.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/regex/message_zh_TW.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jaxws/.hgtags --- a/jaxws/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/jaxws/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ 7386eca865e1f7216637cdf8dcf3f5d5c255f208 jdk8-b93 254c53fd97ab24942043adcfa5c1a0a38a3b274e jdk8-b94 1468c94135f978dd29d03bce2f7d7e952154d144 jdk8-b95 +690d34b326bc78a6f5f225522695b41c7f7f70e8 jdk8-b96 +dcde7f049111353ad23175f54985a4f6bfea720c jdk8-b97 +b1fb4612a2caea52b5661b87509e560fa044b194 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed jdk/.hgtags --- a/jdk/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ 691d6c6cd332d98b0f0221445a73906776f31f72 jdk8-b93 51479fa56b7c4363c6d87c2e8b898d8185cf4b22 jdk8-b94 42aa9f1828852bb8b77e98ec695211493ae0759d jdk8-b95 +4a5d3cf2b3af1660db0237e8da324c140e534fa4 jdk8-b96 +978a95239044f26dcc8a6d59246be07ad6ca6be2 jdk8-b97 +c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed jdk/make/common/Release.gmk --- a/jdk/make/common/Release.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/make/common/Release.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -252,7 +252,7 @@ $(INITIAL_IMAGE_JRE) $(INITIAL_IMAGE_JDK) \ trim-image-jre trim-image-jdk \ identify-image-jre identify-image-jdk \ - process-image-jre process-image-jdk sec-files sec-files-win jgss-files + process-image-jre process-image-jdk sec-files sec-files-win jgss-files endif # Don't use these @@ -400,7 +400,8 @@ # classes that go into jfr.jar JFR_CLASSES_DIRS= \ com/oracle/jrockit/jfr \ - oracle/jrockit/jfr + oracle/jrockit/jfr \ + jdk/jfr # classes that go into jsse.jar JSSE_CLASSES_DIRS = \ @@ -612,6 +613,7 @@ $(ECHO) "oracle/jrockit/jfr/parser/" >> $@ $(ECHO) "oracle/jrockit/jfr/settings/" >> $@ $(ECHO) "oracle/jrockit/jfr/tools/" >> $@ + $(ECHO) "jdk/jfr/" >> $@ endif endif diff -r 0273c023680c -r 6ed8434664ed jdk/make/java/java/FILES_java.gmk --- a/jdk/make/java/java/FILES_java.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/make/java/java/FILES_java.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -529,7 +529,6 @@ sun/misc/JavaNioAccess.java \ sun/misc/Perf.java \ sun/misc/PerfCounter.java \ - sun/misc/Hashing.java \ sun/net/www/protocol/jar/Handler.java \ sun/net/www/protocol/jar/JarURLConnection.java \ sun/net/www/protocol/file/Handler.java \ diff -r 0273c023680c -r 6ed8434664ed jdk/make/sun/font/Makefile --- a/jdk/make/sun/font/Makefile Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/make/sun/font/Makefile Thu Jul 11 12:50:20 2013 -0700 @@ -36,7 +36,11 @@ CPLUSPLUSLIBRARY=true # Use higher optimization level +ifeq ($(PLATFORM), windows) +OPTIMIZATION_LEVEL = HIGHEST +else OPTIMIZATION_LEVEL = HIGHER +endif include $(BUILDDIR)/common/Defs.gmk diff -r 0273c023680c -r 6ed8434664ed jdk/makefiles/CompileNativeLibraries.gmk --- a/jdk/makefiles/CompileNativeLibraries.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/makefiles/CompileNativeLibraries.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -1332,7 +1332,7 @@ ifeq ($(OPENJDK_TARGET_OS),windows) LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \ X11TextRenderer.c - LIBFONTMANAGER_OPTIMIZATION:=LOW +LIBFONTMANAGER_OPTIMIZATION:=HIGHEST else LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \ lcdglyph.c diff -r 0273c023680c -r 6ed8434664ed jdk/makefiles/CreateJars.gmk --- a/jdk/makefiles/CreateJars.gmk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/makefiles/CreateJars.gmk Thu Jul 11 12:50:20 2013 -0700 @@ -132,7 +132,7 @@ ########################################################################################## # Full JRE exclude list for rt.jar and resources.jar -# This value should exclude types destined for jars other than rt.jar and resources.jar. +# This value should exclude types destined for jars other than rt.jar and resources.jar. # When building a Profile this value augments the profile specific exclusions RT_JAR_EXCLUDES += \ com/oracle/security \ @@ -246,7 +246,8 @@ sun/util/resources/cldr \ $(LOCALEDATA_INCLUDES) \ com/oracle/jrockit/jfr \ - oracle/jrockit/jfr + oracle/jrockit/jfr \ + jdk/jfr ifeq ($(OPENJDK_TARGET_OS), macosx) RT_JAR_EXCLUDES += com/sun/nio/sctp \ @@ -337,7 +338,7 @@ # Support for removing the addPropertyChangeListener and removePropertyChangeListener -# methods from classes that only go into the profile builds. +# methods from classes that only go into the profile builds. BEANLESS_CLASSES = $(IMAGES_OUTPUTDIR)/beanless # When there are $ characters in filenames we have some very subtle interactions between @@ -352,7 +353,7 @@ java/util/jar/Pack200\$$Packer.class \ java/util/jar/Pack200\$$Unpacker.class \ com/sun/java/util/jar/pack/PackerImpl.class \ - com/sun/java/util/jar/pack/UnpackerImpl.class + com/sun/java/util/jar/pack/UnpackerImpl.class ifneq ($(PROFILE),) BEANLESS_CLASSES_TARGETS := $(addprefix $(BEANLESS_CLASSES)/, $(CLASSES_TO_DEBEAN)) @@ -428,7 +429,8 @@ SRCS:=$(JDK_OUTPUTDIR)/classes,\ SUFFIXES:=.class .jfc .xsd,\ INCLUDES:=com/oracle/jrockit/jfr \ - oracle/jrockit/jfr,\ + oracle/jrockit/jfr \ + jdk/jfr,\ JAR:=$(IMAGES_OUTPUTDIR)/lib/jfr.jar,\ SKIP_METAINF:=true,\ MANIFEST:=$(MAINMANIFEST), \ @@ -468,14 +470,14 @@ $(MV) $@.tmp $@ ########################################################################################## -# For security and crypto jars, always build the jar, but for closed, install the prebuilt -# signed version instead of the newly built jar. Unsigned jars are treated as intermediate -# targets and explicitly added to the JARS list. For open, signing is not needed. See +# For security and crypto jars, always build the jar, but for closed, install the prebuilt +# signed version instead of the newly built jar. Unsigned jars are treated as intermediate +# targets and explicitly added to the JARS list. For open, signing is not needed. See # SignJars.gmk for more information. # # The source for the crypto jars is not available for all licensees. The BUILD_CRYPTO # variable is set to no if these jars can't be built to skip that step of the build. -# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no +# Note that for OPENJDK, the build will fail if BUILD_CRYPTO=no since then there is no # other way to get the jars than to build them. SUNPKCS11_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/sunpkcs11.jar @@ -738,7 +740,7 @@ @$(ECHO) $(LOG_INFO) "\n>>>Installing prebuilt OracleUcrypto provider..." $(install-file) -JARS += $(UCRYPTO_JAR_UNSIGNED) +JARS += $(UCRYPTO_JAR_UNSIGNED) endif endif diff -r 0273c023680c -r 6ed8434664ed jdk/makefiles/profile-includes.txt --- a/jdk/makefiles/profile-includes.txt Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/makefiles/profile-includes.txt Thu Jul 11 12:50:20 2013 -0700 @@ -125,13 +125,11 @@ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \ - $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \ - jfr.jar \ jvm.hprof.txt \ management-agent.jar \ management/jmxremote.access \ @@ -164,6 +162,7 @@ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \ + $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \ $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \ @@ -214,6 +213,7 @@ images/cursors/motif_MoveDrop32x32.gif \ images/cursors/motif_MoveNoDrop32x32.gif \ jexec \ + jfr.jar \ oblique-fonts/LucidaSansDemiOblique.ttf \ oblique-fonts/LucidaSansOblique.ttf \ oblique-fonts/LucidaTypewriterBoldOblique.ttf \ diff -r 0273c023680c -r 6ed8434664ed jdk/makefiles/sun/awt/ToBin.java --- a/jdk/makefiles/sun/awt/ToBin.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/makefiles/sun/awt/ToBin.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 0273c023680c -r 6ed8434664ed jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java Thu Jul 11 12:50:20 2013 -0700 @@ -127,8 +127,21 @@ } } + /** + * When the parent window is activated this method is called for all EmbeddedFrames in it. + * + * For the CEmbeddedFrame which had focus before the deactivation this method triggers + * focus events in the following order: + * 1. WINDOW_ACTIVATED for this EmbeddedFrame + * 2. WINDOW_GAINED_FOCUS for this EmbeddedFrame + * 3. FOCUS_GAINED for the most recent focus owner in this EmbeddedFrame + * + * The caller must not requestFocus on the EmbeddedFrame together with calling this method. + * + * @param parentWindowActive true if the window is activated, false otherwise + */ // handleWindowFocusEvent is called for all applets, when the browser - // becames active/inactive. This event should be filtered out for + // becomes active/inactive. This event should be filtered out for // non-focused applet. This method can be called from different threads. public void handleWindowFocusEvent(boolean parentWindowActive) { this.parentWindowActive = parentWindowActive; diff -r 0273c023680c -r 6ed8434664ed jdk/src/macosx/native/sun/awt/AWTEvent.m --- a/jdk/src/macosx/native/sun/awt/AWTEvent.m Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/macosx/native/sun/awt/AWTEvent.m Thu Jul 11 12:50:20 2013 -0700 @@ -382,7 +382,7 @@ { TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource(); CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); - if (uchr == nil) { return; } + if (uchr == nil) { return 0; } const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr); // Carbon modifiers should be used instead of NSEvent modifiers UInt32 modifierKeyState = (GetCurrentEventKeyModifiers() >> 8) & 0xFF; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/beans/XMLEncoder.java --- a/jdk/src/share/classes/java/beans/XMLEncoder.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/beans/XMLEncoder.java Thu Jul 11 12:50:20 2013 -0700 @@ -377,7 +377,7 @@ Object arg = args[i]; mark(arg, true); } - mark(stm.getTarget(), false); + mark(stm.getTarget(), stm instanceof Expression); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Boolean.java --- a/jdk/src/share/classes/java/lang/Boolean.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Boolean.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -205,9 +205,9 @@ * Returns a hash code for a {@code boolean} value; compatible with * {@code Boolean.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code boolean} value. * @since 1.8 - * - * @return a hash code value for a {@code boolean} value. */ public static int hashCode(boolean value) { return value ? 1231 : 1237; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Byte.java --- a/jdk/src/share/classes/java/lang/Byte.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Byte.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -398,9 +398,9 @@ * Returns a hash code for a {@code byte} value; compatible with * {@code Byte.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code byte} value. * @since 1.8 - * - * @return a hash code value for a {@code byte} value. */ public static int hashCode(byte value) { return (int)value; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Class.java --- a/jdk/src/share/classes/java/lang/Class.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Class.java Thu Jul 11 12:50:20 2013 -0700 @@ -3250,6 +3250,8 @@ * could not be checked at runtime (because generic types are implemented * by erasure). * + * @param the type to cast this class object to + * @param clazz the class of the type to cast this class object to * @return this {@code Class} object, cast to represent a subclass of * the specified class object. * @throws ClassCastException if this {@code Class} object does not @@ -3405,6 +3407,7 @@ * If this Class represents either the Object class, an interface type, an * array type, a primitive type, or void, the return value is null. * + * @return an object representing the superclass * @since 1.8 */ public AnnotatedType getAnnotatedSuperclass() { @@ -3436,6 +3439,7 @@ * If this Class represents either the Object class, an array type, a * primitive type, or void, the return value is an array of length 0. * + * @return an array representing the superinterfaces * @since 1.8 */ public AnnotatedType[] getAnnotatedInterfaces() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Double.java --- a/jdk/src/share/classes/java/lang/Double.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Double.java Thu Jul 11 12:50:20 2013 -0700 @@ -453,8 +453,7 @@ * a {@code NumberFormatException} be thrown, the regular * expression below can be used to screen the input string: * - * - *
+     * 
{@code
      *  final String Digits     = "(\\p{Digit}+)";
      *  final String HexDigits  = "(\\p{XDigit}+)";
      *  // an exponent is 'e' or 'E' followed by an optionally
@@ -474,7 +473,7 @@
      *       // in addition to strings of floating-point literals, the
      *       // two sub-patterns below are simplifications of the grammar
      *       // productions from section 3.10.2 of
-     *       // The Java™ Language Specification.
+     *       // The Java Language Specification.
      *
      *       // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
      *       "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
@@ -499,8 +498,7 @@
      *  else {
      *      // Perform suitable alternative action
      *  }
-     * 
- *
+ * }
* * @param s the string to be parsed. * @return a {@code Double} object holding the value @@ -756,9 +754,9 @@ * Returns a hash code for a {@code double} value; compatible with * {@code Double.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code double} value. * @since 1.8 - * - * @return a hash code value for a {@code double} value. */ public static int hashCode(double value) { long bits = doubleToLongBits(value); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Float.java --- a/jdk/src/share/classes/java/lang/Float.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Float.java Thu Jul 11 12:50:20 2013 -0700 @@ -664,9 +664,9 @@ * Returns a hash code for a {@code float} value; compatible with * {@code Float.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code float} value. * @since 1.8 - * - * @return a hash code value for a {@code float} value. */ public static int hashCode(float value) { return floatToIntBits(value); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Integer.java --- a/jdk/src/share/classes/java/lang/Integer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Integer.java Thu Jul 11 12:50:20 2013 -0700 @@ -951,6 +951,7 @@ * Returns a hash code for a {@code int} value; compatible with * {@code Integer.hashCode()}. * + * @param value the value to hash * @since 1.8 * * @return a hash code value for a {@code int} value. @@ -1336,6 +1337,7 @@ * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose highest one bit is to be computed * @return an {@code int} value with a single one-bit, in the position * of the highest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. @@ -1358,6 +1360,7 @@ * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose lowest one bit is to be computed * @return an {@code int} value with a single one-bit, in the position * of the lowest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. @@ -1382,6 +1385,7 @@ *
  • ceil(log2(x)) = {@code 32 - numberOfLeadingZeros(x - 1)} * * + * @param i the value whose number of leading zeros is to be computed * @return the number of zero bits preceding the highest-order * ("leftmost") one-bit in the two's complement binary representation * of the specified {@code int} value, or 32 if the value @@ -1408,6 +1412,7 @@ * one-bits in its two's complement representation, in other words if it is * equal to zero. * + * @param i the value whose number of trailing zeros is to be computed * @return the number of zero bits following the lowest-order ("rightmost") * one-bit in the two's complement binary representation of the * specified {@code int} value, or 32 if the value is equal @@ -1431,6 +1436,7 @@ * representation of the specified {@code int} value. This function is * sometimes referred to as the population count. * + * @param i the value whose bits are to be counted * @return the number of one-bits in the two's complement binary * representation of the specified {@code int} value. * @since 1.5 @@ -1458,6 +1464,8 @@ * ignored, even if the distance is negative: {@code rotateLeft(val, * distance) == rotateLeft(val, distance & 0x1F)}. * + * @param i the value whose bits are to be rotated left + * @param distance the number of bit positions to rotate left * @return the value obtained by rotating the two's complement binary * representation of the specified {@code int} value left by the * specified number of bits. @@ -1480,6 +1488,8 @@ * ignored, even if the distance is negative: {@code rotateRight(val, * distance) == rotateRight(val, distance & 0x1F)}. * + * @param i the value whose bits are to be rotated right + * @param distance the number of bit positions to rotate right * @return the value obtained by rotating the two's complement binary * representation of the specified {@code int} value right by the * specified number of bits. @@ -1494,6 +1504,7 @@ * two's complement binary representation of the specified {@code int} * value. * + * @param i the value to be reversed * @return the value obtained by reversing order of the bits in the * specified {@code int} value. * @since 1.5 @@ -1513,6 +1524,7 @@ * return value is -1 if the specified value is negative; 0 if the * specified value is zero; and 1 if the specified value is positive.) * + * @param i the value whose signum is to be computed * @return the signum function of the specified {@code int} value. * @since 1.5 */ @@ -1525,6 +1537,7 @@ * Returns the value obtained by reversing the order of the bytes in the * two's complement representation of the specified {@code int} value. * + * @param i the value whose bytes are to be reversed * @return the value obtained by reversing the bytes in the specified * {@code int} value. * @since 1.5 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Long.java --- a/jdk/src/share/classes/java/lang/Long.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Long.java Thu Jul 11 12:50:20 2013 -0700 @@ -1053,9 +1053,9 @@ * Returns a hash code for a {@code long} value; compatible with * {@code Long.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code long} value. * @since 1.8 - * - * @return a hash code value for a {@code long} value. */ public static int hashCode(long value) { return (int)(value ^ (value >>> 32)); @@ -1357,6 +1357,7 @@ * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose highest one bit is to be computed * @return a {@code long} value with a single one-bit, in the position * of the highest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. @@ -1380,6 +1381,7 @@ * one-bits in its two's complement binary representation, that is, if it * is equal to zero. * + * @param i the value whose lowest one bit is to be computed * @return a {@code long} value with a single one-bit, in the position * of the lowest-order one-bit in the specified value, or zero if * the specified value is itself equal to zero. @@ -1404,6 +1406,7 @@ *
  • ceil(log2(x)) = {@code 64 - numberOfLeadingZeros(x - 1)} * * + * @param i the value whose number of leading zeros is to be computed * @return the number of zero bits preceding the highest-order * ("leftmost") one-bit in the two's complement binary representation * of the specified {@code long} value, or 64 if the value @@ -1432,6 +1435,7 @@ * one-bits in its two's complement representation, in other words if it is * equal to zero. * + * @param i the value whose number of trailing zeros is to be computed * @return the number of zero bits following the lowest-order ("rightmost") * one-bit in the two's complement binary representation of the * specified {@code long} value, or 64 if the value is equal @@ -1456,6 +1460,7 @@ * representation of the specified {@code long} value. This function is * sometimes referred to as the population count. * + * @param i the value whose bits are to be counted * @return the number of one-bits in the two's complement binary * representation of the specified {@code long} value. * @since 1.5 @@ -1484,6 +1489,8 @@ * ignored, even if the distance is negative: {@code rotateLeft(val, * distance) == rotateLeft(val, distance & 0x3F)}. * + * @param i the value whose bits are to be rotated left + * @param distance the number of bit positions to rotate left * @return the value obtained by rotating the two's complement binary * representation of the specified {@code long} value left by the * specified number of bits. @@ -1506,6 +1513,8 @@ * ignored, even if the distance is negative: {@code rotateRight(val, * distance) == rotateRight(val, distance & 0x3F)}. * + * @param i the value whose bits are to be rotated right + * @param distance the number of bit positions to rotate right * @return the value obtained by rotating the two's complement binary * representation of the specified {@code long} value right by the * specified number of bits. @@ -1520,6 +1529,7 @@ * two's complement binary representation of the specified {@code long} * value. * + * @param i the value to be reversed * @return the value obtained by reversing order of the bits in the * specified {@code long} value. * @since 1.5 @@ -1540,6 +1550,7 @@ * return value is -1 if the specified value is negative; 0 if the * specified value is zero; and 1 if the specified value is positive.) * + * @param i the value whose signum is to be computed * @return the signum function of the specified {@code long} value. * @since 1.5 */ @@ -1552,6 +1563,7 @@ * Returns the value obtained by reversing the order of the bytes in the * two's complement representation of the specified {@code long} value. * + * @param i the value whose bytes are to be reversed * @return the value obtained by reversing the bytes in the specified * {@code long} value. * @since 1.5 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Package.java --- a/jdk/src/share/classes/java/lang/Package.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Package.java Thu Jul 11 12:50:20 2013 -0700 @@ -77,18 +77,18 @@ * by the following formal grammar: *
    *
    - *
    SpecificationVersion: - *
    Digits RefinedVersionopt + *
    SpecificationVersion: + *
    Digits RefinedVersionopt - *

    RefinedVersion: + *
    RefinedVersion: *
    {@code .} Digits *
    {@code .} Digits RefinedVersion * - *

    Digits: - *
    Digit - *
    Digits + *
    Digits: + *
    Digit + *
    Digits * - *

    Digit: + *
    Digit: *
    any character for which {@link Character#isDigit} returns {@code true}, * e.g. 0, 1, 2, ... *
    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Runtime.java --- a/jdk/src/share/classes/java/lang/Runtime.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Runtime.java Thu Jul 11 12:50:20 2013 -0700 @@ -117,11 +117,11 @@ * *
      * - *

    • The program exits normally, when the last non-daemon + *
    • The program exits normally, when the last non-daemon * thread exits or when the {@link #exit exit} (equivalently, - * {@link System#exit(int) System.exit}) method is invoked, or + * {@link System#exit(int) System.exit}) method is invoked, or * - *

    • The virtual machine is terminated in response to a + *
    • The virtual machine is terminated in response to a * user interrupt, such as typing ^C, or a system-wide event, * such as user logoff or system shutdown. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Short.java --- a/jdk/src/share/classes/java/lang/Short.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Short.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -403,9 +403,9 @@ * Returns a hash code for a {@code short} value; compatible with * {@code Short.hashCode()}. * + * @param value the value to hash + * @return a hash code value for a {@code short} value. * @since 1.8 - * - * @return a hash code value for a {@code short} value. */ public static int hashCode(short value) { return (int)value; @@ -482,6 +482,7 @@ * Returns the value obtained by reversing the order of the bytes in the * two's complement representation of the specified {@code short} value. * + * @param i the value whose bytes are to be reversed * @return the value obtained by reversing (or, equivalently, swapping) * the bytes in the specified {@code short} value. * @since 1.5 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/StrictMath.java --- a/jdk/src/share/classes/java/lang/StrictMath.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/StrictMath.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1419,6 +1419,7 @@ * {@link Float#MIN_EXPONENT} -1. *
    * @param f a {@code float} value + * @return the unbiased exponent of the argument * @since 1.6 */ public static int getExponent(float f) { @@ -1436,6 +1437,7 @@ * {@link Double#MIN_EXPONENT} -1. * * @param d a {@code double} value + * @return the unbiased exponent of the argument * @since 1.6 */ public static int getExponent(double d) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/SuppressWarnings.java --- a/jdk/src/share/classes/java/lang/SuppressWarnings.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/SuppressWarnings.java Thu Jul 11 12:50:20 2013 -0700 @@ -66,6 +66,7 @@ * additional warning names they support in conjunction with this * annotation type. They are encouraged to cooperate to ensure * that the same names work across multiple compilers. + * @return the set of warnings to be suppressed */ String[] value(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/System.java --- a/jdk/src/share/classes/java/lang/System.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/System.java Thu Jul 11 12:50:20 2013 -0700 @@ -634,6 +634,8 @@ * *

    On UNIX systems, it returns {@code "\n"}; on Microsoft * Windows systems it returns {@code "\r\n"}. + * + * @return the system-dependent line separator string * @since 1.7 */ public static String lineSeparator() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/Thread.java --- a/jdk/src/share/classes/java/lang/Thread.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/Thread.java Thu Jul 11 12:50:20 2013 -0700 @@ -1993,12 +1993,21 @@ // The following three initially uninitialized fields are exclusively - // managed by class java.util.concurrent.ThreadLocalRandom. + // managed by class java.util.concurrent.ThreadLocalRandom. These + // fields are used to build the high-performance PRNGs in the + // concurrent code, and we can not risk accidental false sharing. + // Hence, the fields are isolated with @Contended. + /** The current seed for a ThreadLocalRandom */ + @sun.misc.Contended("tlr") long threadLocalRandomSeed; + /** Probe hash value; nonzero if threadLocalRandomSeed initialized */ + @sun.misc.Contended("tlr") int threadLocalRandomProbe; + /** Secondary seed isolated from public ThreadLocalRandom sequence */ + @sun.misc.Contended("tlr") int threadLocalRandomSecondarySeed; /* Some private helper methods */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/annotation/Annotation.java --- a/jdk/src/share/classes/java/lang/annotation/Annotation.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/annotation/Annotation.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -126,6 +126,7 @@ /** * Returns the annotation type of this annotation. + * @return the annotation type of this annotation */ Class annotationType(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/annotation/Repeatable.java --- a/jdk/src/share/classes/java/lang/annotation/Repeatable.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/annotation/Repeatable.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,6 +43,7 @@ /** * Indicates the containing annotation type for the * repeatable annotation type. + * @return the containing annotation type */ Class value(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/annotation/Retention.java --- a/jdk/src/share/classes/java/lang/annotation/Retention.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/annotation/Retention.java Thu Jul 11 12:50:20 2013 -0700 @@ -44,5 +44,9 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Retention { + /** + * Returns the retention policy. + * @return the retention policy + */ RetentionPolicy value(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/annotation/Target.java --- a/jdk/src/share/classes/java/lang/annotation/Target.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/annotation/Target.java Thu Jul 11 12:50:20 2013 -0700 @@ -67,5 +67,11 @@ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.ANNOTATION_TYPE) public @interface Target { + /** + * Returns an array of the kinds of elements an annotation type + * can be applied to. + * @return an array of the kinds of elements an annotation type + * can be applied to + */ ElementType[] value(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/instrument/Instrumentation.java --- a/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/instrument/Instrumentation.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -363,6 +363,8 @@ * Primitive classes (for example, java.lang.Integer.TYPE) * and array classes are never modifiable. * + * @param theClass the class to check for being modifiable + * @return whether or not the argument class is modifiable * @throws java.lang.NullPointerException if the specified class is null. * * @see #retransformClasses @@ -549,14 +551,14 @@ * {@link java.lang.instrument.ClassFileTransformer ClassFileTransformer}, * it enables native methods to be * instrumented. - *

    + *

    * Since native methods cannot be directly instrumented * (they have no bytecodes), they must be wrapped with * a non-native method which can be instrumented. * For example, if we had: *

          *   native boolean foo(int x);
    - *

    + *

    * We could transform the class file (with the * ClassFileTransformer during the initial definition * of the class) so that this becomes: @@ -567,14 +569,14 @@ * } * * native boolean wrapped_foo(int x); - *

    + *

    * Where foo becomes a wrapper for the actual native * method with the appended prefix "wrapped_". Note that * "wrapped_" would be a poor choice of prefix since it * might conceivably form the name of an existing method * thus something like "$$$MyAgentWrapped$$$_" would be * better but would make these examples less readable. - *

    + *

    * The wrapper will allow data to be collected on the native * method call, but now the problem becomes linking up the * wrapped method with the native implementation. @@ -583,7 +585,7 @@ * which might be: *

          *   Java_somePackage_someClass_foo(JNIEnv* env, jint x)
    - *

    + *

    * This function allows the prefix to be specified and the * proper resolution to occur. * Specifically, when the standard resolution fails, the @@ -596,29 +598,29 @@ *

    {@code
          *   method(foo) -> nativeImplementation(foo)
          * }
    - *

    + *

    * When this fails, the resolution will be retried with * the specified prefix prepended to the method name, * yielding the correct resolution: *

    {@code
          *   method(wrapped_foo) -> nativeImplementation(foo)
          * }
    - *

    + *

    * For automatic resolution, the JVM will attempt: *

    {@code
          *   method(wrapped_foo) -> nativeImplementation(wrapped_foo)
          * }
    - *

    + *

    * When this fails, the resolution will be retried with * the specified prefix deleted from the implementation name, * yielding the correct resolution: *

    {@code
          *   method(wrapped_foo) -> nativeImplementation(foo)
          * }
    - *

    + *

    * Note that since the prefix is only used when standard * resolution fails, native methods can be wrapped selectively. - *

    + *

    * Since each ClassFileTransformer * can do its own transformation of the bytecodes, more * than one layer of wrappers may be applied. Thus each diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,24 +24,23 @@ */ package java.lang.invoke; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import sun.invoke.util.Wrapper; -import static sun.invoke.util.Wrapper.*; + +import static sun.invoke.util.Wrapper.forPrimitiveType; +import static sun.invoke.util.Wrapper.forWrapperType; +import static sun.invoke.util.Wrapper.isWrapperType; /** - * Abstract implementation of a lambda metafactory which provides parameter unrolling and input validation. + * Abstract implementation of a lambda metafactory which provides parameter + * unrolling and input validation. * * @see LambdaMetafactory */ /* package */ abstract class AbstractValidatingLambdaMetafactory { /* - * For context, the comments for the following fields are marked in quotes with their values, given this program: + * For context, the comments for the following fields are marked in quotes + * with their values, given this program: * interface II { Object foo(T x); } * interface JJ extends II { } * class CC { String impl(int i) { return "impl:"+i; }} @@ -54,9 +53,7 @@ final Class targetClass; // The class calling the meta-factory via invokedynamic "class X" final MethodType invokedType; // The type of the invoked method "(CC)II" final Class samBase; // The type of the returned instance "interface JJ" - final MethodHandle samMethod; // Raw method handle for the functional interface method - final MethodHandleInfo samInfo; // Info about the SAM method handle "MethodHandleInfo[9 II.foo(Object)Object]" - final Class samClass; // Interface containing the SAM method "interface II" + final String samMethodName; // Name of the SAM method "foo" final MethodType samMethodType; // Type of the SAM method "(Object)Object" final MethodHandle implMethod; // Raw method handle for the implementation method final MethodHandleInfo implInfo; // Info about the implementation method handle "MethodHandleInfo[5 CC.impl(int)String]" @@ -67,44 +64,64 @@ final MethodType instantiatedMethodType; // Instantiated erased functional interface method type "(Integer)Object" final boolean isSerializable; // Should the returned instance be serializable final Class[] markerInterfaces; // Additional marker interfaces to be implemented + final MethodType[] additionalBridges; // Signatures of additional methods to bridge /** * Meta-factory constructor. * - * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges - * of the caller. - * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the - * expected static type of the returned lambda object, and the static types of the captured - * arguments for the lambda. In the event that the implementation method is an instance method, - * the first argument in the invocation signature will correspond to the receiver. - * @param samMethod The primary method in the functional interface to which the lambda or method reference is - * being converted, represented as a method handle. - * @param implMethod The implementation method which should be called (with suitable adaptation of argument - * types, return types, and adjustment for captured arguments) when methods of the resulting - * functional interface instance are invoked. - * @param instantiatedMethodType The signature of the primary functional interface method after type variables - * are substituted with their instantiation from the capture site + * @param caller Stacked automatically by VM; represents a lookup context + * with the accessibility privileges of the caller. + * @param invokedType Stacked automatically by VM; the signature of the + * invoked method, which includes the expected static + * type of the returned lambda object, and the static + * types of the captured arguments for the lambda. In + * the event that the implementation method is an + * instance method, the first argument in the invocation + * signature will correspond to the receiver. + * @param samMethodName Name of the method in the functional interface to + * which the lambda or method reference is being + * converted, represented as a String. + * @param samMethodType Type of the method in the functional interface to + * which the lambda or method reference is being + * converted, represented as a MethodType. + * @param implMethod The implementation method which should be called + * (with suitable adaptation of argument types, return + * types, and adjustment for captured arguments) when + * methods of the resulting functional interface instance + * are invoked. + * @param instantiatedMethodType The signature of the primary functional + * interface method after type variables are + * substituted with their instantiation from + * the capture site + * @param isSerializable Should the lambda be made serializable? If set, + * either the target type or one of the additional SAM + * types must extend {@code Serializable}. + * @param markerInterfaces Additional interfaces which the lambda object + * should implement. + * @param additionalBridges Method types for additional signatures to be + * bridged to the implementation method * @throws ReflectiveOperationException - * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated + * @throws LambdaConversionException If any of the meta-factory protocol + * invariants are violated */ AbstractValidatingLambdaMetafactory(MethodHandles.Lookup caller, MethodType invokedType, - MethodHandle samMethod, + String samMethodName, + MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType, - int flags, - Class[] markerInterfaces) + boolean isSerializable, + Class[] markerInterfaces, + MethodType[] additionalBridges) throws ReflectiveOperationException, LambdaConversionException { this.targetClass = caller.lookupClass(); this.invokedType = invokedType; this.samBase = invokedType.returnType(); - this.samMethod = samMethod; - this.samInfo = new MethodHandleInfo(samMethod); - this.samClass = samInfo.getDeclaringClass(); - this.samMethodType = samInfo.getMethodType(); + this.samMethodName = samMethodName; + this.samMethodType = samMethodType; this.implMethod = implMethod; this.implInfo = new MethodHandleInfo(implMethod); @@ -118,32 +135,24 @@ implKind == MethodHandleInfo.REF_invokeInterface; this.implDefiningClass = implInfo.getDeclaringClass(); this.implMethodType = implInfo.getMethodType(); + this.instantiatedMethodType = instantiatedMethodType; + this.isSerializable = isSerializable; + this.markerInterfaces = markerInterfaces; + this.additionalBridges = additionalBridges; - this.instantiatedMethodType = instantiatedMethodType; - - if (!samClass.isInterface()) { + if (!samBase.isInterface()) { throw new LambdaConversionException(String.format( "Functional interface %s is not an interface", - samClass.getName())); + samBase.getName())); } - boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(samBase); for (Class c : markerInterfaces) { if (!c.isInterface()) { throw new LambdaConversionException(String.format( "Marker interface %s is not an interface", c.getName())); } - foundSerializableSupertype |= Serializable.class.isAssignableFrom(c); } - this.isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0) - || foundSerializableSupertype; - - if (isSerializable && !foundSerializableSupertype) { - markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1); - markerInterfaces[markerInterfaces.length-1] = Serializable.class; - } - this.markerInterfaces = markerInterfaces; } /** @@ -153,20 +162,14 @@ * functional interface * @throws ReflectiveOperationException */ - abstract CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException; + abstract CallSite buildCallSite() + throws ReflectiveOperationException, LambdaConversionException; /** * Check the meta-factory arguments for errors * @throws LambdaConversionException if there are improper conversions */ void validateMetafactoryArgs() throws LambdaConversionException { - // Check target type is a subtype of class where SAM method is defined - if (!samClass.isAssignableFrom(samBase)) { - throw new LambdaConversionException( - String.format("Invalid target type %s for lambda conversion; not a subtype of functional interface %s", - samBase.getName(), samClass.getName())); - } - switch (implKind) { case MethodHandleInfo.REF_invokeInterface: case MethodHandleInfo.REF_invokeVirtual: @@ -265,9 +268,9 @@ } /** - * Check type adaptability - * @param fromType - * @param toType + * Check type adaptability for parameter types. + * @param fromType Type to convert from + * @param toType Type to convert to * @param strict If true, do strict checks, else allow that fromType may be parameterized * @return True if 'fromType' can be passed to an argument of 'toType' */ @@ -299,15 +302,14 @@ } } else { // both are reference types: fromType should be a superclass of toType. - return strict? toType.isAssignableFrom(fromType) : true; + return !strict || toType.isAssignableFrom(fromType); } } } /** - * Check type adaptability for return types -- special handling of void type) and parameterized fromType - * @param fromType - * @param toType + * Check type adaptability for return types -- + * special handling of void type) and parameterized fromType * @return True if 'fromType' can be converted to 'toType' */ private boolean isAdaptableToAsReturn(Class fromType, Class toType) { @@ -338,89 +340,4 @@ } ***********************/ - /** - * Find the functional interface method and corresponding abstract methods - * which should be bridged. The functional interface method and those to be - * bridged will have the same name and number of parameters. Check for - * matching default methods (non-abstract), the VM will create bridges for - * default methods; We don't have enough readily available type information - * to distinguish between where the functional interface method should be - * bridged and where the default method should be bridged; This situation is - * flagged. - */ - class MethodAnalyzer { - private final Method[] methods = samBase.getMethods(); - - private Method samMethod = null; - private final List methodsToBridge = new ArrayList<>(methods.length); - private boolean conflictFoundBetweenDefaultAndBridge = false; - - MethodAnalyzer() { - String samMethodName = samInfo.getName(); - Class[] samParamTypes = samMethodType.parameterArray(); - int samParamLength = samParamTypes.length; - Class samReturnType = samMethodType.returnType(); - Class objectClass = Object.class; - List defaultMethods = new ArrayList<>(methods.length); - - for (Method m : methods) { - if (m.getName().equals(samMethodName) && m.getDeclaringClass() != objectClass) { - Class[] mParamTypes = m.getParameterTypes(); - if (mParamTypes.length == samParamLength) { - // Method matches name and parameter length -- and is not Object - if (Modifier.isAbstract(m.getModifiers())) { - // Method is abstract - if (m.getReturnType().equals(samReturnType) - && Arrays.equals(mParamTypes, samParamTypes)) { - // Exact match, this is the SAM method signature - samMethod = m; - } else if (!hasMatchingBridgeSignature(m)) { - // Record bridges, exclude methods with duplicate signatures - methodsToBridge.add(m); - } - } else { - // Record default methods for conflict testing - defaultMethods.add(m); - } - } - } - } - for (Method dm : defaultMethods) { - if (hasMatchingBridgeSignature(dm)) { - conflictFoundBetweenDefaultAndBridge = true; - break; - } - } - } - - Method getSamMethod() { - return samMethod; - } - - List getMethodsToBridge() { - return methodsToBridge; - } - - boolean conflictFoundBetweenDefaultAndBridge() { - return conflictFoundBetweenDefaultAndBridge; - } - - /** - * Search the list of previously found bridge methods to determine if there is a method with the same signature - * (return and parameter types) as the specified method. - * - * @param m The method to match - * @return True if the method was found, False otherwise - */ - private boolean hasMatchingBridgeSignature(Method m) { - Class[] ptypes = m.getParameterTypes(); - Class rtype = m.getReturnType(); - for (Method md : methodsToBridge) { - if (md.getReturnType().equals(rtype) && Arrays.equals(ptypes, md.getParameterTypes())) { - return true; - } - } - return false; - } - } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,22 +25,26 @@ package java.lang.invoke; +import jdk.internal.org.objectweb.asm.*; +import sun.misc.Unsafe; + import java.lang.reflect.Constructor; -import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.security.ProtectionDomain; import java.util.concurrent.atomic.AtomicInteger; -import jdk.internal.org.objectweb.asm.*; + import static jdk.internal.org.objectweb.asm.Opcodes.*; -import sun.misc.Unsafe; -import java.security.AccessController; -import java.security.PrivilegedAction; /** - * Lambda metafactory implementation which dynamically creates an inner-class-like class per lambda callsite. + * Lambda metafactory implementation which dynamically creates an + * inner-class-like class per lambda callsite. * * @see LambdaMetafactory */ /* package */ final class InnerClassLambdaMetafactory extends AbstractValidatingLambdaMetafactory { + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); + private static final int CLASSFILE_VERSION = 51; private static final String METHOD_DESCRIPTOR_VOID = Type.getMethodDescriptor(Type.VOID_TYPE); private static final String NAME_MAGIC_ACCESSOR_IMPL = "java/lang/invoke/MagicLambdaImpl"; @@ -54,7 +58,7 @@ private static final String DESCR_CTOR_SERIALIZED_LAMBDA = MethodType.methodType(void.class, Class.class, - int.class, String.class, String.class, String.class, + String.class, String.class, String.class, int.class, String.class, String.class, String.class, String.class, Object[].class).toMethodDescriptorString(); @@ -77,42 +81,64 @@ private final Type[] instantiatedArgumentTypes; // ASM types for the functional interface arguments /** - * General meta-factory constructor, standard cases and allowing for uncommon options such as serialization. + * General meta-factory constructor, supporting both standard cases and + * allowing for uncommon options such as serialization or bridging. * - * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges - * of the caller. - * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the - * expected static type of the returned lambda object, and the static types of the captured - * arguments for the lambda. In the event that the implementation method is an instance method, - * the first argument in the invocation signature will correspond to the receiver. - * @param samMethod The primary method in the functional interface to which the lambda or method reference is - * being converted, represented as a method handle. - * @param implMethod The implementation method which should be called (with suitable adaptation of argument - * types, return types, and adjustment for captured arguments) when methods of the resulting - * functional interface instance are invoked. - * @param instantiatedMethodType The signature of the primary functional interface method after type variables - * are substituted with their instantiation from the capture site - * @param flags A bitmask containing flags that may influence the translation of this lambda expression. Defined - * fields include FLAG_SERIALIZABLE. - * @param markerInterfaces Additional interfaces which the lambda object should implement. + * @param caller Stacked automatically by VM; represents a lookup context + * with the accessibility privileges of the caller. + * @param invokedType Stacked automatically by VM; the signature of the + * invoked method, which includes the expected static + * type of the returned lambda object, and the static + * types of the captured arguments for the lambda. In + * the event that the implementation method is an + * instance method, the first argument in the invocation + * signature will correspond to the receiver. + * @param samMethodName Name of the method in the functional interface to + * which the lambda or method reference is being + * converted, represented as a String. + * @param samMethodType Type of the method in the functional interface to + * which the lambda or method reference is being + * converted, represented as a MethodType. + * @param implMethod The implementation method which should be called (with + * suitable adaptation of argument types, return types, + * and adjustment for captured arguments) when methods of + * the resulting functional interface instance are invoked. + * @param instantiatedMethodType The signature of the primary functional + * interface method after type variables are + * substituted with their instantiation from + * the capture site + * @param isSerializable Should the lambda be made serializable? If set, + * either the target type or one of the additional SAM + * types must extend {@code Serializable}. + * @param markerInterfaces Additional interfaces which the lambda object + * should implement. + * @param additionalBridges Method types for additional signatures to be + * bridged to the implementation method * @throws ReflectiveOperationException - * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated + * @throws LambdaConversionException If any of the meta-factory protocol + * invariants are violated */ public InnerClassLambdaMetafactory(MethodHandles.Lookup caller, MethodType invokedType, - MethodHandle samMethod, + String samMethodName, + MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType, - int flags, - Class[] markerInterfaces) + boolean isSerializable, + Class[] markerInterfaces, + MethodType[] additionalBridges) throws ReflectiveOperationException, LambdaConversionException { - super(caller, invokedType, samMethod, implMethod, instantiatedMethodType, flags, markerInterfaces); + super(caller, invokedType, samMethodName, samMethodType, + implMethod, instantiatedMethodType, + isSerializable, markerInterfaces, additionalBridges); implMethodClassName = implDefiningClass.getName().replace('.', '/'); implMethodName = implInfo.getName(); implMethodDesc = implMethodType.toMethodDescriptorString(); Type implMethodAsmType = Type.getMethodType(implMethodDesc); implMethodArgumentTypes = implMethodAsmType.getArgumentTypes(); - implMethodReturnType = implMethodAsmType.getReturnType(); + implMethodReturnType = (implKind == MethodHandleInfo.REF_newInvokeSpecial) + ? Type.getObjectType(implMethodClassName) + : implMethodAsmType.getReturnType(); constructorType = invokedType.changeReturnType(Void.TYPE); constructorDesc = constructorType.toMethodDescriptorString(); lambdaClassName = targetClass.getName().replace('.', '/') + "$$Lambda$" + counter.incrementAndGet(); @@ -122,7 +148,8 @@ for (int i = 0; i < argTypes.length; i++) { argNames[i] = "arg$" + (i + 1); } - instantiatedArgumentTypes = Type.getArgumentTypes(instantiatedMethodType.toMethodDescriptorString()); + instantiatedArgumentTypes = Type.getArgumentTypes( + instantiatedMethodType.toMethodDescriptorString()); } /** @@ -134,7 +161,8 @@ * @return a CallSite, which, when invoked, will return an instance of the * functional interface * @throws ReflectiveOperationException - * @throws LambdaConversionException If properly formed functional interface is not found + * @throws LambdaConversionException If properly formed functional interface + * is not found */ @Override CallSite buildCallSite() throws ReflectiveOperationException, LambdaConversionException { @@ -165,8 +193,8 @@ } else { return new ConstantCallSite( MethodHandles.Lookup.IMPL_LOOKUP - .findConstructor(innerClass, constructorType) - .asType(constructorType.changeReturnType(samBase))); + .findConstructor(innerClass, constructorType) + .asType(constructorType.changeReturnType(samBase))); } } @@ -174,13 +202,20 @@ * Generate a class file which implements the functional * interface, define and return the class. * + * @implNote The class that is generated does not include signature + * information for exceptions that may be present on the SAM method. + * This is to reduce classfile size, and is harmless as checked exceptions + * are erased anyway, no one will ever compile against this classfile, + * and we make no guarantees about the reflective properties of lambda + * objects. + * * @return a Class which implements the functional interface - * @throws LambdaConversionException If properly formed functional interface is not found + * @throws LambdaConversionException If properly formed functional interface + * is not found */ private Class spinInnerClass() throws LambdaConversionException { - String samName = samBase.getName().replace('.', '/'); String[] interfaces = new String[markerInterfaces.length + 1]; - interfaces[0] = samName; + interfaces[0] = samBase.getName().replace('.', '/'); for (int i=0; i) Unsafe.getUnsafe().defineClass(lambdaClassName, classBytes, 0, classBytes.length, - loader, pd); + return UNSAFE.defineClass(lambdaClassName, + classBytes, 0, classBytes.length, + loader, pd); } /** @@ -256,19 +293,23 @@ */ private void generateConstructor() { // Generate constructor - MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, constructorDesc, null, null); + MethodVisitor ctor = cw.visitMethod(ACC_PRIVATE, NAME_CTOR, + constructorDesc, null, null); ctor.visitCode(); ctor.visitVarInsn(ALOAD, 0); - ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, METHOD_DESCRIPTOR_VOID); + ctor.visitMethodInsn(INVOKESPECIAL, NAME_MAGIC_ACCESSOR_IMPL, NAME_CTOR, + METHOD_DESCRIPTOR_VOID); int lvIndex = 0; for (int i = 0; i < argTypes.length; i++) { ctor.visitVarInsn(ALOAD, 0); ctor.visitVarInsn(argTypes[i].getOpcode(ILOAD), lvIndex + 1); lvIndex += argTypes[i].getSize(); - ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor()); + ctor.visitFieldInsn(PUTFIELD, lambdaClassName, argNames[i], + argTypes[i].getDescriptor()); } ctor.visitInsn(RETURN); - ctor.visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored + // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored + ctor.visitMaxs(-1, -1); ctor.visitEnd(); } @@ -277,18 +318,18 @@ */ private void generateWriteReplace() { TypeConvertingMethodAdapter mv - = new TypeConvertingMethodAdapter(cw.visitMethod(ACC_PRIVATE + ACC_FINAL, - NAME_METHOD_WRITE_REPLACE, DESCR_METHOD_WRITE_REPLACE, - null, null)); + = new TypeConvertingMethodAdapter( + cw.visitMethod(ACC_PRIVATE + ACC_FINAL, + NAME_METHOD_WRITE_REPLACE, DESCR_METHOD_WRITE_REPLACE, + null, null)); mv.visitCode(); mv.visitTypeInsn(NEW, NAME_SERIALIZED_LAMBDA); - mv.visitInsn(DUP);; + mv.visitInsn(DUP); mv.visitLdcInsn(Type.getType(targetClass)); - mv.visitLdcInsn(samInfo.getReferenceKind()); mv.visitLdcInsn(invokedType.returnType().getName().replace('.', '/')); - mv.visitLdcInsn(samInfo.getName()); - mv.visitLdcInsn(samInfo.getMethodType().toMethodDescriptorString()); + mv.visitLdcInsn(samMethodName); + mv.visitLdcInsn(samMethodType.toMethodDescriptorString()); mv.visitLdcInsn(implInfo.getReferenceKind()); mv.visitLdcInsn(implInfo.getDeclaringClass().getName().replace('.', '/')); mv.visitLdcInsn(implInfo.getName()); @@ -301,36 +342,20 @@ mv.visitInsn(DUP); mv.iconst(i); mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor()); + mv.visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], + argTypes[i].getDescriptor()); mv.boxIfTypePrimitive(argTypes[i]); mv.visitInsn(AASTORE); } mv.visitMethodInsn(INVOKESPECIAL, NAME_SERIALIZED_LAMBDA, NAME_CTOR, DESCR_CTOR_SERIALIZED_LAMBDA); mv.visitInsn(ARETURN); - mv.visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored + // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored + mv.visitMaxs(-1, -1); mv.visitEnd(); } /** - * Generate a method which calls the lambda implementation method, - * converting arguments, as needed. - * @param m The method whose signature should be generated - * @param isBridge True if this methods should be flagged as a bridge - */ - private void generateForwardingMethod(Method m, boolean isBridge) { - Class[] exceptionTypes = m.getExceptionTypes(); - String[] exceptionNames = new String[exceptionTypes.length]; - for (int i = 0; i < exceptionTypes.length; i++) { - exceptionNames[i] = exceptionTypes[i].getName().replace('.', '/'); - } - String methodDescriptor = Type.getMethodDescriptor(m); - int access = isBridge? ACC_PUBLIC | ACC_BRIDGE : ACC_PUBLIC; - MethodVisitor mv = cw.visitMethod(access, m.getName(), methodDescriptor, null, exceptionNames); - new ForwardingMethodGenerator(mv).generate(m); - } - - /** * This class generates a method body which calls the lambda implementation * method, converting arguments, as needed. */ @@ -340,36 +365,39 @@ super(mv); } - void generate(Method m) throws InternalError { + void generate(String methodDescriptor) { visitCode(); if (implKind == MethodHandleInfo.REF_newInvokeSpecial) { visitTypeInsn(NEW, implMethodClassName); - visitInsn(DUP);; + visitInsn(DUP); } for (int i = 0; i < argTypes.length; i++) { visitVarInsn(ALOAD, 0); - visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], argTypes[i].getDescriptor()); + visitFieldInsn(GETFIELD, lambdaClassName, argNames[i], + argTypes[i].getDescriptor()); } - convertArgumentTypes(Type.getArgumentTypes(m)); + convertArgumentTypes(Type.getArgumentTypes(methodDescriptor)); // Invoke the method we want to forward to visitMethodInsn(invocationOpcode(), implMethodClassName, implMethodName, implMethodDesc); // Convert the return value (if any) and return it - // Note: if adapting from non-void to void, the 'return' instruction will pop the unneeded result - Type samReturnType = Type.getReturnType(m); + // Note: if adapting from non-void to void, the 'return' + // instruction will pop the unneeded result + Type samReturnType = Type.getReturnType(methodDescriptor); convertType(implMethodReturnType, samReturnType, samReturnType); visitInsn(samReturnType.getOpcode(Opcodes.IRETURN)); - - visitMaxs(-1, -1); // Maxs computed by ClassWriter.COMPUTE_MAXS, these arguments ignored + // Maxs computed by ClassWriter.COMPUTE_MAXS,these arguments ignored + visitMaxs(-1, -1); visitEnd(); } private void convertArgumentTypes(Type[] samArgumentTypes) { int lvIndex = 0; - boolean samIncludesReceiver = implIsInstanceMethod && argTypes.length == 0; + boolean samIncludesReceiver = implIsInstanceMethod && + argTypes.length == 0; int samReceiverLength = samIncludesReceiver ? 1 : 0; if (samIncludesReceiver) { // push receiver @@ -393,7 +421,9 @@ } private void convertType(Type argType, Type targetType, Type functionalType) { - convertType(argType.getDescriptor(), targetType.getDescriptor(), functionalType.getDescriptor()); + convertType(argType.getDescriptor(), + targetType.getDescriptor(), + functionalType.getDescriptor()); } private int invocationOpcode() throws InternalError { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java --- a/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,21 +29,45 @@ * LambdaConversionException */ public class LambdaConversionException extends Exception { + /** + * Constructs a {@code LambdaConversionException}. + */ public LambdaConversionException() { } + /** + * Constructs a {@code LambdaConversionException} with a message. + * @param message the detail message + */ public LambdaConversionException(String message) { super(message); } + /** + * Constructs a {@code LambdaConversionException} with a message and cause. + * @param message the detail message + * @param cause the cause + */ public LambdaConversionException(String message, Throwable cause) { super(message, cause); } + /** + * Constructs a {@code LambdaConversionException} with a cause. + * @param cause the cause + */ public LambdaConversionException(Throwable cause) { super(cause); } + /** + * Constructs a {@code LambdaConversionException} with a message, + * cause, and other settings. + * @param message the detail message + * @param cause the cause + * @param enableSuppression whether or not suppressed exceptions are enabled + * @param writableStackTrace whether or not the stack trace is writable + */ public LambdaConversionException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java --- a/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/LambdaMetafactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,6 +25,9 @@ package java.lang.invoke; +import java.io.Serializable; +import java.util.Arrays; + /** *

    Bootstrap methods for converting lambda expressions and method references to functional interface objects.

    * @@ -44,16 +47,11 @@ * *

    When parameterized types are used, the instantiated type of the functional interface method may be different * from that in the functional interface. For example, consider - * interface I<T> { int m(T x); } if this functional interface type is used in a lambda - * I<Byte> v = ..., we need both the actual functional interface method which has the signature - * (Object)int and the erased instantiated type of the functional interface method (or simply + * {@code interface I { int m(T x); }} if this functional interface type is used in a lambda + * {@code I; v = ...}, we need both the actual functional interface method which has the signature + * {@code (Object)int} and the erased instantiated type of the functional interface method (or simply * instantiated method type), which has signature - * (Byte)int. - * - *

    While functional interfaces only have a single abstract method from the language perspective (concrete - * methods in Object are and default methods may be present), at the bytecode level they may actually have multiple - * methods because of the need for bridge methods. Invoking any of these methods on the lambda object will result - * in invoking the implementation method. + * {@code (Byte)int}. * *

    The argument list of the implementation method and the argument list of the functional interface method(s) * may differ in several ways. The implementation methods may have additional arguments to accommodate arguments @@ -111,7 +109,7 @@ * done on return type, while a strict version is applied to arguments. * *

    A type Q is considered adaptable to S as follows: - * + *
    * * * @@ -137,108 +135,147 @@ * *
    QSLink-time checksCapture-time checks
    PrimitivePrimitive
    * - * The default bootstrap ({@link #metaFactory}) represents the common cases and uses an optimized protocol. - * Alternate bootstraps (e.g., {@link #altMetaFactory}) exist to support uncommon cases such as serialization + * The default bootstrap ({@link #metafactory}) represents the common cases and uses an optimized protocol. + * Alternate bootstraps (e.g., {@link #altMetafactory}) exist to support uncommon cases such as serialization * or additional marker superinterfaces. * */ public class LambdaMetafactory { - /** Flag for alternate metafactories indicating the lambda object is must to be serializable */ + /** Flag for alternate metafactories indicating the lambda object is + * must to be serializable */ public static final int FLAG_SERIALIZABLE = 1 << 0; /** - * Flag for alternate metafactories indicating the lambda object implements other marker interfaces + * Flag for alternate metafactories indicating the lambda object implements + * other marker interfaces * besides Serializable */ public static final int FLAG_MARKERS = 1 << 1; - private static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; + /** + * Flag for alternate metafactories indicating the lambda object requires + * additional bridge methods + */ + public static final int FLAG_BRIDGES = 1 << 2; -/** - * Standard meta-factory for conversion of lambda expressions or method references to functional interfaces. + private static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; + private static final MethodType[] EMPTY_MT_ARRAY = new MethodType[0]; + + /** + * Standard meta-factory for conversion of lambda expressions or method + * references to functional interfaces. * - * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges - * of the caller. - * @param invokedName Stacked automatically by VM; the name of the invoked method as it appears at the call site. - * Currently unused. - * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes the - * expected static type of the returned lambda object, and the static types of the captured - * arguments for the lambda. In the event that the implementation method is an instance method, - * the first argument in the invocation signature will correspond to the receiver. - * @param samMethod The primary method in the functional interface to which the lambda or method reference is - * being converted, represented as a method handle. - * @param implMethod The implementation method which should be called (with suitable adaptation of argument - * types, return types, and adjustment for captured arguments) when methods of the resulting - * functional interface instance are invoked. - * @param instantiatedMethodType The signature of the primary functional interface method after type variables - * are substituted with their instantiation from the capture site - * @return a CallSite, which, when invoked, will return an instance of the functional interface - * @throws ReflectiveOperationException - * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated + * @param caller Stacked automatically by VM; represents a lookup context + * with the accessibility privileges of the caller. + * @param invokedName Stacked automatically by VM; the name of the invoked + * method as it appears at the call site. + * Used as the name of the functional interface method + * to which the lambda or method reference is being + * converted. + * @param invokedType Stacked automatically by VM; the signature of the + * invoked method, which includes the expected static + * type of the returned lambda object, and the static + * types of the captured arguments for the lambda. + * In the event that the implementation method is an + * instance method, the first argument in the invocation + * signature will correspond to the receiver. + * @param samMethodType MethodType of the method in the functional interface + * to which the lambda or method reference is being + * converted, represented as a MethodType. + * @param implMethod The implementation method which should be called + * (with suitable adaptation of argument types, return + * types, and adjustment for captured arguments) when + * methods of the resulting functional interface instance + * are invoked. + * @param instantiatedMethodType The signature of the primary functional + * interface method after type variables + * are substituted with their instantiation + * from the capture site + * @return a CallSite, which, when invoked, will return an instance of the + * functional interface + * @throws ReflectiveOperationException if the caller is not able to + * reconstruct one of the method handles + * @throws LambdaConversionException If any of the meta-factory protocol + * invariants are violated */ - public static CallSite metaFactory(MethodHandles.Lookup caller, + public static CallSite metafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, - MethodHandle samMethod, + MethodType samMethodType, MethodHandle implMethod, MethodType instantiatedMethodType) throws ReflectiveOperationException, LambdaConversionException { AbstractValidatingLambdaMetafactory mf; - mf = new InnerClassLambdaMetafactory(caller, invokedType, samMethod, implMethod, instantiatedMethodType, - 0, EMPTY_CLASS_ARRAY); + mf = new InnerClassLambdaMetafactory(caller, invokedType, + invokedName, samMethodType, + implMethod, instantiatedMethodType, + false, EMPTY_CLASS_ARRAY, EMPTY_MT_ARRAY); mf.validateMetafactoryArgs(); return mf.buildCallSite(); } /** - * Alternate meta-factory for conversion of lambda expressions or method references to functional interfaces, - * which supports serialization and other uncommon options. + * Alternate meta-factory for conversion of lambda expressions or method + * references to functional interfaces, which supports serialization and + * other uncommon options. * * The declared argument list for this method is: * - * CallSite altMetaFactory(MethodHandles.Lookup caller, + * CallSite altMetafactory(MethodHandles.Lookup caller, * String invokedName, * MethodType invokedType, * Object... args) * * but it behaves as if the argument list is: * - * CallSite altMetaFactory(MethodHandles.Lookup caller, + * CallSite altMetafactory(MethodHandles.Lookup caller, * String invokedName, * MethodType invokedType, - * MethodHandle samMethod + * MethodType samMethodType * MethodHandle implMethod, * MethodType instantiatedMethodType, * int flags, * int markerInterfaceCount, // IF flags has MARKERS set * Class... markerInterfaces // IF flags has MARKERS set + * int bridgeCount, // IF flags has BRIDGES set + * MethodType... bridges // IF flags has BRIDGES set * ) * * - * @param caller Stacked automatically by VM; represents a lookup context with the accessibility privileges - * of the caller. - * @param invokedName Stacked automatically by VM; the name of the invoked method as it appears at the call site. - * Currently unused. - * @param invokedType Stacked automatically by VM; the signature of the invoked method, which includes thefu - * expected static type of the returned lambda object, and the static types of the captured - * arguments for the lambda. In the event that the implementation method is an instance method, - * the first argument in the invocation signature will correspond to the receiver. - * @param args argument to pass, flags, marker interface count, and marker interfaces as described above - * @return a CallSite, which, when invoked, will return an instance of the functional interface - * @throws ReflectiveOperationException - * @throws LambdaConversionException If any of the meta-factory protocol invariants are violated + * @param caller Stacked automatically by VM; represents a lookup context + * with the accessibility privileges of the caller. + * @param invokedName Stacked automatically by VM; the name of the invoked + * method as it appears at the call site. + * Used as the name of the functional interface method + * to which the lambda or method reference is being + * converted. + * @param invokedType Stacked automatically by VM; the signature of the + * invoked method, which includes the expected static + * type of the returned lambda object, and the static + * types of the captured arguments for the lambda. + * In the event that the implementation method is an + * instance method, the first argument in the invocation + * signature will correspond to the receiver. + * @param args flags and optional arguments, as described above + * @return a CallSite, which, when invoked, will return an instance of the + * functional interface + * @throws ReflectiveOperationException if the caller is not able to + * reconstruct one of the method handles + * @throws LambdaConversionException If any of the meta-factory protocol + * invariants are violated */ - public static CallSite altMetaFactory(MethodHandles.Lookup caller, + public static CallSite altMetafactory(MethodHandles.Lookup caller, String invokedName, MethodType invokedType, Object... args) throws ReflectiveOperationException, LambdaConversionException { - MethodHandle samMethod = (MethodHandle)args[0]; + MethodType samMethodType = (MethodType)args[0]; MethodHandle implMethod = (MethodHandle)args[1]; MethodType instantiatedMethodType = (MethodType)args[2]; int flags = (Integer) args[3]; Class[] markerInterfaces; + MethodType[] bridges; int argIndex = 4; if ((flags & FLAG_MARKERS) != 0) { int markerCount = (Integer) args[argIndex++]; @@ -248,9 +285,33 @@ } else markerInterfaces = EMPTY_CLASS_ARRAY; - AbstractValidatingLambdaMetafactory mf; - mf = new InnerClassLambdaMetafactory(caller, invokedType, samMethod, implMethod, instantiatedMethodType, - flags, markerInterfaces); + if ((flags & FLAG_BRIDGES) != 0) { + int bridgeCount = (Integer) args[argIndex++]; + bridges = new MethodType[bridgeCount]; + System.arraycopy(args, argIndex, bridges, 0, bridgeCount); + argIndex += bridgeCount; + } + else + bridges = EMPTY_MT_ARRAY; + + boolean foundSerializableSupertype = Serializable.class.isAssignableFrom(invokedType.returnType()); + for (Class c : markerInterfaces) + foundSerializableSupertype |= Serializable.class.isAssignableFrom(c); + boolean isSerializable = ((flags & LambdaMetafactory.FLAG_SERIALIZABLE) != 0) + || foundSerializableSupertype; + + if (isSerializable && !foundSerializableSupertype) { + markerInterfaces = Arrays.copyOf(markerInterfaces, markerInterfaces.length + 1); + markerInterfaces[markerInterfaces.length-1] = Serializable.class; + } + + AbstractValidatingLambdaMetafactory mf + = new InnerClassLambdaMetafactory(caller, invokedType, + invokedName, samMethodType, + implMethod, + instantiatedMethodType, + isSerializable, + markerInterfaces, bridges); mf.validateMetafactoryArgs(); return mf.buildCallSite(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/MethodHandle.java --- a/jdk/src/share/classes/java/lang/invoke/MethodHandle.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandle.java Thu Jul 11 12:50:20 2013 -0700 @@ -44,7 +44,7 @@ * {@linkplain java.lang.invoke.MethodHandles#dropArguments deletion}, * and {@linkplain java.lang.invoke.MethodHandles#filterArguments substitution}. * - *

    Method handle contents

    + *

    Method handle contents

    * Method handles are dynamically and strongly typed according to their parameter and return types. * They are not distinguished by the name or the defining class of their underlying methods. * A method handle must be invoked using a symbolic type descriptor which matches @@ -81,7 +81,7 @@ * from its specific class, as the method handle class hierarchy (if any) * may change from time to time or across implementations from different vendors. * - *

    Method handle compilation

    + *

    Method handle compilation

    * A Java method call expression naming {@code invokeExact} or {@code invoke} * can invoke a method handle from Java source code. * From the viewpoint of source code, these methods can take any arguments @@ -111,7 +111,7 @@ * The ambiguity with the type {@code Void} is harmless, since there are no references of type * {@code Void} except the null reference. * - *

    Method handle invocation

    + *

    Method handle invocation

    * The first time a {@code invokevirtual} instruction is executed * it is linked, by symbolically resolving the names in the instruction * and verifying that the method call is statically legal. @@ -154,7 +154,7 @@ * (Note: The adjusted method handle {@code M2} is not directly observable, * and implementations are therefore not required to materialize it.) * - *

    Invocation checking

    + *

    Invocation checking

    * In typical programs, method handle type matching will usually succeed. * But if a match fails, the JVM will throw a {@link WrongMethodTypeException}, * either directly (in the case of {@code invokeExact}) or indirectly as if @@ -195,7 +195,7 @@ * They should not be passed to untrusted code unless their use from * the untrusted code would be harmless. * - *

    Method handle creation

    + *

    Method handle creation

    * Java code can create a method handle that directly accesses * any method, constructor, or field that is accessible to that code. * This is done via a reflective, capability-based API called @@ -249,7 +249,7 @@ * receiver type. Such a method handle simulates the effect of * an {@code invokespecial} instruction to the same method. * - *

    Usage examples

    + *

    Usage examples

    * Here are some examples of usage: *

    {@code
     Object x, y; String s; int i;
    @@ -295,7 +295,7 @@
      * be a method which calls {@link java.util.Objects#equals(Object,Object) Objects.equals }
      * on its arguments, and asserts that the result is true.
      *
    - * 

    Exceptions

    + *

    Exceptions

    * The methods {@code invokeExact} and {@code invoke} are declared * to throw {@link java.lang.Throwable Throwable}, * which is to say that there is no static restriction on what a method handle @@ -308,7 +308,7 @@ * throwables locally, rethrowing only those which are legal in the context, * and wrapping ones which are illegal. * - *

    Signature polymorphism

    + *

    Signature polymorphism

    * The unusual compilation and linkage behavior of * {@code invokeExact} and plain {@code invoke} * is referenced by the term signature polymorphism. @@ -333,7 +333,7 @@ * Tools which determine symbolic linkage are required to accept such * untransformed descriptors, without reporting linkage errors. * - *

    Interoperation between method handles and the Core Reflection API

    + *

    Interoperation between method handles and the Core Reflection API

    * Using factory methods in the {@link java.lang.invoke.MethodHandles.Lookup Lookup} API, * any class member represented by a Core Reflection API object * can be converted to a behaviorally equivalent method handle. @@ -375,7 +375,7 @@ * to call {@code invokeExact} or plain {@code invoke}, * for any specified type descriptor . * - *

    Interoperation between method handles and Java generics

    + *

    Interoperation between method handles and Java generics

    * A method handle can be obtained on a method, constructor, or field * which is declared with Java generic types. * As with the Core Reflection API, the type of the method handle @@ -457,6 +457,8 @@ * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI, * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}, * it will throw an {@code UnsupportedOperationException}. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} * @throws WrongMethodTypeException if the target's type is not identical with the caller's symbolic type descriptor * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call */ @@ -491,6 +493,8 @@ * {@link java.lang.reflect.Method#invoke java.lang.reflect.Method.invoke}, via JNI, * or indirectly via {@link java.lang.invoke.MethodHandles.Lookup#unreflect Lookup.unreflect}, * it will throw an {@code UnsupportedOperationException}. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} * @throws WrongMethodTypeException if the target's type cannot be adjusted to the caller's symbolic type descriptor * @throws ClassCastException if the target's type can be adjusted to the caller, but a reference cast fails * @throws Throwable anything thrown by the underlying method propagates unchanged through the method handle call @@ -511,15 +515,26 @@ * operations on outgoing argument values.) * The caller can assume that the incoming result value is part of the range * of the callee's return type. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} */ /*non-public*/ final native @PolymorphicSignature Object invokeBasic(Object... args) throws Throwable; + /** + * Private method for trusted invocation of a MemberName of kind {@code REF_invokeVirtual}. + * The caller signature is restricted to basic types as with {@code invokeBasic}. + * The trailing (not leading) argument must be a MemberName. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} + */ /*non-public*/ static native @PolymorphicSignature Object linkToVirtual(Object... args) throws Throwable; /** * Private method for trusted invocation of a MemberName of kind {@code REF_invokeStatic}. * The caller signature is restricted to basic types as with {@code invokeBasic}. * The trailing (not leading) argument must be a MemberName. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} */ /*non-public*/ static native @PolymorphicSignature Object linkToStatic(Object... args) throws Throwable; @@ -527,6 +542,8 @@ * Private method for trusted invocation of a MemberName of kind {@code REF_invokeSpecial}. * The caller signature is restricted to basic types as with {@code invokeBasic}. * The trailing (not leading) argument must be a MemberName. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} */ /*non-public*/ static native @PolymorphicSignature Object linkToSpecial(Object... args) throws Throwable; @@ -534,6 +551,8 @@ * Private method for trusted invocation of a MemberName of kind {@code REF_invokeInterface}. * The caller signature is restricted to basic types as with {@code invokeBasic}. * The trailing (not leading) argument must be a MemberName. + * @param args the signature-polymorphic parameter list, statically represented using varargs + * @return the signature-polymorphic result, statically represented using {@code Object} */ /*non-public*/ static native @PolymorphicSignature Object linkToInterface(Object... args) throws Throwable; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java --- a/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleProxies.java Thu Jul 11 12:50:20 2013 -0700 @@ -108,8 +108,9 @@ * Future versions of this API may also equip wrapper instances * with one or more additional public "marker" interfaces. * + * @param the desired type of the wrapper, a single-method interface + * @param intfc a class object representing {@code T} * @param target the method handle to invoke from the wrapper - * @param intfc the desired type of the wrapper, a single-method interface * @return a correctly-typed wrapper for the given target * @throws NullPointerException if either argument is null * @throws IllegalArgumentException if the {@code intfc} is not a diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/MethodHandles.java --- a/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodHandles.java Thu Jul 11 12:50:20 2013 -0700 @@ -70,6 +70,7 @@ * including direct method handles to private fields and methods. * This lookup object is a capability which may be delegated to trusted agents. * Do not store it in place where untrusted code can access it. + * @return a lookup object for the caller of this method */ @CallerSensitive public static Lookup lookup() { @@ -88,6 +89,7 @@ * {@linkplain Lookup#in publicLookup().in(C.class)}. * Since all classes have equal access to public names, * such a change would confer no new access rights. + * @return a lookup object which is trusted minimally */ public static Lookup publicLookup() { return Lookup.PUBLIC_LOOKUP; @@ -111,72 +113,74 @@ * on the {@code Lookup} object to create method handles for access-checked members. * This includes all methods, constructors, and fields which are allowed to the lookup class, * even private ones. - *

    + * + *

    Lookup Factory Methods

    * The factory methods on a {@code Lookup} object correspond to all major * use cases for methods, constructors, and fields. * Here is a summary of the correspondence between these factory methods and * the behavior the resulting method handles: - * * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * * * - * - * + * + * + * + * + * + * * * - * - * - * - * - * - * + * + * * * - * - * + * + * * *
    lookup expressionmemberbehavior
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}FT f;(T) this.f;{@link java.lang.invoke.MethodHandles.Lookup#findGetter lookup.findGetter(C.class,"f",FT.class)}{@code FT f;}{@code (T) this.f;}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}static
    FT f;
    (T) C.f;{@link java.lang.invoke.MethodHandles.Lookup#findStaticGetter lookup.findStaticGetter(C.class,"f",FT.class)}{@code static}
    {@code FT f;}
    {@code (T) C.f;}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}FT f;this.f = x;{@link java.lang.invoke.MethodHandles.Lookup#findSetter lookup.findSetter(C.class,"f",FT.class)}{@code FT f;}{@code this.f = x;}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}static
    FT f;
    C.f = arg;{@link java.lang.invoke.MethodHandles.Lookup#findStaticSetter lookup.findStaticSetter(C.class,"f",FT.class)}{@code static}
    {@code FT f;}
    {@code C.f = arg;}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}T m(A*);(T) this.m(arg*);{@link java.lang.invoke.MethodHandles.Lookup#findVirtual lookup.findVirtual(C.class,"m",MT)}{@code T m(A*);}{@code (T) this.m(arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}static
    T m(A*);
    (T) C.m(arg*);{@link java.lang.invoke.MethodHandles.Lookup#findStatic lookup.findStatic(C.class,"m",MT)}{@code static}
    {@code T m(A*);}
    {@code (T) C.m(arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}T m(A*);(T) super.m(arg*);{@link java.lang.invoke.MethodHandles.Lookup#findSpecial lookup.findSpecial(C.class,"m",MT,this.class)}{@code T m(A*);}{@code (T) super.m(arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}C(A*);(T) new C(arg*);{@link java.lang.invoke.MethodHandles.Lookup#findConstructor lookup.findConstructor(C.class,MT)}{@code C(A*);}{@code new C(arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}(static)?
    FT f;
    (FT) aField.get(thisOrNull);{@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter lookup.unreflectGetter(aField)}({@code static})?
    {@code FT f;}
    {@code (FT) aField.get(thisOrNull);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}(static)?
    FT f;
    aField.set(thisOrNull, arg);{@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter lookup.unreflectSetter(aField)}({@code static})?
    {@code FT f;}
    {@code aField.set(thisOrNull, arg);}
    {@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}({@code static})?
    {@code T m(A*);}
    {@code (T) aMethod.invoke(thisOrNull, arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}(static)?
    T m(A*);
    (T) aMethod.invoke(thisOrNull, arg*);
    {@linkplain java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}C(A*);(C) aConstructor.newInstance(arg*);{@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor lookup.unreflectConstructor(aConstructor)}{@code C(A*);}{@code (C) aConstructor.newInstance(arg*);}
    {@linkplain java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}(static)?
    T m(A*);
    (T) aMethod.invoke(thisOrNull, arg*);{@link java.lang.invoke.MethodHandles.Lookup#unreflect lookup.unreflect(aMethod)}({@code static})?
    {@code T m(A*);}
    {@code (T) aMethod.invoke(thisOrNull, arg*);}
    - *
    + * * Here, the type {@code C} is the class or interface being searched for a member, * documented as a parameter named {@code refc} in the lookup methods. - * The method or constructor type {@code MT} is composed from the return type {@code T} + * The method type {@code MT} is composed from the return type {@code T} * and the sequence of argument types {@code A*}. + * The constructor also has a sequence of argument types {@code A*} and + * is deemed to return the newly-created object of type {@code C}. * Both {@code MT} and the field type {@code FT} are documented as a parameter named {@code type}. * The formal parameter {@code this} stands for the self-reference of type {@code C}; * if it is present, it is always the leading argument to the method handle invocation. @@ -210,7 +214,7 @@ * security manager checks. * * - *

    Access checking

    + *

    Access checking

    * Access checks are applied in the factory methods of {@code Lookup}, * when a method handle is created. * This is a key difference from the Core Reflection API, since @@ -297,7 +301,7 @@ * with static methods of {@link MethodHandles}, * independently of any {@code Lookup} object. * - *

    Security manager interactions

    + *

    Security manager interactions

    * * If a security manager is present, member lookups are subject to * additional checks. @@ -388,6 +392,7 @@ * but the permissions may be additionally limited by the bitmask * {@link #lookupModes lookupModes}, which controls whether non-public members * can be accessed. + * @return the lookup class, on behalf of which this lookup object finds members */ public Class lookupClass() { return lookupClass; @@ -414,6 +419,7 @@ * The purpose of this is to restrict access via the new lookup object, * so that it can access only names which can be reached by the original * lookup object, and also by the new lookup class. + * @return the lookup modes, which limit the kinds of access performed by this lookup object */ public int lookupModes() { return allowedModes & ALL_MODES; @@ -1352,6 +1358,7 @@ * The type of the method handle will have a void return type. * Its last argument will be the array's element type. * The first and second arguments will be the array type and int. + * @param arrayClass the class of an array * @return a method handle which can store values into the array type * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if arrayClass is not an array type @@ -1580,12 +1587,12 @@ ... MethodType intfn1 = methodType(int.class, int.class); MethodType intfn2 = methodType(int.class, int.class, int.class); -MethodHandle sub = ... {int x, int y => x-y} ...; +MethodHandle sub = ... (int x, int y) -> (x-y) ...; assert(sub.type().equals(intfn2)); MethodHandle sub1 = permuteArguments(sub, intfn2, 0, 1); MethodHandle rsub = permuteArguments(sub, intfn2, 1, 0); assert((int)rsub.invokeExact(1, 100) == 99); -MethodHandle add = ... {int x, int y => x+y} ...; +MethodHandle add = ... (int x, int y) -> (x+y) ...; assert(add.type().equals(intfn2)); MethodHandle twice = permuteArguments(add, intfn1, 0, 0); assert(twice.type().equals(intfn1)); @@ -2261,6 +2268,8 @@ * The method type will nominally specify a return of {@code returnType}. * The return type may be anything convenient: It doesn't matter to the * method handle's behavior, since it will never return normally. + * @param returnType the return type of the desired method handle + * @param exType the parameter type of the desired method handle * @return method handle which can throw the given exceptions * @throws NullPointerException if either argument is null */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/MethodType.java --- a/jdk/src/share/classes/java/lang/invoke/MethodType.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MethodType.java Thu Jul 11 12:50:20 2013 -0700 @@ -194,6 +194,8 @@ /** * Finds or creates a method type with the given components. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. + * @param rtype the return type + * @param ptypes the parameter types * @return a method type with the given components * @throws NullPointerException if {@code rtype} or {@code ptypes} or any element of {@code ptypes} is null * @throws IllegalArgumentException if any element of {@code ptypes} is {@code void.class} @@ -214,6 +216,9 @@ * Finds or creates a method type with the given components. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * The leading parameter type is prepended to the remaining array. + * @param rtype the return type + * @param ptype0 the first parameter type + * @param ptypes the remaining parameter types * @return a method type with the given components * @throws NullPointerException if {@code rtype} or {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is null * @throws IllegalArgumentException if {@code ptype0} or {@code ptypes} or any element of {@code ptypes} is {@code void.class} @@ -230,6 +235,7 @@ * Finds or creates a method type with the given components. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * The resulting method has no parameter types. + * @param rtype the return type * @return a method type with the given return value * @throws NullPointerException if {@code rtype} is null */ @@ -242,6 +248,8 @@ * Finds or creates a method type with the given components. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * The resulting method has the single given parameter type. + * @param rtype the return type + * @param ptype0 the parameter type * @return a method type with the given return value and parameter type * @throws NullPointerException if {@code rtype} or {@code ptype0} is null * @throws IllegalArgumentException if {@code ptype0} is {@code void.class} @@ -256,6 +264,9 @@ * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * The resulting method has the same parameter types as {@code ptypes}, * and the specified return type. + * @param rtype the return type + * @param ptypes the method type which supplies the parameter types + * @return a method type with the given components * @throws NullPointerException if {@code rtype} or {@code ptypes} is null */ public static @@ -938,7 +949,8 @@ * provided to the factory method {@link #methodType(Class,Class[]) methodType}. * For example, null values, or {@code void} parameter types, * will lead to exceptions during deserialization. - * @param the stream to write the object to + * @param s the stream to write the object to + * @throws java.io.IOException if there is a problem writing the object */ private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { s.defaultWriteObject(); // requires serialPersistentFields to be an empty array @@ -953,7 +965,9 @@ * It provides the parameters to the factory method called by * {@link #readResolve readResolve}. * After that call it is discarded. - * @param the stream to read the object from + * @param s the stream to read the object from + * @throws java.io.IOException if there is a problem reading the object + * @throws ClassNotFoundException if one of the component classes cannot be resolved * @see #MethodType() * @see #readResolve * @see #writeObject diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/MutableCallSite.java --- a/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/MutableCallSite.java Thu Jul 11 12:50:20 2013 -0700 @@ -195,7 +195,7 @@ * processed before the method returns abnormally. * Which elements these are (if any) is implementation-dependent. * - *

    Java Memory Model details

    + *

    Java Memory Model details

    * In terms of the Java Memory Model, this operation performs a synchronization * action which is comparable in effect to the writing of a volatile variable * by the current thread, and an eventual volatile read by every other thread diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/SerializedLambda.java --- a/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/SerializedLambda.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,6 @@ private final String functionalInterfaceClass; private final String functionalInterfaceMethodName; private final String functionalInterfaceMethodSignature; - private final int functionalInterfaceMethodKind; private final String implClass; private final String implMethodName; private final String implMethodSignature; @@ -53,28 +52,32 @@ private final Object[] capturedArgs; /** - * Create a {@code SerializedLambda} from the low-level information present at the lambda factory site. + * Create a {@code SerializedLambda} from the low-level information present + * at the lambda factory site. * * @param capturingClass The class in which the lambda expression appears - * @param functionalInterfaceMethodKind Method handle kind (see {@link MethodHandleInfo}) for the - * functional interface method handle present at the lambda factory site - * @param functionalInterfaceClass Name, in slash-delimited form, for the functional interface class present at the - * lambda factory site - * @param functionalInterfaceMethodName Name of the primary method for the functional interface present at the + * @param functionalInterfaceClass Name, in slash-delimited form, of static + * type of the returned lambda object + * @param functionalInterfaceMethodName Name of the functional interface + * method for the present at the * lambda factory site - * @param functionalInterfaceMethodSignature Signature of the primary method for the functional interface present - * at the lambda factory site + * @param functionalInterfaceMethodSignature Signature of the functional + * interface method present at + * the lambda factory site * @param implMethodKind Method handle kind for the implementation method - * @param implClass Name, in slash-delimited form, for the class holding the implementation method + * @param implClass Name, in slash-delimited form, for the class holding + * the implementation method * @param implMethodName Name of the implementation method * @param implMethodSignature Signature of the implementation method - * @param instantiatedMethodType The signature of the primary functional interface method after type variables - * are substituted with their instantiation from the capture site - * @param capturedArgs The dynamic arguments to the lambda factory site, which represent variables captured by + * @param instantiatedMethodType The signature of the primary functional + * interface method after type variables + * are substituted with their instantiation + * from the capture site + * @param capturedArgs The dynamic arguments to the lambda factory site, + * which represent variables captured by * the lambda */ public SerializedLambda(Class capturingClass, - int functionalInterfaceMethodKind, String functionalInterfaceClass, String functionalInterfaceMethodName, String functionalInterfaceMethodSignature, @@ -85,7 +88,6 @@ String instantiatedMethodType, Object[] capturedArgs) { this.capturingClass = capturingClass; - this.functionalInterfaceMethodKind = functionalInterfaceMethodKind; this.functionalInterfaceClass = functionalInterfaceClass; this.functionalInterfaceMethodName = functionalInterfaceMethodName; this.functionalInterfaceMethodSignature = functionalInterfaceMethodSignature; @@ -97,66 +99,102 @@ this.capturedArgs = Objects.requireNonNull(capturedArgs).clone(); } - /** Get the name of the class that captured this lambda */ + /** + * Get the name of the class that captured this lambda. + * @return the name of the class that captured this lambda + */ public String getCapturingClass() { return capturingClass.getName().replace('.', '/'); } - /** Get the name of the functional interface class to which this lambda has been converted */ + /** + * Get the name of the invoked type to which this + * lambda has been converted + * @return the name of the functional interface class to which + * this lambda has been converted + */ public String getFunctionalInterfaceClass() { return functionalInterfaceClass; } - /** Get the name of the primary method for the functional interface to which this lambda has been converted */ + /** + * Get the name of the primary method for the functional interface + * to which this lambda has been converted. + * @return the name of the primary methods of the functional interface + */ public String getFunctionalInterfaceMethodName() { return functionalInterfaceMethodName; } - /** Get the signature of the primary method for the functional interface to which this lambda has been converted */ + /** + * Get the signature of the primary method for the functional + * interface to which this lambda has been converted. + * @return the signature of the primary method of the functional + * interface + */ public String getFunctionalInterfaceMethodSignature() { return functionalInterfaceMethodSignature; } - /** Get the method handle kind (see {@link MethodHandleInfo}) of the primary method for the functional interface - * to which this lambda has been converted */ - public int getFunctionalInterfaceMethodKind() { - return functionalInterfaceMethodKind; - } - - /** Get the name of the class containing the implementation method */ + /** + * Get the name of the class containing the implementation + * method. + * @return the name of the class containing the implementation + * method + */ public String getImplClass() { return implClass; } - /** Get the name of the implementation method */ + /** + * Get the name of the implementation method. + * @return the name of the implementation method + */ public String getImplMethodName() { return implMethodName; } - /** Get the signature of the implementation method */ + /** + * Get the signature of the implementation method. + * @return the signature of the implementation method + */ public String getImplMethodSignature() { return implMethodSignature; } - /** Get the method handle kind (see {@link MethodHandleInfo}) of the implementation method */ + /** + * Get the method handle kind (see {@link MethodHandleInfo}) of + * the implementation method. + * @return the method handle kind of the implementation method + */ public int getImplMethodKind() { return implMethodKind; } /** - * Get the signature of the primary functional interface method after type variables are substituted with - * their instantiation from the capture site + * Get the signature of the primary functional interface method + * after type variables are substituted with their instantiation + * from the capture site. + * @return the signature of the primary functional interface method + * after type variable processing */ public final String getInstantiatedMethodType() { return instantiatedMethodType; } - /** Get the count of dynamic arguments to the lambda capture site */ + /** + * Get the count of dynamic arguments to the lambda capture site. + * @return the count of dynamic arguments to the lambda capture site + */ public int getCapturedArgCount() { return capturedArgs.length; } - /** Get a dynamic argument to the lambda capture site */ + /** + * Get a dynamic argument to the lambda capture site. + * @param i the argument to capture + * @return a dynamic argument to the lambda capture site + */ public Object getCapturedArg(int i) { return capturedArgs[i]; } @@ -187,11 +225,17 @@ @Override public String toString() { - return String.format("SerializedLambda[capturingClass=%s, functionalInterfaceMethod=%s %s.%s:%s, " + - "implementation=%s %s.%s:%s, instantiatedMethodType=%s, numCaptured=%d]", - capturingClass, MethodHandleInfo.getReferenceKindString(functionalInterfaceMethodKind), - functionalInterfaceClass, functionalInterfaceMethodName, functionalInterfaceMethodSignature, - MethodHandleInfo.getReferenceKindString(implMethodKind), implClass, implMethodName, - implMethodSignature, instantiatedMethodType, capturedArgs.length); + String implKind=MethodHandleInfo.getReferenceKindString(implMethodKind); + return String.format("SerializedLambda[%s=%s, %s=%s.%s:%s, " + + "%s=%s %s.%s:%s, %s=%s, %s=%d]", + "capturingClass", capturingClass, + "functionalInterfaceMethod", functionalInterfaceClass, + functionalInterfaceMethodName, + functionalInterfaceMethodSignature, + "implementation", + implKind, + implClass, implMethodName, implMethodSignature, + "instantiatedMethodType", instantiatedMethodType, + "numCaptured", capturedArgs.length); } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/invoke/package-info.java --- a/jdk/src/share/classes/java/lang/invoke/package-info.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/invoke/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -43,13 +43,13 @@ *
  • * * - *

    Summary of relevant Java Virtual Machine changes

    + *

    Summary of relevant Java Virtual Machine changes

    * The following low-level information summarizes relevant parts of the * Java Virtual Machine specification. For full details, please see the * current version of that specification. * * Each occurrence of an {@code invokedynamic} instruction is called a dynamic call site. - *

    {@code invokedynamic} instructions

    + *

    {@code invokedynamic} instructions

    * A dynamic call site is originally in an unlinked state. In this state, there is * no target method for the call site to invoke. *

    @@ -97,7 +97,7 @@ * If this happens, the same error will the thrown for all subsequent * attempts to execute the dynamic call site. * - *

    timing of linkage

    + *

    timing of linkage

    * A dynamic call site is linked just before its first execution. * The bootstrap method call implementing the linkage occurs within * a thread that is attempting a first execution. @@ -131,7 +131,7 @@ * just before its first invocation. * There is no way to undo the effect of a completed bootstrap method call. * - *

    types of bootstrap methods

    + *

    types of bootstrap methods

    * As long as each bootstrap method can be correctly invoked * by {@code MethodHandle.invoke}, its detailed type is arbitrary. * For example, the first argument could be {@code Object} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java --- a/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/AnnotatedElement.java Thu Jul 11 12:50:20 2013 -0700 @@ -130,6 +130,7 @@ * Returns this element's annotation for the specified type if * such an annotation is present, else null. * + * @param the type of the annotation to query for and return if present * @param annotationClass the Class object corresponding to the * annotation type * @return this element's annotation for the specified annotation type if @@ -154,6 +155,7 @@ * The caller of this method is free to modify the returned array; it will * have no effect on the arrays returned to other callers. * + * @param the type of the annotation to query for and return if present * @param annotationClass the Class object corresponding to the * annotation type * @return all this element's annotations for the specified annotation type if @@ -184,6 +186,7 @@ * This method ignores inherited annotations. (Returns null if no * annotations are directly present on this element.) * + * @param the type of the annotation to query for and return if present * @param annotationClass the Class object corresponding to the * annotation type * @return this element's annotation for the specified annotation type if @@ -209,6 +212,8 @@ * The caller of this method is free to modify the returned array; it will * have no effect on the arrays returned to other callers. * + * @param the type of the annotation to query for and return + * if directly present * @param annotationClass the Class object corresponding to the * annotation type * @return all this element's annotations for the specified annotation type if diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/reflect/Executable.java --- a/jdk/src/share/classes/java/lang/reflect/Executable.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Executable.java Thu Jul 11 12:50:20 2013 -0700 @@ -384,6 +384,8 @@ /** * Returns a string describing this {@code Executable}, including * any type parameters. + * @return a string describing this {@code Executable}, including + * any type parameters */ public abstract String toGenericString(); @@ -496,6 +498,8 @@ * If this Executable represents a method, the AnnotatedType object * represents the use of a type to specify the return type of the method. * + * @return an object representing the return type of this method + * or constructor * @since 1.8 */ public abstract AnnotatedType getAnnotatedReturnType(); @@ -531,6 +535,9 @@ * * Returns null if this Executable represents a static method. * + * @return an object representing the receiver type of the + * method or constructor represented by this Executable + * * @since 1.8 */ public AnnotatedType getAnnotatedReceiverType() { @@ -553,6 +560,9 @@ * Returns an array of length 0 if the method/constructor declares no * parameters. * + * @return an array of objects representing the types of the + * formal parameters of this method or constructor + * * @since 1.8 */ public AnnotatedType[] getAnnotatedParameterTypes() { @@ -575,6 +585,9 @@ * Returns an array of length 0 if the method/constructor declares no * exceptions. * + * @return an array of objects representing the declared + * exceptions of this method or constructor + * * @since 1.8 */ public AnnotatedType[] getAnnotatedExceptionTypes() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/reflect/Field.java --- a/jdk/src/share/classes/java/lang/reflect/Field.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Field.java Thu Jul 11 12:50:20 2013 -0700 @@ -1151,6 +1151,8 @@ /** * Returns an AnnotatedType object that represents the use of a type to specify * the declared type of the field represented by this Field. + * @return an object representing the declared type of the field + * represented by this Field * * @since 1.8 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/reflect/Parameter.java --- a/jdk/src/share/classes/java/lang/reflect/Parameter.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java Thu Jul 11 12:50:20 2013 -0700 @@ -152,6 +152,8 @@ * defined in a class file, then that name will be returned by * this method. Otherwise, this method will synthesize a name of * the form argN, where N is the index of the parameter. + * + * @return the name of the parameter */ public String getName() { // Note: empty strings as paramete names are now outlawed. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/lang/reflect/TypeVariable.java --- a/jdk/src/share/classes/java/lang/reflect/TypeVariable.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/lang/reflect/TypeVariable.java Thu Jul 11 12:50:20 2013 -0700 @@ -95,6 +95,7 @@ * * Returns an array of length 0 if the type parameter declares no bounds. * + * @return an array of objects representing the upper bounds of the type variable * @since 1.8 */ AnnotatedType[] getAnnotatedBounds(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/math/BigDecimal.java --- a/jdk/src/share/classes/java/math/BigDecimal.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/math/BigDecimal.java Thu Jul 11 12:50:20 2013 -0700 @@ -2572,6 +2572,9 @@ * ({@code this} * 10n). The scale of * the result is {@code (this.scale() - n)}. * + * @param n the exponent power of ten to scale by + * @return a BigDecimal whose numerical value is equal to + * ({@code this} * 10n) * @throws ArithmeticException if the scale would be * outside the range of a 32-bit integer. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/math/BigInteger.java --- a/jdk/src/share/classes/java/math/BigInteger.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/math/BigInteger.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,8 +33,11 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamField; +import java.util.ArrayList; import java.util.Arrays; import java.util.Random; +import sun.misc.DoubleConsts; +import sun.misc.FloatConsts; /** * Immutable arbitrary-precision integers. All operations behave as if @@ -211,6 +214,16 @@ */ private static final int TOOM_COOK_SQUARE_THRESHOLD = 140; + /** + * The threshold value for using Schoenhage recursive base conversion. If + * the number of ints in the number are larger than this value, + * the Schoenhage algorithm will be used. In practice, it appears that the + * Schoenhage routine is faster for any threshold down to 2, and is + * relatively flat for thresholds between 2-25, so this choice may be + * varied within this range for very small effect. + */ + private static final int SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8; + //Constructors /** @@ -1024,6 +1037,19 @@ private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1]; private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1]; + /** + * The cache of powers of each radix. This allows us to not have to + * recalculate powers of radix^(2^n) more than once. This speeds + * Schoenhage recursive base conversion significantly. + */ + private static volatile BigInteger[][] powerCache; + + /** The cache of logarithms of radices for base conversion. */ + private static final double[] logCache; + + /** The natural log of 2. This is used in computing cache indices. */ + private static final double LOG_TWO = Math.log(2.0); + static { for (int i = 1; i <= MAX_CONSTANT; i++) { int[] magnitude = new int[1]; @@ -1031,6 +1057,20 @@ posConst[i] = new BigInteger(magnitude, 1); negConst[i] = new BigInteger(magnitude, -1); } + + /* + * Initialize the cache of radix^(2^x) values used for base conversion + * with just the very first value. Additional values will be created + * on demand. + */ + powerCache = new BigInteger[Character.MAX_RADIX+1][]; + logCache = new double[Character.MAX_RADIX+1]; + + for (int i=Character.MIN_RADIX; i<=Character.MAX_RADIX; i++) + { + powerCache[i] = new BigInteger[] { BigInteger.valueOf(i) }; + logCache[i] = Math.log(i); + } } /** @@ -1355,7 +1395,7 @@ if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD)) return multiplyKaratsuba(this, val); else - return multiplyToomCook3(this, val); + return multiplyToomCook3(this, val); } private static BigInteger multiplyByInt(int[] x, int y, int sign) { @@ -3297,6 +3337,28 @@ if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) radix = 10; + // If it's small enough, use smallToString. + if (mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) + return smallToString(radix); + + // Otherwise use recursive toString, which requires positive arguments. + // The results will be concatenated into this StringBuilder + StringBuilder sb = new StringBuilder(); + if (signum < 0) { + toString(this.negate(), sb, radix, 0); + sb.insert(0, '-'); + } + else + toString(this, sb, radix, 0); + + return sb.toString(); + } + + /** This method is used to perform toString when arguments are small. */ + private String smallToString(int radix) { + if (signum == 0) + return "0"; + // Compute upper bound on number of digit groups and allocate space int maxNumDigitGroups = (4*mag.length + 6)/7; String digitGroup[] = new String[maxNumDigitGroups]; @@ -3335,6 +3397,81 @@ return buf.toString(); } + /** + * Converts the specified BigInteger to a string and appends to + * sb. This implements the recursive Schoenhage algorithm + * for base conversions. + *

    + * See Knuth, Donald, _The Art of Computer Programming_, Vol. 2, + * Answers to Exercises (4.4) Question 14. + * + * @param u The number to convert to a string. + * @param sb The StringBuilder that will be appended to in place. + * @param radix The base to convert to. + * @param digits The minimum number of digits to pad to. + */ + private static void toString(BigInteger u, StringBuilder sb, int radix, + int digits) { + /* If we're smaller than a certain threshold, use the smallToString + method, padding with leading zeroes when necessary. */ + if (u.mag.length <= SCHOENHAGE_BASE_CONVERSION_THRESHOLD) { + String s = u.smallToString(radix); + + // Pad with internal zeros if necessary. + // Don't pad if we're at the beginning of the string. + if ((s.length() < digits) && (sb.length() > 0)) + for (int i=s.length(); i + * This could be changed to a more complicated caching method using + * Future. + */ + private static BigInteger getRadixConversionCache(int radix, int exponent) { + BigInteger[] cacheLine = powerCache[radix]; // volatile read + if (exponent < cacheLine.length) { + return cacheLine[exponent]; + } + + int oldLength = cacheLine.length; + cacheLine = Arrays.copyOf(cacheLine, exponent + 1); + for (int i = oldLength; i <= exponent; i++) { + cacheLine[i] = cacheLine[i - 1].pow(2); + } + + BigInteger[][] pc = powerCache; // volatile read again + if (exponent >= pc[radix].length) { + pc = pc.clone(); + pc[radix] = cacheLine; + powerCache = pc; // volatile write, publish + } + return cacheLine[exponent]; + } /* zero[i] is a string of i consecutive zeros. */ private static String zeros[] = new String[64]; @@ -3452,8 +3589,72 @@ * @return this BigInteger converted to a {@code float}. */ public float floatValue() { - // Somewhat inefficient, but guaranteed to work. - return Float.parseFloat(this.toString()); + if (signum == 0) { + return 0.0f; + } + + int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1; + + // exponent == floor(log2(abs(this))) + if (exponent < Long.SIZE - 1) { + return longValue(); + } else if (exponent > Float.MAX_EXPONENT) { + return signum > 0 ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY; + } + + /* + * We need the top SIGNIFICAND_WIDTH bits, including the "implicit" + * one bit. To make rounding easier, we pick out the top + * SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or + * down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1 + * bits, and signifFloor the top SIGNIFICAND_WIDTH. + * + * It helps to consider the real number signif = abs(this) * + * 2^(SIGNIFICAND_WIDTH - 1 - exponent). + */ + int shift = exponent - FloatConsts.SIGNIFICAND_WIDTH; + + int twiceSignifFloor; + // twiceSignifFloor will be == abs().shiftRight(shift).intValue() + // We do the shift into an int directly to improve performance. + + int nBits = shift & 0x1f; + int nBits2 = 32 - nBits; + + if (nBits == 0) { + twiceSignifFloor = mag[0]; + } else { + twiceSignifFloor = mag[0] >>> nBits; + if (twiceSignifFloor == 0) { + twiceSignifFloor = (mag[0] << nBits2) | (mag[1] >>> nBits); + } + } + + int signifFloor = twiceSignifFloor >> 1; + signifFloor &= FloatConsts.SIGNIF_BIT_MASK; // remove the implied bit + + /* + * We round up if either the fractional part of signif is strictly + * greater than 0.5 (which is true if the 0.5 bit is set and any lower + * bit is set), or if the fractional part of signif is >= 0.5 and + * signifFloor is odd (which is true if both the 0.5 bit and the 1 bit + * are set). This is equivalent to the desired HALF_EVEN rounding. + */ + boolean increment = (twiceSignifFloor & 1) != 0 + && ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift); + int signifRounded = increment ? signifFloor + 1 : signifFloor; + int bits = ((exponent + FloatConsts.EXP_BIAS)) + << (FloatConsts.SIGNIFICAND_WIDTH - 1); + bits += signifRounded; + /* + * If signifRounded == 2^24, we'd need to set all of the significand + * bits to zero and add 1 to the exponent. This is exactly the behavior + * we get from just adding signifRounded to bits directly. If the + * exponent is Float.MAX_EXPONENT, we round up (correctly) to + * Float.POSITIVE_INFINITY. + */ + bits |= signum & FloatConsts.SIGN_BIT_MASK; + return Float.intBitsToFloat(bits); } /** @@ -3472,8 +3673,80 @@ * @return this BigInteger converted to a {@code double}. */ public double doubleValue() { - // Somewhat inefficient, but guaranteed to work. - return Double.parseDouble(this.toString()); + if (signum == 0) { + return 0.0; + } + + int exponent = ((mag.length - 1) << 5) + bitLengthForInt(mag[0]) - 1; + + // exponent == floor(log2(abs(this))Double) + if (exponent < Long.SIZE - 1) { + return longValue(); + } else if (exponent > Double.MAX_EXPONENT) { + return signum > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY; + } + + /* + * We need the top SIGNIFICAND_WIDTH bits, including the "implicit" + * one bit. To make rounding easier, we pick out the top + * SIGNIFICAND_WIDTH + 1 bits, so we have one to help us round up or + * down. twiceSignifFloor will contain the top SIGNIFICAND_WIDTH + 1 + * bits, and signifFloor the top SIGNIFICAND_WIDTH. + * + * It helps to consider the real number signif = abs(this) * + * 2^(SIGNIFICAND_WIDTH - 1 - exponent). + */ + int shift = exponent - DoubleConsts.SIGNIFICAND_WIDTH; + + long twiceSignifFloor; + // twiceSignifFloor will be == abs().shiftRight(shift).longValue() + // We do the shift into a long directly to improve performance. + + int nBits = shift & 0x1f; + int nBits2 = 32 - nBits; + + int highBits; + int lowBits; + if (nBits == 0) { + highBits = mag[0]; + lowBits = mag[1]; + } else { + highBits = mag[0] >>> nBits; + lowBits = (mag[0] << nBits2) | (mag[1] >>> nBits); + if (highBits == 0) { + highBits = lowBits; + lowBits = (mag[1] << nBits2) | (mag[2] >>> nBits); + } + } + + twiceSignifFloor = ((highBits & LONG_MASK) << 32) + | (lowBits & LONG_MASK); + + long signifFloor = twiceSignifFloor >> 1; + signifFloor &= DoubleConsts.SIGNIF_BIT_MASK; // remove the implied bit + + /* + * We round up if either the fractional part of signif is strictly + * greater than 0.5 (which is true if the 0.5 bit is set and any lower + * bit is set), or if the fractional part of signif is >= 0.5 and + * signifFloor is odd (which is true if both the 0.5 bit and the 1 bit + * are set). This is equivalent to the desired HALF_EVEN rounding. + */ + boolean increment = (twiceSignifFloor & 1) != 0 + && ((signifFloor & 1) != 0 || abs().getLowestSetBit() < shift); + long signifRounded = increment ? signifFloor + 1 : signifFloor; + long bits = (long) ((exponent + DoubleConsts.EXP_BIAS)) + << (DoubleConsts.SIGNIFICAND_WIDTH - 1); + bits += signifRounded; + /* + * If signifRounded == 2^53, we'd need to set all of the significand + * bits to zero and add 1 to the exponent. This is exactly the behavior + * we get from just adding signifRounded to bits directly. If the + * exponent is Double.MAX_EXPONENT, we round up (correctly) to + * Double.POSITIVE_INFINITY. + */ + bits |= signum & DoubleConsts.SIGN_BIT_MASK; + return Double.longBitsToDouble(bits); } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/math/RoundingMode.java --- a/jdk/src/share/classes/java/math/RoundingMode.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/math/RoundingMode.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,6 +101,7 @@ * *

    Example: * + * * * @@ -124,6 +125,7 @@ * *

    Example: *

    Rounding mode UP Examples
    Input NumberInput rounded to one digit
    with {@code UP} rounding *
    5.5 6
    + * * * @@ -148,6 +150,7 @@ * *

    Example: *

    Rounding mode DOWN Examples
    Input NumberInput rounded to one digit
    with {@code DOWN} rounding *
    5.5 5
    + * * * @@ -172,6 +175,7 @@ * *

    Example: *

    Rounding mode CEILING Examples
    Input NumberInput rounded to one digit
    with {@code CEILING} rounding *
    5.5 6
    + * * * @@ -198,6 +202,7 @@ * *

    Example: *

    Rounding mode FLOOR Examples
    Input NumberInput rounded to one digit
    with {@code FLOOR} rounding *
    5.5 5
    + * * * @@ -223,6 +228,7 @@ * *

    Example: *

    Rounding mode HALF_UP Examples
    Input NumberInput rounded to one digit
    with {@code HALF_UP} rounding *
    5.5 6
    + * * * @@ -255,6 +261,7 @@ * *

    Example: *

    Rounding mode HALF_DOWN Examples
    Input NumberInput rounded to one digit
    with {@code HALF_DOWN} rounding *
    5.5 5
    + * * * @@ -278,6 +285,7 @@ * {@code ArithmeticException} is thrown. *

    Example: *

    Rounding mode HALF_EVEN Examples
    Input NumberInput rounded to one digit
    with {@code HALF_EVEN} rounding *
    5.5 6
    + * * * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/Buffer.java --- a/jdk/src/share/classes/java/nio/Buffer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/Buffer.java Thu Jul 11 12:50:20 2013 -0700 @@ -52,7 +52,7 @@ *

    There is one subclass of this class for each non-boolean primitive type. * * - *

    Transferring data

    + *

    Transferring data

    * *

    Each subclass of this class defines two categories of get and * put operations:

    @@ -78,7 +78,7 @@ * current position. * * - *

    Marking and resetting

    + *

    Marking and resetting

    * *

    A buffer's mark is the index to which its position will be reset * when the {@link #reset reset} method is invoked. The mark is not always @@ -89,7 +89,7 @@ * {@link InvalidMarkException} to be thrown. * * - *

    Invariants

    + *

    Invariants

    * *

    The following invariant holds for the mark, position, limit, and * capacity values: @@ -109,7 +109,7 @@ * to zero. * * - *

    Clearing, flipping, and rewinding

    + *

    Clearing, flipping, and rewinding

    * *

    In addition to methods for accessing the position, limit, and capacity * values and for marking and resetting, this class also defines the following @@ -132,7 +132,7 @@ * * * - *

    Read-only buffers

    + *

    Read-only buffers

    * *

    Every buffer is readable, but not every buffer is writable. The * mutation methods of each buffer class are specified as optional @@ -143,14 +143,14 @@ * {@link #isReadOnly isReadOnly} method. * * - *

    Thread safety

    + *

    Thread safety

    * *

    Buffers are not safe for use by multiple concurrent threads. If a * buffer is to be used by more than one thread then access to the buffer * should be controlled by appropriate synchronization. * * - *

    Invocation chaining

    + *

    Invocation chaining

    * *

    Methods in this class that do not otherwise have a value to return are * specified to return the buffer upon which they are invoked. This allows diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/MappedByteBuffer.java --- a/jdk/src/share/classes/java/nio/MappedByteBuffer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/MappedByteBuffer.java Thu Jul 11 12:50:20 2013 -0700 @@ -45,7 +45,7 @@ * this program or another. Whether or not such changes occur, and when they * occur, is operating-system dependent and therefore unspecified. * - *

    All or part of a mapped byte buffer may become + *

    All or part of a mapped byte buffer may become * inaccessible at any time, for example if the mapped file is truncated. An * attempt to access an inaccessible region of a mapped byte buffer will not * change the buffer's content and will cause an unspecified exception to be diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/X-Buffer.java.template --- a/jdk/src/share/classes/java/nio/X-Buffer.java.template Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/X-Buffer.java.template Thu Jul 11 12:50:20 2013 -0700 @@ -44,23 +44,23 @@ * *

      * - *
    • Absolute and relative {@link #get() get} and - * {@link #put($type$) put} methods that read and write + *

    • Absolute and relative {@link #get() get} and + * {@link #put($type$) put} methods that read and write * single $type$s;

    • * - *
    • Relative {@link #get($type$[]) bulk get} + *

    • Relative {@link #get($type$[]) bulk get} * methods that transfer contiguous sequences of $type$s from this buffer * into an array; {#if[!byte]?and}

    • * - *
    • Relative {@link #put($type$[]) bulk put} + *

    • Relative {@link #put($type$[]) bulk put} * methods that transfer contiguous sequences of $type$s from $a$ * $type$ array{#if[char]?, a string,} or some other $type$ * buffer into this buffer;{#if[!byte]? and}

    • * #if[byte] * - *
    • Absolute and relative {@link #getChar() get} - * and {@link #putChar(char) put} methods that read and + *

    • Absolute and relative {@link #getChar() get} + * and {@link #putChar(char) put} methods that read and * write values of other primitive types, translating them to and from * sequences of bytes in a particular byte order;

    • * @@ -70,23 +70,23 @@ * #end[byte] * - *
    • Methods for {@link #compact compacting}, {@link - * #duplicate duplicating}, and {@link #slice - * slicing} $a$ $type$ buffer.

    • + *
    • Methods for {@link #compact compacting}, {@link + * #duplicate duplicating}, and {@link #slice slicing} + * $a$ $type$ buffer.

    • * *
    * *

    $Type$ buffers can be created either by {@link #allocate - * allocation}, which allocates space for the buffer's + * allocation}, which allocates space for the buffer's * #if[byte] * - * content, or by {@link #wrap($type$[]) wrapping} an + * content, or by {@link #wrap($type$[]) wrapping} an * existing $type$ array {#if[char]?or string} into a buffer. * #else[byte] * - * content, by {@link #wrap($type$[]) wrapping} an existing + * content, by {@link #wrap($type$[]) wrapping} an existing * $type$ array {#if[char]?or string} into a buffer, or by creating a * view of an existing byte buffer. * @@ -94,8 +94,8 @@ * #if[byte] * - * - *

    Direct vs. non-direct buffers

    + * + *

    Direct vs. non-direct buffers

    * *

    A byte buffer is either direct or non-direct. Given a * direct byte buffer, the Java virtual machine will make a best effort to @@ -116,7 +116,7 @@ * buffers only when they yield a measureable gain in program performance. * *

    A direct byte buffer may also be created by {@link - * java.nio.channels.FileChannel#map mapping} a region of a file + * java.nio.channels.FileChannel#map mapping} a region of a file * directly into memory. An implementation of the Java platform may optionally * support the creation of direct byte buffers from native code via JNI. If an * instance of one of these kinds of buffers refers to an inaccessible region @@ -129,8 +129,8 @@ * that explicit buffer management can be done in performance-critical code. * * - * - *

    Access to binary data

    + * + *

    Access to binary data

    * *

    This class defines methods for reading and writing values of all other * primitive types, except boolean. Primitive values are translated @@ -156,7 +156,7 @@ * parameters of the absolute get and put methods are in terms of * bytes rather than of the type being read or written. * - * + * * *

    For access to homogeneous binary data, that is, sequences of values of * the same type, this class defines methods that can create views of a @@ -214,7 +214,7 @@ #end[char] * #if[byte] - *

    Invocation chaining

    + *

    Invocation chaining

    #end[byte] * *

    Methods in this class that do not otherwise have a value to return are @@ -297,7 +297,7 @@ *

    The new buffer's position will be zero, its limit will be its * capacity, its mark will be undefined, and each of its elements will be * initialized to zero. Whether or not it has a - * {@link #hasArray backing array} is unspecified. + * {@link #hasArray backing array} is unspecified. * * @param capacity * The new buffer's capacity, in $type$s @@ -318,9 +318,8 @@ * *

    The new buffer's position will be zero, its limit will be its * capacity, its mark will be undefined, and each of its elements will be - * initialized to zero. It will have a {@link #array - * backing array}, and its {@link #arrayOffset array - * offset} will be zero. + * initialized to zero. It will have a {@link #array backing array}, + * and its {@link #arrayOffset array offset} will be zero. * * @param capacity * The new buffer's capacity, in $type$s @@ -344,8 +343,8 @@ * and vice versa. The new buffer's capacity will be * array.length, its position will be offset, its limit * will be offset + length, and its mark will be undefined. Its - * {@link #array backing array} will be the given array, and - * its {@link #arrayOffset array offset} will be zero.

    + * {@link #array backing array} will be the given array, and + * its {@link #arrayOffset array offset} will be zero.

    * * @param array * The array that will back the new buffer @@ -384,8 +383,8 @@ * that is, modifications to the buffer will cause the array to be modified * and vice versa. The new buffer's capacity and limit will be * array.length, its position will be zero, and its mark will be - * undefined. Its {@link #array
    backing array} will be the - * given array, and its {@link #arrayOffset array offset} will + * undefined. Its {@link #array backing array} will be the + * given array, and its {@link #arrayOffset array offset>} will * be zero.

    * * @param array @@ -703,6 +702,9 @@ *
          *     src.get(a, 0, a.length) 
    * + * @param dst + * The destination array + * * @return This buffer * * @throws BufferUnderflowException @@ -842,6 +844,9 @@ *
          *     dst.put(a, 0, a.length) 
    * + * @param src + * The source array + * * @return This buffer * * @throws BufferOverflowException @@ -930,6 +935,9 @@ *
          *     dst.put(s, 0, s.length()) 
    * + * @param src + * The source string + * * @return This buffer * * @throws BufferOverflowException @@ -1419,7 +1427,7 @@ * *

    The byte order of $a$ $type$ buffer created by allocation or by * wrapping an existing $type$ array is the {@link - * ByteOrder#nativeOrder native order} of the underlying + * ByteOrder#nativeOrder native order} of the underlying * hardware. The byte order of $a$ $type$ buffer created as a view of a byte buffer is that of the * byte buffer at the moment that the view is created.

    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousByteChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousByteChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousByteChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -87,6 +87,8 @@ * initiates a read operation before a previous read operation has * completed then a {@link ReadPendingException} will be thrown. * + * @param + * The type of the attachment * @param dst * The buffer into which bytes are to be transferred * @param attachment @@ -166,6 +168,8 @@ * initiates a write operation before a previous write operation has * completed then a {@link WritePendingException} will be thrown. * + * @param + * The type of the attachment * @param src * The buffer from which bytes are to be retrieved * @param attachment diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -61,7 +61,7 @@ * may not allow more than one read and one write operation to be outstanding at * any given time. * - *

    Cancellation

    + *

    Cancellation

    * *

    The {@code Future} interface defines the {@link Future#cancel cancel} * method to cancel execution. This causes all threads waiting on the result of diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousChannelGroup.java Thu Jul 11 12:50:20 2013 -0700 @@ -60,7 +60,7 @@ * default group is not configured then the pooled threads of the default group * are {@link Thread#isDaemon daemon} threads. * - *

    Rounding mode UNNECESSARY Examples
    Input NumberInput rounded to one digit
    with {@code UNNECESSARY} rounding *
    5.5 throw {@code ArithmeticException}
    + *
    * * * @@ -89,7 +89,7 @@ * *
    System propertyDescription
    * - *

    Threading

    + *

    Threading

    * *

    The completion handler for an I/O operation initiated on a channel bound * to a group is guaranteed to be invoked by one of the pooled threads in the @@ -104,7 +104,7 @@ * handler directly by the initiating thread (see {@link * AsynchronousServerSocketChannel#accept(Object,CompletionHandler) accept}). * - *

    Shutdown and Termination

    + *

    Shutdown and Termination

    * *

    The {@link #shutdown() shutdown} method is used to initiate an orderly * shutdown of a group. An orderly shutdown marks the group as shutdown; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousFileChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -425,6 +425,8 @@ * They are not suitable for controlling access to a file by multiple * threads within the same virtual machine. * + * @param + * The type of the attachment * @param position * The position at which the locked region is to start; must be * non-negative @@ -473,6 +475,8 @@ * ch.{@link #lock(long,long,boolean,Object,CompletionHandler) lock}(0L, Long.MAX_VALUE, false, att, handler) * * + * @param + * The type of the attachment * @param attachment * The object to attach to the I/O operation; can be {@code null} * @param handler @@ -652,6 +656,8 @@ * If the given file position is greater than the file's size at the time * that the read is attempted then no bytes are read. * + * @param + * The type of the attachment * @param dst * The buffer into which bytes are to be transferred * @param position @@ -716,6 +722,8 @@ * bytes; the values of any bytes between the previous end-of-file and the * newly-written bytes are unspecified. * + * @param + * The type of the attachment * @param src * The buffer from which bytes are to be transferred * @param position diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -52,7 +52,7 @@ *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Channels of this type support the following options: *

    - * + *
    * * * @@ -98,6 +98,9 @@ /** * Initializes a new instance of this class. + * + * @param provider + * The provider that created this channel */ protected AsynchronousServerSocketChannel(AsynchronousChannelProvider provider) { this.provider = provider; @@ -105,6 +108,8 @@ /** * Returns the provider that created this channel. + * + * @return The provider that created this channel */ public final AsynchronousChannelProvider provider() { return provider; @@ -263,6 +268,8 @@ * the connection is closed and the operation completes with a {@link * SecurityException}. * + * @param + * The type of the attachment * @param attachment * The object to attach to the I/O operation; can be {@code null} * @param handler diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java --- a/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/AsynchronousSocketChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -62,7 +62,7 @@ *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Asynchronous socket channels support the following options: *

    - *
    Option NameDescription
    + *
    * * * @@ -91,7 +91,7 @@ * * Additional (implementation specific) options may also be supported. * - *

    Timeouts

    + *

    Timeouts

    * *

    The {@link #read(ByteBuffer,long,TimeUnit,Object,CompletionHandler) read} * and {@link #write(ByteBuffer,long,TimeUnit,Object,CompletionHandler) write} @@ -123,6 +123,9 @@ /** * Initializes a new instance of this class. + * + * @param provider + * The provider that created this channel */ protected AsynchronousSocketChannel(AsynchronousChannelProvider provider) { this.provider = provider; @@ -130,6 +133,8 @@ /** * Returns the provider that created this channel. + * + * @return The provider that created this channel */ public final AsynchronousChannelProvider provider() { return provider; @@ -287,6 +292,8 @@ * java.lang.SecurityManager#checkConnect checkConnect} method permits * connecting to the address and port number of the given remote endpoint. * + * @param + * The type of the attachment * @param remote * The remote address to which this channel is to be connected * @param attachment @@ -365,6 +372,8 @@ * AsynchronousByteChannel#read(ByteBuffer,Object,CompletionHandler)} * method. * + * @param + * The type of the attachment * @param dst * The buffer into which bytes are to be transferred * @param timeout @@ -461,6 +470,8 @@ * read from the channel will cause an unspecific runtime exception to be * thrown. * + * @param + * The type of the attachment * @param dsts * The buffers into which bytes are to be transferred * @param offset @@ -520,6 +531,8 @@ * AsynchronousByteChannel#write(ByteBuffer,Object,CompletionHandler)} * method. * + * @param + * The type of the attachment * @param src * The buffer from which bytes are to be retrieved * @param timeout @@ -610,6 +623,8 @@ * to write to the channel will cause an unspecific runtime exception to be * thrown. * + * @param + * The type of the attachment * @param srcs * The buffers from which bytes are to be retrieved * @param offset diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/DatagramChannel.java --- a/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/DatagramChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -57,7 +57,7 @@ * setOption} method. A datagram channel to an Internet Protocol socket supports * the following options: *

    - *
    Option NameDescription
    + *
    * * * @@ -117,6 +117,9 @@ /** * Initializes a new instance of this class. + * + * @param provider + * The provider that created this channel */ protected DatagramChannel(SelectorProvider provider) { super(provider); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/FileChannel.java --- a/jdk/src/share/classes/java/nio/channels/FileChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/FileChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -46,7 +46,7 @@ * of bytes that can be read and written and whose current {@link #size * size} can be queried. The size of the file increases * when bytes are written beyond its current size; the size of the file - * decreases when it is {@link #truncate truncated}. The + * decreases when it is {@link #truncate truncated}. The * file may also have some associated metadata such as access * permissions, content type, and last-modification time; this class does not * define methods for metadata access. @@ -830,7 +830,7 @@ *

    A region of a file may be mapped into memory in one of three modes: *

    * - *
      + *
        * *
      • Read-only: Any attempt to modify the resulting buffer * will cause a {@link java.nio.ReadOnlyBufferException} to be thrown. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/FileLock.java --- a/jdk/src/share/classes/java/nio/channels/FileLock.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/FileLock.java Thu Jul 11 12:50:20 2013 -0700 @@ -72,7 +72,7 @@ *

        File-lock objects are safe for use by multiple concurrent threads. * * - *

        Platform dependencies

        + *

        Platform dependencies

        * *

        This file-locking API is intended to map directly to the native locking * facility of the underlying operating system. Thus the locks held on a file @@ -261,6 +261,11 @@ /** * Tells whether or not this lock overlaps the given lock range. * + * @param position + * The starting position of the lock range + * @param size + * The size of the lock range + * * @return true if, and only if, this lock and the given lock * range overlap by at least one byte */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/MulticastChannel.java --- a/jdk/src/share/classes/java/nio/channels/MulticastChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/MulticastChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -71,7 +71,7 @@ * MembershipKey#drop drop} method drops membership so that datagrams from the * source address can no longer be received. * - *

        Platform dependencies

        + *

        Platform dependencies

        * * The multicast implementation is intended to map directly to the native * multicasting facility. Consequently, the following items should be considered diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/NetworkChannel.java --- a/jdk/src/share/classes/java/nio/channels/NetworkChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/NetworkChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -106,6 +106,8 @@ /** * Sets the value of a socket option. * + * @param + * The type of the socket option value * @param name * The socket option * @param value @@ -130,6 +132,8 @@ /** * Returns the value of a socket option. * + * @param + * The type of the socket option value * @param name * The socket option * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/Pipe.java --- a/jdk/src/share/classes/java/nio/channels/Pipe.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/Pipe.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,10 +33,9 @@ * A pair of channels that implements a unidirectional pipe. * *

        A pipe consists of a pair of channels: A writable {@link - * Pipe.SinkChannel sink} channel and a readable {@link - * Pipe.SourceChannel source} channel. Once some bytes are - * written to the sink channel they can be read from source channel in exactly - * the order in which they were written. + * Pipe.SinkChannel sink} channel and a readable {@link Pipe.SourceChannel source} + * channel. Once some bytes are written to the sink channel they can be read + * from source channel in exactlyAthe order in which they were written. * *

        Whether or not a thread writing bytes to a pipe will block until another * thread reads those bytes, or some previously-written bytes, from the pipe is @@ -63,6 +62,9 @@ { /** * Constructs a new instance of this class. + * + * @param provider + * The selector provider */ protected SourceChannel(SelectorProvider provider) { super(provider); @@ -94,6 +96,9 @@ { /** * Initializes a new instance of this class. + * + * @param provider + * The selector provider */ protected SinkChannel(SelectorProvider provider) { super(provider); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/SelectableChannel.java --- a/jdk/src/share/classes/java/nio/channels/SelectableChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/SelectableChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -64,8 +64,8 @@ * threads.

        * * - * - *

        Blocking mode

        + *
        + *

        Blocking mode

        * * A selectable channel is either in blocking mode or in * non-blocking mode. In blocking mode, every I/O operation invoked @@ -142,6 +142,9 @@ * Retrieves the key representing the channel's registration with the given * selector. * + * @param sel + * The selector + * * @return The key returned when this channel was last registered with the * given selector, or null if this channel is not * currently registered with that selector diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/SelectionKey.java --- a/jdk/src/share/classes/java/nio/channels/SelectionKey.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/SelectionKey.java Thu Jul 11 12:50:20 2013 -0700 @@ -42,7 +42,7 @@ * next selection operation. The validity of a key may be tested by invoking * its {@link #isValid isValid} method. * - * + * * *

        A selection key contains two operation sets represented as * integer values. Each bit of an operation set denotes a category of diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/Selector.java --- a/jdk/src/share/classes/java/nio/channels/Selector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/Selector.java Thu Jul 11 12:50:20 2013 -0700 @@ -36,13 +36,13 @@ * *

        A selector may be created by invoking the {@link #open open} method of * this class, which will use the system's default {@link - * java.nio.channels.spi.SelectorProvider selector provider} to + * java.nio.channels.spi.SelectorProvider selector provider} to * create a new selector. A selector may also be created by invoking the * {@link java.nio.channels.spi.SelectorProvider#openSelector openSelector} * method of a custom selector provider. A selector remains open until it is * closed via its {@link #close close} method. * - * + * * *

        A selectable channel's registration with a selector is represented by a * {@link SelectionKey} object. A selector maintains three sets of selection @@ -80,18 +80,18 @@ * during the next selection operation, at which time the key will removed from * all of the selector's key sets. * - *

        Keys are added to the selected-key set by selection + *

        Keys are added to the selected-key set by selection * operations. A key may be removed directly from the selected-key set by * invoking the set's {@link java.util.Set#remove(java.lang.Object) remove} * method or by invoking the {@link java.util.Iterator#remove() remove} method - * of an {@link java.util.Iterator iterator} obtained from the + * of an {@link java.util.Iterator iterator} obtained from the * set. Keys are never removed from the selected-key set in any other way; * they are not, in particular, removed as a side effect of selection * operations. Keys may not be added directly to the selected-key set.

        * * - * - *

        Selection

        + *
        + *

        Selection

        * *

        During each selection operation, keys may be added to and removed from a * selector's selected-key set and may be removed from its key and @@ -111,7 +111,7 @@ * operation began. For a channel that is ready for at least one such * operation, one of the following two actions is performed:

        * - *
          + *
            * *
          1. If the channel's key is not already in the selected-key set then * it is added to that set and its ready-operation set is modified to @@ -126,7 +126,7 @@ * words, the ready set returned by the underlying system is * bitwise-disjoined into the key's current ready set.

          2. * - *
          + *
        * * If all of the keys in the key set at the start of this step have empty * interest sets then neither the selected-key set nor any of the keys' @@ -142,7 +142,7 @@ * difference between the three selection methods.

        * * - *

        Concurrency

        + *

        Concurrency

        * *

        Selectors are themselves safe for use by multiple concurrent threads; * their key sets, however, are not. @@ -183,7 +183,7 @@ *

        The {@link #close close} method synchronizes on the selector and all * three key sets in the same order as in a selection operation. * - * + * * *

        A selector's key and selected-key sets are not, in general, safe for use * by multiple concurrent threads. If such a thread might modify one of these diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java --- a/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/ServerSocketChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -46,7 +46,7 @@ *

        Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Server-socket channels support the following options: *

        - *
    Option NameDescription
    + *
    * * * @@ -78,6 +78,9 @@ /** * Initializes a new instance of this class. + * + * @param provider + * The provider that created this channel */ protected ServerSocketChannel(SelectorProvider provider) { super(provider); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/SocketChannel.java --- a/jdk/src/share/classes/java/nio/channels/SocketChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/SocketChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -66,7 +66,7 @@ *

    Socket options are configured using the {@link #setOption(SocketOption,Object) * setOption} method. Socket channels support the following options: *

    - *
    Option NameDescription
    + *
    * * * @@ -120,6 +120,9 @@ /** * Initializes a new instance of this class. + * + * @param provider + * The provider that created this channel */ protected SocketChannel(SelectorProvider provider) { super(provider); @@ -153,6 +156,8 @@ * @param remote * The remote address to which the new channel is to be connected * + * @return A new, and connected, socket channel + * * @throws AsynchronousCloseException * If another thread closes this channel * while the connect operation is in progress diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java --- a/jdk/src/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java Thu Jul 11 12:50:20 2013 -0700 @@ -46,7 +46,7 @@ * before and after, respectively, invoking an I/O operation that might block * indefinitely. In order to ensure that the {@link #end end} method is always * invoked, these methods should be used within a - * try ... finally block: + * try ... finally block: * *
      * boolean completed = false;
    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java
    --- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java	Tue Jul 02 17:38:10 2013 -0700
    +++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelectableChannel.java	Thu Jul 11 12:50:20 2013 -0700
    @@ -72,6 +72,9 @@
     
         /**
          * Initializes a new instance of this class.
    +     *
    +     * @param  provider
    +     *         The provider that created this channel
          */
         protected AbstractSelectableChannel(SelectorProvider provider) {
             this.provider = provider;
    @@ -251,6 +254,9 @@
          * that is blocked in an I/O operation upon this channel to return
          * immediately, either by throwing an exception or by returning normally.
          * 

    + * + * @throws IOException + * If an I/O error occurs */ protected abstract void implCloseSelectableChannel() throws IOException; @@ -299,6 +305,10 @@ * changing the blocking mode. This method is only invoked if the new mode * is different from the current mode.

    * + * @param block If true then this channel will be placed in + * blocking mode; if false then it will be placed + * non-blocking mode + * * @throws IOException * If an I/O error occurs */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java --- a/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/channels/spi/AbstractSelector.java Thu Jul 11 12:50:20 2013 -0700 @@ -43,7 +43,7 @@ * after, respectively, invoking an I/O operation that might block * indefinitely. In order to ensure that the {@link #end end} method is always * invoked, these methods should be used within a - * try ... finally block:
    + * try ... finally block: * *
      * try {
    @@ -77,6 +77,9 @@
     
         /**
          * Initializes a new instance of this class.
    +     *
    +     * @param  provider
    +     *         The provider that created this selector
          */
         protected AbstractSelector(SelectorProvider provider) {
             this.provider = provider;
    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java
    --- a/jdk/src/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java	Tue Jul 02 17:38:10 2013 -0700
    +++ b/jdk/src/share/classes/java/nio/channels/spi/AsynchronousChannelProvider.java	Thu Jul 11 12:50:20 2013 -0700
    @@ -174,6 +174,8 @@
          * @param   threadFactory
          *          The factory to use when creating new threads
          *
    +     * @return  A new asynchronous channel group
    +     *
          * @throws  IllegalArgumentException
          *          If {@code nThreads <= 0}
          * @throws  IOException
    @@ -193,6 +195,8 @@
          *          A value {@code >=0} or a negative value for implementation
          *          specific default
          *
    +     * @return  A new asynchronous channel group
    +     *
          * @throws  IOException
          *          If an I/O error occurs
          *
    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java
    --- a/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java	Tue Jul 02 17:38:10 2013 -0700
    +++ b/jdk/src/share/classes/java/nio/channels/spi/SelectorProvider.java	Thu Jul 11 12:50:20 2013 -0700
    @@ -183,6 +183,9 @@
          * Opens a datagram channel.
          *
          * @return  The new channel
    +     *
    +     * @throws  IOException
    +     *          If an I/O error occurs
          */
         public abstract DatagramChannel openDatagramChannel()
             throws IOException;
    @@ -209,6 +212,9 @@
          * Opens a pipe.
          *
          * @return  The new pipe
    +     *
    +     * @throws  IOException
    +     *          If an I/O error occurs
          */
         public abstract Pipe openPipe()
             throws IOException;
    @@ -217,6 +223,9 @@
          * Opens a selector.
          *
          * @return  The new selector
    +     *
    +     * @throws  IOException
    +     *          If an I/O error occurs
          */
         public abstract AbstractSelector openSelector()
             throws IOException;
    @@ -225,6 +234,9 @@
          * Opens a server-socket channel.
          *
          * @return  The new channel
    +     *
    +     * @throws  IOException
    +     *          If an I/O error occurs
          */
         public abstract ServerSocketChannel openServerSocketChannel()
             throws IOException;
    @@ -233,6 +245,9 @@
          * Opens a socket channel.
          *
          * @return  The new channel
    +     *
    +     * @throws  IOException
    +     *          If an I/O error occurs
          */
         public abstract SocketChannel openSocketChannel()
             throws IOException;
    diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template
    --- a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template	Tue Jul 02 17:38:10 2013 -0700
    +++ b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Jul 11 12:50:20 2013 -0700
    @@ -163,6 +163,9 @@
          * Initializes a new $coder$.  The new $coder$ will have the given
          * $otypes-per-itype$ and replacement values.
          *
    +     * @param  cs
    +     *         The charset that created this $coder$
    +     *
          * @param  average$ItypesPerOtype$
          *         A positive float value indicating the expected number of
          *         $otype$s that will be produced for each input $itype$
    @@ -209,6 +212,9 @@
          * $otypes-per-itype$ values and its replacement will be the
          * $replTypeName$ $defaultReplName$.
          *
    +     * @param  cs
    +     *         The charset that created this $coder$
    +     *
          * @param  average$ItypesPerOtype$
          *         A positive float value indicating the expected number of
          *         $otype$s that will be produced for each input $itype$
    @@ -386,6 +392,8 @@
          * 

    The default implementation of this method does nothing. This method * should be overridden by $coder$s that require notification of changes to * the malformed-input action.

    + * + * @param newAction The new action */ protected void implOnMalformedInput(CodingErrorAction newAction) { } @@ -428,6 +436,8 @@ *

    The default implementation of this method does nothing. This method * should be overridden by $coder$s that require notification of changes to * the unmappable-character action.

    + * + * @param newAction The new action */ protected void implOnUnmappableCharacter(CodingErrorAction newAction) { } @@ -925,6 +935,9 @@ *

    The default implementation of this method is not very efficient; it * should generally be overridden to improve performance.

    * + * @param c + * The given character + * * @return true if, and only if, this encoder can encode * the given character * @@ -953,6 +966,9 @@ *

    The default implementation of this method is not very efficient; it * should generally be overridden to improve performance.

    * + * @param cs + * The given character sequence + * * @return true if, and only if, this encoder can encode * the given character without throwing any exceptions and without * performing any replacements diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/charset/Charset.java --- a/jdk/src/share/classes/java/nio/charset/Charset.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/charset/Charset.java Thu Jul 11 12:50:20 2013 -0700 @@ -66,7 +66,7 @@ * * *
    - *

    Charset names

    + *

    Charset names

    * *

    Charsets are named by strings composed of the following characters: * @@ -140,7 +140,7 @@ * previous canonical name be made into an alias. * * - *

    Standard charsets

    + *

    Standard charsets

    * *
    * @@ -217,7 +217,7 @@ *

    The {@link StandardCharsets} class defines constants for each of the * standard charsets. * - *

    Terminology

    + *

    Terminology

    * *

    The name of this class is taken from the terms used in * RFC 2278. @@ -737,6 +737,9 @@ * it is not necessarily the case that the given charset is not contained * in this charset. * + * @param cs + * The given charset + * * @return true if the given charset is contained in this charset */ public abstract boolean contains(Charset cs); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/charset/CoderResult.java --- a/jdk/src/share/classes/java/nio/charset/CoderResult.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/charset/CoderResult.java Thu Jul 11 12:50:20 2013 -0700 @@ -227,6 +227,9 @@ * Static factory method that returns the unique object describing a * malformed-input error of the given length. * + * @param length + * The given length + * * @return The requested coder-result object */ public static CoderResult malformedForLength(int length) { @@ -243,6 +246,9 @@ * Static factory method that returns the unique result object describing * an unmappable-character error of the given length. * + * @param length + * The given length + * * @return The requested coder-result object */ public static CoderResult unmappableForLength(int length) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java --- a/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/charset/spi/CharsetProvider.java Thu Jul 11 12:50:20 2013 -0700 @@ -39,8 +39,8 @@ * the usual extension directories. Providers may also be made available by * adding them to the applet or application class path or by some other * platform-specific means. Charset providers are looked up via the current - * thread's {@link java.lang.Thread#getContextClassLoader() context - * class loader}. + * thread's {@link java.lang.Thread#getContextClassLoader() context class + * loader}. * *

    A charset provider identifies itself with a provider-configuration file * named java.nio.charset.spi.CharsetProvider in the resource diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/FileStore.java --- a/jdk/src/share/classes/java/nio/file/FileStore.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/FileStore.java Thu Jul 11 12:50:20 2013 -0700 @@ -173,6 +173,8 @@ * The {@code type} parameter is the type of the attribute view required and * the method returns an instance of that type if supported. * + * @param + * The {@code FileStoreAttributeView} type * @param type * the {@code Class} object corresponding to the attribute view * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/FileSystem.java --- a/jdk/src/share/classes/java/nio/file/FileSystem.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/FileSystem.java Thu Jul 11 12:50:20 2013 -0700 @@ -315,7 +315,7 @@ * that resembles regular expressions but with a simpler syntax. For example: * *

    - *
    Option NameDescription
    + *
    * * * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/FileSystems.java --- a/jdk/src/share/classes/java/nio/file/FileSystems.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/FileSystems.java Thu Jul 11 12:50:20 2013 -0700 @@ -200,6 +200,10 @@ * existing file system. In the case of the {@link FileSystems#getDefault * default} file system, no permission check is required. * + * @param uri the URI to locate the file system + * + * @return the reference to the file system + * * @throws IllegalArgumentException * if the pre-conditions for the {@code uri} parameter are not met * @throws FileSystemNotFoundException diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/Files.java --- a/jdk/src/share/classes/java/nio/file/Files.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/Files.java Thu Jul 11 12:50:20 2013 -0700 @@ -194,7 +194,7 @@ *

    In the addition to {@code READ} and {@code WRITE}, the following * options may be present: * - *

    {@code *.java}Matches a path that represents a file name ending in {@code .java}
    + *
    * * * @@ -1616,7 +1616,8 @@ * } * * - * + * @param + * The {@code FileAttributeView} type * @param path * the path to the file * @param type @@ -1665,6 +1666,8 @@ * PosixFileAttributes attrs = Files.readAttributes(path, PosixFileAttributes.class, NOFOLLOW_LINKS); * * + * @param + * The {@code BasicFileAttributes} type * @param path * the path to the file * @param type @@ -1863,7 +1866,7 @@ * attributes} parameter: * *
    - *
    Option Description
    {@link StandardOpenOption#APPEND APPEND}
    + *
    * * * @@ -1971,10 +1974,12 @@ * System Interface (POSIX) family of standards. * * @param path - * A file reference that locates the file + * The path to the file * @param perms * The new set of permissions * + * @return The path + * * @throws UnsupportedOperationException * if the associated file system does not support the {@code * PosixFileAttributeView} @@ -2009,7 +2014,7 @@ * access to a file attribute that is the owner of the file. * * @param path - * A file reference that locates the file + * The path to the file * @param options * options indicating how symbolic links are handled * @@ -2052,10 +2057,12 @@ * * * @param path - * A file reference that locates the file + * The path to the file * @param owner * The new file owner * + * @return The path + * * @throws UnsupportedOperationException * if the associated file system does not support the {@code * FileOwnerAttributeView} @@ -2090,6 +2097,8 @@ * readAttributes} method and the file type tested with the {@link * BasicFileAttributes#isSymbolicLink} method. * + * @param path The path to the file + * * @return {@code true} if the file is a symbolic link; {@code false} if * the file does not exist, is not a symbolic link, or it cannot * be determined if the file is a symbolic link or not. @@ -2239,7 +2248,7 @@ * @param time * the new last modified time * - * @return the file + * @return the path * * @throws IOException * if an I/O error occurs diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/Path.java --- a/jdk/src/share/classes/java/nio/file/Path.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/Path.java Thu Jul 11 12:50:20 2013 -0700 @@ -64,7 +64,7 @@ * those developing custom file system implementations. Methods may be added to * this interface in future releases.

    * - *

    Accessing Files

    + *

    Accessing Files

    *

    Paths may be used with the {@link Files} class to operate on files, * directories, and other types of files. For example, suppose we want a {@link * java.io.BufferedReader} to read text from a file "{@code access.log}". The @@ -75,7 +75,7 @@ * BufferedReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8); * * - *

    Interoperability

    + *

    Interoperability

    *

    Paths associated with the default {@link * java.nio.file.spi.FileSystemProvider provider} are generally interoperable * with the {@link java.io.File java.io.File} class. Paths created by other @@ -87,7 +87,7 @@ * addition, the {@link #toFile toFile} method is useful to construct a {@code * File} from the {@code String} representation of a {@code Path}. * - *

    Concurrency

    + *

    Concurrency

    *

    Implementations of this interface are immutable and safe for use by * multiple concurrent threads. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java --- a/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/SecureDirectoryStream.java Thu Jul 11 12:50:20 2013 -0700 @@ -122,6 +122,8 @@ * an optional list of attributes to set atomically when creating * the file * + * @return the seekable byte channel + * * @throws ClosedDirectoryStreamException * if the directory stream is closed * @throws IllegalArgumentException @@ -260,6 +262,8 @@ * then all methods to read or update attributes will throw {@link * ClosedDirectoryStreamException ClosedDirectoryStreamException}. * + * @param + * The {@code FileAttributeView} type * @param type * the {@code Class} object corresponding to the file attribute view * @@ -288,6 +292,8 @@ * is created but methods to read or update attributes of the file will * fail when invoked and the file does not exist. * + * @param + * The {@code FileAttributeView} type * @param path * the path of the file * @param type diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/WatchEvent.java --- a/jdk/src/share/classes/java/nio/file/WatchEvent.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/WatchEvent.java Thu Jul 11 12:50:20 2013 -0700 @@ -55,11 +55,16 @@ public static interface Kind { /** * Returns the name of the event kind. + * + * @return the name of the event kind */ String name(); /** * Returns the type of the {@link WatchEvent#context context} value. + * + * + * @return the type of the context value */ Class type(); } @@ -76,6 +81,8 @@ public static interface Modifier { /** * Returns the name of the modifier. + * + * @return the name of the modifier */ String name(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/WatchService.java --- a/jdk/src/share/classes/java/nio/file/WatchService.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/WatchService.java Thu Jul 11 12:50:20 2013 -0700 @@ -78,7 +78,7 @@ * The {@link java.nio.channels.FileChannel FileChannel} class defines methods * to lock regions of a file against access by other programs. * - *

    Platform dependencies

    + *

    Platform dependencies

    * *

    The implementation that observes events from the file system is intended * to map directly on to the native file event notification facility where diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/AclEntry.java --- a/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java Thu Jul 11 12:50:20 2013 -0700 @@ -134,6 +134,7 @@ /** * Sets the type component of this builder. * + * @param type the component type * @return this builder */ public Builder setType(AclEntryType type) { @@ -146,6 +147,7 @@ /** * Sets the principal component of this builder. * + * @param who the principal component * @return this builder */ public Builder setPrincipal(UserPrincipal who) { @@ -168,6 +170,7 @@ * Sets the permissions component of this builder. On return, the * permissions component of this builder is a copy of the given set. * + * @param perms the permissions component * @return this builder * * @throws ClassCastException @@ -193,6 +196,7 @@ * permissions component of this builder is a copy of the permissions in * the given array. * + * @param perms the permissions component * @return this builder */ public Builder setPermissions(AclEntryPermission... perms) { @@ -211,6 +215,7 @@ * Sets the flags component of this builder. On return, the flags * component of this builder is a copy of the given set. * + * @param flags the flags component * @return this builder * * @throws ClassCastException @@ -236,6 +241,7 @@ * component of this builder is a copy of the flags in the given * array. * + * @param flags the flags component * @return this builder */ public Builder setFlags(AclEntryFlag... flags) { @@ -267,9 +273,7 @@ /** * Constructs a new builder with the components of an existing ACL entry. * - * @param entry - * an ACL entry - * + * @param entry an ACL entry * @return a new builder */ public static Builder newBuilder(AclEntry entry) { @@ -278,6 +282,8 @@ /** * Returns the ACL entry type. + * + * @return the ACL entry type */ public AclEntryType type() { return type; @@ -285,6 +291,8 @@ /** * Returns the principal component. + * + * @return the principal component */ public UserPrincipal principal() { return who; @@ -294,6 +302,8 @@ * Returns a copy of the permissions component. * *

    The returned set is a modifiable copy of the permissions. + * + * @return the permissions component */ public Set permissions() { return new HashSet(perms); @@ -303,6 +313,8 @@ * Returns a copy of the flags component. * *

    The returned set is a modifiable copy of the flags. + * + * @return the flags component */ public Set flags() { return new HashSet(flags); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/AclFileAttributeView.java Thu Jul 11 12:50:20 2013 -0700 @@ -54,7 +54,7 @@ * supportsFileAttributeView} method can be used to test if a file system * supports ACLs. * - *

    Interoperability

    + *

    Interoperability

    * * RFC 3530 allows for special user identities to be used on platforms that * support the POSIX defined access permissions. The special user identities @@ -65,7 +65,7 @@ * UserPrincipalLookupService} may be used to obtain a {@link UserPrincipal} * to represent these special identities by invoking the {@link * UserPrincipalLookupService#lookupPrincipalByName lookupPrincipalByName} - * method.

    + * method. * *

    Usage Example: * Suppose we wish to add an entry to an existing ACL to grant "joe" access: @@ -90,11 +90,11 @@ * view.setAcl(acl); * * - *

    Dynamic Access

    + *

    Dynamic Access

    *

    Where dynamic access to file attributes is required, the attributes * supported by this attribute view are as follows: *

    - *
    {@code "*"} Read all {@link BasicFileAttributes basic-file-attributes}.
    + *
    * * * @@ -118,7 +118,7 @@ * update the ACL or owner attributes as if by invoking the {@link #setAcl setAcl} * or {@link #setOwner setOwner} methods. * - *

    Setting the ACL when creating a file

    + *

    Setting the ACL when creating a file

    * *

    Implementations supporting this attribute view may also support setting * the initial ACL when creating a file or directory. The initial ACL diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/AttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/AttributeView.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/AttributeView.java Thu Jul 11 12:50:20 2013 -0700 @@ -38,6 +38,8 @@ public interface AttributeView { /** * Returns the name of the attribute view. + * + * @return the name of the attribute view */ String name(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributeView.java Thu Jul 11 12:50:20 2013 -0700 @@ -41,7 +41,7 @@ *

    Where dynamic access to file attributes is required, the attributes * supported by this attribute view have the following names and types: *

    - *
    Name Type
    + *
    * * * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java --- a/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/BasicFileAttributes.java Thu Jul 11 12:50:20 2013 -0700 @@ -87,22 +87,31 @@ /** * Tells whether the file is a regular file with opaque content. + * + * @return {@code true} if the file is a regular file with opaque content */ boolean isRegularFile(); /** * Tells whether the file is a directory. + * + * @return {@code true} if the file is a directory */ boolean isDirectory(); /** * Tells whether the file is a symbolic link. + * + * @return {@code true} if the file is a symbolic link */ boolean isSymbolicLink(); /** * Tells whether the file is something other than a regular file, directory, * or symbolic link. + * + * @return {@code true} if the file something other than a regular file, + * directory or symbolic link */ boolean isOther(); @@ -138,6 +147,8 @@ * and two files are the {@link java.nio.file.Files#isSameFile same} with * non-{@code null} file keys, then their file keys are equal. * + * @return an object that uniquely identifies the given file, or {@code null} + * * @see java.nio.file.Files#walkFileTree */ Object fileKey(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/DosFileAttributeView.java Thu Jul 11 12:50:20 2013 -0700 @@ -41,7 +41,7 @@ * BasicFileAttributeView}, and in addition, the following attributes are * supported: *
    - *
    Name Type
    + *
    * * * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/FileAttribute.java --- a/jdk/src/share/classes/java/nio/file/attribute/FileAttribute.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/FileAttribute.java Thu Jul 11 12:50:20 2013 -0700 @@ -40,11 +40,15 @@ public interface FileAttribute { /** * Returns the attribute name. + * + * @return The attribute name */ String name(); /** * Returns the attribute value. + * + * @return The attribute value */ T value(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java --- a/jdk/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/attribute/PosixFileAttributeView.java Thu Jul 11 12:50:20 2013 -0700 @@ -68,13 +68,13 @@ * PosixFilePermissions.toString(attrs.permissions())); * * - *

    Dynamic Access

    + *

    Dynamic Access

    *

    Where dynamic access to file attributes is required, the attributes * supported by this attribute view are as defined by {@link * BasicFileAttributeView} and {@link FileOwnerAttributeView}, and in addition, * the following attributes are supported: *

    - *
    Name Type
    + *
    * * * @@ -102,7 +102,7 @@ * #setPermissions setPermissions}, {@link #setOwner setOwner}, and {@link * #setGroup setGroup} methods respectively. * - *

    Setting Initial Permissions

    + *

    Setting Initial Permissions

    *

    Implementations supporting this attribute view may also support setting * the initial permissions when creating a file or directory. The * initial permissions are provided to the {@link Files#createFile createFile} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java --- a/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/nio/file/spi/FileSystemProvider.java Thu Jul 11 12:50:20 2013 -0700 @@ -287,6 +287,8 @@ * @param uri * The URI to convert * + * @return The resulting {@code Path} + * * @throws IllegalArgumentException * If the URI scheme does not identify this provider or other * preconditions on the uri parameter do not hold @@ -751,6 +753,8 @@ * @param link * the path to the symbolic link * + * @return The target of the symbolic link + * * @throws UnsupportedOperationException * if the implementation does not support symbolic links * @throws NotLinkException @@ -984,6 +988,8 @@ * exactly the manner specified by the {@link Files#getFileAttributeView} * method. * + * @param + * The {@code FileAttributeView} type * @param path * the path to the file * @param type @@ -1002,6 +1008,8 @@ * exactly the manner specified by the {@link * Files#readAttributes(Path,Class,LinkOption[])} method. * + * @param + * The {@code BasicFileAttributes} type * @param path * the path to the file * @param type diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/rmi/server/RMIClassLoader.java --- a/jdk/src/share/classes/java/rmi/server/RMIClassLoader.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/rmi/server/RMIClassLoader.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -424,7 +424,7 @@ * *

    * *

    In case the client does not explicitly initialize the KeyPairGenerator - * (via a call to an initialize method), each provider must + * (via a call to an {@code initialize} method), each provider must * supply (and document) a default initialization. * For example, the Sun provider uses a default modulus size (keysize) * of 1024 bits. * *

    Note that this class is abstract and extends from - * KeyPairGeneratorSpi for historical reasons. + * {@code KeyPairGeneratorSpi} for historical reasons. * Application developers should only take notice of the methods defined in - * this KeyPairGenerator class; all the methods in + * this {@code KeyPairGenerator} class; all the methods in * the superclass are intended for cryptographic service providers who wish to * supply their own implementations of key pair generators. * *

    Every implementation of the Java platform is required to support the - * following standard KeyPairGenerator algorithms and keysizes in + * following standard {@code KeyPairGenerator} algorithms and keysizes in * parentheses: *

      - *
    • DiffieHellman (1024)
    • - *
    • DSA (1024)
    • - *
    • RSA (1024, 2048)
    • + *
    • {@code DiffieHellman} (1024)
    • + *
    • {@code DSA} (1024)
    • + *
    • {@code RSA} (1024, 2048)
    • *
    * These algorithms are described in the
    @@ -322,18 +322,18 @@ /** * Initializes the key pair generator for a certain keysize using - * a default parameter set and the SecureRandom + * a default parameter set and the {@code SecureRandom} * implementation of the highest-priority installed provider as the source * of randomness. * (If none of the installed providers supply an implementation of - * SecureRandom, a system-provided source of randomness is + * {@code SecureRandom}, a system-provided source of randomness is * used.) * * @param keysize the keysize. This is an * algorithm-specific metric, such as modulus length, specified in * number of bits. * - * @exception InvalidParameterException if the keysize is not + * @exception InvalidParameterException if the {@code keysize} is not * supported by this KeyPairGenerator object. */ public void initialize(int keysize) { @@ -349,7 +349,7 @@ * number of bits. * @param random the source of randomness. * - * @exception InvalidParameterException if the keysize is not + * @exception InvalidParameterException if the {@code keysize} is not * supported by this KeyPairGenerator object. * * @since 1.2 @@ -369,11 +369,11 @@ /** * Initializes the key pair generator using the specified parameter - * set and the SecureRandom + * set and the {@code SecureRandom} * implementation of the highest-priority installed provider as the source * of randomness. * (If none of the installed providers supply an implementation of - * SecureRandom, a system-provided source of randomness is + * {@code SecureRandom}, a system-provided source of randomness is * used.). * *

    This concrete method has been added to this previously-defined @@ -382,10 +382,10 @@ * {@link KeyPairGeneratorSpi#initialize( * java.security.spec.AlgorithmParameterSpec, * java.security.SecureRandom) initialize} method, - * passing it params and a source of randomness (obtained + * passing it {@code params} and a source of randomness (obtained * from the highest-priority installed provider or system-provided if none * of the installed providers supply one). - * That initialize method always throws an + * That {@code initialize} method always throws an * UnsupportedOperationException if it is not overridden by the provider. * * @param params the parameter set used to generate the keys. @@ -410,8 +410,8 @@ * KeyPairGeneratorSpi#initialize( * java.security.spec.AlgorithmParameterSpec, * java.security.SecureRandom) initialize} method, - * passing it params and random. - * That initialize + * passing it {@code params} and {@code random}. + * That {@code initialize} * method always throws an * UnsupportedOperationException if it is not overridden by the provider. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java --- a/jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/KeyPairGeneratorSpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ /** *

    This class defines the Service Provider Interface (SPI) - * for the KeyPairGenerator class, which is used to generate + * for the {@code KeyPairGenerator} class, which is used to generate * pairs of public and private keys. * *

    All the abstract methods in this class must be implemented by each @@ -37,7 +37,7 @@ * of a key pair generator for a particular algorithm. * *

    In case the client does not explicitly initialize the KeyPairGenerator - * (via a call to an initialize method), each provider must + * (via a call to an {@code initialize} method), each provider must * supply (and document) a default initialization. * For example, the Sun provider uses a default modulus size (keysize) * of 1024 bits. @@ -61,7 +61,7 @@ * * @param random the source of randomness for this generator. * - * @exception InvalidParameterException if the keysize is not + * @exception InvalidParameterException if the {@code keysize} is not * supported by this KeyPairGeneratorSpi object. */ public abstract void initialize(int keysize, SecureRandom random); @@ -100,7 +100,7 @@ * will be used. This will generate a new key pair every time it * is called. * - * @return the newly generated KeyPair + * @return the newly generated {@code KeyPair} */ public abstract KeyPair generateKeyPair(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/KeyRep.java --- a/jdk/src/share/classes/java/security/KeyRep.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/KeyRep.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,17 +116,17 @@ * * @param type either one of Type.SECRET, Type.PUBLIC, or Type.PRIVATE * @param algorithm the algorithm returned from - * Key.getAlgorithm() + * {@code Key.getAlgorithm()} * @param format the encoding format returned from - * Key.getFormat() + * {@code Key.getFormat()} * @param encoded the encoded bytes returned from - * Key.getEncoded() + * {@code Key.getEncoded()} * * @exception NullPointerException - * if type is null, - * if algorithm is null, - * if format is null, - * or if encoded is null + * if type is {@code null}, + * if algorithm is {@code null}, + * if format is {@code null}, + * or if encoded is {@code null} */ public KeyRep(Type type, String algorithm, String format, byte[] encoded) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/KeyStore.java --- a/jdk/src/share/classes/java/security/KeyStore.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/KeyStore.java Thu Jul 11 12:50:20 2013 -0700 @@ -41,13 +41,13 @@ * This class represents a storage facility for cryptographic * keys and certificates. * - *

    A KeyStore manages different types of entries. - * Each type of entry implements the KeyStore.Entry interface. - * Three basic KeyStore.Entry implementations are provided: + *

    A {@code KeyStore} manages different types of entries. + * Each type of entry implements the {@code KeyStore.Entry} interface. + * Three basic {@code KeyStore.Entry} implementations are provided: * *

    Name Type
    + * * - * - * - * - * - * - - * - * + * + * + * + * + * + + * + * *
    Attributes Automatically Placed in a Provider Object
    NameValue
    Provider.id nameString.valueOf(provider.getName())
    Provider.id versionString.valueOf(provider.getVersion())
    Provider.id infoString.valueOf(provider.getInfo())
    Provider.id classNameprovider.getClass().getName()
    {@code Provider.id name}{@code String.valueOf(provider.getName())}
    {@code Provider.id version}{@code String.valueOf(provider.getVersion())}
    {@code Provider.id info}{@code String.valueOf(provider.getInfo())}
    {@code Provider.id className}{@code provider.getClass().getName()}
    * * @author Benjamin Renaud @@ -185,18 +186,18 @@ * used to look up facilities implemented by the provider. * *

    First, if there is a security manager, its - * checkSecurityAccess method is called with the string - * "clearProviderProperties."+name (where name + * {@code checkSecurityAccess} method is called with the string + * {@code "clearProviderProperties."+name} (where {@code name} * is the provider name) to see if it's ok to clear this provider. - * If the default implementation of checkSecurityAccess + * If the default implementation of {@code checkSecurityAccess} * is used (that is, that method is not overriden), then this results in - * a call to the security manager's checkPermission method - * with a SecurityPermission("clearProviderProperties."+name) + * a call to the security manager's {@code checkPermission} method + * with a {@code SecurityPermission("clearProviderProperties."+name)} * permission. * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies access to clear this provider * * @since 1.2 @@ -292,17 +293,17 @@ } /** - * Sets the key property to have the specified - * value. + * Sets the {@code key} property to have the specified + * {@code value}. * *

    First, if there is a security manager, its - * checkSecurityAccess method is called with the string - * "putProviderProperty."+name, where name is the + * {@code checkSecurityAccess} method is called with the string + * {@code "putProviderProperty."+name}, where {@code name} is the * provider name, to see if it's ok to set this provider's property values. - * If the default implementation of checkSecurityAccess + * If the default implementation of {@code checkSecurityAccess} * is used (that is, that method is not overriden), then this results in - * a call to the security manager's checkPermission method - * with a SecurityPermission("putProviderProperty."+name) + * a call to the security manager's {@code checkPermission} method + * with a {@code SecurityPermission("putProviderProperty."+name)} * permission. * * @param key the property key. @@ -310,11 +311,11 @@ * @param value the property value. * * @return the previous value of the specified property - * (key), or null if it did not have one. + * ({@code key}), or null if it did not have one. * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies access to set property values. * * @since 1.2 @@ -329,18 +330,18 @@ } /** - * Removes the key property (and its corresponding - * value). + * Removes the {@code key} property (and its corresponding + * {@code value}). * *

    First, if there is a security manager, its - * checkSecurityAccess method is called with the string - * "removeProviderProperty."+name, where name is + * {@code checkSecurityAccess} method is called with the string + * {@code "removeProviderProperty."+name}, where {@code name} is * the provider name, to see if it's ok to remove this provider's * properties. If the default implementation of - * checkSecurityAccess is used (that is, that method is not + * {@code checkSecurityAccess} is used (that is, that method is not * overriden), then this results in a call to the security manager's - * checkPermission method with a - * SecurityPermission("removeProviderProperty."+name) + * {@code checkPermission} method with a + * {@code SecurityPermission("removeProviderProperty."+name)} * permission. * * @param key the key for the property to be removed. @@ -349,8 +350,8 @@ * or null if the key did not have a mapping. * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies access to remove this provider's properties. * * @since 1.2 @@ -662,9 +663,9 @@ * the service added via {@link #putService putService()} is returned. * * @param type the type of {@link Service service} requested - * (for example, MessageDigest) + * (for example, {@code MessageDigest}) * @param algorithm the case insensitive algorithm name (or alternate - * alias) of the service requested (for example, SHA-1) + * alias) of the service requested (for example, {@code SHA-1}) * * @return the service describing this Provider's matching service * or null if no such service exists @@ -739,20 +740,20 @@ * Java Cryptography Architecture API Specification & Reference . * *

    Also, if there is a security manager, its - * checkSecurityAccess method is called with the string - * "putProviderProperty."+name, where name is + * {@code checkSecurityAccess} method is called with the string + * {@code "putProviderProperty."+name}, where {@code name} is * the provider name, to see if it's ok to set this provider's property - * values. If the default implementation of checkSecurityAccess + * values. If the default implementation of {@code checkSecurityAccess} * is used (that is, that method is not overriden), then this results in - * a call to the security manager's checkPermission method with - * a SecurityPermission("putProviderProperty."+name) + * a call to the security manager's {@code checkPermission} method with + * a {@code SecurityPermission("putProviderProperty."+name)} * permission. * * @param s the Service to add * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method denies + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method denies * access to set property values. * @throws NullPointerException if s is null * @@ -830,21 +831,21 @@ * from this provider's Hashtable. * *

    Also, if there is a security manager, its - * checkSecurityAccess method is called with the string - * "removeProviderProperty."+name, where name is + * {@code checkSecurityAccess} method is called with the string + * {@code "removeProviderProperty."+name}, where {@code name} is * the provider name, to see if it's ok to remove this provider's * properties. If the default implementation of - * checkSecurityAccess is used (that is, that method is not + * {@code checkSecurityAccess} is used (that is, that method is not * overriden), then this results in a call to the security manager's - * checkPermission method with a - * SecurityPermission("removeProviderProperty."+name) + * {@code checkPermission} method with a + * {@code SecurityPermission("removeProviderProperty."+name)} * permission. * * @param s the Service to be removed * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method denies + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method denies * access to remove this provider's properties. * @throws NullPointerException if s is null * @@ -1122,7 +1123,7 @@ } /** - * Get the type of this service. For example, MessageDigest. + * Get the type of this service. For example, {@code MessageDigest}. * * @return the type of this service */ @@ -1132,7 +1133,7 @@ /** * Return the name of the algorithm of this service. For example, - * SHA-1. + * {@code SHA-1}. * * @return the algorithm of this service */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/ProviderException.java --- a/jdk/src/share/classes/java/security/ProviderException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/ProviderException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,13 +58,13 @@ } /** - * Creates a ProviderException with the specified + * Creates a {@code ProviderException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -73,13 +73,13 @@ } /** - * Creates a ProviderException with the specified cause - * and a detail message of (cause==null ? null : cause.toString()) + * Creates a {@code ProviderException} with the specified cause + * and a detail message of {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/PublicKey.java --- a/jdk/src/share/classes/java/security/PublicKey.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/PublicKey.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * * Note: The specialized public key interfaces extend this interface. * See, for example, the DSAPublicKey interface in - * java.security.interfaces. + * {@code java.security.interfaces}. * * @see Key * @see PrivateKey diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/SecureClassLoader.java --- a/jdk/src/share/classes/java/security/SecureClassLoader.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/SecureClassLoader.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,12 +63,12 @@ * class loader for delegation. * *

    If there is a security manager, this method first - * calls the security manager's checkCreateClassLoader + * calls the security manager's {@code checkCreateClassLoader} * method to ensure creation of a class loader is allowed. *

    * @param parent the parent ClassLoader * @exception SecurityException if a security manager exists and its - * checkCreateClassLoader method doesn't allow + * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ @@ -87,11 +87,11 @@ * loader for delegation. * *

    If there is a security manager, this method first - * calls the security manager's checkCreateClassLoader + * calls the security manager's {@code checkCreateClassLoader} * method to ensure creation of a class loader is allowed. * * @exception SecurityException if a security manager exists and its - * checkCreateClassLoader method doesn't allow + * {@code checkCreateClassLoader} method doesn't allow * creation of a class loader. * @see SecurityManager#checkCreateClassLoader */ @@ -113,22 +113,22 @@ * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. *

    - * @param name the expected name of the class, or null + * @param name the expected name of the class, or {@code null} * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes in - * positions off through off+len-1 + * positions {@code off} through {@code off+len-1} * should have the format of a valid class file as defined by * The Java™ Virtual Machine Specification. - * @param off the start offset in b of the class data + * @param off the start offset in {@code b} of the class data * @param len the length of the class data - * @param cs the associated CodeSource, or null if none - * @return the Class object created from the data, + * @param cs the associated CodeSource, or {@code null} if none + * @return the {@code Class} object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class - * @exception IndexOutOfBoundsException if either off or - * len is negative, or if - * off+len is greater than b.length. + * @exception IndexOutOfBoundsException if either {@code off} or + * {@code len} is negative, or if + * {@code off+len} is greater than {@code b.length}. * * @exception SecurityException if an attempt is made to add this class * to a package that contains classes that were signed by @@ -143,22 +143,22 @@ } /** - * Converts a {@link java.nio.ByteBuffer ByteBuffer} - * into an instance of class Class, with an optional CodeSource. + * Converts a {@link java.nio.ByteBuffer ByteBuffer} + * into an instance of class {@code Class}, with an optional CodeSource. * Before the class can be used it must be resolved. *

    * If a non-null CodeSource is supplied a ProtectionDomain is * constructed and associated with the class being defined. *

    - * @param name the expected name of the class, or null + * @param name the expected name of the class, or {@code null} * if not known, using '.' and not '/' as the separator * and without a trailing ".class" suffix. * @param b the bytes that make up the class data. The bytes from positions - * b.position() through b.position() + b.limit() -1 + * {@code b.position()} through {@code b.position() + b.limit() -1} * should have the format of a valid class file as defined by * The Java™ Virtual Machine Specification. - * @param cs the associated CodeSource, or null if none - * @return the Class object created from the data, + * @param cs the associated CodeSource, or {@code null} if none + * @return the {@code Class} object created from the data, * and optional CodeSource. * @exception ClassFormatError if the data did not contain a valid class * @exception SecurityException if an attempt is made to add this class diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/SecureRandom.java --- a/jdk/src/share/classes/java/security/SecureRandom.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/SecureRandom.java Thu Jul 11 12:50:20 2013 -0700 @@ -50,7 +50,7 @@ * RFC 1750: Randomness Recommendations for Security. * *

    A caller obtains a SecureRandom instance via the - * no-argument constructor or one of the getInstance methods: + * no-argument constructor or one of the {@code getInstance} methods: * *

      *      SecureRandom random = new SecureRandom();
    @@ -71,15 +71,15 @@
      *      random.nextBytes(bytes);
      * 
    * - *

    Callers may also invoke the generateSeed method + *

    Callers may also invoke the {@code generateSeed} method * to generate a given number of seed bytes (to seed other random number * generators, for example): *

      *      byte seed[] = random.generateSeed(20);
      * 
    * - * Note: Depending on the implementation, the generateSeed and - * nextBytes methods may block as entropy is being gathered, + * Note: Depending on the implementation, the {@code generateSeed} and + * {@code nextBytes} methods may block as entropy is being gathered, * for example, if they need to read from /dev/random on various Unix-like * operating systems. * @@ -140,16 +140,16 @@ * for information about standard RNG algorithm names. * *

    The returned SecureRandom object has not been seeded. To seed the - * returned object, call the setSeed method. - * If setSeed is not called, the first call to - * nextBytes will force the SecureRandom object to seed itself. - * This self-seeding will not occur if setSeed was + * returned object, call the {@code setSeed} method. + * If {@code setSeed} is not called, the first call to + * {@code nextBytes} will force the SecureRandom object to seed itself. + * This self-seeding will not occur if {@code setSeed} was * previously called. */ public SecureRandom() { /* * This call to our superclass constructor will result in a call - * to our own setSeed method, which will return + * to our own {@code setSeed} method, which will return * immediately when it is passed zero. */ super(0); @@ -250,10 +250,10 @@ * the {@link Security#getProviders() Security.getProviders()} method. * *

    The returned SecureRandom object has not been seeded. To seed the - * returned object, call the setSeed method. - * If setSeed is not called, the first call to - * nextBytes will force the SecureRandom object to seed itself. - * This self-seeding will not occur if setSeed was + * returned object, call the {@code setSeed} method. + * If {@code setSeed} is not called, the first call to + * {@code nextBytes} will force the SecureRandom object to seed itself. + * This self-seeding will not occur if {@code setSeed} was * previously called. * * @param algorithm the name of the RNG algorithm. @@ -293,10 +293,10 @@ * the {@link Security#getProviders() Security.getProviders()} method. * *

    The returned SecureRandom object has not been seeded. To seed the - * returned object, call the setSeed method. - * If setSeed is not called, the first call to - * nextBytes will force the SecureRandom object to seed itself. - * This self-seeding will not occur if setSeed was + * returned object, call the {@code setSeed} method. + * If {@code setSeed} is not called, the first call to + * {@code nextBytes} will force the SecureRandom object to seed itself. + * This self-seeding will not occur if {@code setSeed} was * previously called. * * @param algorithm the name of the RNG algorithm. @@ -341,10 +341,10 @@ * does not have to be registered in the provider list. * *

    The returned SecureRandom object has not been seeded. To seed the - * returned object, call the setSeed method. - * If setSeed is not called, the first call to - * nextBytes will force the SecureRandom object to seed itself. - * This self-seeding will not occur if setSeed was + * returned object, call the {@code setSeed} method. + * If {@code setSeed} is not called, the first call to + * {@code nextBytes} will force the SecureRandom object to seed itself. + * This self-seeding will not occur if {@code setSeed} was * previously called. * * @param algorithm the name of the RNG algorithm. @@ -395,7 +395,7 @@ * Returns the name of the algorithm implemented by this SecureRandom * object. * - * @return the name of the algorithm or unknown + * @return the name of the algorithm or {@code unknown} * if the algorithm name cannot be determined. * @since 1.5 */ @@ -418,12 +418,12 @@ /** * Reseeds this random object, using the eight bytes contained - * in the given long seed. The given seed supplements, + * in the given {@code long seed}. The given seed supplements, * rather than replaces, the existing seed. Thus, repeated calls * are guaranteed never to reduce randomness. * *

    This method is defined for compatibility with - * java.util.Random. + * {@code java.util.Random}. * * @param seed the seed. * @@ -445,10 +445,10 @@ /** * Generates a user-specified number of random bytes. * - *

    If a call to setSeed had not occurred previously, + *

    If a call to {@code setSeed} had not occurred previously, * the first call to this method forces this SecureRandom object * to seed itself. This self-seeding will not occur if - * setSeed was previously called. + * {@code setSeed} was previously called. * * @param bytes the array to be filled in with random bytes. */ @@ -460,15 +460,15 @@ /** * Generates an integer containing the user-specified number of * pseudo-random bits (right justified, with leading zeros). This - * method overrides a java.util.Random method, and serves + * method overrides a {@code java.util.Random} method, and serves * to provide a source of random bits to all of the methods inherited - * from that class (for example, nextInt, - * nextLong, and nextFloat). + * from that class (for example, {@code nextInt}, + * {@code nextLong}, and {@code nextFloat}). * * @param numBits number of pseudo-random bits to be generated, where * {@code 0 <= numBits <= 32}. * - * @return an int containing the user-specified number + * @return an {@code int} containing the user-specified number * of pseudo-random bits (right justified, with leading zeros). */ @Override @@ -492,8 +492,8 @@ * *

    This method is only included for backwards compatibility. * The caller is encouraged to use one of the alternative - * getInstance methods to obtain a SecureRandom object, and - * then call the generateSeed method to obtain seed bytes + * {@code getInstance} methods to obtain a SecureRandom object, and + * then call the {@code generateSeed} method to obtain seed bytes * from that object. * * @param numBytes the number of seed bytes to generate. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/SecureRandomSpi.java --- a/jdk/src/share/classes/java/security/SecureRandomSpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/SecureRandomSpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ /** * This class defines the Service Provider Interface (SPI) - * for the SecureRandom class. + * for the {@code SecureRandom} class. * All the abstract methods in this class must be implemented by each * service provider who wishes to supply the implementation * of a cryptographically strong pseudo-random number generator. @@ -53,10 +53,10 @@ /** * Generates a user-specified number of random bytes. * - *

    If a call to engineSetSeed had not occurred previously, + *

    If a call to {@code engineSetSeed} had not occurred previously, * the first call to this method forces this SecureRandom implementation * to seed itself. This self-seeding will not occur if - * engineSetSeed was previously called. + * {@code engineSetSeed} was previously called. * * @param bytes the array to be filled in with random bytes. */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/Security.java --- a/jdk/src/share/classes/java/security/Security.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/Security.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -298,7 +298,7 @@ * property in the master file of the "SUN" Cryptographic Service * Provider in order to determine how to parse algorithm-specific * parameters. Use the new provider-based and algorithm-independent - * AlgorithmParameters and KeyFactory engine + * {@code AlgorithmParameters} and {@code KeyFactory} engine * classes (introduced in the J2SE version 1.2 platform) instead. */ @Deprecated @@ -321,21 +321,21 @@ * *

    If the given provider is installed at the requested position, * the provider that used to be at that position, and all providers - * with a position greater than position, are shifted up + * with a position greater than {@code position}, are shifted up * one position (towards the end of the list of installed providers). * *

    A provider cannot be added if it is already installed. * *

    First, if there is a security manager, its - * checkSecurityAccess + * {@code checkSecurityAccess} * method is called with the string - * "insertProvider."+provider.getName() + * {@code "insertProvider."+provider.getName()} * to see if it's ok to add a new provider. - * If the default implementation of checkSecurityAccess + * If the default implementation of {@code checkSecurityAccess} * is used (i.e., that method is not overriden), then this will result in - * a call to the security manager's checkPermission method + * a call to the security manager's {@code checkPermission} method * with a - * SecurityPermission("insertProvider."+provider.getName()) + * {@code SecurityPermission("insertProvider."+provider.getName())} * permission. * * @param provider the provider to be added. @@ -349,8 +349,8 @@ * * @throws NullPointerException if provider is null * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies access to add a new provider * * @see #getProvider @@ -374,15 +374,15 @@ * Adds a provider to the next position available. * *

    First, if there is a security manager, its - * checkSecurityAccess + * {@code checkSecurityAccess} * method is called with the string - * "insertProvider."+provider.getName() + * {@code "insertProvider."+provider.getName()} * to see if it's ok to add a new provider. - * If the default implementation of checkSecurityAccess + * If the default implementation of {@code checkSecurityAccess} * is used (i.e., that method is not overriden), then this will result in - * a call to the security manager's checkPermission method + * a call to the security manager's {@code checkPermission} method * with a - * SecurityPermission("insertProvider."+provider.getName()) + * {@code SecurityPermission("insertProvider."+provider.getName())} * permission. * * @param provider the provider to be added. @@ -393,8 +393,8 @@ * * @throws NullPointerException if provider is null * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies access to add a new provider * * @see #getProvider @@ -423,20 +423,20 @@ * if name is null. * *

    First, if there is a security manager, its - * checkSecurityAccess - * method is called with the string "removeProvider."+name + * {@code checkSecurityAccess} + * method is called with the string {@code "removeProvider."+name} * to see if it's ok to remove the provider. - * If the default implementation of checkSecurityAccess + * If the default implementation of {@code checkSecurityAccess} * is used (i.e., that method is not overriden), then this will result in - * a call to the security manager's checkPermission method - * with a SecurityPermission("removeProvider."+name) + * a call to the security manager's {@code checkPermission} method + * with a {@code SecurityPermission("removeProvider."+name)} * permission. * * @param name the name of the provider to remove. * * @throws SecurityException - * if a security manager exists and its {@link - * java.lang.SecurityManager#checkSecurityAccess} method + * if a security manager exists and its {@link + * java.lang.SecurityManager#checkSecurityAccess} method * denies * access to remove the provider * @@ -480,8 +480,8 @@ * Returns an array containing all installed providers that satisfy the * specified selection criterion, or null if no such providers have been * installed. The returned providers are ordered - * according to their preference order. + * according to their + * {@linkplain #insertProviderAt(java.security.Provider, int) preference order}. * *

    A cryptographic service is always associated with a particular * algorithm or type. For example, a digital signature service is @@ -492,8 +492,8 @@ *

    The selection criterion must be specified in one of the following two * formats: *

      - *
    • <crypto_service>.<algorithm_or_type>

      The - * cryptographic service name must not contain any dots. + *

    • {@literal .} + *

      The cryptographic service name must not contain any dots. *

      A * provider satisfies the specified selection criterion iff the provider * implements the @@ -501,11 +501,12 @@ *

      For example, "CertificateFactory.X.509" * would be satisfied by any provider that supplied * a CertificateFactory implementation for X.509 certificates. - *

    • <crypto_service>.<algorithm_or_type> - * <attribute_name>:< attribute_value> + *
    • {@literal . + * :} *

      The cryptographic service name must not contain any dots. There * must be one or more space charaters between the - * <algorithm_or_type> and the <attribute_name>. + * {@literal } and the + * {@literal }. *

      A provider satisfies this selection criterion iff the * provider implements the specified algorithm or type for the specified * cryptographic service and its implementation meets the @@ -558,8 +559,9 @@ * Returns an array containing all installed providers that satisfy the * specified* selection criteria, or null if no such providers have been * installed. The returned providers are ordered - * according to their preference order. + * according to their + * {@linkplain #insertProviderAt(java.security.Provider, int) + * preference order}. * *

      The selection criteria are represented by a map. * Each map entry represents a selection criterion. @@ -567,16 +569,18 @@ * criteria. The key for any entry in such a map must be in one of the * following two formats: *

      * - * The java.security.acl package provides the + * The {@code java.security.acl } package provides the * interfaces to the ACL and related data structures (ACL entries, - * groups, permissions, etc.), and the sun.security.acl + * groups, permissions, etc.), and the {@code sun.security.acl } * classes provide a default implementation of the interfaces. For - * example, java.security.acl.Acl provides the - * interface to an ACL and the sun.security.acl.AclImpl + * example, {@code java.security.acl.Acl } provides the + * interface to an ACL and the {@code sun.security.acl.AclImpl } * class provides the default implementation of the interface.

      * - * The java.security.acl.Acl interface extends the - * java.security.acl.Owner interface. The Owner + * The {@code java.security.acl.Acl } interface extends the + * {@code java.security.acl.Owner } interface. The Owner * interface is used to maintain a list of owners for each ACL. Only * owners are allowed to modify an ACL. For example, only an owner can - * call the ACL's addEntry method to add a new ACL entry + * call the ACL's {@code addEntry} method to add a new ACL entry * to the ACL. * * @see java.security.acl.AclEntry @@ -217,7 +217,7 @@ * More specifically, this method checks whether the passed permission * is a member of the allowed permission set of the specified principal. * The allowed permission set is determined by the same algorithm as is - * used by the getPermissions method. + * used by the {@code getPermissions} method. * * @param principal the principal, assumed to be a valid authenticated * Principal. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/acl/AclEntry.java --- a/jdk/src/share/classes/java/security/acl/AclEntry.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/acl/AclEntry.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ * specified in the entry. * * Note: ACL entries are by default positive. An entry becomes a - * negative entry only if this setNegativePermissions + * negative entry only if this {@code setNegativePermissions} * method is called on it. */ public void setNegativePermissions(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/acl/Group.java --- a/jdk/src/share/classes/java/security/acl/Group.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/acl/Group.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ * Note that Group extends Principal. Thus, either a Principal or a Group can * be passed as an argument to methods containing a Principal parameter. For * example, you can add either a Principal or a Group to a Group object by - * calling the object's addMember method, passing it the + * calling the object's {@code addMember} method, passing it the * Principal or Group. * * @author Satish Dharmaraj diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/acl/Owner.java --- a/jdk/src/share/classes/java/security/acl/Owner.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/acl/Owner.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ /** * Interface for managing owners of Access Control Lists (ACLs) or ACL * configurations. (Note that the Acl interface in the - * java.security.acl package extends this Owner + * {@code java.security.acl} package extends this Owner * interface.) The initial owner Principal should be specified as an * argument to the constructor of the class implementing this interface. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/acl/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/security/acl/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * The classes and interfaces in this package have been + * superseded by classes in the java.security package. + * See that package and, for example, java.security.Permission for details. + * + * @since JDK1.1 + */ +package java.security.acl; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/acl/package.html --- a/jdk/src/share/classes/java/security/acl/package.html Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ - - - - - - - - -The classes and interfaces in this package have been -superseded by classes in the java.security package. -See that package and, for example, java.security.Permission for details. - - - -@since JDK1.1 - - diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CRLException.java --- a/jdk/src/share/classes/java/security/cert/CRLException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CRLException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,13 +57,13 @@ } /** - * Creates a CRLException with the specified + * Creates a {@code CRLException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -72,13 +72,13 @@ } /** - * Creates a CRLException with the specified cause - * and a detail message of (cause==null ? null : cause.toString()) + * Creates a {@code CRLException} with the specified cause + * and a detail message of {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CRLSelector.java --- a/jdk/src/share/classes/java/security/cert/CRLSelector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CRLSelector.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,9 +26,9 @@ package java.security.cert; /** - * A selector that defines a set of criteria for selecting CRLs. + * A selector that defines a set of criteria for selecting {@code CRL}s. * Classes that implement this interface are often used to specify - * which CRLs should be retrieved from a CertStore. + * which {@code CRL}s should be retrieved from a {@code CertStore}. *

      * Concurrent Access *

      @@ -48,19 +48,19 @@ public interface CRLSelector extends Cloneable { /** - * Decides whether a CRL should be selected. + * Decides whether a {@code CRL} should be selected. * - * @param crl the CRL to be checked - * @return true if the CRL should be selected, - * false otherwise + * @param crl the {@code CRL} to be checked + * @return {@code true} if the {@code CRL} should be selected, + * {@code false} otherwise */ boolean match(CRL crl); /** - * Makes a copy of this CRLSelector. Changes to the + * Makes a copy of this {@code CRLSelector}. Changes to the * copy will not affect the original and vice versa. * - * @return a copy of this CRLSelector + * @return a copy of this {@code CRLSelector} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPath.java --- a/jdk/src/share/classes/java/security/cert/CertPath.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPath.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,59 +36,59 @@ * An immutable sequence of certificates (a certification path). *

      * This is an abstract class that defines the methods common to all - * CertPaths. Subclasses can handle different kinds of + * {@code CertPath}s. Subclasses can handle different kinds of * certificates (X.509, PGP, etc.). *

      - * All CertPath objects have a type, a list of - * Certificates, and one or more supported encodings. Because the - * CertPath class is immutable, a CertPath cannot + * All {@code CertPath} objects have a type, a list of + * {@code Certificate}s, and one or more supported encodings. Because the + * {@code CertPath} class is immutable, a {@code CertPath} cannot * change in any externally visible way after being constructed. This * stipulation applies to all public fields and methods of this class and any * added or overridden by subclasses. *

      - * The type is a String that identifies the type of - * Certificates in the certification path. For each - * certificate cert in a certification path certPath, - * cert.getType().equals(certPath.getType()) must be - * true. + * The type is a {@code String} that identifies the type of + * {@code Certificate}s in the certification path. For each + * certificate {@code cert} in a certification path {@code certPath}, + * {@code cert.getType().equals(certPath.getType())} must be + * {@code true}. *

      - * The list of Certificates is an ordered List of - * zero or more Certificates. This List and all - * of the Certificates contained in it must be immutable. + * The list of {@code Certificate}s is an ordered {@code List} of + * zero or more {@code Certificate}s. This {@code List} and all + * of the {@code Certificate}s contained in it must be immutable. *

      - * Each CertPath object must support one or more encodings + * Each {@code CertPath} object must support one or more encodings * so that the object can be translated into a byte array for storage or * transmission to other parties. Preferably, these encodings should be * well-documented standards (such as PKCS#7). One of the encodings supported - * by a CertPath is considered the default encoding. This + * by a {@code CertPath} is considered the default encoding. This * encoding is used if no encoding is explicitly requested (for the * {@link #getEncoded() getEncoded()} method, for instance). *

      - * All CertPath objects are also Serializable. - * CertPath objects are resolved into an alternate + * All {@code CertPath} objects are also {@code Serializable}. + * {@code CertPath} objects are resolved into an alternate * {@link CertPathRep CertPathRep} object during serialization. This allows - * a CertPath object to be serialized into an equivalent + * a {@code CertPath} object to be serialized into an equivalent * representation regardless of its underlying implementation. *

      - * CertPath objects can be created with a - * CertificateFactory or they can be returned by other classes, - * such as a CertPathBuilder. + * {@code CertPath} objects can be created with a + * {@code CertificateFactory} or they can be returned by other classes, + * such as a {@code CertPathBuilder}. *

      - * By convention, X.509 CertPaths (consisting of - * X509Certificates), are ordered starting with the target + * By convention, X.509 {@code CertPath}s (consisting of + * {@code X509Certificate}s), are ordered starting with the target * certificate and ending with a certificate issued by the trust anchor. That * is, the issuer of one certificate is the subject of the following one. The * certificate representing the {@link TrustAnchor TrustAnchor} should not be - * included in the certification path. Unvalidated X.509 CertPaths - * may not follow these conventions. PKIX CertPathValidators will + * included in the certification path. Unvalidated X.509 {@code CertPath}s + * may not follow these conventions. PKIX {@code CertPathValidator}s will * detect any departure from these conventions that cause the certification - * path to be invalid and throw a CertPathValidatorException. + * path to be invalid and throw a {@code CertPathValidatorException}. * *

      Every implementation of the Java platform is required to support the - * following standard CertPath encodings: + * following standard {@code CertPath} encodings: *

        - *
      • PKCS7
      • - *
      • PkiPath
      • + *
      • {@code PKCS7}
      • + *
      • {@code PkiPath}
      • *
      * These encodings are described in the
      @@ -99,17 +99,17 @@ *

      * Concurrent Access *

      - * All CertPath objects must be thread-safe. That is, multiple + * All {@code CertPath} objects must be thread-safe. That is, multiple * threads may concurrently invoke the methods defined in this class on a - * single CertPath object (or more than one) with no - * ill effects. This is also true for the List returned by - * CertPath.getCertificates. + * single {@code CertPath} object (or more than one) with no + * ill effects. This is also true for the {@code List} returned by + * {@code CertPath.getCertificates}. *

      - * Requiring CertPath objects to be immutable and thread-safe + * Requiring {@code CertPath} objects to be immutable and thread-safe * allows them to be passed around to various pieces of code without worrying * about coordinating access. Providing this thread-safety is - * generally not difficult, since the CertPath and - * List objects in question are immutable. + * generally not difficult, since the {@code CertPath} and + * {@code List} objects in question are immutable. * * @see CertificateFactory * @see CertPathBuilder @@ -124,25 +124,25 @@ private String type; // the type of certificates in this chain /** - * Creates a CertPath of the specified type. + * Creates a {@code CertPath} of the specified type. *

      * This constructor is protected because most users should use a - * CertificateFactory to create CertPaths. + * {@code CertificateFactory} to create {@code CertPath}s. * * @param type the standard name of the type of - * Certificates in this path + * {@code Certificate}s in this path */ protected CertPath(String type) { this.type = type; } /** - * Returns the type of Certificates in this certification + * Returns the type of {@code Certificate}s in this certification * path. This is the same string that would be returned by * {@link java.security.cert.Certificate#getType() cert.getType()} - * for all Certificates in the certification path. + * for all {@code Certificate}s in the certification path. * - * @return the type of Certificates in this certification + * @return the type of {@code Certificate}s in this certification * path (never null) */ public String getType() { @@ -152,21 +152,21 @@ /** * Returns an iteration of the encodings supported by this certification * path, with the default encoding first. Attempts to modify the returned - * Iterator via its remove method result in an - * UnsupportedOperationException. + * {@code Iterator} via its {@code remove} method result in an + * {@code UnsupportedOperationException}. * - * @return an Iterator over the names of the supported + * @return an {@code Iterator} over the names of the supported * encodings (as Strings) */ public abstract Iterator getEncodings(); /** * Compares this certification path for equality with the specified - * object. Two CertPaths are equal if and only if their - * types are equal and their certificate Lists (and by - * implication the Certificates in those Lists) - * are equal. A CertPath is never equal to an object that is - * not a CertPath. + * object. Two {@code CertPath}s are equal if and only if their + * types are equal and their certificate {@code List}s (and by + * implication the {@code Certificate}s in those {@code List}s) + * are equal. A {@code CertPath} is never equal to an object that is + * not a {@code CertPath}. *

      * This algorithm is implemented by this method. If it is overridden, * the behavior specified here must be maintained. @@ -195,14 +195,14 @@ * Returns the hashcode for this certification path. The hash code of * a certification path is defined to be the result of the following * calculation: - *

      
      +     * 
      {@code
            *  hashCode = path.getType().hashCode();
            *  hashCode = 31*hashCode + path.getCertificates().hashCode();
      -     * 
      - * This ensures that path1.equals(path2) implies that - * path1.hashCode()==path2.hashCode() for any two certification - * paths, path1 and path2, as required by the - * general contract of Object.hashCode. + * }
      + * This ensures that {@code path1.equals(path2)} implies that + * {@code path1.hashCode()==path2.hashCode()} for any two certification + * paths, {@code path1} and {@code path2}, as required by the + * general contract of {@code Object.hashCode}. * * @return the hashcode value for this certification path */ @@ -214,8 +214,8 @@ /** * Returns a string representation of this certification path. - * This calls the toString method on each of the - * Certificates in the path. + * This calls the {@code toString} method on each of the + * {@code Certificate}s in the path. * * @return a string representation of this certification path */ @@ -266,20 +266,20 @@ /** * Returns the list of certificates in this certification path. - * The List returned must be immutable and thread-safe. + * The {@code List} returned must be immutable and thread-safe. * - * @return an immutable List of Certificates + * @return an immutable {@code List} of {@code Certificate}s * (may be empty, but not null) */ public abstract List getCertificates(); /** - * Replaces the CertPath to be serialized with a - * CertPathRep object. + * Replaces the {@code CertPath} to be serialized with a + * {@code CertPathRep} object. * - * @return the CertPathRep to be serialized + * @return the {@code CertPathRep} to be serialized * - * @throws ObjectStreamException if a CertPathRep object + * @throws ObjectStreamException if a {@code CertPathRep} object * representing this certification path could not be created */ protected Object writeReplace() throws ObjectStreamException { @@ -295,7 +295,7 @@ } /** - * Alternate CertPath class for serialization. + * Alternate {@code CertPath} class for serialization. * @since 1.4 */ protected static class CertPathRep implements Serializable { @@ -308,10 +308,10 @@ private byte[] data; /** - * Creates a CertPathRep with the specified + * Creates a {@code CertPathRep} with the specified * type and encoded form of a certification path. * - * @param type the standard name of a CertPath type + * @param type the standard name of a {@code CertPath} type * @param data the encoded form of the certification path */ protected CertPathRep(String type, byte[] data) { @@ -320,11 +320,11 @@ } /** - * Returns a CertPath constructed from the type and data. + * Returns a {@code CertPath} constructed from the type and data. * - * @return the resolved CertPath object + * @return the resolved {@code CertPath} object * - * @throws ObjectStreamException if a CertPath could not + * @throws ObjectStreamException if a {@code CertPath} could not * be constructed */ protected Object readResolve() throws ObjectStreamException { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathBuilder.java --- a/jdk/src/share/classes/java/security/cert/CertPathBuilder.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathBuilder.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,16 +41,16 @@ * A class for building certification paths (also known as certificate chains). *

      * This class uses a provider-based architecture. - * To create a CertPathBuilder, call - * one of the static getInstance methods, passing in the - * algorithm name of the CertPathBuilder desired and optionally + * To create a {@code CertPathBuilder}, call + * one of the static {@code getInstance} methods, passing in the + * algorithm name of the {@code CertPathBuilder} desired and optionally * the name of the provider desired. * - *

      Once a CertPathBuilder object has been created, certification + *

      Once a {@code CertPathBuilder} object has been created, certification * paths can be constructed by calling the {@link #build build} method and * passing it an algorithm-specific set of parameters. If successful, the - * result (including the CertPath that was built) is returned - * in an object that implements the CertPathBuilderResult + * result (including the {@code CertPath} that was built) is returned + * in an object that implements the {@code CertPathBuilderResult} * interface. * *

      The {@link #getRevocationChecker} method allows an application to specify @@ -67,9 +67,9 @@ * * *

      Every implementation of the Java platform is required to support the - * following standard CertPathBuilder algorithm: + * following standard {@code CertPathBuilder} algorithm: *

        - *
      • PKIX
      • + *
      • {@code PKIX}
      • *
      * This algorithm is described in the
      @@ -87,9 +87,9 @@ *

      * However, this is not true for the non-static methods defined by this class. * Unless otherwise documented by a specific provider, threads that need to - * access a single CertPathBuilder instance concurrently should + * access a single {@code CertPathBuilder} instance concurrently should * synchronize amongst themselves and provide the necessary locking. Multiple - * threads each manipulating a different CertPathBuilder instance + * threads each manipulating a different {@code CertPathBuilder} instance * need not synchronize. * * @see CertPath @@ -114,7 +114,7 @@ private final String algorithm; /** - * Creates a CertPathBuilder object of the given algorithm, + * Creates a {@code CertPathBuilder} object of the given algorithm, * and encapsulates the given provider implementation (SPI object) in it. * * @param builderSpi the provider implementation @@ -130,7 +130,7 @@ } /** - * Returns a CertPathBuilder object that implements the + * Returns a {@code CertPathBuilder} object that implements the * specified algorithm. * *

      This method traverses the list of registered security Providers, @@ -142,13 +142,13 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - * @param algorithm the name of the requested CertPathBuilder + * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard algorithm names. * - * @return a CertPathBuilder object that implements the + * @return a {@code CertPathBuilder} object that implements the * specified algorithm. * * @throws NoSuchAlgorithmException if no Provider supports a @@ -166,7 +166,7 @@ } /** - * Returns a CertPathBuilder object that implements the + * Returns a {@code CertPathBuilder} object that implements the * specified algorithm. * *

      A new CertPathBuilder object encapsulating the @@ -177,7 +177,7 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - * @param algorithm the name of the requested CertPathBuilder + * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the * Java Cryptography Architecture Standard Algorithm Name Documentation @@ -185,7 +185,7 @@ * * @param provider the name of the provider. * - * @return a CertPathBuilder object that implements the + * @return a {@code CertPathBuilder} object that implements the * specified algorithm. * * @throws NoSuchAlgorithmException if a CertPathBuilderSpi @@ -195,7 +195,7 @@ * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null or empty. * * @see java.security.Provider @@ -209,7 +209,7 @@ } /** - * Returns a CertPathBuilder object that implements the + * Returns a {@code CertPathBuilder} object that implements the * specified algorithm. * *

      A new CertPathBuilder object encapsulating the @@ -217,7 +217,7 @@ * object is returned. Note that the specified Provider object * does not have to be registered in the provider list. * - * @param algorithm the name of the requested CertPathBuilder + * @param algorithm the name of the requested {@code CertPathBuilder} * algorithm. See the CertPathBuilder section in the * Java Cryptography Architecture Standard Algorithm Name Documentation @@ -225,14 +225,14 @@ * * @param provider the provider. * - * @return a CertPathBuilder object that implements the + * @return a {@code CertPathBuilder} object that implements the * specified algorithm. * * @exception NoSuchAlgorithmException if a CertPathBuilderSpi * implementation for the specified algorithm is not available * from the specified Provider object. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null. * * @see java.security.Provider @@ -246,18 +246,18 @@ } /** - * Returns the provider of this CertPathBuilder. + * Returns the provider of this {@code CertPathBuilder}. * - * @return the provider of this CertPathBuilder + * @return the provider of this {@code CertPathBuilder} */ public final Provider getProvider() { return this.provider; } /** - * Returns the name of the algorithm of this CertPathBuilder. + * Returns the name of the algorithm of this {@code CertPathBuilder}. * - * @return the name of the algorithm of this CertPathBuilder + * @return the name of the algorithm of this {@code CertPathBuilder} */ public final String getAlgorithm() { return this.algorithm; @@ -272,7 +272,7 @@ * @throws CertPathBuilderException if the builder is unable to construct * a certification path that satisfies the specified parameters * @throws InvalidAlgorithmParameterException if the specified parameters - * are inappropriate for this CertPathBuilder + * are inappropriate for this {@code CertPathBuilder} */ public final CertPathBuilderResult build(CertPathParameters params) throws CertPathBuilderException, InvalidAlgorithmParameterException diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathBuilderException.java --- a/jdk/src/share/classes/java/security/cert/CertPathBuilderException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,9 @@ /** * An exception indicating one of a variety of problems encountered when - * building a certification path with a CertPathBuilder. + * building a certification path with a {@code CertPathBuilder}. *

      - * A CertPathBuilderException provides support for wrapping + * A {@code CertPathBuilderException} provides support for wrapping * exceptions. The {@link #getCause getCause} method returns the throwable, * if any, that caused this exception to be thrown. *

      @@ -53,7 +53,7 @@ private static final long serialVersionUID = 5316471420178794402L; /** - * Creates a CertPathBuilderException with null + * Creates a {@code CertPathBuilderException} with {@code null} * as its detail message. */ public CertPathBuilderException() { @@ -61,8 +61,8 @@ } /** - * Creates a CertPathBuilderException with the given - * detail message. The detail message is a String that + * Creates a {@code CertPathBuilderException} with the given + * detail message. The detail message is a {@code String} that * describes this particular exception in more detail. * * @param msg the detail message @@ -72,16 +72,16 @@ } /** - * Creates a CertPathBuilderException that wraps the specified + * Creates a {@code CertPathBuilderException} that wraps the specified * throwable. This allows any exception to be converted into a - * CertPathBuilderException, while retaining information + * {@code CertPathBuilderException}, while retaining information * about the wrapped exception, which may be useful for debugging. The - * detail message is set to (cause==null ? null : cause.toString() - * ) (which typically contains the class and detail message of + * detail message is set to ({@code cause==null ? null : cause.toString()}) + * (which typically contains the class and detail message of * cause). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertPathBuilderException(Throwable cause) { @@ -89,12 +89,12 @@ } /** - * Creates a CertPathBuilderException with the specified + * Creates a {@code CertPathBuilderException} with the specified * detail message and cause. * * @param msg the detail message * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertPathBuilderException(String msg, Throwable cause) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathBuilderResult.java --- a/jdk/src/share/classes/java/security/cert/CertPathBuilderResult.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderResult.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,8 @@ * All results returned by the {@link CertPathBuilder#build * CertPathBuilder.build} method must implement this interface. *

      - * At a minimum, a CertPathBuilderResult contains the - * CertPath built by the CertPathBuilder instance. + * At a minimum, a {@code CertPathBuilderResult} contains the + * {@code CertPath} built by the {@code CertPathBuilder} instance. * Implementations of this interface may add methods to return implementation * or algorithm specific information, such as debugging information or * certification path validation results. @@ -54,15 +54,15 @@ /** * Returns the built certification path. * - * @return the certification path (never null) + * @return the certification path (never {@code null}) */ CertPath getCertPath(); /** - * Makes a copy of this CertPathBuilderResult. Changes to the + * Makes a copy of this {@code CertPathBuilderResult}. Changes to the * copy will not affect the original and vice versa. * - * @return a copy of this CertPathBuilderResult + * @return a copy of this {@code CertPathBuilderResult} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathBuilderSpi.java --- a/jdk/src/share/classes/java/security/cert/CertPathBuilderSpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathBuilderSpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,23 +30,23 @@ /** * The Service Provider Interface (SPI) * for the {@link CertPathBuilder CertPathBuilder} class. All - * CertPathBuilder implementations must include a class (the - * SPI class) that extends this class (CertPathBuilderSpi) and + * {@code CertPathBuilder} implementations must include a class (the + * SPI class) that extends this class ({@code CertPathBuilderSpi}) and * implements all of its methods. In general, instances of this class should - * only be accessed through the CertPathBuilder class. For + * only be accessed through the {@code CertPathBuilder} class. For * details, see the Java Cryptography Architecture. *

      * Concurrent Access *

      * Instances of this class need not be protected against concurrent * access from multiple threads. Threads that need to access a single - * CertPathBuilderSpi instance concurrently should synchronize + * {@code CertPathBuilderSpi} instance concurrently should synchronize * amongst themselves and provide the necessary locking before calling the - * wrapping CertPathBuilder object. + * wrapping {@code CertPathBuilder} object. *

      - * However, implementations of CertPathBuilderSpi may still + * However, implementations of {@code CertPathBuilderSpi} may still * encounter concurrency issues, since multiple threads each - * manipulating a different CertPathBuilderSpi instance need not + * manipulating a different {@code CertPathBuilderSpi} instance need not * synchronize. * * @since 1.4 @@ -68,7 +68,7 @@ * @throws CertPathBuilderException if the builder is unable to construct * a certification path that satisfies the specified parameters * @throws InvalidAlgorithmParameterException if the specified parameters - * are inappropriate for this CertPathBuilder + * are inappropriate for this {@code CertPathBuilder} */ public abstract CertPathBuilderResult engineBuild(CertPathParameters params) throws CertPathBuilderException, InvalidAlgorithmParameterException; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathParameters.java --- a/jdk/src/share/classes/java/security/cert/CertPathParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,8 @@ /** * A specification of certification path algorithm parameters. * The purpose of this interface is to group (and provide type safety for) - * all CertPath parameter specifications. All - * CertPath parameter specifications must implement this + * all {@code CertPath} parameter specifications. All + * {@code CertPath} parameter specifications must implement this * interface. * * @author Yassir Elley @@ -40,10 +40,10 @@ public interface CertPathParameters extends Cloneable { /** - * Makes a copy of this CertPathParameters. Changes to the + * Makes a copy of this {@code CertPathParameters}. Changes to the * copy will not affect the original and vice versa. * - * @return a copy of this CertPathParameters + * @return a copy of this {@code CertPathParameters} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathValidator.java --- a/jdk/src/share/classes/java/security/cert/CertPathValidator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathValidator.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,17 +42,17 @@ * chains). *

      * This class uses a provider-based architecture. - * To create a CertPathValidator, - * call one of the static getInstance methods, passing in the - * algorithm name of the CertPathValidator desired and + * To create a {@code CertPathValidator}, + * call one of the static {@code getInstance} methods, passing in the + * algorithm name of the {@code CertPathValidator} desired and * optionally the name of the provider desired. * - *

      Once a CertPathValidator object has been created, it can + *

      Once a {@code CertPathValidator} object has been created, it can * be used to validate certification paths by calling the {@link #validate - * validate} method and passing it the CertPath to be validated + * validate} method and passing it the {@code CertPath} to be validated * and an algorithm-specific set of parameters. If successful, the result is * returned in an object that implements the - * CertPathValidatorResult interface. + * {@code CertPathValidatorResult} interface. * *

      The {@link #getRevocationChecker} method allows an application to specify * additional algorithm-specific parameters and options used by the @@ -69,9 +69,9 @@ * * *

      Every implementation of the Java platform is required to support the - * following standard CertPathValidator algorithm: + * following standard {@code CertPathValidator} algorithm: *

        - *
      • PKIX
      • + *
      • {@code PKIX}
      • *
      * This algorithm is described in the @@ -89,9 +89,9 @@ *

      * However, this is not true for the non-static methods defined by this class. * Unless otherwise documented by a specific provider, threads that need to - * access a single CertPathValidator instance concurrently should + * access a single {@code CertPathValidator} instance concurrently should * synchronize amongst themselves and provide the necessary locking. Multiple - * threads each manipulating a different CertPathValidator + * threads each manipulating a different {@code CertPathValidator} * instance need not synchronize. * * @see CertPath @@ -115,7 +115,7 @@ private final String algorithm; /** - * Creates a CertPathValidator object of the given algorithm, + * Creates a {@code CertPathValidator} object of the given algorithm, * and encapsulates the given provider implementation (SPI object) in it. * * @param validatorSpi the provider implementation @@ -131,7 +131,7 @@ } /** - * Returns a CertPathValidator object that implements the + * Returns a {@code CertPathValidator} object that implements the * specified algorithm. * *

      This method traverses the list of registered security Providers, @@ -143,13 +143,13 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - * @param algorithm the name of the requested CertPathValidator + * @param algorithm the name of the requested {@code CertPathValidator} * algorithm. See the CertPathValidator section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard algorithm names. * - * @return a CertPathValidator object that implements the + * @return a {@code CertPathValidator} object that implements the * specified algorithm. * * @exception NoSuchAlgorithmException if no Provider supports a @@ -167,7 +167,7 @@ } /** - * Returns a CertPathValidator object that implements the + * Returns a {@code CertPathValidator} object that implements the * specified algorithm. * *

      A new CertPathValidator object encapsulating the @@ -178,7 +178,7 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - * @param algorithm the name of the requested CertPathValidator + * @param algorithm the name of the requested {@code CertPathValidator} * algorithm. See the CertPathValidator section in the * Java Cryptography Architecture Standard Algorithm Name Documentation @@ -186,7 +186,7 @@ * * @param provider the name of the provider. * - * @return a CertPathValidator object that implements the + * @return a {@code CertPathValidator} object that implements the * specified algorithm. * * @exception NoSuchAlgorithmException if a CertPathValidatorSpi @@ -196,7 +196,7 @@ * @exception NoSuchProviderException if the specified provider is not * registered in the security provider list. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null or empty. * * @see java.security.Provider @@ -211,7 +211,7 @@ } /** - * Returns a CertPathValidator object that implements the + * Returns a {@code CertPathValidator} object that implements the * specified algorithm. * *

      A new CertPathValidator object encapsulating the @@ -219,7 +219,7 @@ * object is returned. Note that the specified Provider object * does not have to be registered in the provider list. * - * @param algorithm the name of the requested CertPathValidator + * @param algorithm the name of the requested {@code CertPathValidator} * algorithm. See the CertPathValidator section in the * Java Cryptography Architecture Standard Algorithm Name Documentation @@ -227,14 +227,14 @@ * * @param provider the provider. * - * @return a CertPathValidator object that implements the + * @return a {@code CertPathValidator} object that implements the * specified algorithm. * * @exception NoSuchAlgorithmException if a CertPathValidatorSpi * implementation for the specified algorithm is not available * from the specified Provider object. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null. * * @see java.security.Provider @@ -248,19 +248,19 @@ } /** - * Returns the Provider of this - * CertPathValidator. + * Returns the {@code Provider} of this + * {@code CertPathValidator}. * - * @return the Provider of this CertPathValidator + * @return the {@code Provider} of this {@code CertPathValidator} */ public final Provider getProvider() { return this.provider; } /** - * Returns the algorithm name of this CertPathValidator. + * Returns the algorithm name of this {@code CertPathValidator}. * - * @return the algorithm name of this CertPathValidator + * @return the algorithm name of this {@code CertPathValidator} */ public final String getAlgorithm() { return this.algorithm; @@ -270,20 +270,20 @@ * Validates the specified certification path using the specified * algorithm parameter set. *

      - * The CertPath specified must be of a type that is + * The {@code CertPath} specified must be of a type that is * supported by the validation algorithm, otherwise an - * InvalidAlgorithmParameterException will be thrown. For - * example, a CertPathValidator that implements the PKIX - * algorithm validates CertPath objects of type X.509. + * {@code InvalidAlgorithmParameterException} will be thrown. For + * example, a {@code CertPathValidator} that implements the PKIX + * algorithm validates {@code CertPath} objects of type X.509. * - * @param certPath the CertPath to be validated + * @param certPath the {@code CertPath} to be validated * @param params the algorithm parameters * @return the result of the validation algorithm - * @exception CertPathValidatorException if the CertPath + * @exception CertPathValidatorException if the {@code CertPath} * does not validate * @exception InvalidAlgorithmParameterException if the specified - * parameters or the type of the specified CertPath are - * inappropriate for this CertPathValidator + * parameters or the type of the specified {@code CertPath} are + * inappropriate for this {@code CertPathValidator} */ public final CertPathValidatorResult validate(CertPath certPath, CertPathParameters params) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathValidatorException.java --- a/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,11 +34,11 @@ * An exception indicating one of a variety of problems encountered when * validating a certification path. *

      - * A CertPathValidatorException provides support for wrapping + * A {@code CertPathValidatorException} provides support for wrapping * exceptions. The {@link #getCause getCause} method returns the throwable, * if any, that caused this exception to be thrown. *

      - * A CertPathValidatorException may also include the + * A {@code CertPathValidatorException} may also include the * certification path that was being validated when the exception was thrown, * the index of the certificate in the certification path that caused the * exception to be thrown, and the reason that caused the failure. Use the @@ -70,7 +70,7 @@ private int index = -1; /** - * @serial the CertPath that was being validated when + * @serial the {@code CertPath} that was being validated when * the exception was thrown */ private CertPath certPath; @@ -81,7 +81,7 @@ private Reason reason = BasicReason.UNSPECIFIED; /** - * Creates a CertPathValidatorException with + * Creates a {@code CertPathValidatorException} with * no detail message. */ public CertPathValidatorException() { @@ -89,8 +89,8 @@ } /** - * Creates a CertPathValidatorException with the given - * detail message. A detail message is a String that + * Creates a {@code CertPathValidatorException} with the given + * detail message. A detail message is a {@code String} that * describes this particular exception. * * @param msg the detail message @@ -100,16 +100,16 @@ } /** - * Creates a CertPathValidatorException that wraps the + * Creates a {@code CertPathValidatorException} that wraps the * specified throwable. This allows any exception to be converted into a - * CertPathValidatorException, while retaining information + * {@code CertPathValidatorException}, while retaining information * about the wrapped exception, which may be useful for debugging. The - * detail message is set to (cause==null ? null : cause.toString() - * ) (which typically contains the class and detail message of + * detail message is set to ({@code cause==null ? null : cause.toString()}) + * (which typically contains the class and detail message of * cause). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertPathValidatorException(Throwable cause) { @@ -117,12 +117,12 @@ } /** - * Creates a CertPathValidatorException with the specified + * Creates a {@code CertPathValidatorException} with the specified * detail message and cause. * * @param msg the detail message * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertPathValidatorException(String msg, Throwable cause) { @@ -130,21 +130,21 @@ } /** - * Creates a CertPathValidatorException with the specified + * Creates a {@code CertPathValidatorException} with the specified * detail message, cause, certification path, and index. * - * @param msg the detail message (or null if none) - * @param cause the cause (or null if none) + * @param msg the detail message (or {@code null} if none) + * @param cause the cause (or {@code null} if none) * @param certPath the certification path that was in the process of * being validated when the error was encountered * @param index the index of the certificate in the certification path * that caused the error (or -1 if not applicable). Note that - * the list of certificates in a CertPath is zero based. + * the list of certificates in a {@code CertPath} is zero based. * @throws IndexOutOfBoundsException if the index is out of range * {@code (index < -1 || (certPath != null && index >= * certPath.getCertificates().size()) } - * @throws IllegalArgumentException if certPath is - * null and index is not -1 + * @throws IllegalArgumentException if {@code certPath} is + * {@code null} and {@code index} is not -1 */ public CertPathValidatorException(String msg, Throwable cause, CertPath certPath, int index) { @@ -152,23 +152,23 @@ } /** - * Creates a CertPathValidatorException with the specified + * Creates a {@code CertPathValidatorException} with the specified * detail message, cause, certification path, index, and reason. * - * @param msg the detail message (or null if none) - * @param cause the cause (or null if none) + * @param msg the detail message (or {@code null} if none) + * @param cause the cause (or {@code null} if none) * @param certPath the certification path that was in the process of * being validated when the error was encountered * @param index the index of the certificate in the certification path * that caused the error (or -1 if not applicable). Note that - * the list of certificates in a CertPath is zero based. + * the list of certificates in a {@code CertPath} is zero based. * @param reason the reason the validation failed * @throws IndexOutOfBoundsException if the index is out of range * {@code (index < -1 || (certPath != null && index >= * certPath.getCertificates().size()) } - * @throws IllegalArgumentException if certPath is - * null and index is not -1 - * @throws NullPointerException if reason is null + * @throws IllegalArgumentException if {@code certPath} is + * {@code null} and {@code index} is not -1 + * @throws NullPointerException if {@code reason} is {@code null} * * @since 1.7 */ @@ -194,8 +194,8 @@ * Returns the certification path that was being validated when * the exception was thrown. * - * @return the CertPath that was being validated when - * the exception was thrown (or null if not specified) + * @return the {@code CertPath} that was being validated when + * the exception was thrown (or {@code null} if not specified) */ public CertPath getCertPath() { return this.certPath; @@ -204,7 +204,7 @@ /** * Returns the index of the certificate in the certification path * that caused the exception to be thrown. Note that the list of - * certificates in a CertPath is zero based. If no + * certificates in a {@code CertPath} is zero based. If no * index has been set, -1 is returned. * * @return the index that has been set, or -1 if none has been set @@ -219,7 +219,7 @@ * {@link #getIndex}. * * @return the reason that the validation failed, or - * BasicReason.UNSPECIFIED if a reason has not been + * {@code BasicReason.UNSPECIFIED} if a reason has not been * specified * * @since 1.7 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathValidatorResult.java --- a/jdk/src/share/classes/java/security/cert/CertPathValidatorResult.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorResult.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,10 +41,10 @@ public interface CertPathValidatorResult extends Cloneable { /** - * Makes a copy of this CertPathValidatorResult. Changes to the + * Makes a copy of this {@code CertPathValidatorResult}. Changes to the * copy will not affect the original and vice versa. * - * @return a copy of this CertPathValidatorResult + * @return a copy of this {@code CertPathValidatorResult} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertPathValidatorSpi.java --- a/jdk/src/share/classes/java/security/cert/CertPathValidatorSpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertPathValidatorSpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,23 +31,23 @@ * * The Service Provider Interface (SPI) * for the {@link CertPathValidator CertPathValidator} class. All - * CertPathValidator implementations must include a class (the - * SPI class) that extends this class (CertPathValidatorSpi) + * {@code CertPathValidator} implementations must include a class (the + * SPI class) that extends this class ({@code CertPathValidatorSpi}) * and implements all of its methods. In general, instances of this class - * should only be accessed through the CertPathValidator class. + * should only be accessed through the {@code CertPathValidator} class. * For details, see the Java Cryptography Architecture. *

      * Concurrent Access *

      * Instances of this class need not be protected against concurrent * access from multiple threads. Threads that need to access a single - * CertPathValidatorSpi instance concurrently should synchronize + * {@code CertPathValidatorSpi} instance concurrently should synchronize * amongst themselves and provide the necessary locking before calling the - * wrapping CertPathValidator object. + * wrapping {@code CertPathValidator} object. *

      - * However, implementations of CertPathValidatorSpi may still + * However, implementations of {@code CertPathValidatorSpi} may still * encounter concurrency issues, since multiple threads each - * manipulating a different CertPathValidatorSpi instance need not + * manipulating a different {@code CertPathValidatorSpi} instance need not * synchronize. * * @since 1.4 @@ -64,20 +64,20 @@ * Validates the specified certification path using the specified * algorithm parameter set. *

      - * The CertPath specified must be of a type that is + * The {@code CertPath} specified must be of a type that is * supported by the validation algorithm, otherwise an - * InvalidAlgorithmParameterException will be thrown. For - * example, a CertPathValidator that implements the PKIX - * algorithm validates CertPath objects of type X.509. + * {@code InvalidAlgorithmParameterException} will be thrown. For + * example, a {@code CertPathValidator} that implements the PKIX + * algorithm validates {@code CertPath} objects of type X.509. * - * @param certPath the CertPath to be validated + * @param certPath the {@code CertPath} to be validated * @param params the algorithm parameters * @return the result of the validation algorithm - * @exception CertPathValidatorException if the CertPath + * @exception CertPathValidatorException if the {@code CertPath} * does not validate * @exception InvalidAlgorithmParameterException if the specified - * parameters or the type of the specified CertPath are - * inappropriate for this CertPathValidator + * parameters or the type of the specified {@code CertPath} are + * inappropriate for this {@code CertPathValidator} */ public abstract CertPathValidatorResult engineValidate(CertPath certPath, CertPathParameters params) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertSelector.java --- a/jdk/src/share/classes/java/security/cert/CertSelector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertSelector.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,9 +27,9 @@ /** * A selector that defines a set of criteria for selecting - * Certificates. Classes that implement this interface - * are often used to specify which Certificates should - * be retrieved from a CertStore. + * {@code Certificate}s. Classes that implement this interface + * are often used to specify which {@code Certificate}s should + * be retrieved from a {@code CertStore}. *

      * Concurrent Access *

      @@ -49,19 +49,19 @@ public interface CertSelector extends Cloneable { /** - * Decides whether a Certificate should be selected. + * Decides whether a {@code Certificate} should be selected. * - * @param cert the Certificate to be checked - * @return true if the Certificate - * should be selected, false otherwise + * @param cert the {@code Certificate} to be checked + * @return {@code true} if the {@code Certificate} + * should be selected, {@code false} otherwise */ boolean match(Certificate cert); /** - * Makes a copy of this CertSelector. Changes to the + * Makes a copy of this {@code CertSelector}. Changes to the * copy will not affect the original and vice versa. * - * @return a copy of this CertSelector + * @return a copy of this {@code CertSelector} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertStore.java --- a/jdk/src/share/classes/java/security/cert/CertStore.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertStore.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,32 +38,32 @@ import sun.security.jca.GetInstance.Instance; /** - * A class for retrieving Certificates and CRLs + * A class for retrieving {@code Certificate}s and {@code CRL}s * from a repository. *

      * This class uses a provider-based architecture. - * To create a CertStore, call one of the static - * getInstance methods, passing in the type of - * CertStore desired, any applicable initialization parameters + * To create a {@code CertStore}, call one of the static + * {@code getInstance} methods, passing in the type of + * {@code CertStore} desired, any applicable initialization parameters * and optionally the name of the provider desired. *

      - * Once the CertStore has been created, it can be used to - * retrieve Certificates and CRLs by calling its + * Once the {@code CertStore} has been created, it can be used to + * retrieve {@code Certificate}s and {@code CRL}s by calling its * {@link #getCertificates(CertSelector selector) getCertificates} and * {@link #getCRLs(CRLSelector selector) getCRLs} methods. *

      * Unlike a {@link java.security.KeyStore KeyStore}, which provides access * to a cache of private keys and trusted certificates, a - * CertStore is designed to provide access to a potentially + * {@code CertStore} is designed to provide access to a potentially * vast repository of untrusted certificates and CRLs. For example, an LDAP - * implementation of CertStore provides access to certificates + * implementation of {@code CertStore} provides access to certificates * and CRLs stored in one or more directories using the LDAP protocol and the * schema as defined in the RFC service attribute. * *

      Every implementation of the Java platform is required to support the - * following standard CertStore type: + * following standard {@code CertStore} type: *

        - *
      • Collection
      • + *
      • {@code Collection}
      • *
      * This type is described in the @@ -75,10 +75,10 @@ *

      * Concurrent Access *

      - * All public methods of CertStore objects must be thread-safe. + * All public methods of {@code CertStore} objects must be thread-safe. * That is, multiple threads may concurrently invoke these methods on a - * single CertStore object (or more than one) with no - * ill effects. This allows a CertPathBuilder to search for a + * single {@code CertStore} object (or more than one) with no + * ill effects. This allows a {@code CertPathBuilder} to search for a * CRL while simultaneously searching for further certificates, for instance. *

      * The static methods of this class are also guaranteed to be thread-safe. @@ -104,13 +104,13 @@ private CertStoreParameters params; /** - * Creates a CertStore object of the given type, and + * Creates a {@code CertStore} object of the given type, and * encapsulates the given provider implementation (SPI object) in it. * * @param storeSpi the provider implementation * @param provider the provider * @param type the type - * @param params the initialization parameters (may be null) + * @param params the initialization parameters (may be {@code null}) */ protected CertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params) { @@ -122,28 +122,28 @@ } /** - * Returns a Collection of Certificates that - * match the specified selector. If no Certificates - * match the selector, an empty Collection will be returned. + * Returns a {@code Collection} of {@code Certificate}s that + * match the specified selector. If no {@code Certificate}s + * match the selector, an empty {@code Collection} will be returned. *

      - * For some CertStore types, the resulting - * Collection may not contain all of the - * Certificates that match the selector. For instance, - * an LDAP CertStore may not search all entries in the + * For some {@code CertStore} types, the resulting + * {@code Collection} may not contain all of the + * {@code Certificate}s that match the selector. For instance, + * an LDAP {@code CertStore} may not search all entries in the * directory. Instead, it may just search entries that are likely to - * contain the Certificates it is looking for. + * contain the {@code Certificate}s it is looking for. *

      - * Some CertStore implementations (especially LDAP - * CertStores) may throw a CertStoreException - * unless a non-null CertSelector is provided that + * Some {@code CertStore} implementations (especially LDAP + * {@code CertStore}s) may throw a {@code CertStoreException} + * unless a non-null {@code CertSelector} is provided that * includes specific criteria that can be used to find the certificates. * Issuer and/or subject names are especially useful criteria. * - * @param selector A CertSelector used to select which - * Certificates should be returned. Specify null - * to return all Certificates (if supported). - * @return A Collection of Certificates that - * match the specified selector (never null) + * @param selector A {@code CertSelector} used to select which + * {@code Certificate}s should be returned. Specify {@code null} + * to return all {@code Certificate}s (if supported). + * @return A {@code Collection} of {@code Certificate}s that + * match the specified selector (never {@code null}) * @throws CertStoreException if an exception occurs */ public final Collection getCertificates @@ -152,28 +152,28 @@ } /** - * Returns a Collection of CRLs that - * match the specified selector. If no CRLs - * match the selector, an empty Collection will be returned. + * Returns a {@code Collection} of {@code CRL}s that + * match the specified selector. If no {@code CRL}s + * match the selector, an empty {@code Collection} will be returned. *

      - * For some CertStore types, the resulting - * Collection may not contain all of the - * CRLs that match the selector. For instance, - * an LDAP CertStore may not search all entries in the + * For some {@code CertStore} types, the resulting + * {@code Collection} may not contain all of the + * {@code CRL}s that match the selector. For instance, + * an LDAP {@code CertStore} may not search all entries in the * directory. Instead, it may just search entries that are likely to - * contain the CRLs it is looking for. + * contain the {@code CRL}s it is looking for. *

      - * Some CertStore implementations (especially LDAP - * CertStores) may throw a CertStoreException - * unless a non-null CRLSelector is provided that + * Some {@code CertStore} implementations (especially LDAP + * {@code CertStore}s) may throw a {@code CertStoreException} + * unless a non-null {@code CRLSelector} is provided that * includes specific criteria that can be used to find the CRLs. * Issuer names and/or the certificate to be checked are especially useful. * - * @param selector A CRLSelector used to select which - * CRLs should be returned. Specify null - * to return all CRLs (if supported). - * @return A Collection of CRLs that - * match the specified selector (never null) + * @param selector A {@code CRLSelector} used to select which + * {@code CRL}s should be returned. Specify {@code null} + * to return all {@code CRL}s (if supported). + * @return A {@code Collection} of {@code CRL}s that + * match the specified selector (never {@code null}) * @throws CertStoreException if an exception occurs */ public final Collection getCRLs(CRLSelector selector) @@ -182,8 +182,8 @@ } /** - * Returns a CertStore object that implements the specified - * CertStore type and is initialized with the specified + * Returns a {@code CertStore} object that implements the specified + * {@code CertStore} type and is initialized with the specified * parameters. * *

      This method traverses the list of registered security Providers, @@ -195,29 +195,29 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - *

      The CertStore that is returned is initialized with the - * specified CertStoreParameters. The type of parameters - * needed may vary between different types of CertStores. - * Note that the specified CertStoreParameters object is + *

      The {@code CertStore} that is returned is initialized with the + * specified {@code CertStoreParameters}. The type of parameters + * needed may vary between different types of {@code CertStore}s. + * Note that the specified {@code CertStoreParameters} object is * cloned. * - * @param type the name of the requested CertStore type. + * @param type the name of the requested {@code CertStore} type. * See the CertStore section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard types. * - * @param params the initialization parameters (may be null). + * @param params the initialization parameters (may be {@code null}). * - * @return a CertStore object that implements the specified - * CertStore type. + * @return a {@code CertStore} object that implements the specified + * {@code CertStore} type. * * @throws NoSuchAlgorithmException if no Provider supports a * CertStoreSpi implementation for the specified type. * * @throws InvalidAlgorithmParameterException if the specified * initialization parameters are inappropriate for this - * CertStore. + * {@code CertStore}. * * @see java.security.Provider */ @@ -244,8 +244,8 @@ } /** - * Returns a CertStore object that implements the specified - * CertStore type. + * Returns a {@code CertStore} object that implements the specified + * {@code CertStore} type. * *

      A new CertStore object encapsulating the * CertStoreSpi implementation from the specified provider @@ -255,23 +255,23 @@ *

      Note that the list of registered providers may be retrieved via * the {@link Security#getProviders() Security.getProviders()} method. * - *

      The CertStore that is returned is initialized with the - * specified CertStoreParameters. The type of parameters - * needed may vary between different types of CertStores. - * Note that the specified CertStoreParameters object is + *

      The {@code CertStore} that is returned is initialized with the + * specified {@code CertStoreParameters}. The type of parameters + * needed may vary between different types of {@code CertStore}s. + * Note that the specified {@code CertStoreParameters} object is * cloned. * - * @param type the requested CertStore type. + * @param type the requested {@code CertStore} type. * See the CertStore section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard types. * - * @param params the initialization parameters (may be null). + * @param params the initialization parameters (may be {@code null}). * * @param provider the name of the provider. * - * @return a CertStore object that implements the + * @return a {@code CertStore} object that implements the * specified type. * * @throws NoSuchAlgorithmException if a CertStoreSpi @@ -280,12 +280,12 @@ * * @throws InvalidAlgorithmParameterException if the specified * initialization parameters are inappropriate for this - * CertStore. + * {@code CertStore}. * * @throws NoSuchProviderException if the specified provider is not * registered in the security provider list. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null or empty. * * @see java.security.Provider @@ -305,31 +305,31 @@ } /** - * Returns a CertStore object that implements the specified - * CertStore type. + * Returns a {@code CertStore} object that implements the specified + * {@code CertStore} type. * *

      A new CertStore object encapsulating the * CertStoreSpi implementation from the specified Provider * object is returned. Note that the specified Provider object * does not have to be registered in the provider list. * - *

      The CertStore that is returned is initialized with the - * specified CertStoreParameters. The type of parameters - * needed may vary between different types of CertStores. - * Note that the specified CertStoreParameters object is + *

      The {@code CertStore} that is returned is initialized with the + * specified {@code CertStoreParameters}. The type of parameters + * needed may vary between different types of {@code CertStore}s. + * Note that the specified {@code CertStoreParameters} object is * cloned. * - * @param type the requested CertStore type. + * @param type the requested {@code CertStore} type. * See the CertStore section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard types. * - * @param params the initialization parameters (may be null). + * @param params the initialization parameters (may be {@code null}). * * @param provider the provider. * - * @return a CertStore object that implements the + * @return a {@code CertStore} object that implements the * specified type. * * @exception NoSuchAlgorithmException if a CertStoreSpi @@ -338,9 +338,9 @@ * * @throws InvalidAlgorithmParameterException if the specified * initialization parameters are inappropriate for this - * CertStore + * {@code CertStore} * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null. * * @see java.security.Provider @@ -359,30 +359,30 @@ } /** - * Returns the parameters used to initialize this CertStore. - * Note that the CertStoreParameters object is cloned before + * Returns the parameters used to initialize this {@code CertStore}. + * Note that the {@code CertStoreParameters} object is cloned before * it is returned. * - * @return the parameters used to initialize this CertStore - * (may be null) + * @return the parameters used to initialize this {@code CertStore} + * (may be {@code null}) */ public final CertStoreParameters getCertStoreParameters() { return (params == null ? null : (CertStoreParameters) params.clone()); } /** - * Returns the type of this CertStore. + * Returns the type of this {@code CertStore}. * - * @return the type of this CertStore + * @return the type of this {@code CertStore} */ public final String getType() { return this.type; } /** - * Returns the provider of this CertStore. + * Returns the provider of this {@code CertStore}. * - * @return the provider of this CertStore + * @return the provider of this {@code CertStore} */ public final Provider getProvider() { return this.provider; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertStoreException.java --- a/jdk/src/share/classes/java/security/cert/CertStoreException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertStoreException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,9 +29,9 @@ /** * An exception indicating one of a variety of problems retrieving - * certificates and CRLs from a CertStore. + * certificates and CRLs from a {@code CertStore}. *

      - * A CertStoreException provides support for wrapping + * A {@code CertStoreException} provides support for wrapping * exceptions. The {@link #getCause getCause} method returns the throwable, * if any, that caused this exception to be thrown. *

      @@ -53,7 +53,7 @@ private static final long serialVersionUID = 2395296107471573245L; /** - * Creates a CertStoreException with null as + * Creates a {@code CertStoreException} with {@code null} as * its detail message. */ public CertStoreException() { @@ -61,8 +61,8 @@ } /** - * Creates a CertStoreException with the given detail - * message. A detail message is a String that describes this + * Creates a {@code CertStoreException} with the given detail + * message. A detail message is a {@code String} that describes this * particular exception. * * @param msg the detail message @@ -72,15 +72,15 @@ } /** - * Creates a CertStoreException that wraps the specified + * Creates a {@code CertStoreException} that wraps the specified * throwable. This allows any exception to be converted into a - * CertStoreException, while retaining information about the + * {@code CertStoreException}, while retaining information about the * cause, which may be useful for debugging. The detail message is - * set to (cause==null ? null : cause.toString()) (which + * set to ({@code cause==null ? null : cause.toString()}) (which * typically contains the class and detail message of cause). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertStoreException(Throwable cause) { @@ -88,12 +88,12 @@ } /** - * Creates a CertStoreException with the specified detail + * Creates a {@code CertStoreException} with the specified detail * message and cause. * * @param msg the detail message * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause getCause()} method). (A null value is + * {@link #getCause getCause()} method). (A {@code null} value is * permitted, and indicates that the cause is nonexistent or unknown.) */ public CertStoreException(String msg, Throwable cause) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertStoreParameters.java --- a/jdk/src/share/classes/java/security/cert/CertStoreParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertStoreParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,20 +26,20 @@ package java.security.cert; /** - * A specification of CertStore parameters. + * A specification of {@code CertStore} parameters. *

      * The purpose of this interface is to group (and provide type safety for) - * all CertStore parameter specifications. All - * CertStore parameter specifications must implement this + * all {@code CertStore} parameter specifications. All + * {@code CertStore} parameter specifications must implement this * interface. *

      - * Typically, a CertStoreParameters object is passed as a parameter + * Typically, a {@code CertStoreParameters} object is passed as a parameter * to one of the {@link CertStore#getInstance CertStore.getInstance} methods. - * The getInstance method returns a CertStore that - * is used for retrieving Certificates and CRLs. The - * CertStore that is returned is initialized with the specified + * The {@code getInstance} method returns a {@code CertStore} that + * is used for retrieving {@code Certificate}s and {@code CRL}s. The + * {@code CertStore} that is returned is initialized with the specified * parameters. The type of parameters needed may vary between different types - * of CertStores. + * of {@code CertStore}s. * * @see CertStore#getInstance * @@ -49,32 +49,32 @@ public interface CertStoreParameters extends Cloneable { /** - * Makes a copy of this CertStoreParameters. + * Makes a copy of this {@code CertStoreParameters}. *

      * The precise meaning of "copy" may depend on the class of - * the CertStoreParameters object. A typical implementation + * the {@code CertStoreParameters} object. A typical implementation * performs a "deep copy" of this object, but this is not an absolute * requirement. Some implementations may perform a "shallow copy" of some * or all of the fields of this object. *

      - * Note that the CertStore.getInstance methods make a copy - * of the specified CertStoreParameters. A deep copy - * implementation of clone is safer and more robust, as it - * prevents the caller from corrupting a shared CertStore by + * Note that the {@code CertStore.getInstance} methods make a copy + * of the specified {@code CertStoreParameters}. A deep copy + * implementation of {@code clone} is safer and more robust, as it + * prevents the caller from corrupting a shared {@code CertStore} by * subsequently modifying the contents of its initialization parameters. - * However, a shallow copy implementation of clone is more + * However, a shallow copy implementation of {@code clone} is more * appropriate for applications that need to hold a reference to a - * parameter contained in the CertStoreParameters. For example, + * parameter contained in the {@code CertStoreParameters}. For example, * a shallow copy clone allows an application to release the resources of - * a particular CertStore initialization parameter immediately, + * a particular {@code CertStore} initialization parameter immediately, * rather than waiting for the garbage collection mechanism. This should - * be done with the utmost care, since the CertStore may still + * be done with the utmost care, since the {@code CertStore} may still * be in use by other threads. *

      * Each subclass should state the precise behavior of this method so * that users and developers know what to expect. * - * @return a copy of this CertStoreParameters + * @return a copy of this {@code CertStoreParameters} */ Object clone(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertStoreSpi.java --- a/jdk/src/share/classes/java/security/cert/CertStoreSpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertStoreSpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,26 +30,26 @@ /** * The Service Provider Interface (SPI) - * for the {@link CertStore CertStore} class. All CertStore + * for the {@link CertStore CertStore} class. All {@code CertStore} * implementations must include a class (the SPI class) that extends - * this class (CertStoreSpi), provides a constructor with - * a single argument of type CertStoreParameters, and implements + * this class ({@code CertStoreSpi}), provides a constructor with + * a single argument of type {@code CertStoreParameters}, and implements * all of its methods. In general, instances of this class should only be - * accessed through the CertStore class. + * accessed through the {@code CertStore} class. * For details, see the Java Cryptography Architecture. *

      * Concurrent Access *

      - * The public methods of all CertStoreSpi objects must be + * The public methods of all {@code CertStoreSpi} objects must be * thread-safe. That is, multiple threads may concurrently invoke these - * methods on a single CertStoreSpi object (or more than one) - * with no ill effects. This allows a CertPathBuilder to search + * methods on a single {@code CertStoreSpi} object (or more than one) + * with no ill effects. This allows a {@code CertPathBuilder} to search * for a CRL while simultaneously searching for further certificates, for * instance. *

      - * Simple CertStoreSpi implementations will probably ensure - * thread safety by adding a synchronized keyword to their - * engineGetCertificates and engineGetCRLs methods. + * Simple {@code CertStoreSpi} implementations will probably ensure + * thread safety by adding a {@code synchronized} keyword to their + * {@code engineGetCertificates} and {@code engineGetCRLs} methods. * More sophisticated ones may allow truly concurrent access. * * @since 1.4 @@ -60,64 +60,64 @@ /** * The sole constructor. * - * @param params the initialization parameters (may be null) + * @param params the initialization parameters (may be {@code null}) * @throws InvalidAlgorithmParameterException if the initialization - * parameters are inappropriate for this CertStoreSpi + * parameters are inappropriate for this {@code CertStoreSpi} */ public CertStoreSpi(CertStoreParameters params) throws InvalidAlgorithmParameterException { } /** - * Returns a Collection of Certificates that - * match the specified selector. If no Certificates - * match the selector, an empty Collection will be returned. + * Returns a {@code Collection} of {@code Certificate}s that + * match the specified selector. If no {@code Certificate}s + * match the selector, an empty {@code Collection} will be returned. *

      - * For some CertStore types, the resulting - * Collection may not contain all of the - * Certificates that match the selector. For instance, - * an LDAP CertStore may not search all entries in the + * For some {@code CertStore} types, the resulting + * {@code Collection} may not contain all of the + * {@code Certificate}s that match the selector. For instance, + * an LDAP {@code CertStore} may not search all entries in the * directory. Instead, it may just search entries that are likely to - * contain the Certificates it is looking for. + * contain the {@code Certificate}s it is looking for. *

      - * Some CertStore implementations (especially LDAP - * CertStores) may throw a CertStoreException - * unless a non-null CertSelector is provided that includes + * Some {@code CertStore} implementations (especially LDAP + * {@code CertStore}s) may throw a {@code CertStoreException} + * unless a non-null {@code CertSelector} is provided that includes * specific criteria that can be used to find the certificates. Issuer * and/or subject names are especially useful criteria. * - * @param selector A CertSelector used to select which - * Certificates should be returned. Specify null - * to return all Certificates (if supported). - * @return A Collection of Certificates that - * match the specified selector (never null) + * @param selector A {@code CertSelector} used to select which + * {@code Certificate}s should be returned. Specify {@code null} + * to return all {@code Certificate}s (if supported). + * @return A {@code Collection} of {@code Certificate}s that + * match the specified selector (never {@code null}) * @throws CertStoreException if an exception occurs */ public abstract Collection engineGetCertificates (CertSelector selector) throws CertStoreException; /** - * Returns a Collection of CRLs that - * match the specified selector. If no CRLs - * match the selector, an empty Collection will be returned. + * Returns a {@code Collection} of {@code CRL}s that + * match the specified selector. If no {@code CRL}s + * match the selector, an empty {@code Collection} will be returned. *

      - * For some CertStore types, the resulting - * Collection may not contain all of the - * CRLs that match the selector. For instance, - * an LDAP CertStore may not search all entries in the + * For some {@code CertStore} types, the resulting + * {@code Collection} may not contain all of the + * {@code CRL}s that match the selector. For instance, + * an LDAP {@code CertStore} may not search all entries in the * directory. Instead, it may just search entries that are likely to - * contain the CRLs it is looking for. + * contain the {@code CRL}s it is looking for. *

      - * Some CertStore implementations (especially LDAP - * CertStores) may throw a CertStoreException - * unless a non-null CRLSelector is provided that includes + * Some {@code CertStore} implementations (especially LDAP + * {@code CertStore}s) may throw a {@code CertStoreException} + * unless a non-null {@code CRLSelector} is provided that includes * specific criteria that can be used to find the CRLs. Issuer names * and/or the certificate to be checked are especially useful. * - * @param selector A CRLSelector used to select which - * CRLs should be returned. Specify null - * to return all CRLs (if supported). - * @return A Collection of CRLs that - * match the specified selector (never null) + * @param selector A {@code CRLSelector} used to select which + * {@code CRL}s should be returned. Specify {@code null} + * to return all {@code CRL}s (if supported). + * @return A {@code Collection} of {@code CRL}s that + * match the specified selector (never {@code null}) * @throws CertStoreException if an exception occurs */ public abstract Collection engineGetCRLs diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/Certificate.java --- a/jdk/src/share/classes/java/security/cert/Certificate.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/Certificate.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -90,8 +90,8 @@ /** * Compares this certificate for equality with the specified - * object. If the other object is an - * instanceof Certificate, then + * object. If the {@code other} object is an + * {@code instanceof} {@code Certificate}, then * its encoded form is retrieved and compared with the * encoded form of this certificate. * @@ -196,8 +196,8 @@ * *

      This method was added to version 1.8 of the Java Platform * Standard Edition. In order to maintain backwards compatibility with - * existing service providers, this method cannot be abstract - * and by default throws an UnsupportedOperationException. + * existing service providers, this method cannot be {@code abstract} + * and by default throws an {@code UnsupportedOperationException}. * * @param key the PublicKey used to carry out the verification. * @param sigProvider the signature provider. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateEncodingException.java --- a/jdk/src/share/classes/java/security/cert/CertificateEncodingException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateEncodingException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,13 +56,13 @@ } /** - * Creates a CertificateEncodingException with the specified + * Creates a {@code CertificateEncodingException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -71,14 +71,14 @@ } /** - * Creates a CertificateEncodingException + * Creates a {@code CertificateEncodingException} * with the specified cause and a detail message of - * (cause==null ? null : cause.toString()) + * {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateException.java --- a/jdk/src/share/classes/java/security/cert/CertificateException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,13 +57,13 @@ } /** - * Creates a CertificateException with the specified + * Creates a {@code CertificateException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -72,13 +72,13 @@ } /** - * Creates a CertificateException with the specified cause - * and a detail message of (cause==null ? null : cause.toString()) + * Creates a {@code CertificateException} with the specified cause + * and a detail message of {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateExpiredException.java --- a/jdk/src/share/classes/java/security/cert/CertificateExpiredException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateExpiredException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ /** * Certificate Expired Exception. This is thrown whenever the current - * Date or the specified Date is after the - * notAfter date/time specified in the validity period + * {@code Date} or the specified {@code Date} is after the + * {@code notAfter} date/time specified in the validity period * of the certificate. * * @author Hemma Prafullchandra diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateFactory.java --- a/jdk/src/share/classes/java/security/cert/CertificateFactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateFactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,27 +41,27 @@ /** * This class defines the functionality of a certificate factory, which is - * used to generate certificate, certification path (CertPath) + * used to generate certificate, certification path ({@code CertPath}) * and certificate revocation list (CRL) objects from their encodings. * *

      For encodings consisting of multiple certificates, use - * generateCertificates when you want to + * {@code generateCertificates} when you want to * parse a collection of possibly unrelated certificates. Otherwise, - * use generateCertPath when you want to generate - * a CertPath (a certificate chain) and subsequently - * validate it with a CertPathValidator. + * use {@code generateCertPath} when you want to generate + * a {@code CertPath} (a certificate chain) and subsequently + * validate it with a {@code CertPathValidator}. * *

      A certificate factory for X.509 must return certificates that are an - * instance of java.security.cert.X509Certificate, and CRLs - * that are an instance of java.security.cert.X509CRL. + * instance of {@code java.security.cert.X509Certificate}, and CRLs + * that are an instance of {@code java.security.cert.X509CRL}. * *

      The following example reads a file with Base64 encoded certificates, * which are each bounded at the beginning by -----BEGIN CERTIFICATE-----, and * bounded at the end by -----END CERTIFICATE-----. We convert the - * FileInputStream (which does not support mark - * and reset) to a BufferedInputStream (which + * {@code FileInputStream} (which does not support {@code mark} + * and {@code reset}) to a {@code BufferedInputStream} (which * supports those methods), so that each call to - * generateCertificate consumes only one certificate, and the + * {@code generateCertificate} consumes only one certificate, and the * read position of the input stream is positioned to the next certificate in * the file:

      * @@ -92,14 +92,14 @@ * * *

      Every implementation of the Java platform is required to support the - * following standard CertificateFactory type: + * following standard {@code CertificateFactory} type: *

        - *
      • X.509
      • + *
      • {@code X.509}
      • *
      - * and the following standard CertPath encodings: + * and the following standard {@code CertPath} encodings: *
        - *
      • PKCS7
      • - *
      • PkiPath
      • + *
      • {@code PKCS7}
      • + *
      • {@code PkiPath}
      • *
      * The type and encodings are described in the @@ -258,7 +258,7 @@ * implementation for the specified algorithm is not available * from the specified Provider object. * - * @exception IllegalArgumentException if the provider is + * @exception IllegalArgumentException if the {@code provider} is * null. * * @see java.security.Provider @@ -299,17 +299,17 @@ /** * Generates a certificate object and initializes it with - * the data read from the input stream inStream. + * the data read from the input stream {@code inStream}. * *

      In order to take advantage of the specialized certificate format * supported by this certificate factory, * the returned certificate object can be typecast to the corresponding * certificate class. For example, if this certificate * factory implements X.509 certificates, the returned certificate object - * can be typecast to the X509Certificate class. + * can be typecast to the {@code X509Certificate} class. * *

      In the case of a certificate factory for X.509 certificates, the - * certificate provided in inStream must be DER-encoded and + * certificate provided in {@code inStream} must be DER-encoded and * may be supplied in binary or printable (Base64) encoding. If the * certificate is provided in Base64 encoding, it must be bounded at * the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at @@ -324,7 +324,7 @@ * the inherent end-of-certificate marker. If the data in the input stream * does not contain an inherent end-of-certificate marker (other * than EOF) and there is trailing data after the certificate is parsed, a - * CertificateException is thrown. + * {@code CertificateException} is thrown. * * @param inStream an input stream with the certificate data. * @@ -340,19 +340,19 @@ } /** - * Returns an iteration of the CertPath encodings supported + * Returns an iteration of the {@code CertPath} encodings supported * by this certificate factory, with the default encoding first. See * the CertPath Encodings section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard encoding names and their formats. *

      - * Attempts to modify the returned Iterator via its - * remove method result in an - * UnsupportedOperationException. + * Attempts to modify the returned {@code Iterator} via its + * {@code remove} method result in an + * {@code UnsupportedOperationException}. * - * @return an Iterator over the names of the supported - * CertPath encodings (as Strings) + * @return an {@code Iterator} over the names of the supported + * {@code CertPath} encodings (as {@code String}s) * @since 1.4 */ public final Iterator getCertPathEncodings() { @@ -360,15 +360,15 @@ } /** - * Generates a CertPath object and initializes it with - * the data read from the InputStream inStream. The data + * Generates a {@code CertPath} object and initializes it with + * the data read from the {@code InputStream} inStream. The data * is assumed to be in the default encoding. The name of the default - * encoding is the first element of the Iterator returned by + * encoding is the first element of the {@code Iterator} returned by * the {@link #getCertPathEncodings getCertPathEncodings} method. * - * @param inStream an InputStream containing the data - * @return a CertPath initialized with the data from the - * InputStream + * @param inStream an {@code InputStream} containing the data + * @return a {@code CertPath} initialized with the data from the + * {@code InputStream} * @exception CertificateException if an exception occurs while decoding * @since 1.4 */ @@ -379,18 +379,18 @@ } /** - * Generates a CertPath object and initializes it with - * the data read from the InputStream inStream. The data + * Generates a {@code CertPath} object and initializes it with + * the data read from the {@code InputStream} inStream. The data * is assumed to be in the specified encoding. See * the CertPath Encodings section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard encoding names and their formats. * - * @param inStream an InputStream containing the data + * @param inStream an {@code InputStream} containing the data * @param encoding the encoding used for the data - * @return a CertPath initialized with the data from the - * InputStream + * @return a {@code CertPath} initialized with the data from the + * {@code InputStream} * @exception CertificateException if an exception occurs while decoding or * the encoding requested is not supported * @since 1.4 @@ -402,15 +402,15 @@ } /** - * Generates a CertPath object and initializes it with - * a List of Certificates. + * Generates a {@code CertPath} object and initializes it with + * a {@code List} of {@code Certificate}s. *

      * The certificates supplied must be of a type supported by the - * CertificateFactory. They will be copied out of the supplied - * List object. + * {@code CertificateFactory}. They will be copied out of the supplied + * {@code List} object. * - * @param certificates a List of Certificates - * @return a CertPath initialized with the supplied list of + * @param certificates a {@code List} of {@code Certificate}s + * @return a {@code CertPath} initialized with the supplied list of * certificates * @exception CertificateException if an exception occurs * @since 1.4 @@ -424,20 +424,20 @@ /** * Returns a (possibly empty) collection view of the certificates read - * from the given input stream inStream. + * from the given input stream {@code inStream}. * *

      In order to take advantage of the specialized certificate format * supported by this certificate factory, each element in * the returned collection view can be typecast to the corresponding * certificate class. For example, if this certificate * factory implements X.509 certificates, the elements in the returned - * collection can be typecast to the X509Certificate class. + * collection can be typecast to the {@code X509Certificate} class. * *

      In the case of a certificate factory for X.509 certificates, - * inStream may contain a sequence of DER-encoded certificates + * {@code inStream} may contain a sequence of DER-encoded certificates * in the formats described for * {@link #generateCertificate(java.io.InputStream) generateCertificate}. - * In addition, inStream may contain a PKCS#7 certificate + * In addition, {@code inStream} may contain a PKCS#7 certificate * chain. This is a PKCS#7 SignedData object, with the only * significant field being certificates. In particular, the * signature and the contents are ignored. This format allows multiple @@ -464,14 +464,14 @@ /** * Generates a certificate revocation list (CRL) object and initializes it - * with the data read from the input stream inStream. + * with the data read from the input stream {@code inStream}. * *

      In order to take advantage of the specialized CRL format * supported by this certificate factory, * the returned CRL object can be typecast to the corresponding * CRL class. For example, if this certificate * factory implements X.509 CRLs, the returned CRL object - * can be typecast to the X509CRL class. + * can be typecast to the {@code X509CRL} class. * *

      Note that if the given input stream does not support * {@link java.io.InputStream#mark(int) mark} and @@ -482,7 +482,7 @@ * end-of-CRL marker. If the data in the * input stream does not contain an inherent end-of-CRL marker (other * than EOF) and there is trailing data after the CRL is parsed, a - * CRLException is thrown. + * {@code CRLException} is thrown. * * @param inStream an input stream with the CRL data. * @@ -499,18 +499,18 @@ /** * Returns a (possibly empty) collection view of the CRLs read - * from the given input stream inStream. + * from the given input stream {@code inStream}. * *

      In order to take advantage of the specialized CRL format * supported by this certificate factory, each element in * the returned collection view can be typecast to the corresponding * CRL class. For example, if this certificate * factory implements X.509 CRLs, the elements in the returned - * collection can be typecast to the X509CRL class. + * collection can be typecast to the {@code X509CRL} class. * *

      In the case of a certificate factory for X.509 CRLs, - * inStream may contain a sequence of DER-encoded CRLs. - * In addition, inStream may contain a PKCS#7 CRL + * {@code inStream} may contain a sequence of DER-encoded CRLs. + * In addition, {@code inStream} may contain a PKCS#7 CRL * set. This is a PKCS#7 SignedData object, with the only * significant field being crls. In particular, the * signature and the contents are ignored. This format allows multiple diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java --- a/jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateFactorySpi.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,18 +35,18 @@ /** * This class defines the Service Provider Interface (SPI) - * for the CertificateFactory class. + * for the {@code CertificateFactory} class. * All the abstract methods in this class must be implemented by each * cryptographic service provider who wishes to supply the implementation * of a certificate factory for a particular certificate type, e.g., X.509. * *

      Certificate factories are used to generate certificate, certification path - * (CertPath) and certificate revocation list (CRL) objects from + * ({@code CertPath}) and certificate revocation list (CRL) objects from * their encodings. * *

      A certificate factory for X.509 must return certificates that are an - * instance of java.security.cert.X509Certificate, and CRLs - * that are an instance of java.security.cert.X509CRL. + * instance of {@code java.security.cert.X509Certificate}, and CRLs + * that are an instance of {@code java.security.cert.X509CRL}. * * @author Hemma Prafullchandra * @author Jan Luehe @@ -67,17 +67,17 @@ /** * Generates a certificate object and initializes it with - * the data read from the input stream inStream. + * the data read from the input stream {@code inStream}. * *

      In order to take advantage of the specialized certificate format * supported by this certificate factory, * the returned certificate object can be typecast to the corresponding * certificate class. For example, if this certificate * factory implements X.509 certificates, the returned certificate object - * can be typecast to the X509Certificate class. + * can be typecast to the {@code X509Certificate} class. * *

      In the case of a certificate factory for X.509 certificates, the - * certificate provided in inStream must be DER-encoded and + * certificate provided in {@code inStream} must be DER-encoded and * may be supplied in binary or printable (Base64) encoding. If the * certificate is provided in Base64 encoding, it must be bounded at * the beginning by -----BEGIN CERTIFICATE-----, and must be bounded at @@ -92,7 +92,7 @@ * end-of-certificate marker. If the data in the * input stream does not contain an inherent end-of-certificate marker (other * than EOF) and there is trailing data after the certificate is parsed, a - * CertificateException is thrown. + * {@code CertificateException} is thrown. * * @param inStream an input stream with the certificate data. * @@ -105,18 +105,18 @@ throws CertificateException; /** - * Generates a CertPath object and initializes it with - * the data read from the InputStream inStream. The data + * Generates a {@code CertPath} object and initializes it with + * the data read from the {@code InputStream} inStream. The data * is assumed to be in the default encoding. * *

      This method was added to version 1.4 of the Java 2 Platform * Standard Edition. In order to maintain backwards compatibility with - * existing service providers, this method cannot be abstract - * and by default throws an UnsupportedOperationException. + * existing service providers, this method cannot be {@code abstract} + * and by default throws an {@code UnsupportedOperationException}. * - * @param inStream an InputStream containing the data - * @return a CertPath initialized with the data from the - * InputStream + * @param inStream an {@code InputStream} containing the data + * @return a {@code CertPath} initialized with the data from the + * {@code InputStream} * @exception CertificateException if an exception occurs while decoding * @exception UnsupportedOperationException if the method is not supported * @since 1.4 @@ -128,19 +128,19 @@ } /** - * Generates a CertPath object and initializes it with - * the data read from the InputStream inStream. The data + * Generates a {@code CertPath} object and initializes it with + * the data read from the {@code InputStream} inStream. The data * is assumed to be in the specified encoding. * *

      This method was added to version 1.4 of the Java 2 Platform * Standard Edition. In order to maintain backwards compatibility with - * existing service providers, this method cannot be abstract - * and by default throws an UnsupportedOperationException. + * existing service providers, this method cannot be {@code abstract} + * and by default throws an {@code UnsupportedOperationException}. * - * @param inStream an InputStream containing the data + * @param inStream an {@code InputStream} containing the data * @param encoding the encoding used for the data - * @return a CertPath initialized with the data from the - * InputStream + * @return a {@code CertPath} initialized with the data from the + * {@code InputStream} * @exception CertificateException if an exception occurs while decoding or * the encoding requested is not supported * @exception UnsupportedOperationException if the method is not supported @@ -153,20 +153,20 @@ } /** - * Generates a CertPath object and initializes it with - * a List of Certificates. + * Generates a {@code CertPath} object and initializes it with + * a {@code List} of {@code Certificate}s. *

      * The certificates supplied must be of a type supported by the - * CertificateFactory. They will be copied out of the supplied - * List object. + * {@code CertificateFactory}. They will be copied out of the supplied + * {@code List} object. * *

      This method was added to version 1.4 of the Java 2 Platform * Standard Edition. In order to maintain backwards compatibility with - * existing service providers, this method cannot be abstract - * and by default throws an UnsupportedOperationException. + * existing service providers, this method cannot be {@code abstract} + * and by default throws an {@code UnsupportedOperationException}. * - * @param certificates a List of Certificates - * @return a CertPath initialized with the supplied list of + * @param certificates a {@code List} of {@code Certificate}s + * @return a {@code CertPath} initialized with the supplied list of * certificates * @exception CertificateException if an exception occurs * @exception UnsupportedOperationException if the method is not supported @@ -180,24 +180,24 @@ } /** - * Returns an iteration of the CertPath encodings supported + * Returns an iteration of the {@code CertPath} encodings supported * by this certificate factory, with the default encoding first. See * the CertPath Encodings section in the * Java Cryptography Architecture Standard Algorithm Name Documentation * for information about standard encoding names. *

      - * Attempts to modify the returned Iterator via its - * remove method result in an - * UnsupportedOperationException. + * Attempts to modify the returned {@code Iterator} via its + * {@code remove} method result in an + * {@code UnsupportedOperationException}. * *

      This method was added to version 1.4 of the Java 2 Platform * Standard Edition. In order to maintain backwards compatibility with - * existing service providers, this method cannot be abstract - * and by default throws an UnsupportedOperationException. + * existing service providers, this method cannot be {@code abstract} + * and by default throws an {@code UnsupportedOperationException}. * - * @return an Iterator over the names of the supported - * CertPath encodings (as Strings) + * @return an {@code Iterator} over the names of the supported + * {@code CertPath} encodings (as {@code String}s) * @exception UnsupportedOperationException if the method is not supported * @since 1.4 */ @@ -207,21 +207,21 @@ /** * Returns a (possibly empty) collection view of the certificates read - * from the given input stream inStream. + * from the given input stream {@code inStream}. * *

      In order to take advantage of the specialized certificate format * supported by this certificate factory, each element in * the returned collection view can be typecast to the corresponding * certificate class. For example, if this certificate * factory implements X.509 certificates, the elements in the returned - * collection can be typecast to the X509Certificate class. + * collection can be typecast to the {@code X509Certificate} class. * *

      In the case of a certificate factory for X.509 certificates, - * inStream may contain a single DER-encoded certificate + * {@code inStream} may contain a single DER-encoded certificate * in the formats described for * {@link CertificateFactory#generateCertificate(java.io.InputStream) * generateCertificate}. - * In addition, inStream may contain a PKCS#7 certificate + * In addition, {@code inStream} may contain a PKCS#7 certificate * chain. This is a PKCS#7 SignedData object, with the only * significant field being certificates. In particular, the * signature and the contents are ignored. This format allows multiple @@ -247,14 +247,14 @@ /** * Generates a certificate revocation list (CRL) object and initializes it - * with the data read from the input stream inStream. + * with the data read from the input stream {@code inStream}. * *

      In order to take advantage of the specialized CRL format * supported by this certificate factory, * the returned CRL object can be typecast to the corresponding * CRL class. For example, if this certificate * factory implements X.509 CRLs, the returned CRL object - * can be typecast to the X509CRL class. + * can be typecast to the {@code X509CRL} class. * *

      Note that if the given input stream does not support * {@link java.io.InputStream#mark(int) mark} and @@ -265,7 +265,7 @@ * end-of-CRL marker. If the data in the * input stream does not contain an inherent end-of-CRL marker (other * than EOF) and there is trailing data after the CRL is parsed, a - * CRLException is thrown. + * {@code CRLException} is thrown. * * @param inStream an input stream with the CRL data. * @@ -279,18 +279,18 @@ /** * Returns a (possibly empty) collection view of the CRLs read - * from the given input stream inStream. + * from the given input stream {@code inStream}. * *

      In order to take advantage of the specialized CRL format * supported by this certificate factory, each element in * the returned collection view can be typecast to the corresponding * CRL class. For example, if this certificate * factory implements X.509 CRLs, the elements in the returned - * collection can be typecast to the X509CRL class. + * collection can be typecast to the {@code X509CRL} class. * *

      In the case of a certificate factory for X.509 CRLs, - * inStream may contain a single DER-encoded CRL. - * In addition, inStream may contain a PKCS#7 CRL + * {@code inStream} may contain a single DER-encoded CRL. + * In addition, {@code inStream} may contain a PKCS#7 CRL * set. This is a PKCS#7 SignedData object, with the only * significant field being crls. In particular, the * signature and the contents are ignored. This format allows multiple diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateNotYetValidException.java --- a/jdk/src/share/classes/java/security/cert/CertificateNotYetValidException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateNotYetValidException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ /** * Certificate is not yet valid exception. This is thrown whenever - * the current Date or the specified Date - * is before the notBefore date/time in the Certificate + * the current {@code Date} or the specified {@code Date} + * is before the {@code notBefore} date/time in the Certificate * validity period. * * @author Hemma Prafullchandra diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateParsingException.java --- a/jdk/src/share/classes/java/security/cert/CertificateParsingException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateParsingException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -57,13 +57,13 @@ } /** - * Creates a CertificateParsingException with the specified + * Creates a {@code CertificateParsingException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -72,14 +72,14 @@ } /** - * Creates a CertificateParsingException with the + * Creates a {@code CertificateParsingException} with the * specified cause and a detail message of - * (cause==null ? null : cause.toString()) + * {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CertificateRevokedException.java --- a/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CertificateRevokedException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ /** * An exception that indicates an X.509 certificate is revoked. A - * CertificateRevokedException contains additional information + * {@code CertificateRevokedException} contains additional information * about the revoked certificate, such as the date on which the * certificate was revoked and the reason it was revoked. * @@ -60,7 +60,7 @@ */ private final CRLReason reason; /** - * @serial the X500Principal that represents the name of the + * @serial the {@code X500Principal} that represents the name of the * authority that signed the certificate's revocation status information */ private final X500Principal authority; @@ -68,7 +68,7 @@ private transient Map extensions; /** - * Constructs a CertificateRevokedException with + * Constructs a {@code CertificateRevokedException} with * the specified revocation date, reason code, authority name, and map * of extensions. * @@ -78,12 +78,12 @@ * @param extensions a map of X.509 Extensions. Each key is an OID String * that maps to the corresponding Extension. The map is copied to * prevent subsequent modification. - * @param authority the X500Principal that represents the name + * @param authority the {@code X500Principal} that represents the name * of the authority that signed the certificate's revocation status * information - * @throws NullPointerException if revocationDate, - * reason, authority, or - * extensions is null + * @throws NullPointerException if {@code revocationDate}, + * {@code reason}, {@code authority}, or + * {@code extensions} is {@code null} */ public CertificateRevokedException(Date revocationDate, CRLReason reason, X500Principal authority, Map extensions) { @@ -121,7 +121,7 @@ * Returns the name of the authority that signed the certificate's * revocation status information. * - * @return the X500Principal that represents the name of the + * @return the {@code X500Principal} that represents the name of the * authority that signed the certificate's revocation status information */ public X500Principal getAuthorityName() { @@ -130,16 +130,16 @@ /** * Returns the invalidity date, as specifed in the Invalidity Date - * extension of this CertificateRevokedException. The + * extension of this {@code CertificateRevokedException}. The * invalidity date is the date on which it is known or suspected that the * private key was compromised or that the certificate otherwise became - * invalid. This implementation calls getExtensions() and + * invalid. This implementation calls {@code getExtensions()} and * checks the returned map for an entry for the Invalidity Date extension * OID ("2.5.29.24"). If found, it returns the invalidity date in the * extension; otherwise null. A new Date object is returned each time the * method is invoked to protect against subsequent modification. * - * @return the invalidity date, or null if not specified + * @return the invalidity date, or {@code null} if not specified */ public Date getInvalidityDate() { Extension ext = getExtensions().get("2.5.29.24"); @@ -176,7 +176,7 @@ } /** - * Serialize this CertificateRevokedException instance. + * Serialize this {@code CertificateRevokedException} instance. * * @serialData the size of the extensions map (int), followed by all of * the extensions in the map, in no particular order. For each extension, @@ -208,7 +208,7 @@ } /** - * Deserialize the CertificateRevokedException instance. + * Deserialize the {@code CertificateRevokedException} instance. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java --- a/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/CollectionCertStoreParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,13 +30,13 @@ import java.util.Collections; /** - * Parameters used as input for the Collection CertStore + * Parameters used as input for the Collection {@code CertStore} * algorithm. *

      * This class is used to provide necessary configuration parameters - * to implementations of the Collection CertStore + * to implementations of the Collection {@code CertStore} * algorithm. The only parameter included in this class is the - * Collection from which the CertStore will + * {@code Collection} from which the {@code CertStore} will * retrieve certificates and CRLs. *

      * Concurrent Access @@ -58,30 +58,30 @@ private Collection coll; /** - * Creates an instance of CollectionCertStoreParameters + * Creates an instance of {@code CollectionCertStoreParameters} * which will allow certificates and CRLs to be retrieved from the - * specified Collection. If the specified - * Collection contains an object that is not a - * Certificate or CRL, that object will be - * ignored by the Collection CertStore. + * specified {@code Collection}. If the specified + * {@code Collection} contains an object that is not a + * {@code Certificate} or {@code CRL}, that object will be + * ignored by the Collection {@code CertStore}. *

      - * The Collection is not copied. Instead, a + * The {@code Collection} is not copied. Instead, a * reference is used. This allows the caller to subsequently add or - * remove Certificates or CRLs from the - * Collection, thus changing the set of - * Certificates or CRLs available to the - * Collection CertStore. The Collection CertStore - * will not modify the contents of the Collection. + * remove {@code Certificates} or {@code CRL}s from the + * {@code Collection}, thus changing the set of + * {@code Certificates} or {@code CRL}s available to the + * Collection {@code CertStore}. The Collection {@code CertStore} + * will not modify the contents of the {@code Collection}. *

      - * If the Collection will be modified by one thread while - * another thread is calling a method of a Collection CertStore - * that has been initialized with this Collection, the - * Collection must have fail-fast iterators. + * If the {@code Collection} will be modified by one thread while + * another thread is calling a method of a Collection {@code CertStore} + * that has been initialized with this {@code Collection}, the + * {@code Collection} must have fail-fast iterators. * - * @param collection a Collection of - * Certificates and CRLs - * @exception NullPointerException if collection is - * null + * @param collection a {@code Collection} of + * {@code Certificate}s and {@code CRL}s + * @exception NullPointerException if {@code collection} is + * {@code null} */ public CollectionCertStoreParameters(Collection collection) { if (collection == null) @@ -90,22 +90,22 @@ } /** - * Creates an instance of CollectionCertStoreParameters with + * Creates an instance of {@code CollectionCertStoreParameters} with * the default parameter values (an empty and immutable - * Collection). + * {@code Collection}). */ public CollectionCertStoreParameters() { coll = Collections.EMPTY_SET; } /** - * Returns the Collection from which Certificates - * and CRLs are retrieved. This is not a copy of the - * Collection, it is a reference. This allows the caller to - * subsequently add or remove Certificates or - * CRLs from the Collection. + * Returns the {@code Collection} from which {@code Certificate}s + * and {@code CRL}s are retrieved. This is not a copy of the + * {@code Collection}, it is a reference. This allows the caller to + * subsequently add or remove {@code Certificates} or + * {@code CRL}s from the {@code Collection}. * - * @return the Collection (never null) + * @return the {@code Collection} (never null) */ public Collection getCollection() { return coll; @@ -113,7 +113,7 @@ /** * Returns a copy of this object. Note that only a reference to the - * Collection is copied, and not the contents. + * {@code Collection} is copied, and not the contents. * * @return the copy */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/Extension.java --- a/jdk/src/share/classes/java/security/cert/Extension.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/Extension.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,7 +84,7 @@ * that are encoded as an OCTET STRING. It does not include the OCTET * STRING tag and length. * - * @return a copy of the extension's value, or null if no + * @return a copy of the extension's value, or {@code null} if no * extension value is present. */ byte[] getValue(); @@ -95,7 +95,7 @@ * * @param out the output stream * @exception IOException on encoding or output error. - * @exception NullPointerException if out is null. + * @exception NullPointerException if {@code out} is {@code null}. */ void encode(OutputStream out) throws IOException; } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java --- a/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/LDAPCertStoreParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,10 @@ package java.security.cert; /** - * Parameters used as input for the LDAP CertStore algorithm. + * Parameters used as input for the LDAP {@code CertStore} algorithm. *

      * This class is used to provide necessary configuration parameters (server - * name and port number) to implementations of the LDAP CertStore + * name and port number) to implementations of the LDAP {@code CertStore} * algorithm. *

      * Concurrent Access @@ -59,13 +59,13 @@ private String serverName; /** - * Creates an instance of LDAPCertStoreParameters with the + * Creates an instance of {@code LDAPCertStoreParameters} with the * specified parameter values. * * @param serverName the DNS name of the LDAP server * @param port the port number of the LDAP server - * @exception NullPointerException if serverName is - * null + * @exception NullPointerException if {@code serverName} is + * {@code null} */ public LDAPCertStoreParameters(String serverName, int port) { if (serverName == null) @@ -75,19 +75,19 @@ } /** - * Creates an instance of LDAPCertStoreParameters with the + * Creates an instance of {@code LDAPCertStoreParameters} with the * specified server name and a default port of 389. * * @param serverName the DNS name of the LDAP server - * @exception NullPointerException if serverName is - * null + * @exception NullPointerException if {@code serverName} is + * {@code null} */ public LDAPCertStoreParameters(String serverName) { this(serverName, LDAP_DEFAULT_PORT); } /** - * Creates an instance of LDAPCertStoreParameters with the + * Creates an instance of {@code LDAPCertStoreParameters} with the * default parameter values (server name "localhost", port 389). */ public LDAPCertStoreParameters() { @@ -97,7 +97,7 @@ /** * Returns the DNS name of the LDAP server. * - * @return the name (not null) + * @return the name (not {@code null}) */ public String getServerName() { return serverName; @@ -117,7 +117,7 @@ * the original and vice versa. *

      * Note: this method currently performs a shallow copy of the object - * (simply calls Object.clone()). This may be changed in a + * (simply calls {@code Object.clone()}). This may be changed in a * future revision to perform a deep copy if new parameters are added * that should not be shared. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java --- a/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXBuilderParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,35 +32,35 @@ import java.util.Set; /** - * Parameters used as input for the PKIX CertPathBuilder + * Parameters used as input for the PKIX {@code CertPathBuilder} * algorithm. *

      - * A PKIX CertPathBuilder uses these parameters to {@link - * CertPathBuilder#build build} a CertPath which has been + * A PKIX {@code CertPathBuilder} uses these parameters to {@link + * CertPathBuilder#build build} a {@code CertPath} which has been * validated according to the PKIX certification path validation algorithm. * - *

      To instantiate a PKIXBuilderParameters object, an + *

      To instantiate a {@code PKIXBuilderParameters} object, an * application must specify one or more most-trusted CAs as defined by * the PKIX certification path validation algorithm. The most-trusted CA * can be specified using one of two constructors. An application * can call {@link #PKIXBuilderParameters(Set, CertSelector) * PKIXBuilderParameters(Set, CertSelector)}, specifying a - * Set of TrustAnchor objects, each of which + * {@code Set} of {@code TrustAnchor} objects, each of which * identifies a most-trusted CA. Alternatively, an application can call * {@link #PKIXBuilderParameters(KeyStore, CertSelector) * PKIXBuilderParameters(KeyStore, CertSelector)}, specifying a - * KeyStore instance containing trusted certificate entries, each + * {@code KeyStore} instance containing trusted certificate entries, each * of which will be considered as a most-trusted CA. * *

      In addition, an application must specify constraints on the target - * certificate that the CertPathBuilder will attempt + * certificate that the {@code CertPathBuilder} will attempt * to build a path to. The constraints are specified as a - * CertSelector object. These constraints should provide the - * CertPathBuilder with enough search criteria to find the target - * certificate. Minimal criteria for an X509Certificate usually + * {@code CertSelector} object. These constraints should provide the + * {@code CertPathBuilder} with enough search criteria to find the target + * certificate. Minimal criteria for an {@code X509Certificate} usually * include the subject name and/or one or more subject alternative names. - * If enough criteria is not specified, the CertPathBuilder - * may throw a CertPathBuilderException. + * If enough criteria is not specified, the {@code CertPathBuilder} + * may throw a {@code CertPathBuilderException}. *

      * Concurrent Access *

      @@ -80,23 +80,23 @@ private int maxPathLength = 5; /** - * Creates an instance of PKIXBuilderParameters with - * the specified Set of most-trusted CAs. + * Creates an instance of {@code PKIXBuilderParameters} with + * the specified {@code Set} of most-trusted CAs. * Each element of the set is a {@link TrustAnchor TrustAnchor}. * - *

      Note that the Set is copied to protect against + *

      Note that the {@code Set} is copied to protect against * subsequent modifications. * - * @param trustAnchors a Set of TrustAnchors - * @param targetConstraints a CertSelector specifying the + * @param trustAnchors a {@code Set} of {@code TrustAnchor}s + * @param targetConstraints a {@code CertSelector} specifying the * constraints on the target certificate - * @throws InvalidAlgorithmParameterException if trustAnchors - * is empty (trustAnchors.isEmpty() == true) - * @throws NullPointerException if trustAnchors is - * null + * @throws InvalidAlgorithmParameterException if {@code trustAnchors} + * is empty {@code (trustAnchors.isEmpty() == true)} + * @throws NullPointerException if {@code trustAnchors} is + * {@code null} * @throws ClassCastException if any of the elements of - * trustAnchors are not of type - * java.security.cert.TrustAnchor + * {@code trustAnchors} are not of type + * {@code java.security.cert.TrustAnchor} */ public PKIXBuilderParameters(Set trustAnchors, CertSelector targetConstraints) throws InvalidAlgorithmParameterException @@ -106,22 +106,22 @@ } /** - * Creates an instance of PKIXBuilderParameters that + * Creates an instance of {@code PKIXBuilderParameters} that * populates the set of most-trusted CAs from the trusted - * certificate entries contained in the specified KeyStore. - * Only keystore entries that contain trusted X509Certificates + * certificate entries contained in the specified {@code KeyStore}. + * Only keystore entries that contain trusted {@code X509Certificate}s * are considered; all other certificate types are ignored. * - * @param keystore a KeyStore from which the set of + * @param keystore a {@code KeyStore} from which the set of * most-trusted CAs will be populated - * @param targetConstraints a CertSelector specifying the + * @param targetConstraints a {@code CertSelector} specifying the * constraints on the target certificate - * @throws KeyStoreException if keystore has not been + * @throws KeyStoreException if {@code keystore} has not been * initialized - * @throws InvalidAlgorithmParameterException if keystore does + * @throws InvalidAlgorithmParameterException if {@code keystore} does * not contain at least one trusted certificate entry - * @throws NullPointerException if keystore is - * null + * @throws NullPointerException if {@code keystore} is + * {@code null} */ public PKIXBuilderParameters(KeyStore keystore, CertSelector targetConstraints) @@ -139,7 +139,7 @@ * in a certification path is not an intermediate certificate, and is not * included in this limit. Usually the last certificate is an end entity * certificate, but it can be a CA certificate. A PKIX - * CertPathBuilder instance must not build + * {@code CertPathBuilder} instance must not build * paths longer than the length specified. * *

      A value of 0 implies that the path can only contain @@ -149,14 +149,14 @@ * Setting a value less than -1 will cause an exception to be thrown. * *

      If any of the CA certificates contain the - * BasicConstraintsExtension, the value of the - * pathLenConstraint field of the extension overrides + * {@code BasicConstraintsExtension}, the value of the + * {@code pathLenConstraint} field of the extension overrides * the maximum path length parameter whenever the result is a * certification path of smaller length. * * @param maxPathLength the maximum number of non-self-issued intermediate * certificates that may exist in a certification path - * @throws InvalidParameterException if maxPathLength is set + * @throws InvalidParameterException if {@code maxPathLength} is set * to a value less than -1 * * @see #getMaxPathLength diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java --- a/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathBuilderResult.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,14 +33,14 @@ * returned using this algorithm are also validated according to the PKIX * certification path validation algorithm. * - *

      Instances of PKIXCertPathBuilderResult are returned by - * the build method of CertPathBuilder + *

      Instances of {@code PKIXCertPathBuilderResult} are returned by + * the {@code build} method of {@code CertPathBuilder} * objects implementing the PKIX algorithm. * - *

      All PKIXCertPathBuilderResult objects contain the + *

      All {@code PKIXCertPathBuilderResult} objects contain the * certification path constructed by the build algorithm, the * valid policy tree and subject public key resulting from the build - * algorithm, and a TrustAnchor describing the certification + * algorithm, and a {@code TrustAnchor} describing the certification * authority (CA) that served as a trust anchor for the certification path. *

      * Concurrent Access @@ -62,18 +62,18 @@ private CertPath certPath; /** - * Creates an instance of PKIXCertPathBuilderResult + * Creates an instance of {@code PKIXCertPathBuilderResult} * containing the specified parameters. * - * @param certPath the validated CertPath - * @param trustAnchor a TrustAnchor describing the CA that + * @param certPath the validated {@code CertPath} + * @param trustAnchor a {@code TrustAnchor} describing the CA that * served as a trust anchor for the certification path - * @param policyTree the immutable valid policy tree, or null + * @param policyTree the immutable valid policy tree, or {@code null} * if there are no valid policies * @param subjectPublicKey the public key of the subject - * @throws NullPointerException if the certPath, - * trustAnchor or subjectPublicKey parameters - * are null + * @throws NullPointerException if the {@code certPath}, + * {@code trustAnchor} or {@code subjectPublicKey} parameters + * are {@code null} */ public PKIXCertPathBuilderResult(CertPath certPath, TrustAnchor trustAnchor, PolicyNode policyTree, @@ -87,13 +87,13 @@ /** * Returns the built and validated certification path. The - * CertPath object does not include the trust anchor. + * {@code CertPath} object does not include the trust anchor. * Instead, use the {@link #getTrustAnchor() getTrustAnchor()} method to - * obtain the TrustAnchor that served as the trust anchor + * obtain the {@code TrustAnchor} that served as the trust anchor * for the certification path. * - * @return the built and validated CertPath (never - * null) + * @return the built and validated {@code CertPath} (never + * {@code null}) */ public CertPath getCertPath() { return certPath; @@ -101,10 +101,10 @@ /** * Return a printable representation of this - * PKIXCertPathBuilderResult. + * {@code PKIXCertPathBuilderResult}. * - * @return a String describing the contents of this - * PKIXCertPathBuilderResult + * @return a {@code String} describing the contents of this + * {@code PKIXCertPathBuilderResult} */ public String toString() { StringBuffer sb = new StringBuffer(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java --- a/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathChecker.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,38 +30,38 @@ /** * An abstract class that performs one or more checks on an - * X509Certificate. + * {@code X509Certificate}. * - *

      A concrete implementation of the PKIXCertPathChecker class + *

      A concrete implementation of the {@code PKIXCertPathChecker} class * can be created to extend the PKIX certification path validation algorithm. * For example, an implementation may check for and process a critical private * extension of each certificate in a certification path. * - *

      Instances of PKIXCertPathChecker are passed as parameters + *

      Instances of {@code PKIXCertPathChecker} are passed as parameters * using the {@link PKIXParameters#setCertPathCheckers setCertPathCheckers} * or {@link PKIXParameters#addCertPathChecker addCertPathChecker} methods - * of the PKIXParameters and PKIXBuilderParameters - * class. Each of the PKIXCertPathCheckers {@link #check check} + * of the {@code PKIXParameters} and {@code PKIXBuilderParameters} + * class. Each of the {@code PKIXCertPathChecker}s {@link #check check} * methods will be called, in turn, for each certificate processed by a PKIX - * CertPathValidator or CertPathBuilder + * {@code CertPathValidator} or {@code CertPathBuilder} * implementation. * - *

      A PKIXCertPathChecker may be called multiple times on + *

      A {@code PKIXCertPathChecker} may be called multiple times on * successive certificates in a certification path. Concrete subclasses * are expected to maintain any internal state that may be necessary to * check successive certificates. The {@link #init init} method is used * to initialize the internal state of the checker so that the certificates * of a new certification path may be checked. A stateful implementation * must override the {@link #clone clone} method if necessary in - * order to allow a PKIX CertPathBuilder to efficiently + * order to allow a PKIX {@code CertPathBuilder} to efficiently * backtrack and try other paths. In these situations, the - * CertPathBuilder is able to restore prior path validation - * states by restoring the cloned PKIXCertPathCheckers. + * {@code CertPathBuilder} is able to restore prior path validation + * states by restoring the cloned {@code PKIXCertPathChecker}s. * *

      The order in which the certificates are presented to the - * PKIXCertPathChecker may be either in the forward direction + * {@code PKIXCertPathChecker} may be either in the forward direction * (from target to most-trusted CA) or in the reverse direction (from - * most-trusted CA to target). A PKIXCertPathChecker implementation + * most-trusted CA to target). A {@code PKIXCertPathChecker} implementation * must support reverse checking (the ability to perform its checks when * it is presented with certificates in the reverse direction) and may * support forward checking (the ability to perform its checks when it is @@ -96,19 +96,19 @@ protected PKIXCertPathChecker() {} /** - * Initializes the internal state of this PKIXCertPathChecker. + * Initializes the internal state of this {@code PKIXCertPathChecker}. *

      - * The forward flag specifies the order that + * The {@code forward} flag specifies the order that * certificates will be passed to the {@link #check check} method - * (forward or reverse). A PKIXCertPathChecker must + * (forward or reverse). A {@code PKIXCertPathChecker} must * support reverse checking and may support forward checking. * * @param forward the order that certificates are presented to - * the check method. If true, certificates + * the {@code check} method. If {@code true}, certificates * are presented from target to most-trusted CA (forward); if - * false, from most-trusted CA to target (reverse). + * {@code false}, from most-trusted CA to target (reverse). * @throws CertPathValidatorException if this - * PKIXCertPathChecker is unable to check certificates in + * {@code PKIXCertPathChecker} is unable to check certificates in * the specified order; it should never be thrown if the forward flag * is false since reverse checking must be supported */ @@ -118,32 +118,32 @@ /** * Indicates if forward checking is supported. Forward checking refers - * to the ability of the PKIXCertPathChecker to perform - * its checks when certificates are presented to the check + * to the ability of the {@code PKIXCertPathChecker} to perform + * its checks when certificates are presented to the {@code check} * method in the forward direction (from target to most-trusted CA). * - * @return true if forward checking is supported, - * false otherwise + * @return {@code true} if forward checking is supported, + * {@code false} otherwise */ @Override public abstract boolean isForwardCheckingSupported(); /** - * Returns an immutable Set of X.509 certificate extensions - * that this PKIXCertPathChecker supports (i.e. recognizes, is - * able to process), or null if no extensions are supported. + * Returns an immutable {@code Set} of X.509 certificate extensions + * that this {@code PKIXCertPathChecker} supports (i.e. recognizes, is + * able to process), or {@code null} if no extensions are supported. *

      - * Each element of the set is a String representing the + * Each element of the set is a {@code String} representing the * Object Identifier (OID) of the X.509 extension that is supported. * The OID is represented by a set of nonnegative integers separated by * periods. *

      - * All X.509 certificate extensions that a PKIXCertPathChecker + * All X.509 certificate extensions that a {@code PKIXCertPathChecker} * might possibly be able to process should be included in the set. * - * @return an immutable Set of X.509 extension OIDs (in - * String format) supported by this - * PKIXCertPathChecker, or null if no + * @return an immutable {@code Set} of X.509 extension OIDs (in + * {@code String} format) supported by this + * {@code PKIXCertPathChecker}, or {@code null} if no * extensions are supported */ public abstract Set getSupportedExtensions(); @@ -153,10 +153,10 @@ * state and removes any critical extensions that it processes from the * specified collection of OID strings that represent the unresolved * critical extensions. The certificates are presented in the order - * specified by the init method. + * specified by the {@code init} method. * - * @param cert the Certificate to be checked - * @param unresolvedCritExts a Collection of OID strings + * @param cert the {@code Certificate} to be checked + * @param unresolvedCritExts a {@code Collection} of OID strings * representing the current set of unresolved critical extensions * @exception CertPathValidatorException if the specified certificate does * not pass the check @@ -177,12 +177,12 @@ } /** - * Returns a clone of this object. Calls the Object.clone() + * Returns a clone of this object. Calls the {@code Object.clone()} * method. * All subclasses which maintain state must support and * override this method, if necessary. * - * @return a copy of this PKIXCertPathChecker + * @return a copy of this {@code PKIXCertPathChecker} */ @Override public Object clone() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java --- a/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXCertPathValidatorResult.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,13 +31,13 @@ * This class represents the successful result of the PKIX certification * path validation algorithm. * - *

      Instances of PKIXCertPathValidatorResult are returned by the + *

      Instances of {@code PKIXCertPathValidatorResult} are returned by the * {@link CertPathValidator#validate validate} method of - * CertPathValidator objects implementing the PKIX algorithm. + * {@code CertPathValidator} objects implementing the PKIX algorithm. * - *

      All PKIXCertPathValidatorResult objects contain the + *

      All {@code PKIXCertPathValidatorResult} objects contain the * valid policy tree and subject public key resulting from the - * validation algorithm, as well as a TrustAnchor describing + * validation algorithm, as well as a {@code TrustAnchor} describing * the certification authority (CA) that served as a trust anchor for the * certification path. *

      @@ -62,16 +62,16 @@ private PublicKey subjectPublicKey; /** - * Creates an instance of PKIXCertPathValidatorResult + * Creates an instance of {@code PKIXCertPathValidatorResult} * containing the specified parameters. * - * @param trustAnchor a TrustAnchor describing the CA that + * @param trustAnchor a {@code TrustAnchor} describing the CA that * served as a trust anchor for the certification path - * @param policyTree the immutable valid policy tree, or null + * @param policyTree the immutable valid policy tree, or {@code null} * if there are no valid policies * @param subjectPublicKey the public key of the subject - * @throws NullPointerException if the subjectPublicKey or - * trustAnchor parameters are null + * @throws NullPointerException if the {@code subjectPublicKey} or + * {@code trustAnchor} parameters are {@code null} */ public PKIXCertPathValidatorResult(TrustAnchor trustAnchor, PolicyNode policyTree, PublicKey subjectPublicKey) @@ -86,10 +86,10 @@ } /** - * Returns the TrustAnchor describing the CA that served + * Returns the {@code TrustAnchor} describing the CA that served * as a trust anchor for the certification path. * - * @return the TrustAnchor (never null) + * @return the {@code TrustAnchor} (never {@code null}) */ public TrustAnchor getTrustAnchor() { return trustAnchor; @@ -98,18 +98,18 @@ /** * Returns the root node of the valid policy tree resulting from the * PKIX certification path validation algorithm. The - * PolicyNode object that is returned and any objects that + * {@code PolicyNode} object that is returned and any objects that * it returns through public methods are immutable. * *

      Most applications will not need to examine the valid policy tree. * They can achieve their policy processing goals by setting the - * policy-related parameters in PKIXParameters. However, more + * policy-related parameters in {@code PKIXParameters}. However, more * sophisticated applications, especially those that process policy * qualifiers, may need to traverse the valid policy tree using the * {@link PolicyNode#getParent PolicyNode.getParent} and * {@link PolicyNode#getChildren PolicyNode.getChildren} methods. * - * @return the root node of the valid policy tree, or null + * @return the root node of the valid policy tree, or {@code null} * if there are no valid policies */ public PolicyNode getPolicyTree() { @@ -120,7 +120,7 @@ * Returns the public key of the subject (target) of the certification * path, including any inherited public key parameters if applicable. * - * @return the public key of the subject (never null) + * @return the public key of the subject (never {@code null}) */ public PublicKey getPublicKey() { return subjectPublicKey; @@ -142,10 +142,10 @@ /** * Return a printable representation of this - * PKIXCertPathValidatorResult. + * {@code PKIXCertPathValidatorResult}. * - * @return a String describing the contents of this - * PKIXCertPathValidatorResult + * @return a {@code String} describing the contents of this + * {@code PKIXCertPathValidatorResult} */ public String toString() { StringBuffer sb = new StringBuffer(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXParameters.java --- a/jdk/src/share/classes/java/security/cert/PKIXParameters.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXParameters.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,34 +38,34 @@ import java.util.Set; /** - * Parameters used as input for the PKIX CertPathValidator + * Parameters used as input for the PKIX {@code CertPathValidator} * algorithm. *

      - * A PKIX CertPathValidator uses these parameters to - * validate a CertPath according to the PKIX certification path + * A PKIX {@code CertPathValidator} uses these parameters to + * validate a {@code CertPath} according to the PKIX certification path * validation algorithm. * - *

      To instantiate a PKIXParameters object, an + *

      To instantiate a {@code PKIXParameters} object, an * application must specify one or more most-trusted CAs as defined by * the PKIX certification path validation algorithm. The most-trusted CAs * can be specified using one of two constructors. An application * can call {@link #PKIXParameters(Set) PKIXParameters(Set)}, - * specifying a Set of TrustAnchor objects, each + * specifying a {@code Set} of {@code TrustAnchor} objects, each * of which identify a most-trusted CA. Alternatively, an application can call * {@link #PKIXParameters(KeyStore) PKIXParameters(KeyStore)}, specifying a - * KeyStore instance containing trusted certificate entries, each + * {@code KeyStore} instance containing trusted certificate entries, each * of which will be considered as a most-trusted CA. *

      - * Once a PKIXParameters object has been created, other parameters + * Once a {@code PKIXParameters} object has been created, other parameters * can be specified (by calling {@link #setInitialPolicies setInitialPolicies} * or {@link #setDate setDate}, for instance) and then the - * PKIXParameters is passed along with the CertPath + * {@code PKIXParameters} is passed along with the {@code CertPath} * to be validated to {@link CertPathValidator#validate * CertPathValidator.validate}. *

      - * Any parameter that is not set (or is set to null) will + * Any parameter that is not set (or is set to {@code null}) will * be set to the default value for that parameter. The default value for the - * date parameter is null, which indicates + * {@code date} parameter is {@code null}, which indicates * the current time when the path is validated. The default for the * remaining parameters is the least constrained. *

      @@ -99,20 +99,20 @@ private CertSelector certSelector; /** - * Creates an instance of PKIXParameters with the specified - * Set of most-trusted CAs. Each element of the + * Creates an instance of {@code PKIXParameters} with the specified + * {@code Set} of most-trusted CAs. Each element of the * set is a {@link TrustAnchor TrustAnchor}. *

      - * Note that the Set is copied to protect against + * Note that the {@code Set} is copied to protect against * subsequent modifications. * - * @param trustAnchors a Set of TrustAnchors + * @param trustAnchors a {@code Set} of {@code TrustAnchor}s * @throws InvalidAlgorithmParameterException if the specified - * Set is empty (trustAnchors.isEmpty() == true) - * @throws NullPointerException if the specified Set is - * null - * @throws ClassCastException if any of the elements in the Set - * are not of type java.security.cert.TrustAnchor + * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)} + * @throws NullPointerException if the specified {@code Set} is + * {@code null} + * @throws ClassCastException if any of the elements in the {@code Set} + * are not of type {@code java.security.cert.TrustAnchor} */ public PKIXParameters(Set trustAnchors) throws InvalidAlgorithmParameterException @@ -125,18 +125,18 @@ } /** - * Creates an instance of PKIXParameters that + * Creates an instance of {@code PKIXParameters} that * populates the set of most-trusted CAs from the trusted - * certificate entries contained in the specified KeyStore. - * Only keystore entries that contain trusted X509Certificates + * certificate entries contained in the specified {@code KeyStore}. + * Only keystore entries that contain trusted {@code X509Certificates} * are considered; all other certificate types are ignored. * - * @param keystore a KeyStore from which the set of + * @param keystore a {@code KeyStore} from which the set of * most-trusted CAs will be populated * @throws KeyStoreException if the keystore has not been initialized * @throws InvalidAlgorithmParameterException if the keystore does * not contain at least one trusted certificate entry - * @throws NullPointerException if the keystore is null + * @throws NullPointerException if the keystore is {@code null} */ public PKIXParameters(KeyStore keystore) throws KeyStoreException, InvalidAlgorithmParameterException @@ -161,11 +161,11 @@ } /** - * Returns an immutable Set of the most-trusted + * Returns an immutable {@code Set} of the most-trusted * CAs. * - * @return an immutable Set of TrustAnchors - * (never null) + * @return an immutable {@code Set} of {@code TrustAnchor}s + * (never {@code null}) * * @see #setTrustAnchors */ @@ -174,18 +174,18 @@ } /** - * Sets the Set of most-trusted CAs. + * Sets the {@code Set} of most-trusted CAs. *

      - * Note that the Set is copied to protect against + * Note that the {@code Set} is copied to protect against * subsequent modifications. * - * @param trustAnchors a Set of TrustAnchors + * @param trustAnchors a {@code Set} of {@code TrustAnchor}s * @throws InvalidAlgorithmParameterException if the specified - * Set is empty (trustAnchors.isEmpty() == true) - * @throws NullPointerException if the specified Set is - * null + * {@code Set} is empty {@code (trustAnchors.isEmpty() == true)} + * @throws NullPointerException if the specified {@code Set} is + * {@code null} * @throws ClassCastException if any of the elements in the set - * are not of type java.security.cert.TrustAnchor + * are not of type {@code java.security.cert.TrustAnchor} * * @see #getTrustAnchors */ @@ -211,16 +211,16 @@ } /** - * Returns an immutable Set of initial + * Returns an immutable {@code Set} of initial * policy identifiers (OID strings), indicating that any one of these * policies would be acceptable to the certificate user for the purposes of * certification path processing. The default return value is an empty - * Set, which is interpreted as meaning that any policy would + * {@code Set}, which is interpreted as meaning that any policy would * be acceptable. * - * @return an immutable Set of initial policy OIDs in - * String format, or an empty Set (implying any - * policy is acceptable). Never returns null. + * @return an immutable {@code Set} of initial policy OIDs in + * {@code String} format, or an empty {@code Set} (implying any + * policy is acceptable). Never returns {@code null}. * * @see #setInitialPolicies */ @@ -229,21 +229,21 @@ } /** - * Sets the Set of initial policy identifiers + * Sets the {@code Set} of initial policy identifiers * (OID strings), indicating that any one of these * policies would be acceptable to the certificate user for the purposes of * certification path processing. By default, any policy is acceptable * (i.e. all policies), so a user that wants to allow any policy as * acceptable does not need to call this method, or can call it - * with an empty Set (or null). + * with an empty {@code Set} (or {@code null}). *

      - * Note that the Set is copied to protect against + * Note that the {@code Set} is copied to protect against * subsequent modifications. * - * @param initialPolicies a Set of initial policy - * OIDs in String format (or null) + * @param initialPolicies a {@code Set} of initial policy + * OIDs in {@code String} format (or {@code null}) * @throws ClassCastException if any of the elements in the set are - * not of type String + * not of type {@code String} * * @see #getInitialPolicies */ @@ -262,19 +262,19 @@ } /** - * Sets the list of CertStores to be used in finding - * certificates and CRLs. May be null, in which case - * no CertStores will be used. The first - * CertStores in the list may be preferred to those that + * Sets the list of {@code CertStore}s to be used in finding + * certificates and CRLs. May be {@code null}, in which case + * no {@code CertStore}s will be used. The first + * {@code CertStore}s in the list may be preferred to those that * appear later. *

      - * Note that the List is copied to protect against + * Note that the {@code List} is copied to protect against * subsequent modifications. * - * @param stores a List of CertStores (or - * null) + * @param stores a {@code List} of {@code CertStore}s (or + * {@code null}) * @throws ClassCastException if any of the elements in the list are - * not of type java.security.cert.CertStore + * not of type {@code java.security.cert.CertStore} * * @see #getCertStores */ @@ -293,10 +293,10 @@ } /** - * Adds a CertStore to the end of the list of - * CertStores used in finding certificates and CRLs. + * Adds a {@code CertStore} to the end of the list of + * {@code CertStore}s used in finding certificates and CRLs. * - * @param store the CertStore to add. If null, + * @param store the {@code CertStore} to add. If {@code null}, * the store is ignored (not added to list). */ public void addCertStore(CertStore store) { @@ -306,11 +306,11 @@ } /** - * Returns an immutable List of CertStores that + * Returns an immutable {@code List} of {@code CertStore}s that * are used to find certificates and CRLs. * - * @return an immutable List of CertStores - * (may be empty, but never null) + * @return an immutable {@code List} of {@code CertStore}s + * (may be empty, but never {@code null}) * * @see #setCertStores */ @@ -325,7 +325,7 @@ * will be used. If this flag is false, the default revocation checking * mechanism will be disabled (not used). *

      - * When a PKIXParameters object is created, this flag is set + * When a {@code PKIXParameters} object is created, this flag is set * to true. This setting reflects the most common strategy for checking * revocation, since each service provider must support revocation * checking to be PKIX compliant. Sophisticated applications should set @@ -360,8 +360,8 @@ * acceptable policy needs to be explicitly identified in every certificate. * By default, the ExplicitPolicyRequired flag is false. * - * @param val true if explicit policy is to be required, - * false otherwise + * @param val {@code true} if explicit policy is to be required, + * {@code false} otherwise */ public void setExplicitPolicyRequired(boolean val) { explicitPolicyRequired = val; @@ -372,8 +372,8 @@ * acceptable policy needs to be explicitly identified in every certificate. * By default, the ExplicitPolicyRequired flag is false. * - * @return true if explicit policy is required, - * false otherwise + * @return {@code true} if explicit policy is required, + * {@code false} otherwise */ public boolean isExplicitPolicyRequired() { return explicitPolicyRequired; @@ -384,8 +384,8 @@ * mapping is inhibited. By default, policy mapping is not inhibited (the * flag is false). * - * @param val true if policy mapping is to be inhibited, - * false otherwise + * @param val {@code true} if policy mapping is to be inhibited, + * {@code false} otherwise */ public void setPolicyMappingInhibited(boolean val) { policyMappingInhibited = val; @@ -406,10 +406,10 @@ * Sets state to determine if the any policy OID should be processed * if it is included in a certificate. By default, the any policy OID * is not inhibited ({@link #isAnyPolicyInhibited isAnyPolicyInhibited()} - * returns false). + * returns {@code false}). * - * @param val true if the any policy OID is to be - * inhibited, false otherwise + * @param val {@code true} if the any policy OID is to be + * inhibited, {@code false} otherwise */ public void setAnyPolicyInhibited(boolean val) { anyPolicyInhibited = val; @@ -419,8 +419,8 @@ * Checks whether the any policy OID should be processed if it * is included in a certificate. * - * @return true if the any policy OID is inhibited, - * false otherwise + * @return {@code true} if the any policy OID is inhibited, + * {@code false} otherwise */ public boolean isAnyPolicyInhibited() { return anyPolicyInhibited; @@ -432,7 +432,7 @@ * policies extension that is marked critical are rejected. * If the flag is false, certificates are not rejected on this basis. * - *

      When a PKIXParameters object is created, this flag is + *

      When a {@code PKIXParameters} object is created, this flag is * set to true. This setting reflects the most common (and simplest) * strategy for processing policy qualifiers. Applications that want to use * a more sophisticated policy must set this flag to false. @@ -459,7 +459,7 @@ * extension that is marked critical are rejected. * If the flag is false, certificates are not rejected on this basis. * - *

      When a PKIXParameters object is created, this flag is + *

      When a {@code PKIXParameters} object is created, this flag is * set to true. This setting reflects the most common (and simplest) * strategy for processing policy qualifiers. Applications that want to use * a more sophisticated policy must set this flag to false. @@ -473,12 +473,12 @@ /** * Returns the time for which the validity of the certification path - * should be determined. If null, the current time is used. + * should be determined. If {@code null}, the current time is used. *

      - * Note that the Date returned is copied to protect against + * Note that the {@code Date} returned is copied to protect against * subsequent modifications. * - * @return the Date, or null if not set + * @return the {@code Date}, or {@code null} if not set * @see #setDate */ public Date getDate() { @@ -490,12 +490,12 @@ /** * Sets the time for which the validity of the certification path - * should be determined. If null, the current time is used. + * should be determined. If {@code null}, the current time is used. *

      - * Note that the Date supplied here is copied to protect + * Note that the {@code Date} supplied here is copied to protect * against subsequent modifications. * - * @param date the Date, or null for the + * @param date the {@code Date}, or {@code null} for the * current time * @see #getDate */ @@ -507,39 +507,39 @@ } /** - * Sets a List of additional certification path checkers. If - * the specified List contains an object that is not a - * PKIXCertPathChecker, it is ignored. + * Sets a {@code List} of additional certification path checkers. If + * the specified {@code List} contains an object that is not a + * {@code PKIXCertPathChecker}, it is ignored. *

      - * Each PKIXCertPathChecker specified implements + * Each {@code PKIXCertPathChecker} specified implements * additional checks on a certificate. Typically, these are checks to * process and verify private extensions contained in certificates. - * Each PKIXCertPathChecker should be instantiated with any + * Each {@code PKIXCertPathChecker} should be instantiated with any * initialization parameters needed to execute the check. *

      * This method allows sophisticated applications to extend a PKIX - * CertPathValidator or CertPathBuilder. - * Each of the specified PKIXCertPathCheckers will be called, - * in turn, by a PKIX CertPathValidator or - * CertPathBuilder for each certificate processed or + * {@code CertPathValidator} or {@code CertPathBuilder}. + * Each of the specified {@code PKIXCertPathChecker}s will be called, + * in turn, by a PKIX {@code CertPathValidator} or + * {@code CertPathBuilder} for each certificate processed or * validated. *

      - * Regardless of whether these additional PKIXCertPathCheckers - * are set, a PKIX CertPathValidator or - * CertPathBuilder must perform all of the required PKIX + * Regardless of whether these additional {@code PKIXCertPathChecker}s + * are set, a PKIX {@code CertPathValidator} or + * {@code CertPathBuilder} must perform all of the required PKIX * checks on each certificate. The one exception to this rule is if the * RevocationEnabled flag is set to false (see the {@link * #setRevocationEnabled setRevocationEnabled} method). *

      - * Note that the List supplied here is copied and each - * PKIXCertPathChecker in the list is cloned to protect + * Note that the {@code List} supplied here is copied and each + * {@code PKIXCertPathChecker} in the list is cloned to protect * against subsequent modifications. * - * @param checkers a List of PKIXCertPathCheckers. - * May be null, in which case no additional checkers will be + * @param checkers a {@code List} of {@code PKIXCertPathChecker}s. + * May be {@code null}, in which case no additional checkers will be * used. * @throws ClassCastException if any of the elements in the list - * are not of type java.security.cert.PKIXCertPathChecker + * are not of type {@code java.security.cert.PKIXCertPathChecker} * @see #getCertPathCheckers */ public void setCertPathCheckers(List checkers) { @@ -556,14 +556,14 @@ } /** - * Returns the List of certification path checkers. - * The returned List is immutable, and each - * PKIXCertPathChecker in the List is cloned + * Returns the {@code List} of certification path checkers. + * The returned {@code List} is immutable, and each + * {@code PKIXCertPathChecker} in the {@code List} is cloned * to protect against subsequent modifications. * - * @return an immutable List of - * PKIXCertPathCheckers (may be empty, but not - * null) + * @return an immutable {@code List} of + * {@code PKIXCertPathChecker}s (may be empty, but not + * {@code null}) * @see #setCertPathCheckers */ public List getCertPathCheckers() { @@ -575,15 +575,15 @@ } /** - * Adds a PKIXCertPathChecker to the list of certification + * Adds a {@code PKIXCertPathChecker} to the list of certification * path checkers. See the {@link #setCertPathCheckers setCertPathCheckers} * method for more details. *

      - * Note that the PKIXCertPathChecker is cloned to protect + * Note that the {@code PKIXCertPathChecker} is cloned to protect * against subsequent modifications. * - * @param checker a PKIXCertPathChecker to add to the list of - * checks. If null, the checker is ignored (not added to list). + * @param checker a {@code PKIXCertPathChecker} to add to the list of + * checks. If {@code null}, the checker is ignored (not added to list). */ public void addCertPathChecker(PKIXCertPathChecker checker) { if (checker != null) { @@ -592,10 +592,10 @@ } /** - * Returns the signature provider's name, or null + * Returns the signature provider's name, or {@code null} * if not set. * - * @return the signature provider's name (or null) + * @return the signature provider's name (or {@code null}) * @see #setSigProvider */ public String getSigProvider() { @@ -605,10 +605,10 @@ /** * Sets the signature provider's name. The specified provider will be * preferred when creating {@link java.security.Signature Signature} - * objects. If null or not set, the first provider found + * objects. If {@code null} or not set, the first provider found * supporting the algorithm will be used. * - * @param sigProvider the signature provider's name (or null) + * @param sigProvider the signature provider's name (or {@code null}) * @see #getSigProvider */ public void setSigProvider(String sigProvider) { @@ -617,14 +617,14 @@ /** * Returns the required constraints on the target certificate. - * The constraints are returned as an instance of CertSelector. - * If null, no constraints are defined. + * The constraints are returned as an instance of {@code CertSelector}. + * If {@code null}, no constraints are defined. * - *

      Note that the CertSelector returned is cloned + *

      Note that the {@code CertSelector} returned is cloned * to protect against subsequent modifications. * - * @return a CertSelector specifying the constraints - * on the target certificate (or null) + * @return a {@code CertSelector} specifying the constraints + * on the target certificate (or {@code null}) * @see #setTargetCertConstraints */ public CertSelector getTargetCertConstraints() { @@ -638,14 +638,14 @@ /** * Sets the required constraints on the target certificate. * The constraints are specified as an instance of - * CertSelector. If null, no constraints are + * {@code CertSelector}. If {@code null}, no constraints are * defined. * - *

      Note that the CertSelector specified is cloned + *

      Note that the {@code CertSelector} specified is cloned * to protect against subsequent modifications. * - * @param selector a CertSelector specifying the constraints - * on the target certificate (or null) + * @param selector a {@code CertSelector} specifying the constraints + * on the target certificate (or {@code null}) * @see #getTargetCertConstraints */ public void setTargetCertConstraints(CertSelector selector) { @@ -656,10 +656,10 @@ } /** - * Makes a copy of this PKIXParameters object. Changes + * Makes a copy of this {@code PKIXParameters} object. Changes * to the copy will not affect the original and vice versa. * - * @return a copy of this PKIXParameters object + * @return a copy of this {@code PKIXParameters} object */ public Object clone() { try { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PKIXReason.java --- a/jdk/src/share/classes/java/security/cert/PKIXReason.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PKIXReason.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,10 @@ package java.security.cert; /** - * The PKIXReason enumerates the potential PKIX-specific reasons + * The {@code PKIXReason} enumerates the potential PKIX-specific reasons * that an X.509 certification path may be invalid according to the PKIX * (RFC 3280) standard. These reasons are in addition to those of the - * CertPathValidatorException.BasicReason enumeration. + * {@code CertPathValidatorException.BasicReason} enumeration. * * @since 1.7 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PolicyNode.java --- a/jdk/src/share/classes/java/security/cert/PolicyNode.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PolicyNode.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,7 +41,7 @@ * *

      Most applications will not need to examine the valid policy tree. * They can achieve their policy processing goals by setting the - * policy-related parameters in PKIXParameters. However, + * policy-related parameters in {@code PKIXParameters}. However, * the valid policy tree is available for more sophisticated applications, * especially those that process policy qualifiers. * @@ -50,12 +50,12 @@ * valid policy tree. The tree can be traversed using the * {@link #getChildren getChildren} and {@link #getParent getParent} methods. * Data about a particular node can be retrieved using other methods of - * PolicyNode. + * {@code PolicyNode}. * *

      Concurrent Access - *

      All PolicyNode objects must be immutable and + *

      All {@code PolicyNode} objects must be immutable and * thread-safe. Multiple threads may concurrently invoke the methods defined - * in this class on a single PolicyNode object (or more than one) + * in this class on a single {@code PolicyNode} object (or more than one) * with no ill effects. This stipulation applies to all public fields and * methods of this class and any added or overridden by subclasses. * @@ -65,10 +65,10 @@ public interface PolicyNode { /** - * Returns the parent of this node, or null if this is the + * Returns the parent of this node, or {@code null} if this is the * root node. * - * @return the parent of this node, or null if this is the + * @return the parent of this node, or {@code null} if this is the * root node */ PolicyNode getParent(); @@ -76,8 +76,8 @@ /** * Returns an iterator over the children of this node. Any attempts to * modify the children of this node through the - * Iterator's remove method must throw an - * UnsupportedOperationException. + * {@code Iterator}'s remove method must throw an + * {@code UnsupportedOperationException}. * * @return an iterator over the children of this node */ @@ -94,7 +94,7 @@ /** * Returns the valid policy represented by this node. * - * @return the String OID of the valid policy + * @return the {@code String} OID of the valid policy * represented by this node. For the root node, this method always returns * the special anyPolicy OID: "2.5.29.32.0". */ @@ -104,9 +104,9 @@ * Returns the set of policy qualifiers associated with the * valid policy represented by this node. * - * @return an immutable Set of - * PolicyQualifierInfos. For the root node, this - * is always an empty Set. + * @return an immutable {@code Set} of + * {@code PolicyQualifierInfo}s. For the root node, this + * is always an empty {@code Set}. */ Set getPolicyQualifiers(); @@ -114,9 +114,9 @@ * Returns the set of expected policies that would satisfy this * node's valid policy in the next certificate to be processed. * - * @return an immutable Set of expected policy - * String OIDs. For the root node, this method - * always returns a Set with one element, the + * @return an immutable {@code Set} of expected policy + * {@code String} OIDs. For the root node, this method + * always returns a {@code Set} with one element, the * special anyPolicy OID: "2.5.29.32.0". */ Set getExpectedPolicies(); @@ -125,8 +125,8 @@ * Returns the criticality indicator of the certificate policy extension * in the most recently processed certificate. * - * @return true if extension marked critical, - * false otherwise. For the root node, false + * @return {@code true} if extension marked critical, + * {@code false} otherwise. For the root node, {@code false} * is always returned. */ boolean isCritical(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java --- a/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/PolicyQualifierInfo.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,12 +50,12 @@ * policy information terms limit the set of policies for certification paths * which include this certificate. *

      - * A Set of PolicyQualifierInfo objects are returned + * A {@code Set} of {@code PolicyQualifierInfo} objects are returned * by the {@link PolicyNode#getPolicyQualifiers PolicyNode.getPolicyQualifiers} * method. This allows applications with specific policy requirements to * process and validate each policy qualifier. Applications that need to * process policy qualifiers should explicitly set the - * policyQualifiersRejected flag to false (by calling the + * {@code policyQualifiersRejected} flag to false (by calling the * {@link PKIXParameters#setPolicyQualifiersRejected * PKIXParameters.setPolicyQualifiersRejected} method) before validating * a certification path. @@ -64,17 +64,17 @@ * that any policy qualifier in a certificate policies extension that is * marked critical must be processed and validated. Otherwise the * certification path must be rejected. If the - * policyQualifiersRejected flag is set to false, it is up to + * {@code policyQualifiersRejected} flag is set to false, it is up to * the application to validate all policy qualifiers in this manner in order * to be PKIX compliant. * *

      Concurrent Access * - *

      All PolicyQualifierInfo objects must be immutable and + *

      All {@code PolicyQualifierInfo} objects must be immutable and * thread-safe. That is, multiple threads may concurrently invoke the - * methods defined in this class on a single PolicyQualifierInfo + * methods defined in this class on a single {@code PolicyQualifierInfo} * object (or more than one) with no ill effects. Requiring - * PolicyQualifierInfo objects to be immutable and thread-safe + * {@code PolicyQualifierInfo} objects to be immutable and thread-safe * allows them to be passed around to various pieces of code without * worrying about coordinating access. * @@ -90,7 +90,7 @@ private String pqiString; /** - * Creates an instance of PolicyQualifierInfo from the + * Creates an instance of {@code PolicyQualifierInfo} from the * encoded bytes. The encoded byte array is copied on construction. * * @param encoded a byte array containing the qualifier in DER encoding @@ -115,12 +115,12 @@ } /** - * Returns the policyQualifierId field of this - * PolicyQualifierInfo. The policyQualifierId + * Returns the {@code policyQualifierId} field of this + * {@code PolicyQualifierInfo}. The {@code policyQualifierId} * is an Object Identifier (OID) represented by a set of nonnegative * integers separated by periods. * - * @return the OID (never null) + * @return the OID (never {@code null}) */ public final String getPolicyQualifierId() { return mId; @@ -128,9 +128,9 @@ /** * Returns the ASN.1 DER encoded form of this - * PolicyQualifierInfo. + * {@code PolicyQualifierInfo}. * - * @return the ASN.1 DER encoded bytes (never null). + * @return the ASN.1 DER encoded bytes (never {@code null}). * Note that a copy is returned, so the data is cloned each time * this method is called. */ @@ -139,10 +139,10 @@ } /** - * Returns the ASN.1 DER encoded form of the qualifier - * field of this PolicyQualifierInfo. + * Returns the ASN.1 DER encoded form of the {@code qualifier} + * field of this {@code PolicyQualifierInfo}. * - * @return the ASN.1 DER encoded bytes of the qualifier + * @return the ASN.1 DER encoded bytes of the {@code qualifier} * field. Note that a copy is returned, so the data is cloned each * time this method is called. */ @@ -152,10 +152,10 @@ /** * Return a printable representation of this - * PolicyQualifierInfo. + * {@code PolicyQualifierInfo}. * - * @return a String describing the contents of this - * PolicyQualifierInfo + * @return a {@code String} describing the contents of this + * {@code PolicyQualifierInfo} */ public String toString() { if (pqiString != null) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/TrustAnchor.java --- a/jdk/src/share/classes/java/security/cert/TrustAnchor.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/TrustAnchor.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,16 +40,16 @@ * for validating X.509 certification paths. A most-trusted CA includes the * public key of the CA, the CA's name, and any constraints upon the set of * paths which may be validated using this key. These parameters can be - * specified in the form of a trusted X509Certificate or as + * specified in the form of a trusted {@code X509Certificate} or as * individual parameters. *

      * Concurrent Access *

      - *

      All TrustAnchor objects must be immutable and + *

      All {@code TrustAnchor} objects must be immutable and * thread-safe. That is, multiple threads may concurrently invoke the - * methods defined in this class on a single TrustAnchor + * methods defined in this class on a single {@code TrustAnchor} * object (or more than one) with no ill effects. Requiring - * TrustAnchor objects to be immutable and thread-safe + * {@code TrustAnchor} objects to be immutable and thread-safe * allows them to be passed around to various pieces of code without * worrying about coordinating access. This stipulation applies to all * public fields and methods of this class and any added or overridden @@ -71,8 +71,8 @@ private NameConstraintsExtension nc; /** - * Creates an instance of TrustAnchor with the specified - * X509Certificate and optional name constraints, which + * Creates an instance of {@code TrustAnchor} with the specified + * {@code X509Certificate} and optional name constraints, which * are intended to be used as additional constraints when validating * an X.509 certification path. *

      @@ -82,7 +82,7 @@ * RFC 3280 * and X.509. The ASN.1 definition of this structure appears below. * - *

      
      +     * 
      {@code
            *  NameConstraints ::= SEQUENCE {
            *       permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
            *       excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
      @@ -106,20 +106,20 @@
            *       uniformResourceIdentifier       [6]     IA5String,
            *       iPAddress                       [7]     OCTET STRING,
            *       registeredID                    [8]     OBJECT IDENTIFIER}
      -     * 
      + * }
      *

      * Note that the name constraints byte array supplied is cloned to protect * against subsequent modifications. * - * @param trustedCert a trusted X509Certificate + * @param trustedCert a trusted {@code X509Certificate} * @param nameConstraints a byte array containing the ASN.1 DER encoding of * a NameConstraints extension to be used for checking name constraints. * Only the value of the extension is included, not the OID or criticality - * flag. Specify null to omit the parameter. + * flag. Specify {@code null} to omit the parameter. * @throws IllegalArgumentException if the name constraints cannot be * decoded * @throws NullPointerException if the specified - * X509Certificate is null + * {@code X509Certificate} is {@code null} */ public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints) { @@ -134,7 +134,7 @@ } /** - * Creates an instance of TrustAnchor where the + * Creates an instance of {@code TrustAnchor} where the * most-trusted CA is specified as an X500Principal and public key. * Name constraints are an optional parameter, and are intended to be used * as additional constraints when validating an X.509 certification path. @@ -155,9 +155,9 @@ * @param nameConstraints a byte array containing the ASN.1 DER encoding of * a NameConstraints extension to be used for checking name constraints. * Only the value of the extension is included, not the OID or criticality - * flag. Specify null to omit the parameter. - * @throws NullPointerException if the specified caPrincipal or - * pubKey parameter is null + * flag. Specify {@code null} to omit the parameter. + * @throws NullPointerException if the specified {@code caPrincipal} or + * {@code pubKey} parameter is {@code null} * @since 1.5 */ public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey, @@ -173,7 +173,7 @@ } /** - * Creates an instance of TrustAnchor where the + * Creates an instance of {@code TrustAnchor} where the * most-trusted CA is specified as a distinguished name and public key. * Name constraints are an optional parameter, and are intended to be used * as additional constraints when validating an X.509 certification path. @@ -191,17 +191,17 @@ * * @param caName the X.500 distinguished name of the most-trusted CA in * RFC 2253 - * String format + * {@code String} format * @param pubKey the public key of the most-trusted CA * @param nameConstraints a byte array containing the ASN.1 DER encoding of * a NameConstraints extension to be used for checking name constraints. * Only the value of the extension is included, not the OID or criticality - * flag. Specify null to omit the parameter. - * @throws IllegalArgumentException if the specified - * caName parameter is empty (caName.length() == 0) + * flag. Specify {@code null} to omit the parameter. + * @throws IllegalArgumentException if the specified + * {@code caName} parameter is empty {@code (caName.length() == 0)} * or incorrectly formatted or the name constraints cannot be decoded - * @throws NullPointerException if the specified caName or - * pubKey parameter is null + * @throws NullPointerException if the specified {@code caName} or + * {@code pubKey} parameter is {@code null} */ public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints) { @@ -225,7 +225,7 @@ /** * Returns the most-trusted CA certificate. * - * @return a trusted X509Certificate or null + * @return a trusted {@code X509Certificate} or {@code null} * if the trust anchor was not specified as a trusted certificate */ public final X509Certificate getTrustedCert() { @@ -236,7 +236,7 @@ * Returns the name of the most-trusted CA as an X500Principal. * * @return the X.500 distinguished name of the most-trusted CA, or - * null if the trust anchor was not specified as a trusted + * {@code null} if the trust anchor was not specified as a trusted * public key and name or X500Principal pair * @since 1.5 */ @@ -245,11 +245,11 @@ } /** - * Returns the name of the most-trusted CA in RFC 2253 String + * Returns the name of the most-trusted CA in RFC 2253 {@code String} * format. * * @return the X.500 distinguished name of the most-trusted CA, or - * null if the trust anchor was not specified as a trusted + * {@code null} if the trust anchor was not specified as a trusted * public key and name or X500Principal pair */ public final String getCAName() { @@ -259,7 +259,7 @@ /** * Returns the public key of the most-trusted CA. * - * @return the public key of the most-trusted CA, or null + * @return the public key of the most-trusted CA, or {@code null} * if the trust anchor was not specified as a trusted public key and name * or X500Principal pair */ @@ -306,16 +306,16 @@ * * @return a byte array containing the ASN.1 DER encoding of * a NameConstraints extension used for checking name constraints, - * or null if not set. + * or {@code null} if not set. */ public final byte [] getNameConstraints() { return ncBytes == null ? null : ncBytes.clone(); } /** - * Returns a formatted string describing the TrustAnchor. + * Returns a formatted string describing the {@code TrustAnchor}. * - * @return a formatted string describing the TrustAnchor + * @return a formatted string describing the {@code TrustAnchor} */ public String toString() { StringBuffer sb = new StringBuffer(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509CRL.java --- a/jdk/src/share/classes/java/security/cert/X509CRL.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509CRL.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,7 +72,7 @@ * RFC 3280: Internet X.509 * Public Key Infrastructure Certificate and CRL Profile. *

      - * The ASN.1 definition of tbsCertList is: + * The ASN.1 definition of {@code tbsCertList} is: *

        * TBSCertList  ::=  SEQUENCE  {
        *     version                 Version OPTIONAL,
      @@ -94,12 +94,12 @@
        * 

      * CRLs are instantiated using a certificate factory. The following is an * example of how to instantiate an X.509 CRL: - *

      
      + * 
      {@code
        * try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
        *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
        *     X509CRL crl = (X509CRL)cf.generateCRL(inStream);
        * }
      - * 
      + * }
      * * @author Hemma Prafullchandra * @@ -122,8 +122,8 @@ /** * Compares this CRL for equality with the given - * object. If the other object is an - * instanceof X509CRL, then + * object. If the {@code other} object is an + * {@code instanceof} {@code X509CRL}, then * its encoded form is retrieved and compared with the * encoded form of this CRL. * @@ -225,7 +225,7 @@ * * This method was added to version 1.8 of the Java Platform Standard * Edition. In order to maintain backwards compatibility with existing - * service providers, this method is not abstract + * service providers, this method is not {@code abstract} * and it provides a default implementation. * * @param key the PublicKey used to carry out the verification. @@ -245,11 +245,12 @@ } /** - * Gets the version (version number) value from the CRL. + * Gets the {@code version} (version number) value from the CRL. * The ASN.1 definition for this is: *
            * version    Version OPTIONAL,
      -     *             -- if present, must be v2

      + * -- if present, must be v2 + * * Version ::= INTEGER { v1(0), v2(1), v3(2) } * -- v3 does not apply to CRLs but appears for consistency * -- with definition of Version for certs @@ -261,12 +262,12 @@ /** * Denigrated, replaced by {@linkplain - * #getIssuerX500Principal()}. This method returns the issuer + * #getIssuerX500Principal()}. This method returns the {@code issuer} * as an implementation specific Principal object, which should not be * relied upon by portable code. * *

      - * Gets the issuer (issuer distinguished name) value from + * Gets the {@code issuer} (issuer distinguished name) value from * the CRL. The issuer name identifies the entity that signed (and * issued) the CRL. * @@ -287,14 +288,14 @@ * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY *

      - * The Name describes a hierarchical name composed of + * The {@code Name} describes a hierarchical name composed of * attributes, * such as country name, and corresponding values, such as US. - * The type of the AttributeValue component is determined by - * the AttributeType; in general it will be a - * directoryString. A directoryString is usually - * one of PrintableString, - * TeletexString or UniversalString. + * The type of the {@code AttributeValue} component is determined by + * the {@code AttributeType}; in general it will be a + * {@code directoryString}. A {@code directoryString} is usually + * one of {@code PrintableString}, + * {@code TeletexString} or {@code UniversalString}. * * @return a Principal whose name is the issuer distinguished name. */ @@ -302,11 +303,11 @@ /** * Returns the issuer (issuer distinguished name) value from the - * CRL as an X500Principal. + * CRL as an {@code X500Principal}. *

      * It is recommended that subclasses override this method. * - * @return an X500Principal representing the issuer + * @return an {@code X500Principal} representing the issuer * distinguished name * @since 1.4 */ @@ -318,7 +319,7 @@ } /** - * Gets the thisUpdate date from the CRL. + * Gets the {@code thisUpdate} date from the CRL. * The ASN.1 definition for this is: *

            * thisUpdate   ChoiceOfTime
      @@ -327,14 +328,14 @@
            *     generalTime    GeneralizedTime }
            * 
      * - * @return the thisUpdate date from the CRL. + * @return the {@code thisUpdate} date from the CRL. */ public abstract Date getThisUpdate(); /** - * Gets the nextUpdate date from the CRL. + * Gets the {@code nextUpdate} date from the CRL. * - * @return the nextUpdate date from the CRL, or null if + * @return the {@code nextUpdate} date from the CRL, or null if * not present. */ public abstract Date getNextUpdate(); @@ -388,7 +389,7 @@ /** * Gets the DER-encoded CRL information, the - * tbsCertList from this CRL. + * {@code tbsCertList} from this CRL. * This can be used to verify the signature independently. * * @return the DER-encoded CRL information. @@ -397,7 +398,7 @@ public abstract byte[] getTBSCertList() throws CRLException; /** - * Gets the signature value (the raw signature bits) from + * Gets the {@code signature} value (the raw signature bits) from * the CRL. * The ASN.1 definition for this is: *
      @@ -413,7 +414,8 @@
            * signature algorithm. An example is the string "SHA256withRSA".
            * The ASN.1 definition for this is:
            * 
      -     * signatureAlgorithm   AlgorithmIdentifier

      + * signatureAlgorithm AlgorithmIdentifier + * * AlgorithmIdentifier ::= SEQUENCE { * algorithm OBJECT IDENTIFIER, * parameters ANY DEFINED BY algorithm OPTIONAL } @@ -422,7 +424,7 @@ * -- algorithm object identifier value *

      * - *

      The algorithm name is determined from the algorithm + *

      The algorithm name is determined from the {@code algorithm} * OID string. * * @return the signature algorithm name. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509CRLEntry.java --- a/jdk/src/share/classes/java/security/cert/X509CRLEntry.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509CRLEntry.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,11 +43,11 @@ * crlEntryExtensions Extensions OPTIONAL * -- if present, must be v2 * } OPTIONAL - *

      + * * CertificateSerialNumber ::= INTEGER - *

      + * * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension - *

      + * * Extension ::= SEQUENCE { * extnId OBJECT IDENTIFIER, * critical BOOLEAN DEFAULT FALSE, @@ -68,8 +68,8 @@ /** * Compares this CRL entry for equality with the given - * object. If the other object is an - * instanceof X509CRLEntry, then + * object. If the {@code other} object is an + * {@code instanceof} {@code X509CRLEntry}, then * its encoded form (the inner SEQUENCE) is retrieved and compared * with the encoded form of this CRL entry. * @@ -178,7 +178,7 @@ * in the Reason Code extension of this CRL entry. * * @return the reason the certificate has been revoked, or - * null if this CRL entry does not have + * {@code null} if this CRL entry does not have * a Reason Code extension * @since 1.7 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509CRLSelector.java --- a/jdk/src/share/classes/java/security/cert/X509CRLSelector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509CRLSelector.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,18 +37,18 @@ import sun.security.x509.X500Name; /** - * A CRLSelector that selects X509CRLs that + * A {@code CRLSelector} that selects {@code X509CRLs} that * match all specified criteria. This class is particularly useful when - * selecting CRLs from a CertStore to check revocation status + * selecting CRLs from a {@code CertStore} to check revocation status * of a particular certificate. *

      - * When first constructed, an X509CRLSelector has no criteria - * enabled and each of the get methods return a default - * value (null). Therefore, the {@link #match match} method - * would return true for any X509CRL. Typically, + * When first constructed, an {@code X509CRLSelector} has no criteria + * enabled and each of the {@code get} methods return a default + * value ({@code null}). Therefore, the {@link #match match} method + * would return {@code true} for any {@code X509CRL}. Typically, * several criteria are enabled (by calling {@link #setIssuers setIssuers} * or {@link #setDateAndTime setDateAndTime}, for instance) and then the - * X509CRLSelector is passed to + * {@code X509CRLSelector} is passed to * {@link CertStore#getCRLs CertStore.getCRLs} or some similar * method. *

      @@ -86,35 +86,35 @@ private long skew = 0; /** - * Creates an X509CRLSelector. Initially, no criteria are set - * so any X509CRL will match. + * Creates an {@code X509CRLSelector}. Initially, no criteria are set + * so any {@code X509CRL} will match. */ public X509CRLSelector() {} /** * Sets the issuerNames criterion. The issuer distinguished name in the - * X509CRL must match at least one of the specified - * distinguished names. If null, any issuer distinguished name + * {@code X509CRL} must match at least one of the specified + * distinguished names. If {@code null}, any issuer distinguished name * will do. *

      * This method allows the caller to specify, with a single method call, - * the complete set of issuer names which X509CRLs may contain. + * the complete set of issuer names which {@code X509CRLs} may contain. * The specified value replaces the previous value for the issuerNames * criterion. *

      - * The names parameter (if not null) is a - * Collection of X500Principals. + * The {@code names} parameter (if not {@code null}) is a + * {@code Collection} of {@code X500Principal}s. *

      - * Note that the names parameter can contain duplicate + * Note that the {@code names} parameter can contain duplicate * distinguished names, but they may be removed from the - * Collection of names returned by the + * {@code Collection} of names returned by the * {@link #getIssuers getIssuers} method. *

      - * Note that a copy is performed on the Collection to + * Note that a copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @param issuers a Collection of X500Principals - * (or null) + * @param issuers a {@code Collection} of X500Principals + * (or {@code null}) * @see #getIssuers * @since 1.5 */ @@ -138,31 +138,31 @@ * this method. See {@link #addIssuerName(String)} for more information. *

      * Sets the issuerNames criterion. The issuer distinguished name in the - * X509CRL must match at least one of the specified - * distinguished names. If null, any issuer distinguished name + * {@code X509CRL} must match at least one of the specified + * distinguished names. If {@code null}, any issuer distinguished name * will do. *

      * This method allows the caller to specify, with a single method call, - * the complete set of issuer names which X509CRLs may contain. + * the complete set of issuer names which {@code X509CRLs} may contain. * The specified value replaces the previous value for the issuerNames * criterion. *

      - * The names parameter (if not null) is a - * Collection of names. Each name is a String + * The {@code names} parameter (if not {@code null}) is a + * {@code Collection} of names. Each name is a {@code String} * or a byte array representing a distinguished name (in * RFC 2253 or - * ASN.1 DER encoded form, respectively). If null is supplied + * ASN.1 DER encoded form, respectively). If {@code null} is supplied * as the value for this argument, no issuerNames check will be performed. *

      - * Note that the names parameter can contain duplicate + * Note that the {@code names} parameter can contain duplicate * distinguished names, but they may be removed from the - * Collection of names returned by the + * {@code Collection} of names returned by the * {@link #getIssuerNames getIssuerNames} method. *

      * If a name is specified as a byte array, it should contain a single DER * encoded distinguished name, as defined in X.501. The ASN.1 notation for * this structure is as follows. - *

      
      +     * 
      {@code
            * Name ::= CHOICE {
            *   RDNSequence }
            *
      @@ -185,12 +185,12 @@
            *       universalString         UniversalString (SIZE (1..MAX)),
            *       utf8String              UTF8String (SIZE (1.. MAX)),
            *       bmpString               BMPString (SIZE (1..MAX)) }
      -     * 
      + * }
      *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @param names a Collection of names (or null) + * @param names a {@code Collection} of names (or {@code null}) * @throws IOException if a parsing error occurs * @see #getIssuerNames */ @@ -208,11 +208,11 @@ /** * Adds a name to the issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified + * name in the {@code X509CRL} must match at least one of the specified * distinguished names. *

      * This method allows the caller to add a name to the set of issuer names - * which X509CRLs may contain. The specified name is added to + * which {@code X509CRLs} may contain. The specified name is added to * any previous value for the issuerNames criterion. * If the specified name is a duplicate, it may be ignored. * @@ -232,11 +232,11 @@ * names. *

      * Adds a name to the issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified + * name in the {@code X509CRL} must match at least one of the specified * distinguished names. *

      * This method allows the caller to add a name to the set of issuer names - * which X509CRLs may contain. The specified name is added to + * which {@code X509CRLs} may contain. The specified name is added to * any previous value for the issuerNames criterion. * If the specified name is a duplicate, it may be ignored. * @@ -249,11 +249,11 @@ /** * Adds a name to the issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified + * name in the {@code X509CRL} must match at least one of the specified * distinguished names. *

      * This method allows the caller to add a name to the set of issuer names - * which X509CRLs may contain. The specified name is added to + * which {@code X509CRLs} may contain. The specified name is added to * any previous value for the issuerNames criterion. If the specified name * is a duplicate, it may be ignored. * If a name is specified as a byte array, it should contain a single DER @@ -279,7 +279,7 @@ /** * A private method that adds a name (String or byte array) to the * issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified + * name in the {@code X509CRL} must match at least one of the specified * distinguished names. * * @param name the name in string or byte array form @@ -301,11 +301,11 @@ * Clone and check an argument of the form passed to * setIssuerNames. Throw an IOException if the argument is malformed. * - * @param names a Collection of names. Each entry is a + * @param names a {@code Collection} of names. Each entry is a * String or a byte array (the name, in string or ASN.1 - * DER encoded form, respectively). null is + * DER encoded form, respectively). {@code null} is * not an acceptable value. - * @return a deep copy of the specified Collection + * @return a deep copy of the specified {@code Collection} * @throws IOException if a parsing error occurs */ private static HashSet cloneAndCheckIssuerNames(Collection names) @@ -334,11 +334,11 @@ * into a RuntimeException. This method should be used when the object being * cloned has already been checked, so there should never be any exceptions. * - * @param names a Collection of names. Each entry is a + * @param names a {@code Collection} of names. Each entry is a * String or a byte array (the name, in string or ASN.1 - * DER encoded form, respectively). null is + * DER encoded form, respectively). {@code null} is * not an acceptable value. - * @return a deep copy of the specified Collection + * @return a deep copy of the specified {@code Collection} * @throws RuntimeException if a parsing error occurs */ private static HashSet cloneIssuerNames(Collection names) { @@ -354,7 +354,7 @@ * returning a Collection of issuerX500Principals. * Throw an IOException if the argument is malformed. * - * @param names a Collection of names. Each entry is a + * @param names a {@code Collection} of names. Each entry is a * String or a byte array (the name, in string or ASN.1 * DER encoded form, respectively). Null is * not an acceptable value. @@ -380,24 +380,24 @@ } /** - * Sets the minCRLNumber criterion. The X509CRL must have a + * Sets the minCRLNumber criterion. The {@code X509CRL} must have a * CRL number extension whose value is greater than or equal to the - * specified value. If null, no minCRLNumber check will be + * specified value. If {@code null}, no minCRLNumber check will be * done. * - * @param minCRL the minimum CRL number accepted (or null) + * @param minCRL the minimum CRL number accepted (or {@code null}) */ public void setMinCRLNumber(BigInteger minCRL) { this.minCRL = minCRL; } /** - * Sets the maxCRLNumber criterion. The X509CRL must have a + * Sets the maxCRLNumber criterion. The {@code X509CRL} must have a * CRL number extension whose value is less than or equal to the - * specified value. If null, no maxCRLNumber check will be + * specified value. If {@code null}, no maxCRLNumber check will be * done. * - * @param maxCRL the maximum CRL number accepted (or null) + * @param maxCRL the maximum CRL number accepted (or {@code null}) */ public void setMaxCRLNumber(BigInteger maxCRL) { this.maxCRL = maxCRL; @@ -406,16 +406,16 @@ /** * Sets the dateAndTime criterion. The specified date must be * equal to or later than the value of the thisUpdate component - * of the X509CRL and earlier than the value of the - * nextUpdate component. There is no match if the X509CRL + * of the {@code X509CRL} and earlier than the value of the + * nextUpdate component. There is no match if the {@code X509CRL} * does not contain a nextUpdate component. - * If null, no dateAndTime check will be done. + * If {@code null}, no dateAndTime check will be done. *

      - * Note that the Date supplied here is cloned to protect + * Note that the {@code Date} supplied here is cloned to protect * against subsequent modifications. * - * @param dateAndTime the Date to match against - * (or null) + * @param dateAndTime the {@code Date} to match against + * (or {@code null}) * @see #getDateAndTime */ public void setDateAndTime(Date dateAndTime) { @@ -438,13 +438,13 @@ /** * Sets the certificate being checked. This is not a criterion. Rather, - * it is optional information that may help a CertStore + * it is optional information that may help a {@code CertStore} * find CRLs that would be relevant when checking revocation for the - * specified certificate. If null is specified, then no + * specified certificate. If {@code null} is specified, then no * such optional information is provided. * - * @param cert the X509Certificate being checked - * (or null) + * @param cert the {@code X509Certificate} being checked + * (or {@code null}) * @see #getCertificateChecking */ public void setCertificateChecking(X509Certificate cert) { @@ -453,15 +453,15 @@ /** * Returns the issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified - * distinguished names. If the value returned is null, any + * name in the {@code X509CRL} must match at least one of the specified + * distinguished names. If the value returned is {@code null}, any * issuer distinguished name will do. *

      - * If the value returned is not null, it is a - * unmodifiable Collection of X500Principals. + * If the value returned is not {@code null}, it is a + * unmodifiable {@code Collection} of {@code X500Principal}s. * - * @return an unmodifiable Collection of names - * (or null) + * @return an unmodifiable {@code Collection} of names + * (or {@code null}) * @see #setIssuers * @since 1.5 */ @@ -474,25 +474,25 @@ /** * Returns a copy of the issuerNames criterion. The issuer distinguished - * name in the X509CRL must match at least one of the specified - * distinguished names. If the value returned is null, any + * name in the {@code X509CRL} must match at least one of the specified + * distinguished names. If the value returned is {@code null}, any * issuer distinguished name will do. *

      - * If the value returned is not null, it is a - * Collection of names. Each name is a String + * If the value returned is not {@code null}, it is a + * {@code Collection} of names. Each name is a {@code String} * or a byte array representing a distinguished name (in RFC 2253 or * ASN.1 DER encoded form, respectively). Note that the - * Collection returned may contain duplicate names. + * {@code Collection} returned may contain duplicate names. *

      * If a name is specified as a byte array, it should contain a single DER * encoded distinguished name, as defined in X.501. The ASN.1 notation for * this structure is given in the documentation for * {@link #setIssuerNames setIssuerNames(Collection names)}. *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @return a Collection of names (or null) + * @return a {@code Collection} of names (or {@code null}) * @see #setIssuerNames */ public Collection getIssuerNames() { @@ -503,23 +503,23 @@ } /** - * Returns the minCRLNumber criterion. The X509CRL must have a + * Returns the minCRLNumber criterion. The {@code X509CRL} must have a * CRL number extension whose value is greater than or equal to the - * specified value. If null, no minCRLNumber check will be done. + * specified value. If {@code null}, no minCRLNumber check will be done. * - * @return the minimum CRL number accepted (or null) + * @return the minimum CRL number accepted (or {@code null}) */ public BigInteger getMinCRL() { return minCRL; } /** - * Returns the maxCRLNumber criterion. The X509CRL must have a + * Returns the maxCRLNumber criterion. The {@code X509CRL} must have a * CRL number extension whose value is less than or equal to the - * specified value. If null, no maxCRLNumber check will be + * specified value. If {@code null}, no maxCRLNumber check will be * done. * - * @return the maximum CRL number accepted (or null) + * @return the maximum CRL number accepted (or {@code null}) */ public BigInteger getMaxCRL() { return maxCRL; @@ -528,15 +528,15 @@ /** * Returns the dateAndTime criterion. The specified date must be * equal to or later than the value of the thisUpdate component - * of the X509CRL and earlier than the value of the + * of the {@code X509CRL} and earlier than the value of the * nextUpdate component. There is no match if the - * X509CRL does not contain a nextUpdate component. - * If null, no dateAndTime check will be done. + * {@code X509CRL} does not contain a nextUpdate component. + * If {@code null}, no dateAndTime check will be done. *

      - * Note that the Date returned is cloned to protect against + * Note that the {@code Date} returned is cloned to protect against * subsequent modifications. * - * @return the Date to match against (or null) + * @return the {@code Date} to match against (or {@code null}) * @see #setDateAndTime */ public Date getDateAndTime() { @@ -547,12 +547,12 @@ /** * Returns the certificate being checked. This is not a criterion. Rather, - * it is optional information that may help a CertStore + * it is optional information that may help a {@code CertStore} * find CRLs that would be relevant when checking revocation for the - * specified certificate. If the value returned is null, then + * specified certificate. If the value returned is {@code null}, then * no such optional information is provided. * - * @return the certificate being checked (or null) + * @return the certificate being checked (or {@code null}) * @see #setCertificateChecking */ public X509Certificate getCertificateChecking() { @@ -560,10 +560,10 @@ } /** - * Returns a printable representation of the X509CRLSelector. + * Returns a printable representation of the {@code X509CRLSelector}. * - * @return a String describing the contents of the - * X509CRLSelector. + * @return a {@code String} describing the contents of the + * {@code X509CRLSelector}. */ public String toString() { StringBuffer sb = new StringBuffer(); @@ -587,11 +587,11 @@ } /** - * Decides whether a CRL should be selected. + * Decides whether a {@code CRL} should be selected. * - * @param crl the CRL to be checked - * @return true if the CRL should be selected, - * false otherwise + * @param crl the {@code CRL} to be checked + * @return {@code true} if the {@code CRL} should be selected, + * {@code false} otherwise */ public boolean match(CRL crl) { if (!(crl instanceof X509CRL)) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509CertSelector.java --- a/jdk/src/share/classes/java/security/cert/X509CertSelector.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509CertSelector.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,27 +39,27 @@ import sun.security.x509.*; /** - * A CertSelector that selects X509Certificates that + * A {@code CertSelector} that selects {@code X509Certificates} that * match all specified criteria. This class is particularly useful when - * selecting certificates from a CertStore to build a + * selecting certificates from a {@code CertStore} to build a * PKIX-compliant certification path. *

      - * When first constructed, an X509CertSelector has no criteria - * enabled and each of the get methods return a default value - * (null, or -1 for the {@link #getBasicConstraints + * When first constructed, an {@code X509CertSelector} has no criteria + * enabled and each of the {@code get} methods return a default value + * ({@code null}, or {@code -1} for the {@link #getBasicConstraints * getBasicConstraints} method). Therefore, the {@link #match match} - * method would return true for any X509Certificate. + * method would return {@code true} for any {@code X509Certificate}. * Typically, several criteria are enabled (by calling * {@link #setIssuer setIssuer} or * {@link #setKeyUsage setKeyUsage}, for instance) and then the - * X509CertSelector is passed to + * {@code X509CertSelector} is passed to * {@link CertStore#getCertificates CertStore.getCertificates} or some similar * method. *

      * Several criteria can be enabled (by calling {@link #setIssuer setIssuer} * and {@link #setSerialNumber setSerialNumber}, - * for example) such that the match method - * usually uniquely matches a single X509Certificate. We say + * for example) such that the {@code match} method + * usually uniquely matches a single {@code X509Certificate}. We say * usually, since it is possible for two issuing CAs to have the same * distinguished name and each issue a certificate with the same serial * number. Other unique combinations include the issuer, subject, @@ -149,8 +149,8 @@ static final int NAME_OID = 8; /** - * Creates an X509CertSelector. Initially, no criteria are set - * so any X509Certificate will match. + * Creates an {@code X509CertSelector}. Initially, no criteria are set + * so any {@code X509Certificate} will match. */ public X509CertSelector() { // empty @@ -158,17 +158,17 @@ /** * Sets the certificateEquals criterion. The specified - * X509Certificate must be equal to the - * X509Certificate passed to the match method. - * If null, then this check is not applied. + * {@code X509Certificate} must be equal to the + * {@code X509Certificate} passed to the {@code match} method. + * If {@code null}, then this check is not applied. * *

      This method is particularly useful when it is necessary to * match a single certificate. Although other criteria can be specified * in conjunction with the certificateEquals criterion, it is usually not * practical or necessary. * - * @param cert the X509Certificate to match (or - * null) + * @param cert the {@code X509Certificate} to match (or + * {@code null}) * @see #getCertificate */ public void setCertificate(X509Certificate cert) { @@ -178,11 +178,11 @@ /** * Sets the serialNumber criterion. The specified serial number * must match the certificate serial number in the - * X509Certificate. If null, any certificate + * {@code X509Certificate}. If {@code null}, any certificate * serial number will do. * * @param serial the certificate serial number to match - * (or null) + * (or {@code null}) * @see #getSerialNumber */ public void setSerialNumber(BigInteger serial) { @@ -192,11 +192,11 @@ /** * Sets the issuer criterion. The specified distinguished name * must match the issuer distinguished name in the - * X509Certificate. If null, any issuer + * {@code X509Certificate}. If {@code null}, any issuer * distinguished name will do. * * @param issuer a distinguished name as X500Principal - * (or null) + * (or {@code null}) * @since 1.5 */ public void setIssuer(X500Principal issuer) { @@ -213,14 +213,14 @@ *

      * Sets the issuer criterion. The specified distinguished name * must match the issuer distinguished name in the - * X509Certificate. If null, any issuer + * {@code X509Certificate}. If {@code null}, any issuer * distinguished name will do. *

      - * If issuerDN is not null, it should contain a + * If {@code issuerDN} is not {@code null}, it should contain a * distinguished name, in RFC 2253 format. * * @param issuerDN a distinguished name in RFC 2253 format - * (or null) + * (or {@code null}) * @throws IOException if a parsing error occurs (incorrect form for DN) */ public void setIssuer(String issuerDN) throws IOException { @@ -234,14 +234,14 @@ /** * Sets the issuer criterion. The specified distinguished name * must match the issuer distinguished name in the - * X509Certificate. If null is specified, + * {@code X509Certificate}. If {@code null} is specified, * the issuer criterion is disabled and any issuer distinguished name will * do. *

      - * If issuerDN is not null, it should contain a + * If {@code issuerDN} is not {@code null}, it should contain a * single DER encoded distinguished name, as defined in X.501. The ASN.1 * notation for this structure is as follows. - *

      
      +     * 
      {@code
            * Name ::= CHOICE {
            *   RDNSequence }
            *
      @@ -264,13 +264,13 @@
            *       universalString         UniversalString (SIZE (1..MAX)),
            *       utf8String              UTF8String (SIZE (1.. MAX)),
            *       bmpString               BMPString (SIZE (1..MAX)) }
      -     * 
      + * }
      *

      * Note that the byte array specified here is cloned to protect against * subsequent modifications. * * @param issuerDN a byte array containing the distinguished name - * in ASN.1 DER encoded form (or null) + * in ASN.1 DER encoded form (or {@code null}) * @throws IOException if an encoding error occurs (incorrect form for DN) */ public void setIssuer(byte[] issuerDN) throws IOException { @@ -284,11 +284,11 @@ /** * Sets the subject criterion. The specified distinguished name * must match the subject distinguished name in the - * X509Certificate. If null, any subject + * {@code X509Certificate}. If {@code null}, any subject * distinguished name will do. * * @param subject a distinguished name as X500Principal - * (or null) + * (or {@code null}) * @since 1.5 */ public void setSubject(X500Principal subject) { @@ -304,14 +304,14 @@ *

      * Sets the subject criterion. The specified distinguished name * must match the subject distinguished name in the - * X509Certificate. If null, any subject + * {@code X509Certificate}. If {@code null}, any subject * distinguished name will do. *

      - * If subjectDN is not null, it should contain a + * If {@code subjectDN} is not {@code null}, it should contain a * distinguished name, in RFC 2253 format. * * @param subjectDN a distinguished name in RFC 2253 format - * (or null) + * (or {@code null}) * @throws IOException if a parsing error occurs (incorrect form for DN) */ public void setSubject(String subjectDN) throws IOException { @@ -325,16 +325,16 @@ /** * Sets the subject criterion. The specified distinguished name * must match the subject distinguished name in the - * X509Certificate. If null, any subject + * {@code X509Certificate}. If {@code null}, any subject * distinguished name will do. *

      - * If subjectDN is not null, it should contain a + * If {@code subjectDN} is not {@code null}, it should contain a * single DER encoded distinguished name, as defined in X.501. For the ASN.1 * notation for this structure, see * {@link #setIssuer(byte [] issuerDN) setIssuer(byte [] issuerDN)}. * * @param subjectDN a byte array containing the distinguished name in - * ASN.1 DER format (or null) + * ASN.1 DER format (or {@code null}) * @throws IOException if an encoding error occurs (incorrect form for DN) */ public void setSubject(byte[] subjectDN) throws IOException { @@ -347,34 +347,34 @@ /** * Sets the subjectKeyIdentifier criterion. The - * X509Certificate must contain a SubjectKeyIdentifier + * {@code X509Certificate} must contain a SubjectKeyIdentifier * extension for which the contents of the extension * matches the specified criterion value. - * If the criterion value is null, no + * If the criterion value is {@code null}, no * subjectKeyIdentifier check will be done. *

      - * If subjectKeyID is not null, it + * If {@code subjectKeyID} is not {@code null}, it * should contain a single DER encoded value corresponding to the contents * of the extension value (not including the object identifier, * criticality setting, and encapsulating OCTET STRING) * for a SubjectKeyIdentifier extension. * The ASN.1 notation for this structure follows. *

      - *

      
      +     * 
      {@code
            * SubjectKeyIdentifier ::= KeyIdentifier
            *
            * KeyIdentifier ::= OCTET STRING
      -     * 
      + * }
      *

      * Since the format of subject key identifiers is not mandated by * any standard, subject key identifiers are not parsed by the - * X509CertSelector. Instead, the values are compared using + * {@code X509CertSelector}. Instead, the values are compared using * a byte-by-byte comparison. *

      * Note that the byte array supplied here is cloned to protect against * subsequent modifications. * - * @param subjectKeyID the subject key identifier (or null) + * @param subjectKeyID the subject key identifier (or {@code null}) * @see #getSubjectKeyIdentifier */ public void setSubjectKeyIdentifier(byte[] subjectKeyID) { @@ -387,46 +387,46 @@ /** * Sets the authorityKeyIdentifier criterion. The - * X509Certificate must contain an + * {@code X509Certificate} must contain an * AuthorityKeyIdentifier extension for which the contents of the * extension value matches the specified criterion value. - * If the criterion value is null, no + * If the criterion value is {@code null}, no * authorityKeyIdentifier check will be done. *

      - * If authorityKeyID is not null, it + * If {@code authorityKeyID} is not {@code null}, it * should contain a single DER encoded value corresponding to the contents * of the extension value (not including the object identifier, * criticality setting, and encapsulating OCTET STRING) * for an AuthorityKeyIdentifier extension. * The ASN.1 notation for this structure follows. *

      - *

      
      +     * 
      {@code
            * AuthorityKeyIdentifier ::= SEQUENCE {
            *    keyIdentifier             [0] KeyIdentifier           OPTIONAL,
            *    authorityCertIssuer       [1] GeneralNames            OPTIONAL,
            *    authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL  }
            *
            * KeyIdentifier ::= OCTET STRING
      -     * 
      + * }
      *

      * Authority key identifiers are not parsed by the - * X509CertSelector. Instead, the values are + * {@code X509CertSelector}. Instead, the values are * compared using a byte-by-byte comparison. *

      - * When the keyIdentifier field of - * AuthorityKeyIdentifier is populated, the value is - * usually taken from the SubjectKeyIdentifier extension + * When the {@code keyIdentifier} field of + * {@code AuthorityKeyIdentifier} is populated, the value is + * usually taken from the {@code SubjectKeyIdentifier} extension * in the issuer's certificate. Note, however, that the result of - * X509Certificate.getExtensionValue(<SubjectKeyIdentifier Object - * Identifier>) on the issuer's certificate may NOT be used - * directly as the input to setAuthorityKeyIdentifier. + * {@code X509Certificate.getExtensionValue()} on the issuer's certificate may NOT be used + * directly as the input to {@code setAuthorityKeyIdentifier}. * This is because the SubjectKeyIdentifier contains * only a KeyIdentifier OCTET STRING, and not a SEQUENCE of * KeyIdentifier, GeneralNames, and CertificateSerialNumber. * In order to use the extension value of the issuer certificate's - * SubjectKeyIdentifier + * {@code SubjectKeyIdentifier} * extension, it will be necessary to extract the value of the embedded - * KeyIdentifier OCTET STRING, then DER encode this OCTET + * {@code KeyIdentifier} OCTET STRING, then DER encode this OCTET * STRING inside a SEQUENCE. * For more details on SubjectKeyIdentifier, see * {@link #setSubjectKeyIdentifier(byte[] subjectKeyID)}. @@ -435,7 +435,7 @@ * subsequent modifications. * * @param authorityKeyID the authority key identifier - * (or null) + * (or {@code null}) * @see #getAuthorityKeyIdentifier */ public void setAuthorityKeyIdentifier(byte[] authorityKeyID) { @@ -449,13 +449,13 @@ /** * Sets the certificateValid criterion. The specified date must fall * within the certificate validity period for the - * X509Certificate. If null, no certificateValid + * {@code X509Certificate}. If {@code null}, no certificateValid * check will be done. *

      - * Note that the Date supplied here is cloned to protect + * Note that the {@code Date} supplied here is cloned to protect * against subsequent modifications. * - * @param certValid the Date to check (or null) + * @param certValid the {@code Date} to check (or {@code null}) * @see #getCertificateValid */ public void setCertificateValid(Date certValid) { @@ -469,14 +469,14 @@ /** * Sets the privateKeyValid criterion. The specified date must fall * within the private key validity period for the - * X509Certificate. If null, no privateKeyValid + * {@code X509Certificate}. If {@code null}, no privateKeyValid * check will be done. *

      - * Note that the Date supplied here is cloned to protect + * Note that the {@code Date} supplied here is cloned to protect * against subsequent modifications. * - * @param privateKeyValid the Date to check (or - * null) + * @param privateKeyValid the {@code Date} to check (or + * {@code null}) * @see #getPrivateKeyValid */ public void setPrivateKeyValid(Date privateKeyValid) { @@ -489,12 +489,12 @@ /** * Sets the subjectPublicKeyAlgID criterion. The - * X509Certificate must contain a subject public key - * with the specified algorithm. If null, no + * {@code X509Certificate} must contain a subject public key + * with the specified algorithm. If {@code null}, no * subjectPublicKeyAlgID check will be done. * * @param oid The object identifier (OID) of the algorithm to check - * for (or null). An OID is represented by a + * for (or {@code null}). An OID is represented by a * set of nonnegative integers separated by periods. * @throws IOException if the OID is invalid, such as * the first component being not 0, 1 or 2 or the second component @@ -512,10 +512,10 @@ /** * Sets the subjectPublicKey criterion. The - * X509Certificate must contain the specified subject public - * key. If null, no subjectPublicKey check will be done. + * {@code X509Certificate} must contain the specified subject public + * key. If {@code null}, no subjectPublicKey check will be done. * - * @param key the subject public key to check for (or null) + * @param key the subject public key to check for (or {@code null}) * @see #getSubjectPublicKey */ public void setSubjectPublicKey(PublicKey key) { @@ -529,17 +529,17 @@ } /** - * Sets the subjectPublicKey criterion. The X509Certificate - * must contain the specified subject public key. If null, + * Sets the subjectPublicKey criterion. The {@code X509Certificate} + * must contain the specified subject public key. If {@code null}, * no subjectPublicKey check will be done. *

      * Because this method allows the public key to be specified as a byte * array, it may be used for unknown key types. *

      - * If key is not null, it should contain a + * If {@code key} is not {@code null}, it should contain a * single DER encoded SubjectPublicKeyInfo structure, as defined in X.509. * The ASN.1 notation for this structure is as follows. - *

      
      +     * 
      {@code
            * SubjectPublicKeyInfo  ::=  SEQUENCE  {
            *   algorithm            AlgorithmIdentifier,
            *   subjectPublicKey     BIT STRING  }
      @@ -550,13 +550,13 @@
            *                              -- contains a value of the type
            *                              -- registered for use with the
            *                              -- algorithm object identifier value
      -     * 
      + * }
      *

      * Note that the byte array supplied here is cloned to protect against * subsequent modifications. * * @param key a byte array containing the subject public key in ASN.1 DER - * form (or null) + * form (or {@code null}) * @throws IOException if an encoding error occurs (incorrect form for * subject public key) * @see #getSubjectPublicKey @@ -572,9 +572,9 @@ } /** - * Sets the keyUsage criterion. The X509Certificate - * must allow the specified keyUsage values. If null, no - * keyUsage check will be done. Note that an X509Certificate + * Sets the keyUsage criterion. The {@code X509Certificate} + * must allow the specified keyUsage values. If {@code null}, no + * keyUsage check will be done. Note that an {@code X509Certificate} * that has no keyUsage extension implicitly allows all keyUsage values. *

      * Note that the boolean array supplied here is cloned to protect against @@ -583,7 +583,7 @@ * @param keyUsage a boolean array in the same format as the boolean * array returned by * {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}. - * Or null. + * Or {@code null}. * @see #getKeyUsage */ public void setKeyUsage(boolean[] keyUsage) { @@ -595,18 +595,18 @@ } /** - * Sets the extendedKeyUsage criterion. The X509Certificate + * Sets the extendedKeyUsage criterion. The {@code X509Certificate} * must allow the specified key purposes in its extended key usage - * extension. If keyPurposeSet is empty or null, + * extension. If {@code keyPurposeSet} is empty or {@code null}, * no extendedKeyUsage check will be done. Note that an - * X509Certificate that has no extendedKeyUsage extension + * {@code X509Certificate} that has no extendedKeyUsage extension * implicitly allows all key purposes. *

      - * Note that the Set is cloned to protect against + * Note that the {@code Set} is cloned to protect against * subsequent modifications. * - * @param keyPurposeSet a Set of key purpose OIDs in string - * format (or null). Each OID is represented by a set of + * @param keyPurposeSet a {@code Set} of key purpose OIDs in string + * format (or {@code null}). Each OID is represented by a set of * nonnegative integers separated by periods. * @throws IOException if the OID is invalid, such as * the first component being not 0, 1 or 2 or the second component @@ -632,15 +632,15 @@ * specified in the {@link #setSubjectAlternativeNames * setSubjectAlternativeNames} or {@link #addSubjectAlternativeName * addSubjectAlternativeName} methods. If enabled, - * the X509Certificate must contain all of the + * the {@code X509Certificate} must contain all of the * specified subject alternative names. If disabled, the - * X509Certificate must contain at least one of the + * {@code X509Certificate} must contain at least one of the * specified subject alternative names. * - *

      The matchAllNames flag is true by default. + *

      The matchAllNames flag is {@code true} by default. * - * @param matchAllNames if true, the flag is enabled; - * if false, the flag is disabled. + * @param matchAllNames if {@code true}, the flag is enabled; + * if {@code false}, the flag is disabled. * @see #getMatchAllSubjectAltNames */ public void setMatchAllSubjectAltNames(boolean matchAllNames) { @@ -649,7 +649,7 @@ /** * Sets the subjectAlternativeNames criterion. The - * X509Certificate must contain all or at least one of the + * {@code X509Certificate} must contain all or at least one of the * specified subjectAlternativeNames, depending on the value of * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames * setMatchAllSubjectAltNames}). @@ -659,19 +659,19 @@ * subjectAlternativeNames criterion. The specified value replaces * the previous value for the subjectAlternativeNames criterion. *

      - * The names parameter (if not null) is a - * Collection with one + * The {@code names} parameter (if not {@code null}) is a + * {@code Collection} with one * entry for each name to be included in the subject alternative name - * criterion. Each entry is a List whose first entry is an - * Integer (the name type, 0-8) and whose second - * entry is a String or a byte array (the name, in + * criterion. Each entry is a {@code List} whose first entry is an + * {@code Integer} (the name type, 0-8) and whose second + * entry is a {@code String} or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). - * There can be multiple names of the same type. If null + * There can be multiple names of the same type. If {@code null} * is supplied as the value for this argument, no * subjectAlternativeNames check will be performed. *

      - * Each subject alternative name in the Collection - * may be specified either as a String or as an ASN.1 encoded + * Each subject alternative name in the {@code Collection} + * may be specified either as a {@code String} or as an ASN.1 encoded * byte array. For more details about the formats used, see * {@link #addSubjectAlternativeName(int type, String name) * addSubjectAlternativeName(int type, String name)} and @@ -682,15 +682,15 @@ * array form instead of the String form. See the note in * {@link #addSubjectAlternativeName(int, String)} for more information. *

      - * Note that the names parameter can contain duplicate + * Note that the {@code names} parameter can contain duplicate * names (same name and name type), but they may be removed from the - * Collection of names returned by the + * {@code Collection} of names returned by the * {@link #getSubjectAlternativeNames getSubjectAlternativeNames} method. *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @param names a Collection of names (or null) + * @param names a {@code Collection} of names (or {@code null}) * @throws IOException if a parsing error occurs * @see #getSubjectAlternativeNames */ @@ -714,7 +714,7 @@ /** * Adds a name to the subjectAlternativeNames criterion. The - * X509Certificate must contain all or at least one + * {@code X509Certificate} must contain all or at least one * of the specified subjectAlternativeNames, depending on the value of * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames * setMatchAllSubjectAltNames}). @@ -747,7 +747,7 @@ * * @param type the name type (0-8, as specified in * RFC 3280, section 4.2.1.7) - * @param name the name in string form (not null) + * @param name the name in string form (not {@code null}) * @throws IOException if a parsing error occurs */ public void addSubjectAlternativeName(int type, String name) @@ -757,7 +757,7 @@ /** * Adds a name to the subjectAlternativeNames criterion. The - * X509Certificate must contain all or at least one + * {@code X509Certificate} must contain all or at least one * of the specified subjectAlternativeNames, depending on the value of * the matchAllNames flag (see {@link #setMatchAllSubjectAltNames * setMatchAllSubjectAltNames}). @@ -774,7 +774,7 @@ * the encoded value of the name, and should not include the tag associated * with the name in the GeneralName structure. The ASN.1 definition of this * structure appears below. - *

      
      +     * 
      {@code
            *  GeneralName ::= CHOICE {
            *       otherName                       [0]     OtherName,
            *       rfc822Name                      [1]     IA5String,
      @@ -785,7 +785,7 @@
            *       uniformResourceIdentifier       [6]     IA5String,
            *       iPAddress                       [7]     OCTET STRING,
            *       registeredID                    [8]     OBJECT IDENTIFIER}
      -     * 
      + * }
      *

      * Note that the byte array supplied here is cloned to protect against * subsequent modifications. @@ -802,7 +802,7 @@ /** * A private method that adds a name (String or byte array) to the - * subjectAlternativeNames criterion. The X509Certificate + * subjectAlternativeNames criterion. The {@code X509Certificate} * must contain the specified subjectAlternativeName. * * @param type the name type (0-8, as specified in @@ -829,19 +829,19 @@ /** * Parse an argument of the form passed to setSubjectAlternativeNames, - * returning a Collection of - * GeneralNameInterfaces. + * returning a {@code Collection} of + * {@code GeneralNameInterface}s. * Throw an IllegalArgumentException or a ClassCastException * if the argument is malformed. * * @param names a Collection with one entry per name. - * Each entry is a List whose first entry + * Each entry is a {@code List} whose first entry * is an Integer (the name type, 0-8) and whose second * entry is a String or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). * There can be multiple names of the same type. Null is * not an acceptable value. - * @return a Set of GeneralNameInterfaces + * @return a Set of {@code GeneralNameInterface}s * @throws IOException if a parsing error occurs */ private static Set parseNames(Collection> names) throws IOException { @@ -865,8 +865,8 @@ /** * Compare for equality two objects of the form passed to * setSubjectAlternativeNames (or X509CRLSelector.setIssuerNames). - * Throw an IllegalArgumentException or a - * ClassCastException if one of the objects is malformed. + * Throw an {@code IllegalArgumentException} or a + * {@code ClassCastException} if one of the objects is malformed. * * @param object1 a Collection containing the first object to compare * @param object2 a Collection containing the second object to compare @@ -880,7 +880,7 @@ } /** - * Make a GeneralNameInterface out of a name type (0-8) and an + * Make a {@code GeneralNameInterface} out of a name type (0-8) and an * Object that may be a byte array holding the ASN.1 DER encoded * name or a String form of the name. Except for X.509 * Distinguished Names, the String form of the name must not be the @@ -989,7 +989,7 @@ /** - * Sets the name constraints criterion. The X509Certificate + * Sets the name constraints criterion. The {@code X509Certificate} * must have subject and subject alternative names that * meet the specified name constraints. *

      @@ -998,7 +998,7 @@ * would appear in the NameConstraints structure defined in RFC 3280 * and X.509. The ASN.1 definition of this structure appears below. * - *

      
      +     * 
      {@code
            *  NameConstraints ::= SEQUENCE {
            *       permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
            *       excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
      @@ -1022,7 +1022,7 @@
            *       uniformResourceIdentifier       [6]     IA5String,
            *       iPAddress                       [7]     OCTET STRING,
            *       registeredID                    [8]     OBJECT IDENTIFIER}
      -     * 
      + * }
      *

      * Note that the byte array supplied here is cloned to protect against * subsequent modifications. @@ -1031,7 +1031,7 @@ * a NameConstraints extension to be used for checking * name constraints. Only the value of the extension is * included, not the OID or criticality flag. Can be - * null, + * {@code null}, * in which case no name constraints check will be performed. * @throws IOException if a parsing error occurs * @see #getNameConstraints @@ -1048,7 +1048,7 @@ /** * Sets the basic constraints constraint. If the value is greater than or - * equal to zero, X509Certificates must include a + * equal to zero, {@code X509Certificates} must include a * basicConstraints extension with * a pathLen of at least this value. If the value is -2, only end-entity * certificates are accepted. If the value is -1, no check is done. @@ -1070,18 +1070,18 @@ } /** - * Sets the policy constraint. The X509Certificate must + * Sets the policy constraint. The {@code X509Certificate} must * include at least one of the specified policies in its certificate - * policies extension. If certPolicySet is empty, then the - * X509Certificate must include at least some specified policy - * in its certificate policies extension. If certPolicySet is - * null, no policy check will be performed. + * policies extension. If {@code certPolicySet} is empty, then the + * {@code X509Certificate} must include at least some specified policy + * in its certificate policies extension. If {@code certPolicySet} is + * {@code null}, no policy check will be performed. *

      - * Note that the Set is cloned to protect against + * Note that the {@code Set} is cloned to protect against * subsequent modifications. * - * @param certPolicySet a Set of certificate policy OIDs in - * string format (or null). Each OID is + * @param certPolicySet a {@code Set} of certificate policy OIDs in + * string format (or {@code null}). Each OID is * represented by a set of nonnegative integers * separated by periods. * @throws IOException if a parsing error occurs on the OID such as @@ -1115,12 +1115,12 @@ } /** - * Sets the pathToNames criterion. The X509Certificate must + * Sets the pathToNames criterion. The {@code X509Certificate} must * not include name constraints that would prohibit building a * path to the specified names. *

      * This method allows the caller to specify, with a single method call, - * the complete set of names which the X509Certificates's + * the complete set of names which the {@code X509Certificates}'s * name constraints must permit. The specified value replaces * the previous value for the pathToNames criterion. *

      @@ -1129,19 +1129,19 @@ * built, any candidate certificate must not include name constraints that * would prohibit building a path to any of the names in the partial path. *

      - * The names parameter (if not null) is a - * Collection with one + * The {@code names} parameter (if not {@code null}) is a + * {@code Collection} with one * entry for each name to be included in the pathToNames - * criterion. Each entry is a List whose first entry is an - * Integer (the name type, 0-8) and whose second - * entry is a String or a byte array (the name, in + * criterion. Each entry is a {@code List} whose first entry is an + * {@code Integer} (the name type, 0-8) and whose second + * entry is a {@code String} or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). - * There can be multiple names of the same type. If null + * There can be multiple names of the same type. If {@code null} * is supplied as the value for this argument, no * pathToNames check will be performed. *

      - * Each name in the Collection - * may be specified either as a String or as an ASN.1 encoded + * Each name in the {@code Collection} + * may be specified either as a {@code String} or as an ASN.1 encoded * byte array. For more details about the formats used, see * {@link #addPathToName(int type, String name) * addPathToName(int type, String name)} and @@ -1152,16 +1152,16 @@ * array form instead of the String form. See the note in * {@link #addPathToName(int, String)} for more information. *

      - * Note that the names parameter can contain duplicate + * Note that the {@code names} parameter can contain duplicate * names (same name and name type), but they may be removed from the - * Collection of names returned by the + * {@code Collection} of names returned by the * {@link #getPathToNames getPathToNames} method. *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @param names a Collection with one entry per name - * (or null) + * @param names a {@code Collection} with one entry per name + * (or {@code null}) * @throws IOException if a parsing error occurs * @see #getPathToNames */ @@ -1186,12 +1186,12 @@ } /** - * Adds a name to the pathToNames criterion. The X509Certificate + * Adds a name to the pathToNames criterion. The {@code X509Certificate} * must not include name constraints that would prohibit building a * path to the specified name. *

      * This method allows the caller to add a name to the set of names which - * the X509Certificates's name constraints must permit. + * the {@code X509Certificates}'s name constraints must permit. * The specified name is added to any previous value for the * pathToNames criterion. If the name is a duplicate, it may be ignored. *

      @@ -1223,12 +1223,12 @@ } /** - * Adds a name to the pathToNames criterion. The X509Certificate + * Adds a name to the pathToNames criterion. The {@code X509Certificate} * must not include name constraints that would prohibit building a * path to the specified name. *

      * This method allows the caller to add a name to the set of names which - * the X509Certificates's name constraints must permit. + * the {@code X509Certificates}'s name constraints must permit. * The specified name is added to any previous value for the * pathToNames criterion. If the name is a duplicate, it may be ignored. *

      @@ -1254,7 +1254,7 @@ /** * A private method that adds a name (String or byte array) to the - * pathToNames criterion. The X509Certificate must contain + * pathToNames criterion. The {@code X509Certificate} must contain * the specified pathToName. * * @param type the name type (0-8, as specified in @@ -1279,11 +1279,11 @@ /** * Returns the certificateEquals criterion. The specified - * X509Certificate must be equal to the - * X509Certificate passed to the match method. - * If null, this check is not applied. + * {@code X509Certificate} must be equal to the + * {@code X509Certificate} passed to the {@code match} method. + * If {@code null}, this check is not applied. * - * @return the X509Certificate to match (or null) + * @return the {@code X509Certificate} to match (or {@code null}) * @see #setCertificate */ public X509Certificate getCertificate() { @@ -1293,11 +1293,11 @@ /** * Returns the serialNumber criterion. The specified serial number * must match the certificate serial number in the - * X509Certificate. If null, any certificate + * {@code X509Certificate}. If {@code null}, any certificate * serial number will do. * * @return the certificate serial number to match - * (or null) + * (or {@code null}) * @see #setSerialNumber */ public BigInteger getSerialNumber() { @@ -1305,13 +1305,13 @@ } /** - * Returns the issuer criterion as an X500Principal. This + * Returns the issuer criterion as an {@code X500Principal}. This * distinguished name must match the issuer distinguished name in the - * X509Certificate. If null, the issuer criterion + * {@code X509Certificate}. If {@code null}, the issuer criterion * is disabled and any issuer distinguished name will do. * * @return the required issuer distinguished name as X500Principal - * (or null) + * (or {@code null}) * @since 1.5 */ public X500Principal getIssuer() { @@ -1325,16 +1325,16 @@ * encoding information in the RFC 2253 String form of some distinguished * names. *

      - * Returns the issuer criterion as a String. This + * Returns the issuer criterion as a {@code String}. This * distinguished name must match the issuer distinguished name in the - * X509Certificate. If null, the issuer criterion + * {@code X509Certificate}. If {@code null}, the issuer criterion * is disabled and any issuer distinguished name will do. *

      - * If the value returned is not null, it is a + * If the value returned is not {@code null}, it is a * distinguished name, in RFC 2253 format. * * @return the required issuer distinguished name in RFC 2253 format - * (or null) + * (or {@code null}) */ public String getIssuerAsString() { return (issuer == null ? null : issuer.getName()); @@ -1343,10 +1343,10 @@ /** * Returns the issuer criterion as a byte array. This distinguished name * must match the issuer distinguished name in the - * X509Certificate. If null, the issuer criterion + * {@code X509Certificate}. If {@code null}, the issuer criterion * is disabled and any issuer distinguished name will do. *

      - * If the value returned is not null, it is a byte + * If the value returned is not {@code null}, it is a byte * array containing a single DER encoded distinguished name, as defined in * X.501. The ASN.1 notation for this structure is supplied in the * documentation for @@ -1356,7 +1356,7 @@ * subsequent modifications. * * @return a byte array containing the required issuer distinguished name - * in ASN.1 DER format (or null) + * in ASN.1 DER format (or {@code null}) * @throws IOException if an encoding error occurs */ public byte[] getIssuerAsBytes() throws IOException { @@ -1364,13 +1364,13 @@ } /** - * Returns the subject criterion as an X500Principal. This + * Returns the subject criterion as an {@code X500Principal}. This * distinguished name must match the subject distinguished name in the - * X509Certificate. If null, the subject criterion + * {@code X509Certificate}. If {@code null}, the subject criterion * is disabled and any subject distinguished name will do. * * @return the required subject distinguished name as X500Principal - * (or null) + * (or {@code null}) * @since 1.5 */ public X500Principal getSubject() { @@ -1384,16 +1384,16 @@ * encoding information in the RFC 2253 String form of some distinguished * names. *

      - * Returns the subject criterion as a String. This + * Returns the subject criterion as a {@code String}. This * distinguished name must match the subject distinguished name in the - * X509Certificate. If null, the subject criterion + * {@code X509Certificate}. If {@code null}, the subject criterion * is disabled and any subject distinguished name will do. *

      - * If the value returned is not null, it is a + * If the value returned is not {@code null}, it is a * distinguished name, in RFC 2253 format. * * @return the required subject distinguished name in RFC 2253 format - * (or null) + * (or {@code null}) */ public String getSubjectAsString() { return (subject == null ? null : subject.getName()); @@ -1402,10 +1402,10 @@ /** * Returns the subject criterion as a byte array. This distinguished name * must match the subject distinguished name in the - * X509Certificate. If null, the subject criterion + * {@code X509Certificate}. If {@code null}, the subject criterion * is disabled and any subject distinguished name will do. *

      - * If the value returned is not null, it is a byte + * If the value returned is not {@code null}, it is a byte * array containing a single DER encoded distinguished name, as defined in * X.501. The ASN.1 notation for this structure is supplied in the * documentation for @@ -1415,7 +1415,7 @@ * subsequent modifications. * * @return a byte array containing the required subject distinguished name - * in ASN.1 DER format (or null) + * in ASN.1 DER format (or {@code null}) * @throws IOException if an encoding error occurs */ public byte[] getSubjectAsBytes() throws IOException { @@ -1424,14 +1424,14 @@ /** * Returns the subjectKeyIdentifier criterion. The - * X509Certificate must contain a SubjectKeyIdentifier - * extension with the specified value. If null, no + * {@code X509Certificate} must contain a SubjectKeyIdentifier + * extension with the specified value. If {@code null}, no * subjectKeyIdentifier check will be done. *

      * Note that the byte array returned is cloned to protect against * subsequent modifications. * - * @return the key identifier (or null) + * @return the key identifier (or {@code null}) * @see #setSubjectKeyIdentifier */ public byte[] getSubjectKeyIdentifier() { @@ -1443,14 +1443,14 @@ /** * Returns the authorityKeyIdentifier criterion. The - * X509Certificate must contain a AuthorityKeyIdentifier - * extension with the specified value. If null, no + * {@code X509Certificate} must contain a AuthorityKeyIdentifier + * extension with the specified value. If {@code null}, no * authorityKeyIdentifier check will be done. *

      * Note that the byte array returned is cloned to protect against * subsequent modifications. * - * @return the key identifier (or null) + * @return the key identifier (or {@code null}) * @see #setAuthorityKeyIdentifier */ public byte[] getAuthorityKeyIdentifier() { @@ -1463,13 +1463,13 @@ /** * Returns the certificateValid criterion. The specified date must fall * within the certificate validity period for the - * X509Certificate. If null, no certificateValid + * {@code X509Certificate}. If {@code null}, no certificateValid * check will be done. *

      - * Note that the Date returned is cloned to protect against + * Note that the {@code Date} returned is cloned to protect against * subsequent modifications. * - * @return the Date to check (or null) + * @return the {@code Date} to check (or {@code null}) * @see #setCertificateValid */ public Date getCertificateValid() { @@ -1482,13 +1482,13 @@ /** * Returns the privateKeyValid criterion. The specified date must fall * within the private key validity period for the - * X509Certificate. If null, no privateKeyValid + * {@code X509Certificate}. If {@code null}, no privateKeyValid * check will be done. *

      - * Note that the Date returned is cloned to protect against + * Note that the {@code Date} returned is cloned to protect against * subsequent modifications. * - * @return the Date to check (or null) + * @return the {@code Date} to check (or {@code null}) * @see #setPrivateKeyValid */ public Date getPrivateKeyValid() { @@ -1500,12 +1500,12 @@ /** * Returns the subjectPublicKeyAlgID criterion. The - * X509Certificate must contain a subject public key - * with the specified algorithm. If null, no + * {@code X509Certificate} must contain a subject public key + * with the specified algorithm. If {@code null}, no * subjectPublicKeyAlgID check will be done. * * @return the object identifier (OID) of the signature algorithm to check - * for (or null). An OID is represented by a set of + * for (or {@code null}). An OID is represented by a set of * nonnegative integers separated by periods. * @see #setSubjectPublicKeyAlgID */ @@ -1518,10 +1518,10 @@ /** * Returns the subjectPublicKey criterion. The - * X509Certificate must contain the specified subject - * public key. If null, no subjectPublicKey check will be done. + * {@code X509Certificate} must contain the specified subject + * public key. If {@code null}, no subjectPublicKey check will be done. * - * @return the subject public key to check for (or null) + * @return the subject public key to check for (or {@code null}) * @see #setSubjectPublicKey */ public PublicKey getSubjectPublicKey() { @@ -1529,7 +1529,7 @@ } /** - * Returns the keyUsage criterion. The X509Certificate + * Returns the keyUsage criterion. The {@code X509Certificate} * must allow the specified keyUsage values. If null, no keyUsage * check will be done. *

      @@ -1539,7 +1539,7 @@ * @return a boolean array in the same format as the boolean * array returned by * {@link X509Certificate#getKeyUsage() X509Certificate.getKeyUsage()}. - * Or null. + * Or {@code null}. * @see #setKeyUsage */ public boolean[] getKeyUsage() { @@ -1550,15 +1550,15 @@ } /** - * Returns the extendedKeyUsage criterion. The X509Certificate + * Returns the extendedKeyUsage criterion. The {@code X509Certificate} * must allow the specified key purposes in its extended key usage - * extension. If the keyPurposeSet returned is empty or - * null, no extendedKeyUsage check will be done. Note that an - * X509Certificate that has no extendedKeyUsage extension + * extension. If the {@code keyPurposeSet} returned is empty or + * {@code null}, no extendedKeyUsage check will be done. Note that an + * {@code X509Certificate} that has no extendedKeyUsage extension * implicitly allows all key purposes. * - * @return an immutable Set of key purpose OIDs in string - * format (or null) + * @return an immutable {@code Set} of key purpose OIDs in string + * format (or {@code null}) * @see #setExtendedKeyUsage */ public Set getExtendedKeyUsage() { @@ -1566,19 +1566,19 @@ } /** - * Indicates if the X509Certificate must contain all + * Indicates if the {@code X509Certificate} must contain all * or at least one of the subjectAlternativeNames * specified in the {@link #setSubjectAlternativeNames * setSubjectAlternativeNames} or {@link #addSubjectAlternativeName - * addSubjectAlternativeName} methods. If true, - * the X509Certificate must contain all of the - * specified subject alternative names. If false, the - * X509Certificate must contain at least one of the + * addSubjectAlternativeName} methods. If {@code true}, + * the {@code X509Certificate} must contain all of the + * specified subject alternative names. If {@code false}, the + * {@code X509Certificate} must contain at least one of the * specified subject alternative names. * - * @return true if the flag is enabled; - * false if the flag is disabled. The flag is - * true by default. + * @return {@code true} if the flag is enabled; + * {@code false} if the flag is disabled. The flag is + * {@code true} by default. * @see #setMatchAllSubjectAltNames */ public boolean getMatchAllSubjectAltNames() { @@ -1587,35 +1587,35 @@ /** * Returns a copy of the subjectAlternativeNames criterion. - * The X509Certificate must contain all or at least one + * The {@code X509Certificate} must contain all or at least one * of the specified subjectAlternativeNames, depending on the value * of the matchAllNames flag (see {@link #getMatchAllSubjectAltNames * getMatchAllSubjectAltNames}). If the value returned is - * null, no subjectAlternativeNames check will be performed. + * {@code null}, no subjectAlternativeNames check will be performed. *

      - * If the value returned is not null, it is a - * Collection with + * If the value returned is not {@code null}, it is a + * {@code Collection} with * one entry for each name to be included in the subject alternative name - * criterion. Each entry is a List whose first entry is an - * Integer (the name type, 0-8) and whose second - * entry is a String or a byte array (the name, in + * criterion. Each entry is a {@code List} whose first entry is an + * {@code Integer} (the name type, 0-8) and whose second + * entry is a {@code String} or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). * There can be multiple names of the same type. Note that the - * Collection returned may contain duplicate names (same name + * {@code Collection} returned may contain duplicate names (same name * and name type). *

      - * Each subject alternative name in the Collection - * may be specified either as a String or as an ASN.1 encoded + * Each subject alternative name in the {@code Collection} + * may be specified either as a {@code String} or as an ASN.1 encoded * byte array. For more details about the formats used, see * {@link #addSubjectAlternativeName(int type, String name) * addSubjectAlternativeName(int type, String name)} and * {@link #addSubjectAlternativeName(int type, byte [] name) * addSubjectAlternativeName(int type, byte [] name)}. *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @return a Collection of names (or null) + * @return a {@code Collection} of names (or {@code null}) * @see #setSubjectAlternativeNames */ public Collection> getSubjectAlternativeNames() { @@ -1628,21 +1628,21 @@ /** * Clone an object of the form passed to * setSubjectAlternativeNames and setPathToNames. - * Throw a RuntimeException if the argument is malformed. + * Throw a {@code RuntimeException} if the argument is malformed. *

      * This method wraps cloneAndCheckNames, changing any - * IOException into a RuntimeException. This + * {@code IOException} into a {@code RuntimeException}. This * method should be used when the object being * cloned has already been checked, so there should never be any exceptions. * - * @param names a Collection with one entry per name. - * Each entry is a List whose first entry + * @param names a {@code Collection} with one entry per name. + * Each entry is a {@code List} whose first entry * is an Integer (the name type, 0-8) and whose second * entry is a String or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). * There can be multiple names of the same type. Null * is not an acceptable value. - * @return a deep copy of the specified Collection + * @return a deep copy of the specified {@code Collection} * @throws RuntimeException if a parsing error occurs */ private static Set> cloneNames(Collection> names) { @@ -1657,16 +1657,16 @@ /** * Clone and check an argument of the form passed to * setSubjectAlternativeNames and setPathToNames. - * Throw an IOException if the argument is malformed. + * Throw an {@code IOException} if the argument is malformed. * - * @param names a Collection with one entry per name. - * Each entry is a List whose first entry + * @param names a {@code Collection} with one entry per name. + * Each entry is a {@code List} whose first entry * is an Integer (the name type, 0-8) and whose second * entry is a String or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). * There can be multiple names of the same type. - * null is not an acceptable value. - * @return a deep copy of the specified Collection + * {@code null} is not an acceptable value. + * @return a deep copy of the specified {@code Collection} * @throws IOException if a parsing error occurs */ private static Set> cloneAndCheckNames(Collection> names) throws IOException { @@ -1709,7 +1709,7 @@ } /** - * Returns the name constraints criterion. The X509Certificate + * Returns the name constraints criterion. The {@code X509Certificate} * must have subject and subject alternative names that * meet the specified name constraints. *

      @@ -1725,7 +1725,7 @@ * * @return a byte array containing the ASN.1 DER encoding of * a NameConstraints extension used for checking name constraints. - * null if no name constraints check will be performed. + * {@code null} if no name constraints check will be performed. * @see #setNameConstraints */ public byte[] getNameConstraints() { @@ -1738,7 +1738,7 @@ /** * Returns the basic constraints constraint. If the value is greater than - * or equal to zero, the X509Certificates must include a + * or equal to zero, the {@code X509Certificates} must include a * basicConstraints extension with a pathLen of at least this value. * If the value is -2, only end-entity certificates are accepted. If * the value is -1, no basicConstraints check is done. @@ -1751,15 +1751,15 @@ } /** - * Returns the policy criterion. The X509Certificate must + * Returns the policy criterion. The {@code X509Certificate} must * include at least one of the specified policies in its certificate policies - * extension. If the Set returned is empty, then the - * X509Certificate must include at least some specified policy - * in its certificate policies extension. If the Set returned is - * null, no policy check will be performed. + * extension. If the {@code Set} returned is empty, then the + * {@code X509Certificate} must include at least some specified policy + * in its certificate policies extension. If the {@code Set} returned is + * {@code null}, no policy check will be performed. * - * @return an immutable Set of certificate policy OIDs in - * string format (or null) + * @return an immutable {@code Set} of certificate policy OIDs in + * string format (or {@code null}) * @see #setPolicy */ public Set getPolicy() { @@ -1768,33 +1768,33 @@ /** * Returns a copy of the pathToNames criterion. The - * X509Certificate must not include name constraints that would + * {@code X509Certificate} must not include name constraints that would * prohibit building a path to the specified names. If the value - * returned is null, no pathToNames check will be performed. + * returned is {@code null}, no pathToNames check will be performed. *

      - * If the value returned is not null, it is a - * Collection with one + * If the value returned is not {@code null}, it is a + * {@code Collection} with one * entry for each name to be included in the pathToNames - * criterion. Each entry is a List whose first entry is an - * Integer (the name type, 0-8) and whose second - * entry is a String or a byte array (the name, in + * criterion. Each entry is a {@code List} whose first entry is an + * {@code Integer} (the name type, 0-8) and whose second + * entry is a {@code String} or a byte array (the name, in * string or ASN.1 DER encoded form, respectively). * There can be multiple names of the same type. Note that the - * Collection returned may contain duplicate names (same + * {@code Collection} returned may contain duplicate names (same * name and name type). *

      - * Each name in the Collection - * may be specified either as a String or as an ASN.1 encoded + * Each name in the {@code Collection} + * may be specified either as a {@code String} or as an ASN.1 encoded * byte array. For more details about the formats used, see * {@link #addPathToName(int type, String name) * addPathToName(int type, String name)} and * {@link #addPathToName(int type, byte [] name) * addPathToName(int type, byte [] name)}. *

      - * Note that a deep copy is performed on the Collection to + * Note that a deep copy is performed on the {@code Collection} to * protect against subsequent modifications. * - * @return a Collection of names (or null) + * @return a {@code Collection} of names (or {@code null}) * @see #setPathToNames */ public Collection> getPathToNames() { @@ -1805,10 +1805,10 @@ } /** - * Return a printable representation of the CertSelector. + * Return a printable representation of the {@code CertSelector}. * - * @return a String describing the contents of the - * CertSelector + * @return a {@code String} describing the contents of the + * {@code CertSelector} */ public String toString() { StringBuffer sb = new StringBuffer(); @@ -1927,22 +1927,22 @@ /** * Returns an Extension object given any X509Certificate and extension oid. - * Throw an IOException if the extension byte value is + * Throw an {@code IOException} if the extension byte value is * malformed. * - * @param cert a X509Certificate - * @param extId an integer which specifies the extension index. + * @param cert a {@code X509Certificate} + * @param extId an {@code integer} which specifies the extension index. * Currently, the supported extensions are as follows: * index 0 - PrivateKeyUsageExtension * index 1 - SubjectAlternativeNameExtension * index 2 - NameConstraintsExtension * index 3 - CertificatePoliciesExtension * index 4 - ExtendedKeyUsageExtension - * @return an Extension object whose real type is as specified + * @return an {@code Extension} object whose real type is as specified * by the extension oid. - * @throws IOException if cannot construct the Extension + * @throws IOException if cannot construct the {@code Extension} * object with the extension encoding retrieved from the passed in - * X509Certificate. + * {@code X509Certificate}. */ private static Extension getExtensionObject(X509Certificate cert, int extId) throws IOException { @@ -1990,11 +1990,11 @@ } /** - * Decides whether a Certificate should be selected. + * Decides whether a {@code Certificate} should be selected. * - * @param cert the Certificate to be checked - * @return true if the Certificate should be - * selected, false otherwise + * @param cert the {@code Certificate} to be checked + * @return {@code true} if the {@code Certificate} should be + * selected, {@code false} otherwise */ public boolean match(Certificate cert) { if (!(cert instanceof X509Certificate)) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509Certificate.java --- a/jdk/src/share/classes/java/security/cert/X509Certificate.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509Certificate.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,7 +66,7 @@ * RFC 3280: Internet X.509 * Public Key Infrastructure Certificate and CRL Profile. *

      - * The ASN.1 definition of tbsCertificate is: + * The ASN.1 definition of {@code tbsCertificate} is: *

        * TBSCertificate  ::=  SEQUENCE  {
        *     version         [0]  EXPLICIT Version DEFAULT v1,
      @@ -126,10 +126,12 @@
            * is valid. It is defined in
            * ASN.1 as:
            * 
      -     * validity             Validity

      + * validity Validity + * * Validity ::= SEQUENCE { * notBefore CertificateValidityDate, - * notAfter CertificateValidityDate }

      + * notAfter CertificateValidityDate } + * * CertificateValidityDate ::= CHOICE { * utcTime UTCTime, * generalTime GeneralizedTime } @@ -151,9 +153,9 @@ * is valid at that date/time. * * @exception CertificateExpiredException if the certificate has expired - * with respect to the date supplied. + * with respect to the {@code date} supplied. * @exception CertificateNotYetValidException if the certificate is not - * yet valid with respect to the date supplied. + * yet valid with respect to the {@code date} supplied. * * @see #checkValidity() */ @@ -161,11 +163,12 @@ throws CertificateExpiredException, CertificateNotYetValidException; /** - * Gets the version (version number) value from the + * Gets the {@code version} (version number) value from the * certificate. * The ASN.1 definition for this is: *

      -     * version  [0] EXPLICIT Version DEFAULT v1

      + * version [0] EXPLICIT Version DEFAULT v1 + * * Version ::= INTEGER { v1(0), v2(1), v3(2) } *

      * @return the version number, i.e. 1, 2 or 3. @@ -173,14 +176,14 @@ public abstract int getVersion(); /** - * Gets the serialNumber value from the certificate. + * Gets the {@code serialNumber} value from the certificate. * The serial number is an integer assigned by the certification * authority to each certificate. It must be unique for each * certificate issued by a given CA (i.e., the issuer name and * serial number identify a unique certificate). * The ASN.1 definition for this is: *
      -     * serialNumber     CertificateSerialNumber

      + * serialNumber CertificateSerialNumber * * CertificateSerialNumber ::= INTEGER *

      @@ -191,12 +194,12 @@ /** * Denigrated, replaced by {@linkplain - * #getIssuerX500Principal()}. This method returns the issuer + * #getIssuerX500Principal()}. This method returns the {@code issuer} * as an implementation specific Principal object, which should not be * relied upon by portable code. * *

      - * Gets the issuer (issuer distinguished name) value from + * Gets the {@code issuer} (issuer distinguished name) value from * the certificate. The issuer name identifies the entity that signed (and * issued) the certificate. * @@ -204,7 +207,7 @@ * X.500 distinguished name (DN). * The ASN.1 definition for this is: *

      -     * issuer    Name

      + * issuer Name * * Name ::= CHOICE { RDNSequence } * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName @@ -217,14 +220,14 @@ * AttributeType ::= OBJECT IDENTIFIER * AttributeValue ::= ANY *

      - * The Name describes a hierarchical name composed of + * The {@code Name} describes a hierarchical name composed of * attributes, * such as country name, and corresponding values, such as US. - * The type of the AttributeValue component is determined by - * the AttributeType; in general it will be a - * directoryString. A directoryString is usually - * one of PrintableString, - * TeletexString or UniversalString. + * The type of the {@code AttributeValue} component is determined by + * the {@code AttributeType}; in general it will be a + * {@code directoryString}. A {@code directoryString} is usually + * one of {@code PrintableString}, + * {@code TeletexString} or {@code UniversalString}. * * @return a Principal whose name is the issuer distinguished name. */ @@ -232,11 +235,11 @@ /** * Returns the issuer (issuer distinguished name) value from the - * certificate as an X500Principal. + * certificate as an {@code X500Principal}. *

      * It is recommended that subclasses override this method. * - * @return an X500Principal representing the issuer + * @return an {@code X500Principal} representing the issuer * distinguished name * @since 1.4 */ @@ -249,22 +252,22 @@ /** * Denigrated, replaced by {@linkplain - * #getSubjectX500Principal()}. This method returns the subject + * #getSubjectX500Principal()}. This method returns the {@code subject} * as an implementation specific Principal object, which should not be * relied upon by portable code. * *

      - * Gets the subject (subject distinguished name) value - * from the certificate. If the subject value is empty, - * then the getName() method of the returned - * Principal object returns an empty string (""). + * Gets the {@code subject} (subject distinguished name) value + * from the certificate. If the {@code subject} value is empty, + * then the {@code getName()} method of the returned + * {@code Principal} object returns an empty string (""). * *

      The ASN.1 definition for this is: *

            * subject    Name
            * 
      * - *

      See {@link #getIssuerDN() getIssuerDN} for Name + *

      See {@link #getIssuerDN() getIssuerDN} for {@code Name} * and other relevant definitions. * * @return a Principal whose name is the subject name. @@ -273,13 +276,13 @@ /** * Returns the subject (subject distinguished name) value from the - * certificate as an X500Principal. If the subject value - * is empty, then the getName() method of the returned - * X500Principal object returns an empty string (""). + * certificate as an {@code X500Principal}. If the subject value + * is empty, then the {@code getName()} method of the returned + * {@code X500Principal} object returns an empty string (""). *

      * It is recommended that subclasses override this method. * - * @return an X500Principal representing the subject + * @return an {@code X500Principal} representing the subject * distinguished name * @since 1.4 */ @@ -291,15 +294,16 @@ } /** - * Gets the notBefore date from the validity period of + * Gets the {@code notBefore} date from the validity period of * the certificate. * The relevant ASN.1 definitions are: *

      -     * validity             Validity

      + * validity Validity * * Validity ::= SEQUENCE { * notBefore CertificateValidityDate, - * notAfter CertificateValidityDate }

      + * notAfter CertificateValidityDate } + * * CertificateValidityDate ::= CHOICE { * utcTime UTCTime, * generalTime GeneralizedTime } @@ -311,7 +315,7 @@ public abstract Date getNotBefore(); /** - * Gets the notAfter date from the validity period of + * Gets the {@code notAfter} date from the validity period of * the certificate. See {@link #getNotBefore() getNotBefore} * for relevant ASN.1 definitions. * @@ -322,7 +326,7 @@ /** * Gets the DER-encoded certificate information, the - * tbsCertificate from this certificate. + * {@code tbsCertificate} from this certificate. * This can be used to verify the signature independently. * * @return the DER-encoded certificate information. @@ -332,7 +336,7 @@ throws CertificateEncodingException; /** - * Gets the signature value (the raw signature bits) from + * Gets the {@code signature} value (the raw signature bits) from * the certificate. * The ASN.1 definition for this is: *

      @@ -348,7 +352,8 @@
            * signature algorithm. An example is the string "SHA256withRSA".
            * The ASN.1 definition for this is:
            * 
      -     * signatureAlgorithm   AlgorithmIdentifier

      + * signatureAlgorithm AlgorithmIdentifier + * * AlgorithmIdentifier ::= SEQUENCE { * algorithm OBJECT IDENTIFIER, * parameters ANY DEFINED BY algorithm OPTIONAL } @@ -357,7 +362,7 @@ * -- algorithm object identifier value *

      * - *

      The algorithm name is determined from the algorithm + *

      The algorithm name is determined from the {@code algorithm} * OID string. * * @return the signature algorithm name. @@ -400,7 +405,7 @@ public abstract byte[] getSigAlgParams(); /** - * Gets the issuerUniqueID value from the certificate. + * Gets the {@code issuerUniqueID} value from the certificate. * The issuer unique identifier is present in the certificate * to handle the possibility of reuse of issuer names over time. * RFC 3280 recommends that names not be reused and that @@ -410,7 +415,8 @@ * *

      The ASN.1 definition for this is: *

      -     * issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL

      + * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL + * * UniqueIdentifier ::= BIT STRING *

      * @@ -420,11 +426,12 @@ public abstract boolean[] getIssuerUniqueID(); /** - * Gets the subjectUniqueID value from the certificate. + * Gets the {@code subjectUniqueID} value from the certificate. * *

      The ASN.1 definition for this is: *

      -     * subjectUniqueID  [2]  IMPLICIT UniqueIdentifier OPTIONAL

      + * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL + * * UniqueIdentifier ::= BIT STRING *

      * @@ -435,7 +442,7 @@ /** * Gets a boolean array representing bits of - * the KeyUsage extension, (OID = 2.5.29.15). + * the {@code KeyUsage} extension, (OID = 2.5.29.15). * The key usage extension defines the purpose (e.g., encipherment, * signature, certificate signing) of the key contained in the * certificate. @@ -467,16 +474,16 @@ /** * Gets an unmodifiable list of Strings representing the OBJECT - * IDENTIFIERs of the ExtKeyUsageSyntax field of the + * IDENTIFIERs of the {@code ExtKeyUsageSyntax} field of the * extended key usage extension, (OID = 2.5.29.37). It indicates * one or more purposes for which the certified public key may be * used, in addition to or in place of the basic purposes * indicated in the key usage extension field. The ASN.1 * definition for this is: *
      -     * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId

      + * ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId * - * KeyPurposeId ::= OBJECT IDENTIFIER

      + * KeyPurposeId ::= OBJECT IDENTIFIER *

      * * Key purposes may be defined by any organization with a @@ -486,7 +493,7 @@ *

      * This method was added to version 1.4 of the Java 2 Platform Standard * Edition. In order to maintain backwards compatibility with existing - * service providers, this method is not abstract + * service providers, this method is not {@code abstract} * and it provides a default implementation. Subclasses * should override this method with a correct implementation. * @@ -503,13 +510,13 @@ /** * Gets the certificate constraints path length from the - * critical BasicConstraints extension, (OID = 2.5.29.19). + * critical {@code BasicConstraints} extension, (OID = 2.5.29.19). *

      * The basic constraints extension identifies whether the subject * of the certificate is a Certificate Authority (CA) and * how deep a certification path may exist through that CA. The - * pathLenConstraint field (see below) is meaningful - * only if cA is set to TRUE. In this case, it gives the + * {@code pathLenConstraint} field (see below) is meaningful + * only if {@code cA} is set to TRUE. In this case, it gives the * maximum number of CA certificates that may follow this certificate in a * certification path. A value of zero indicates that only an end-entity * certificate may follow in the path. @@ -521,21 +528,21 @@ * pathLenConstraint INTEGER (0..MAX) OPTIONAL } *

      * - * @return the value of pathLenConstraint if the + * @return the value of {@code pathLenConstraint} if the * BasicConstraints extension is present in the certificate and the * subject of the certificate is a CA, otherwise -1. * If the subject of the certificate is a CA and - * pathLenConstraint does not appear, - * Integer.MAX_VALUE is returned to indicate that there is no + * {@code pathLenConstraint} does not appear, + * {@code Integer.MAX_VALUE} is returned to indicate that there is no * limit to the allowed length of the certification path. */ public abstract int getBasicConstraints(); /** * Gets an immutable collection of subject alternative names from the - * SubjectAltName extension, (OID = 2.5.29.17). + * {@code SubjectAltName} extension, (OID = 2.5.29.17). *

      - * The ASN.1 definition of the SubjectAltName extension is: + * The ASN.1 definition of the {@code SubjectAltName} extension is: *

            * SubjectAltName ::= GeneralNames
            *
      @@ -553,23 +560,23 @@
            *      registeredID                    [8]     OBJECT IDENTIFIER}
            * 
      *

      - * If this certificate does not contain a SubjectAltName - * extension, null is returned. Otherwise, a - * Collection is returned with an entry representing each - * GeneralName included in the extension. Each entry is a - * List whose first entry is an Integer - * (the name type, 0-8) and whose second entry is a String + * If this certificate does not contain a {@code SubjectAltName} + * extension, {@code null} is returned. Otherwise, a + * {@code Collection} is returned with an entry representing each + * {@code GeneralName} included in the extension. Each entry is a + * {@code List} whose first entry is an {@code Integer} + * (the name type, 0-8) and whose second entry is a {@code String} * or a byte array (the name, in string or ASN.1 DER encoded form, * respectively). *

      * RFC 822, DNS, and URI - * names are returned as Strings, + * names are returned as {@code String}s, * using the well-established string formats for those types (subject to * the restrictions included in RFC 3280). IPv4 address names are * returned using dotted quad notation. IPv6 address names are returned * in the form "a1:a2:...:a8", where a1-a8 are hexadecimal values * representing the eight 16-bit pieces of the address. OID names are - * returned as Strings represented as a series of nonnegative + * returned as {@code String}s represented as a series of nonnegative * integers separated by periods. And directory names (distinguished names) * are returned in * RFC 2253 string format. No standard string format is @@ -577,19 +584,19 @@ * other type of names. They are returned as byte arrays * containing the ASN.1 DER encoded form of the name. *

      - * Note that the Collection returned may contain more + * Note that the {@code Collection} returned may contain more * than one name of the same type. Also, note that the returned - * Collection is immutable and any entries containing byte + * {@code Collection} is immutable and any entries containing byte * arrays are cloned to protect against subsequent modifications. *

      * This method was added to version 1.4 of the Java 2 Platform Standard * Edition. In order to maintain backwards compatibility with existing - * service providers, this method is not abstract + * service providers, this method is not {@code abstract} * and it provides a default implementation. Subclasses * should override this method with a correct implementation. * - * @return an immutable Collection of subject alternative - * names (or null) + * @return an immutable {@code Collection} of subject alternative + * names (or {@code null}) * @throws CertificateParsingException if the extension cannot be decoded * @since 1.4 */ @@ -600,38 +607,38 @@ /** * Gets an immutable collection of issuer alternative names from the - * IssuerAltName extension, (OID = 2.5.29.18). + * {@code IssuerAltName} extension, (OID = 2.5.29.18). *

      - * The ASN.1 definition of the IssuerAltName extension is: + * The ASN.1 definition of the {@code IssuerAltName} extension is: *

            * IssuerAltName ::= GeneralNames
            * 
      - * The ASN.1 definition of GeneralNames is defined + * The ASN.1 definition of {@code GeneralNames} is defined * in {@link #getSubjectAlternativeNames getSubjectAlternativeNames}. *

      - * If this certificate does not contain an IssuerAltName - * extension, null is returned. Otherwise, a - * Collection is returned with an entry representing each - * GeneralName included in the extension. Each entry is a - * List whose first entry is an Integer - * (the name type, 0-8) and whose second entry is a String + * If this certificate does not contain an {@code IssuerAltName} + * extension, {@code null} is returned. Otherwise, a + * {@code Collection} is returned with an entry representing each + * {@code GeneralName} included in the extension. Each entry is a + * {@code List} whose first entry is an {@code Integer} + * (the name type, 0-8) and whose second entry is a {@code String} * or a byte array (the name, in string or ASN.1 DER encoded form, * respectively). For more details about the formats used for each - * name type, see the getSubjectAlternativeNames method. + * name type, see the {@code getSubjectAlternativeNames} method. *

      - * Note that the Collection returned may contain more + * Note that the {@code Collection} returned may contain more * than one name of the same type. Also, note that the returned - * Collection is immutable and any entries containing byte + * {@code Collection} is immutable and any entries containing byte * arrays are cloned to protect against subsequent modifications. *

      * This method was added to version 1.4 of the Java 2 Platform Standard * Edition. In order to maintain backwards compatibility with existing - * service providers, this method is not abstract + * service providers, this method is not {@code abstract} * and it provides a default implementation. Subclasses * should override this method with a correct implementation. * - * @return an immutable Collection of issuer alternative - * names (or null) + * @return an immutable {@code Collection} of issuer alternative + * names (or {@code null}) * @throws CertificateParsingException if the extension cannot be decoded * @since 1.4 */ @@ -649,7 +656,7 @@ * * This method was added to version 1.8 of the Java Platform Standard * Edition. In order to maintain backwards compatibility with existing - * service providers, this method is not abstract + * service providers, this method is not {@code abstract} * and it provides a default implementation. * * @param key the PublicKey used to carry out the verification. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/X509Extension.java --- a/jdk/src/share/classes/java/security/cert/X509Extension.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/cert/X509Extension.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,9 +59,9 @@ * -- the extnId object identifier value * } *

      - * Since not all extensions are known, the getExtensionValue + * Since not all extensions are known, the {@code getExtensionValue} * method returns the DER-encoded OCTET STRING of the - * extension value (i.e., the extnValue). This can then + * extension value (i.e., the {@code extnValue}). This can then * be handled by a Class that understands the extension. * * @author Hemma Prafullchandra @@ -72,8 +72,8 @@ /** * Check if there is a critical extension that is not supported. * - * @return true if a critical extension is found that is - * not supported, otherwise false. + * @return {@code true} if a critical extension is found that is + * not supported, otherwise {@code false}. */ public boolean hasUnsupportedCriticalExtension(); @@ -113,28 +113,28 @@ * * Here is sample code to get a Set of non-critical extensions from an * X509CRL revoked certificate entry and print the OIDs: - *
      
      +     * 
      {@code
            * CertificateFactory cf = null;
            * X509CRL crl = null;
            * try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
            *     cf = CertificateFactory.getInstance("X.509");
            *     crl = (X509CRL)cf.generateCRL(inStrm);
      -     * }

      + * } * - * byte[] certData = <DER-encoded certificate data> + * byte[] certData = * ByteArrayInputStream bais = new ByteArrayInputStream(certData); * X509Certificate cert = (X509Certificate)cf.generateCertificate(bais); * X509CRLEntry badCert = - * crl.getRevokedCertificate(cert.getSerialNumber());

      + * crl.getRevokedCertificate(cert.getSerialNumber()); * * if (badCert != null) { - * Set nonCritSet = badCert.getNonCriticalExtensionOIDs();

      + * Set nonCritSet = badCert.getNonCriticalExtensionOIDs(); * if (nonCritSet != null) * for (String oid : nonCritSet) { * System.out.println(oid); * } * } - *

      + * }
      * * @return a Set (or an empty Set if none are marked non-critical) of * the extension OID strings for extensions that are marked non-critical. @@ -145,9 +145,9 @@ /** * Gets the DER-encoded OCTET string for the extension value - * (extnValue) identified by the passed-in oid + * (extnValue) identified by the passed-in {@code oid} * String. - * The oid string is + * The {@code oid} string is * represented by a set of nonnegative whole numbers separated * by periods. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/security/cert/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Provides classes and interfaces for parsing and managing + * certificates, certificate revocation lists (CRLs), and + * certification paths. It contains support for X.509 v3 + * certificates and X.509 v2 CRLs. + * + *

      Package Specification

      + * + * + * + *

      Related Documentation

      + * + * For information about X.509 certificates and CRLs, please see: + * + * + * @since 1.2 + */ +package java.security.cert; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/cert/package.html --- a/jdk/src/share/classes/java/security/cert/package.html Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ - - - - - - -Provides classes and interfaces for parsing and managing -certificates, certificate revocation lists (CRLs), and -certification paths. It contains support for X.509 v3 -certificates and X.509 v2 CRLs. - -

      Package Specification

      - - - -

      Related Documentation

      - -For information about X.509 certificates and CRLs, please see: - - -@since 1.2 - - diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java --- a/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/interfaces/DSAKeyPairGenerator.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,8 +30,8 @@ /** * An interface to an object capable of generating DSA key pairs. * - *

      The initialize methods may each be called any number - * of times. If no initialize method is called on a + *

      The {@code initialize} methods may each be called any number + * of times. If no {@code initialize} method is called on a * DSAKeyPairGenerator, the default is to generate 1024-bit keys, using * precomputed p, q and g parameters and an instance of SecureRandom as * the random bit source. @@ -42,22 +42,22 @@ *

        * *
      1. Get a key pair generator for the DSA algorithm by calling the - * KeyPairGenerator getInstance method with "DSA" + * KeyPairGenerator {@code getInstance} method with "DSA" * as its argument.

        * *

      2. Initialize the generator by casting the result to a DSAKeyPairGenerator * and calling one of the - * initialize methods from this DSAKeyPairGenerator interface.

        + * {@code initialize} methods from this DSAKeyPairGenerator interface.

        * - *

      3. Generate a key pair by calling the generateKeyPair + *
      4. Generate a key pair by calling the {@code generateKeyPair} * method from the KeyPairGenerator class. * *
      * *

      Note: it is not always necessary to do do algorithm-specific * initialization for a DSA key pair generator. That is, it is not always - * necessary to call an initialize method in this interface. - * Algorithm-independent initialization using the initialize method + * necessary to call an {@code initialize} method in this interface. + * Algorithm-independent initialization using the {@code initialize} method * in the KeyPairGenerator * interface is all that is needed when you accept defaults for algorithm-specific * parameters. @@ -80,7 +80,7 @@ * @param random the random bit source to use to generate key bits; * can be null. * - * @exception InvalidParameterException if the params + * @exception InvalidParameterException if the {@code params} * value is invalid, null, or unsupported. */ public void initialize(DSAParams params, SecureRandom random) @@ -92,7 +92,7 @@ * If a SecureRandom bit source is needed but not supplied, i.e. * null, a default SecureRandom instance will be used. * - *

      If genParams is true, this method generates new + *

      If {@code genParams} is true, this method generates new * p, q and g parameters. If it is false, the method uses precomputed * parameters for the modulus length requested. If there are no * precomputed parameters for that modulus length, an exception will be @@ -108,8 +108,8 @@ * @param genParams whether or not to generate new parameters for * the modulus length requested. * - * @exception InvalidParameterException if modlen is - * invalid, or unsupported, or if genParams is false and there + * @exception InvalidParameterException if {@code modlen} is + * invalid, or unsupported, or if {@code genParams} is false and there * are no precomputed parameters for the requested modulus length. */ public void initialize(int modlen, boolean genParams, SecureRandom random) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/DSAParams.java --- a/jdk/src/share/classes/java/security/interfaces/DSAParams.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/interfaces/DSAParams.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,23 +42,23 @@ public interface DSAParams { /** - * Returns the prime, p. + * Returns the prime, {@code p}. * - * @return the prime, p. + * @return the prime, {@code p}. */ public BigInteger getP(); /** - * Returns the subprime, q. + * Returns the subprime, {@code q}. * - * @return the subprime, q. + * @return the subprime, {@code q}. */ public BigInteger getQ(); /** - * Returns the base, g. + * Returns the base, {@code g}. * - * @return the base, g. + * @return the base, {@code g}. */ public BigInteger getG(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java --- a/jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/interfaces/DSAPrivateKey.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,9 +50,9 @@ static final long serialVersionUID = 7776497482533790279L; /** - * Returns the value of the private key, x. + * Returns the value of the private key, {@code x}. * - * @return the value of the private key, x. + * @return the value of the private key, {@code x}. */ public BigInteger getX(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java --- a/jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/interfaces/DSAPublicKey.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,9 +50,9 @@ static final long serialVersionUID = 1234526332779022332L; /** - * Returns the value of the public key, y. + * Returns the value of the public key, {@code y}. * - * @return the value of the public key, y. + * @return the value of the public key, {@code y}. */ public BigInteger getY(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/security/interfaces/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Provides interfaces for generating RSA (Rivest, Shamir and + * Adleman AsymmetricCipher algorithm) + * keys as defined in the RSA Laboratory Technical Note + * PKCS#1, and DSA (Digital Signature + * Algorithm) keys as defined in NIST's FIPS-186. + *

      + * Note that these interfaces are intended only for key + * implementations whose key material is accessible and + * available. These interfaces are not intended for key + * implementations whose key material resides in + * inaccessible, protected storage (such as in a + * hardware device). + *

      + * For more developer information on how to use these + * interfaces, including information on how to design + * {@code Key} classes for hardware devices, please refer + * to these cryptographic provider developer guides: + *

      + * + *

      Package Specification

      + * + *
        + *
      • PKCS #1: RSA Encryption Standard, Version 1.5, November 1993
      • + *
      • Federal Information Processing Standards Publication (FIPS PUB) 186: + * Digital Signature Standard (DSS)
      • + *
      + * + *

      Related Documentation

      + * + * For further documentation, please see: + * + * + * @since JDK1.1 + */ +package java.security.interfaces; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/interfaces/package.html --- a/jdk/src/share/classes/java/security/interfaces/package.html Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ - - - - - - -Provides interfaces for generating RSA (Rivest, Shamir and -Adleman AsymmetricCipher algorithm) -keys as defined in the RSA Laboratory Technical Note -PKCS#1, and DSA (Digital Signature -Algorithm) keys as defined in NIST's FIPS-186. -

      -Note that these interfaces are intended only for key -implementations whose key material is accessible and -available. These interfaces are not intended for key -implementations whose key material resides in -inaccessible, protected storage (such as in a -hardware device). -

      -For more developer information on how to use these -interfaces, including information on how to design -Key classes for hardware devices, please refer -to these cryptographic provider developer guides: -

      - -

      Package Specification

      - -
        -
      • PKCS #1: RSA Encryption Standard, Version 1.5, November 1993
      • -
      • Federal Information Processing Standards Publication (FIPS PUB) 186: - Digital Signature Standard (DSS)
      • -
      - -

      Related Documentation

      - -For further documentation, please see: - - -@since JDK1.1 - - diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/package-info.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/security/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/** + * Provides the classes and interfaces for the security framework. + * This includes classes that implement an easily configurable, + * fine-grained access control security architecture. + * This package also supports + * the generation and storage of cryptographic public key pairs, + * as well as a number of exportable cryptographic operations + * including those for message digest and signature generation. Finally, + * this package provides classes that support signed/guarded objects + * and secure random number generation. + * + * Many of the classes provided in this package (the cryptographic + * and secure random number generator classes in particular) are + * provider-based. The class itself defines a programming interface + * to which applications may write. The implementations themselves may + * then be written by independent third-party vendors and plugged + * in seamlessly as needed. Therefore application developers may + * take advantage of any number of provider-based implementations + * without having to add or rewrite code. + * + *

      Package Specification

      + * + * + * + *

      Related Documentation

      + * + * For further documentation, please see: + * + * + * @since 1.1 + */ +package java.security; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/package.html --- a/jdk/src/share/classes/java/security/package.html Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ - - - - - - - - -Provides the classes and interfaces for the security framework. -This includes classes that implement an easily configurable, -fine-grained access control security architecture. -This package also supports -the generation and storage of cryptographic public key pairs, -as well as a number of exportable cryptographic operations -including those for message digest and signature generation. Finally, -this package provides classes that support signed/guarded objects -and secure random number generation. - -Many of the classes provided in this package (the cryptographic -and secure random number generator classes in particular) are -provider-based. The class itself defines a programming interface -to which applications may write. The implementations themselves may -then be written by independent third-party vendors and plugged -in seamlessly as needed. Therefore application developers may -take advantage of any number of provider-based implementations -without having to add or rewrite code. - -

      Package Specification

      - - - -

      Related Documentation

      - -For further documentation, please see: - - -@since 1.1 - - diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/DSAGenParameterSpec.java --- a/jdk/src/share/classes/java/security/spec/DSAGenParameterSpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/DSAGenParameterSpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,13 +41,13 @@ /** * Creates a domain parameter specification for DSA parameter - * generation using primePLen and subprimeQLen. - * The value of subprimeQLen is also used as the default + * generation using {@code primePLen} and {@code subprimeQLen}. + * The value of {@code subprimeQLen} is also used as the default * length of the domain parameter seed in bits. * @param primePLen the desired length of the prime P in bits. * @param subprimeQLen the desired length of the sub-prime Q in bits. - * @exception IllegalArgumentException if primePLen - * or subprimeQLen is illegal per the specification of + * @exception IllegalArgumentException if {@code primePLen} + * or {@code subprimeQLen} is illegal per the specification of * FIPS 186-3. */ public DSAGenParameterSpec(int primePLen, int subprimeQLen) { @@ -56,14 +56,14 @@ /** * Creates a domain parameter specification for DSA parameter - * generation using primePLen, subprimeQLen, - * and seedLen. + * generation using {@code primePLen}, {@code subprimeQLen}, + * and {@code seedLen}. * @param primePLen the desired length of the prime P in bits. * @param subprimeQLen the desired length of the sub-prime Q in bits. * @param seedLen the desired length of the domain parameter seed in bits, - * shall be equal to or greater than subprimeQLen. - * @exception IllegalArgumentException if primePLenLen, - * subprimeQLen, or seedLen is illegal per the + * shall be equal to or greater than {@code subprimeQLen}. + * @exception IllegalArgumentException if {@code primePLenLen}, + * {@code subprimeQLen}, or {@code seedLen} is illegal per the * specification of FIPS 186-3. */ public DSAGenParameterSpec(int primePLen, int subprimeQLen, int seedLen) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/DSAParameterSpec.java --- a/jdk/src/share/classes/java/security/spec/DSAParameterSpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/DSAParameterSpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,27 +61,27 @@ } /** - * Returns the prime p. + * Returns the prime {@code p}. * - * @return the prime p. + * @return the prime {@code p}. */ public BigInteger getP() { return this.p; } /** - * Returns the sub-prime q. + * Returns the sub-prime {@code q}. * - * @return the sub-prime q. + * @return the sub-prime {@code q}. */ public BigInteger getQ() { return this.q; } /** - * Returns the base g. + * Returns the base {@code g}. * - * @return the base g. + * @return the base {@code g}. */ public BigInteger getG() { return this.g; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/DSAPrivateKeySpec.java --- a/jdk/src/share/classes/java/security/spec/DSAPrivateKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/DSAPrivateKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,36 +69,36 @@ } /** - * Returns the private key x. + * Returns the private key {@code x}. * - * @return the private key x. + * @return the private key {@code x}. */ public BigInteger getX() { return this.x; } /** - * Returns the prime p. + * Returns the prime {@code p}. * - * @return the prime p. + * @return the prime {@code p}. */ public BigInteger getP() { return this.p; } /** - * Returns the sub-prime q. + * Returns the sub-prime {@code q}. * - * @return the sub-prime q. + * @return the sub-prime {@code q}. */ public BigInteger getQ() { return this.q; } /** - * Returns the base g. + * Returns the base {@code g}. * - * @return the base g. + * @return the base {@code g}. */ public BigInteger getG() { return this.g; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/DSAPublicKeySpec.java --- a/jdk/src/share/classes/java/security/spec/DSAPublicKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/DSAPublicKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -69,36 +69,36 @@ } /** - * Returns the public key y. + * Returns the public key {@code y}. * - * @return the public key y. + * @return the public key {@code y}. */ public BigInteger getY() { return this.y; } /** - * Returns the prime p. + * Returns the prime {@code p}. * - * @return the prime p. + * @return the prime {@code p}. */ public BigInteger getP() { return this.p; } /** - * Returns the sub-prime q. + * Returns the sub-prime {@code q}. * - * @return the sub-prime q. + * @return the sub-prime {@code q}. */ public BigInteger getQ() { return this.q; } /** - * Returns the base g. + * Returns the base {@code g}. * - * @return the base g. + * @return the base {@code g}. */ public BigInteger getG() { return this.g; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECFieldF2m.java --- a/jdk/src/share/classes/java/security/spec/ECFieldF2m.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECFieldF2m.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,9 +45,9 @@ /** * Creates an elliptic curve characteristic 2 finite - * field which has 2^m elements with normal basis. - * @param m with 2^m being the number of elements. - * @exception IllegalArgumentException if m + * field which has 2^{@code m} elements with normal basis. + * @param m with 2^{@code m} being the number of elements. + * @exception IllegalArgumentException if {@code m} * is not positive. */ public ECFieldF2m(int m) { @@ -61,24 +61,24 @@ /** * Creates an elliptic curve characteristic 2 finite - * field which has 2^m elements with + * field which has 2^{@code m} elements with * polynomial basis. * The reduction polynomial for this field is based - * on rp whose i-th bit correspondes to + * on {@code rp} whose i-th bit correspondes to * the i-th coefficient of the reduction polynomial.

      * Note: A valid reduction polynomial is either a - * trinomial (X^m + X^k + 1 - * with m > k >= 1) or a - * pentanomial (X^m + X^k3 - * + X^k2 + X^k1 + 1 with - * m > k3 > k2 - * > k1 >= 1). - * @param m with 2^m being the number of elements. + * trinomial (X^{@code m} + X^{@code k} + 1 + * with {@code m} > {@code k} >= 1) or a + * pentanomial (X^{@code m} + X^{@code k3} + * + X^{@code k2} + X^{@code k1} + 1 with + * {@code m} > {@code k3} > {@code k2} + * > {@code k1} >= 1). + * @param m with 2^{@code m} being the number of elements. * @param rp the BigInteger whose i-th bit corresponds to * the i-th coefficient of the reduction polynomial. - * @exception NullPointerException if rp is null. - * @exception IllegalArgumentException if m - * is not positive, or rp does not represent + * @exception NullPointerException if {@code rp} is null. + * @exception IllegalArgumentException if {@code m} + * is not positive, or {@code rp} does not represent * a valid reduction polynomial. */ public ECFieldF2m(int m, BigInteger rp) { @@ -106,28 +106,28 @@ /** * Creates an elliptic curve characteristic 2 finite - * field which has 2^m elements with + * field which has 2^{@code m} elements with * polynomial basis. The reduction polynomial for this - * field is based on ks whose content + * field is based on {@code ks} whose content * contains the order of the middle term(s) of the * reduction polynomial. * Note: A valid reduction polynomial is either a - * trinomial (X^m + X^k + 1 - * with m > k >= 1) or a - * pentanomial (X^m + X^k3 - * + X^k2 + X^k1 + 1 with - * m > k3 > k2 - * > k1 >= 1), so ks should + * trinomial (X^{@code m} + X^{@code k} + 1 + * with {@code m} > {@code k} >= 1) or a + * pentanomial (X^{@code m} + X^{@code k3} + * + X^{@code k2} + X^{@code k1} + 1 with + * {@code m} > {@code k3} > {@code k2} + * > {@code k1} >= 1), so {@code ks} should * have length 1 or 3. - * @param m with 2^m being the number of elements. + * @param m with 2^{@code m} being the number of elements. * @param ks the order of the middle term(s) of the * reduction polynomial. Contents of this array are copied * to protect against subsequent modification. - * @exception NullPointerException if ks is null. - * @exception IllegalArgumentException ifm - * is not positive, or the length of ks - * is neither 1 nor 3, or values in ks - * are not between m-1 and 1 (inclusive) + * @exception NullPointerException if {@code ks} is null. + * @exception IllegalArgumentException if{@code m} + * is not positive, or the length of {@code ks} + * is neither 1 nor 3, or values in {@code ks} + * are not between {@code m}-1 and 1 (inclusive) * and in descending order. */ public ECFieldF2m(int m, int[] ks) { @@ -160,7 +160,7 @@ } /** - * Returns the field size in bits which is m + * Returns the field size in bits which is {@code m} * for this characteristic 2 finite field. * @return the field size in bits. */ @@ -169,9 +169,9 @@ } /** - * Returns the value m of this characteristic + * Returns the value {@code m} of this characteristic * 2 finite field. - * @return m with 2^m being the + * @return {@code m} with 2^{@code m} being the * number of elements. */ public int getM() { @@ -211,8 +211,8 @@ * Compares this finite field for equality with the * specified object. * @param obj the object to be compared. - * @return true if obj is an instance - * of ECFieldF2m and both m and the reduction + * @return true if {@code obj} is an instance + * of ECFieldF2m and both {@code m} and the reduction * polynomial match, false otherwise. */ public boolean equals(Object obj) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECFieldFp.java --- a/jdk/src/share/classes/java/security/spec/ECFieldFp.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECFieldFp.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,10 +43,10 @@ /** * Creates an elliptic curve prime finite field - * with the specified prime p. + * with the specified prime {@code p}. * @param p the prime. - * @exception NullPointerException if p is null. - * @exception IllegalArgumentException if p + * @exception NullPointerException if {@code p} is null. + * @exception IllegalArgumentException if {@code p} * is not positive. */ public ECFieldFp(BigInteger p) { @@ -66,7 +66,7 @@ }; /** - * Returns the prime p of this prime finite field. + * Returns the prime {@code p} of this prime finite field. * @return the prime. */ public BigInteger getP() { @@ -77,7 +77,7 @@ * Compares this prime finite field for equality with the * specified object. * @param obj the object to be compared. - * @return true if obj is an instance + * @return true if {@code obj} is an instance * of ECFieldFp and the prime value match, false otherwise. */ public boolean equals(Object obj) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java --- a/jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECGenParameterSpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,13 +41,13 @@ /** * Creates a parameter specification for EC parameter * generation using a standard (or predefined) name - * stdName in order to generate the corresponding + * {@code stdName} in order to generate the corresponding * (precomputed) elliptic curve domain parameters. For the * list of supported names, please consult the documentation * of provider whose implementation will be used. * @param stdName the standard name of the to-be-generated EC * domain parameters. - * @exception NullPointerException if stdName + * @exception NullPointerException if {@code stdName} * is null. */ public ECGenParameterSpec(String stdName) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECParameterSpec.java --- a/jdk/src/share/classes/java/security/spec/ECParameterSpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECParameterSpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,12 +49,12 @@ * @param curve the elliptic curve which this parameter * defines. * @param g the generator which is also known as the base point. - * @param n the order of the generator g. + * @param n the order of the generator {@code g}. * @param h the cofactor. - * @exception NullPointerException if curve, - * g, or n is null. - * @exception IllegalArgumentException if n - * or h is not positive. + * @exception NullPointerException if {@code curve}, + * {@code g}, or {@code n} is null. + * @exception IllegalArgumentException if {@code n} + * or {@code h} is not positive. */ public ECParameterSpec(EllipticCurve curve, ECPoint g, BigInteger n, int h) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECPoint.java --- a/jdk/src/share/classes/java/security/spec/ECPoint.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECPoint.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,11 +54,11 @@ /** * Creates an ECPoint from the specified affine x-coordinate - * x and affine y-coordinate y. + * {@code x} and affine y-coordinate {@code y}. * @param x the affine x-coordinate. * @param y the affine y-coordinate. - * @exception NullPointerException if x or - * y is null. + * @exception NullPointerException if {@code x} or + * {@code y} is null. */ public ECPoint(BigInteger x, BigInteger y) { if ((x==null) || (y==null)) { @@ -69,7 +69,7 @@ } /** - * Returns the affine x-coordinate x. + * Returns the affine x-coordinate {@code x}. * Note: POINT_INFINITY has a null affine x-coordinate. * @return the affine x-coordinate. */ @@ -78,7 +78,7 @@ } /** - * Returns the affine y-coordinate y. + * Returns the affine y-coordinate {@code y}. * Note: POINT_INFINITY has a null affine y-coordinate. * @return the affine y-coordinate. */ @@ -90,7 +90,7 @@ * Compares this elliptic curve point for equality with * the specified object. * @param obj the object to be compared. - * @return true if obj is an instance of + * @return true if {@code obj} is an instance of * ECPoint and the affine coordinates match, false otherwise. */ public boolean equals(Object obj) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECPrivateKeySpec.java --- a/jdk/src/share/classes/java/security/spec/ECPrivateKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECPrivateKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,8 +48,8 @@ * @param s the private value. * @param params the associated elliptic curve domain * parameters. - * @exception NullPointerException if s - * or params is null. + * @exception NullPointerException if {@code s} + * or {@code params} is null. */ public ECPrivateKeySpec(BigInteger s, ECParameterSpec params) { if (s == null) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/ECPublicKeySpec.java --- a/jdk/src/share/classes/java/security/spec/ECPublicKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/ECPublicKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,9 +47,9 @@ * @param w the public point. * @param params the associated elliptic curve domain * parameters. - * @exception NullPointerException if w - * or params is null. - * @exception IllegalArgumentException if w + * @exception NullPointerException if {@code w} + * or {@code params} is null. + * @exception IllegalArgumentException if {@code w} * is point at infinity, i.e. ECPoint.POINT_INFINITY */ public ECPublicKeySpec(ECPoint w, ECParameterSpec params) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/EllipticCurve.java --- a/jdk/src/share/classes/java/security/spec/EllipticCurve.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/EllipticCurve.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,15 +68,15 @@ /** * Creates an elliptic curve with the specified elliptic field - * field and the coefficients a and - * b. + * {@code field} and the coefficients {@code a} and + * {@code b}. * @param field the finite field that this elliptic curve is over. * @param a the first coefficient of this elliptic curve. * @param b the second coefficient of this elliptic curve. - * @exception NullPointerException if field, - * a, or b is null. - * @exception IllegalArgumentException if a - * or b is not null and not in field. + * @exception NullPointerException if {@code field}, + * {@code a}, or {@code b} is null. + * @exception IllegalArgumentException if {@code a} + * or {@code b} is not null and not in {@code field}. */ public EllipticCurve(ECField field, BigInteger a, BigInteger b) { @@ -85,18 +85,18 @@ /** * Creates an elliptic curve with the specified elliptic field - * field, the coefficients a and - * b, and the seed used for curve generation. + * {@code field}, the coefficients {@code a} and + * {@code b}, and the {@code seed} used for curve generation. * @param field the finite field that this elliptic curve is over. * @param a the first coefficient of this elliptic curve. * @param b the second coefficient of this elliptic curve. * @param seed the bytes used during curve generation for later * validation. Contents of this array are copied to protect against * subsequent modification. - * @exception NullPointerException if field, - * a, or b is null. - * @exception IllegalArgumentException if a - * or b is not null and not in field. + * @exception NullPointerException if {@code field}, + * {@code a}, or {@code b} is null. + * @exception IllegalArgumentException if {@code a} + * or {@code b} is not null and not in {@code field}. */ public EllipticCurve(ECField field, BigInteger a, BigInteger b, byte[] seed) { @@ -122,9 +122,9 @@ } /** - * Returns the finite field field that this + * Returns the finite field {@code field} that this * elliptic curve is over. - * @return the field field that this curve + * @return the field {@code field} that this curve * is over. */ public ECField getField() { @@ -132,27 +132,27 @@ } /** - * Returns the first coefficient a of the + * Returns the first coefficient {@code a} of the * elliptic curve. - * @return the first coefficient a. + * @return the first coefficient {@code a}. */ public BigInteger getA() { return a; } /** - * Returns the second coefficient b of the + * Returns the second coefficient {@code b} of the * elliptic curve. - * @return the second coefficient b. + * @return the second coefficient {@code b}. */ public BigInteger getB() { return b; } /** - * Returns the seeding bytes seed used + * Returns the seeding bytes {@code seed} used * during curve generation. May be null if not specified. - * @return the seeding bytes seed. A new + * @return the seeding bytes {@code seed}. A new * array is returned each time this method is called. */ public byte[] getSeed() { @@ -164,7 +164,7 @@ * Compares this elliptic curve for equality with the * specified object. * @param obj the object to be compared. - * @return true if obj is an instance of + * @return true if {@code obj} is an instance of * EllipticCurve and the field, A, and B match, false otherwise. */ public boolean equals(Object obj) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/EncodedKeySpec.java --- a/jdk/src/share/classes/java/security/spec/EncodedKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/EncodedKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -49,7 +49,7 @@ * * @param encodedKey the encoded key. The contents of the * array are copied to protect against subsequent modification. - * @exception NullPointerException if encodedKey + * @exception NullPointerException if {@code encodedKey} * is null. */ public EncodedKeySpec(byte[] encodedKey) { @@ -74,9 +74,9 @@ * (see {@link java.security.Key Key}) can be transformed * (see {@link java.security.KeyFactory KeyFactory}) * into this key specification (or a subclass of it), - * getFormat called + * {@code getFormat} called * on the opaque key returns the same value as the - * getFormat method + * {@code getFormat} method * of this key specification. * * @return a string representation of the encoding format. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java --- a/jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/InvalidKeySpecException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,13 +63,13 @@ } /** - * Creates a InvalidKeySpecException with the specified + * Creates a {@code InvalidKeySpecException} with the specified * detail message and cause. * * @param message the detail message (which is saved for later retrieval * by the {@link #getMessage()} method). * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ @@ -78,13 +78,13 @@ } /** - * Creates a InvalidKeySpecException with the specified cause - * and a detail message of (cause==null ? null : cause.toString()) + * Creates a {@code InvalidKeySpecException} with the specified cause + * and a detail message of {@code (cause==null ? null : cause.toString())} * (which typically contains the class and detail message of - * cause). + * {@code cause}). * * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A null value is permitted, + * {@link #getCause()} method). (A {@code null} value is permitted, * and indicates that the cause is nonexistent or unknown.) * @since 1.5 */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/KeySpec.java --- a/jdk/src/share/classes/java/security/spec/KeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/KeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ *

      A key may be specified in an algorithm-specific way, or in an * algorithm-independent encoding format (such as ASN.1). * For example, a DSA private key may be specified by its components - * x, p, q, and g + * {@code x}, {@code p}, {@code q}, and {@code g} * (see {@link DSAPrivateKeySpec}), or it may be * specified using its DER encoding * (see {@link PKCS8EncodedKeySpec}). diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java --- a/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/MGF1ParameterSpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -92,7 +92,7 @@ * * @param mdName the algorithm name for the message digest * used in this mask generation function MGF1. - * @exception NullPointerException if mdName is null. + * @exception NullPointerException if {@code mdName} is null. */ public MGF1ParameterSpec(String mdName) { if (mdName == null) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java --- a/jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/PKCS8EncodedKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ /** * This class represents the ASN.1 encoding of a private key, - * encoded according to the ASN.1 type PrivateKeyInfo. - * The PrivateKeyInfo syntax is defined in the PKCS#8 standard + * encoded according to the ASN.1 type {@code PrivateKeyInfo}. + * The {@code PrivateKeyInfo} syntax is defined in the PKCS#8 standard * as follows: * *

      @@ -67,7 +67,7 @@
            * @param encodedKey the key, which is assumed to be
            * encoded according to the PKCS #8 standard. The contents of
            * the array are copied to protect against subsequent modification.
      -     * @exception NullPointerException if encodedKey
      +     * @exception NullPointerException if {@code encodedKey}
            * is null.
            */
           public PKCS8EncodedKeySpec(byte[] encodedKey) {
      @@ -88,7 +88,7 @@
            * Returns the name of the encoding format associated with this
            * key specification.
            *
      -     * @return the string "PKCS#8".
      +     * @return the string {@code "PKCS#8"}.
            */
           public final String getFormat() {
               return "PKCS#8";
      diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/PSSParameterSpec.java
      --- a/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java	Tue Jul 02 17:38:10 2013 -0700
      +++ b/jdk/src/share/classes/java/security/spec/PSSParameterSpec.java	Thu Jul 11 12:50:20 2013 -0700
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -91,14 +91,14 @@
           public static final PSSParameterSpec DEFAULT = new PSSParameterSpec();
       
           /**
      -     * Constructs a new PSSParameterSpec as defined in
      +     * Constructs a new {@code PSSParameterSpec} as defined in
            * the PKCS #1 standard using the default values.
            */
           private PSSParameterSpec() {
           }
       
           /**
      -     * Creates a new PSSParameterSpec as defined in
      +     * Creates a new {@code PSSParameterSpec} as defined in
            * the PKCS #1 standard using the specified message digest,
            * mask generation function, parameters for mask generation
            * function, salt length, and trailer field values.
      @@ -111,10 +111,10 @@
            * getMGFParameters().
            * @param saltLen the length of salt.
            * @param trailerField the value of the trailer field.
      -     * @exception NullPointerException if mdName,
      -     * or mgfName is null.
      -     * @exception IllegalArgumentException if saltLen
      -     * or trailerField is less than 0.
      +     * @exception NullPointerException if {@code mdName},
      +     * or {@code mgfName} is null.
      +     * @exception IllegalArgumentException if {@code saltLen}
      +     * or {@code trailerField} is less than 0.
            * @since 1.5
            */
           public PSSParameterSpec(String mdName, String mgfName,
      @@ -143,13 +143,13 @@
           }
       
           /**
      -     * Creates a new PSSParameterSpec
      +     * Creates a new {@code PSSParameterSpec}
            * using the specified salt length and other default values as
            * defined in PKCS#1.
            *
            * @param saltLen the length of salt in bits to be used in PKCS#1
            * PSS encoding.
      -     * @exception IllegalArgumentException if saltLen is
      +     * @exception IllegalArgumentException if {@code saltLen} is
            * less than 0.
            */
           public PSSParameterSpec(int saltLen) {
      diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java
      --- a/jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java	Tue Jul 02 17:38:10 2013 -0700
      +++ b/jdk/src/share/classes/java/security/spec/RSAKeyGenParameterSpec.java	Thu Jul 11 12:50:20 2013 -0700
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -55,7 +55,7 @@
           public static final BigInteger F4 = BigInteger.valueOf(65537);
       
           /**
      -     * Constructs a new RSAParameterSpec object from the
      +     * Constructs a new {@code RSAParameterSpec} object from the
            * given keysize and public-exponent value.
            *
            * @param keysize the modulus size (specified in number of bits)
      diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
      --- a/jdk/src/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java	Tue Jul 02 17:38:10 2013 -0700
      +++ b/jdk/src/share/classes/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java	Thu Jul 11 12:50:20 2013 -0700
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -57,12 +57,12 @@
           private final RSAOtherPrimeInfo otherPrimeInfo[];
       
          /**
      -    * Creates a new RSAMultiPrimePrivateCrtKeySpec
      +    * Creates a new {@code RSAMultiPrimePrivateCrtKeySpec}
           * given the modulus, publicExponent, privateExponent,
           * primeP, primeQ, primeExponentP, primeExponentQ,
           * crtCoefficient, and otherPrimeInfo as defined in PKCS#1 v2.1.
           *
      -    * 

      Note that the contents of otherPrimeInfo + *

      Note that the contents of {@code otherPrimeInfo} * are copied to protect against subsequent modification when * constructing this object. * @@ -78,13 +78,13 @@ * @param otherPrimeInfo triplets of the rest of primes, null can be * specified if there are only two prime factors (p and q). * @exception NullPointerException if any of the parameters, i.e. - * modulus, - * publicExponent, privateExponent, - * primeP, primeQ, - * primeExponentP, primeExponentQ, - * crtCoefficient, is null. + * {@code modulus}, + * {@code publicExponent}, {@code privateExponent}, + * {@code primeP}, {@code primeQ}, + * {@code primeExponentP}, {@code primeExponentQ}, + * {@code crtCoefficient}, is null. * @exception IllegalArgumentException if an empty, i.e. 0-length, - * otherPrimeInfo is specified. + * {@code otherPrimeInfo} is specified. */ public RSAMultiPrimePrivateCrtKeySpec(BigInteger modulus, BigInteger publicExponent, diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/RSAOtherPrimeInfo.java --- a/jdk/src/share/classes/java/security/spec/RSAOtherPrimeInfo.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/RSAOtherPrimeInfo.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ /** - * Creates a new RSAOtherPrimeInfo + * Creates a new {@code RSAOtherPrimeInfo} * given the prime, primeExponent, and * crtCoefficient as defined in PKCS#1. * @@ -67,8 +67,8 @@ * @param crtCoefficient the Chinese Remainder Theorem * coefficient. * @exception NullPointerException if any of the parameters, i.e. - * prime, primeExponent, - * crtCoefficient, is null. + * {@code prime}, {@code primeExponent}, + * {@code crtCoefficient}, is null. * */ public RSAOtherPrimeInfo(BigInteger prime, diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java --- a/jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/RSAPrivateCrtKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,7 +55,7 @@ /** - * Creates a new RSAPrivateCrtKeySpec + * Creates a new {@code RSAPrivateCrtKeySpec} * given the modulus, publicExponent, privateExponent, * primeP, primeQ, primeExponentP, primeExponentQ, and * crtCoefficient as defined in PKCS#1. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java --- a/jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/security/spec/X509EncodedKeySpec.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,8 +27,8 @@ /** * This class represents the ASN.1 encoding of a public key, - * encoded according to the ASN.1 type SubjectPublicKeyInfo. - * The SubjectPublicKeyInfo syntax is defined in the X.509 + * encoded according to the ASN.1 type {@code SubjectPublicKeyInfo}. + * The {@code SubjectPublicKeyInfo} syntax is defined in the X.509 * standard as follows: * *

      @@ -57,7 +57,7 @@
            * @param encodedKey the key, which is assumed to be
            * encoded according to the X.509 standard. The contents of the
            * array are copied to protect against subsequent modification.
      -     * @exception NullPointerException if encodedKey
      +     * @exception NullPointerException if {@code encodedKey}
            * is null.
            */
           public X509EncodedKeySpec(byte[] encodedKey) {
      @@ -78,7 +78,7 @@
            * Returns the name of the encoding format associated with this
            * key specification.
            *
      -     * @return the string "X.509".
      +     * @return the string {@code "X.509"}.
            */
           public final String getFormat() {
               return "X.509";
      diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/package-info.java
      --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      +++ b/jdk/src/share/classes/java/security/spec/package-info.java	Thu Jul 11 12:50:20 2013 -0700
      @@ -0,0 +1,73 @@
      +/*
      + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
      + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
      + *
      + * This code is free software; you can redistribute it and/or modify it
      + * under the terms of the GNU General Public License version 2 only, as
      + * published by the Free Software Foundation.  Oracle designates this
      + * particular file as subject to the "Classpath" exception as provided
      + * by Oracle in the LICENSE file that accompanied this code.
      + *
      + * This code is distributed in the hope that it will be useful, but WITHOUT
      + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      + * version 2 for more details (a copy is included in the LICENSE file that
      + * accompanied this code).
      + *
      + * You should have received a copy of the GNU General Public License version
      + * 2 along with this work; if not, write to the Free Software Foundation,
      + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      + *
      + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      + * or visit www.oracle.com if you need additional information or have any
      + * questions.
      + */
      +
      +/**
      + * Provides classes and interfaces for key specifications and algorithm
      + * parameter specifications.
      + *
      + * 

      A key specification is a transparent representation of the key material + * that constitutes a key. A key may be specified in an algorithm-specific + * way, or in an algorithm-independent encoding format (such as ASN.1). + * This package contains key specifications for DSA public and private keys, + * RSA public and private keys, PKCS #8 private keys in DER-encoded format, + * and X.509 public and private keys in DER-encoded format. + * + *

      An algorithm parameter specification is a transparent representation + * of the sets of parameters used with an algorithm. This package contains + * an algorithm parameter specification for parameters used with the + * DSA algorithm. + * + *

      Package Specification

      + * + *
        + *
      • PKCS #1: RSA Encryption Standard, Version 1.5, November 1993
      • + *
      • PKCS #8: Private-Key Information Syntax Standard, + * Version 1.2, November 1993
      • + *
      • Federal Information Processing Standards Publication (FIPS PUB) 186: + * Digital Signature Standard (DSS)
      • + *
      + * + *

      Related Documentation

      + * + * For documentation that includes information about algorithm parameter + * and key specifications, please see: + * + * + * @since 1.2 + */ +package java.security.spec; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/security/spec/package.html --- a/jdk/src/share/classes/java/security/spec/package.html Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ - - - - - - - - -Provides classes and interfaces for key specifications and algorithm -parameter specifications. - -

      A key specification is a transparent representation of the key material -that constitutes a key. A key may be specified in an algorithm-specific -way, or in an algorithm-independent encoding format (such as ASN.1). -This package contains key specifications for DSA public and private keys, -RSA public and private keys, PKCS #8 private keys in DER-encoded format, -and X.509 public and private keys in DER-encoded format. - -

      An algorithm parameter specification is a transparent representation -of the sets of parameters used with an algorithm. This package contains -an algorithm parameter specification for parameters used with the -DSA algorithm. - -

      Package Specification

      - -
        -
      • PKCS #1: RSA Encryption Standard, Version 1.5, November 1993
      • -
      • PKCS #8: Private-Key Information Syntax Standard, - Version 1.2, November 1993
      • -
      • Federal Information Processing Standards Publication (FIPS PUB) 186: - Digital Signature Standard (DSS)
      • -
      - -

      Related Documentation

      - -For documentation that includes information about algorithm parameter -and key specifications, please see: - - -@since 1.2 - - diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/Blob.java --- a/jdk/src/share/classes/java/sql/Blob.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/Blob.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,7 @@ /** * The representation (mapping) in - * the JavaTM programming + * the Java™ programming * language of an SQL * BLOB value. An SQL BLOB is a built-in type * that stores a Binary Large Object as a column value in a row of diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/CallableStatement.java --- a/jdk/src/share/classes/java/sql/CallableStatement.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/CallableStatement.java Thu Jul 11 12:50:20 2013 -0700 @@ -2445,6 +2445,7 @@ * @param parameterIndex the first parameter is 1, the second is 2, and so on * @param type Class representing the Java data type to convert the * designated parameter to. + * @param the type of the class modeled by this Class object * @return an instance of {@code type} holding the OUT parameter value * @throws SQLException if conversion is not supported, type is null or * another error occurs. The getCause() method of the @@ -2473,6 +2474,7 @@ * @param parameterName the name of the parameter * @param type Class representing the Java data type to convert * the designated parameter to. + * @param the type of the class modeled by this Class object * @return an instance of {@code type} holding the OUT parameter * value * @throws SQLException if conversion is not supported, type is null or diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/Clob.java --- a/jdk/src/share/classes/java/sql/Clob.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/Clob.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import java.io.Reader; /** - * The mapping in the JavaTM programming language + * The mapping in the Java™ programming language * for the SQL CLOB type. * An SQL CLOB is a built-in type * that stores a Character Large Object as a column value in a row of diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/DatabaseMetaData.java --- a/jdk/src/share/classes/java/sql/DatabaseMetaData.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/DatabaseMetaData.java Thu Jul 11 12:50:20 2013 -0700 @@ -31,7 +31,7 @@ *

      * This interface is implemented by driver vendors to let users know the capabilities * of a Database Management System (DBMS) in combination with - * the driver based on JDBCTM technology + * the driver based on JDBC™ technology * ("JDBC driver") that is used with it. Different relational DBMSs often support * different features, implement features in different ways, and use different * data types. In addition, a driver may implement a feature on top of what the @@ -3074,7 +3074,7 @@ * * @param holdability one of the following constants: * ResultSet.HOLD_CURSORS_OVER_COMMIT or - * ResultSet.CLOSE_CURSORS_AT_COMMIT + * ResultSet.CLOSE_CURSORS_AT_COMMIT * @return true if so; false otherwise * @exception SQLException if a database access error occurs * @see Connection diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/Driver.java --- a/jdk/src/share/classes/java/sql/Driver.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/Driver.java Thu Jul 11 12:50:20 2013 -0700 @@ -144,7 +144,7 @@ /** * Reports whether this driver is a genuine JDBC - * CompliantTM driver. + * Compliant™ driver. * A driver may only report true here if it passes the JDBC * compliance tests; otherwise it is required to return false. *

      @@ -173,7 +173,8 @@ * In the worst case, this may be the root Logger. * * @return the parent Logger for this driver - * @throws SQLFeatureNotSupportedException if the driver does not use java.util.logging. + * @throws SQLFeatureNotSupportedException if the driver does not use + * {@code java.util.logging}. * @since 1.7 */ public Logger getParentLogger() throws SQLFeatureNotSupportedException; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/DriverAction.java --- a/jdk/src/share/classes/java/sql/DriverAction.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/DriverAction.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,7 +33,7 @@ * directly by applications. A JDBC Driver may choose * to create its {@code DriverAction} implementation in a private class * to avoid it being called directly. - * + *

      * The JDBC driver's static initialization block must call * {@linkplain DriverManager#registerDriver(java.sql.Driver, java.sql.DriverAction) } in order * to inform {@code DriverManager} which {@code DriverAction} implementation to diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/NClob.java --- a/jdk/src/share/classes/java/sql/NClob.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/NClob.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ import java.sql.Clob; /** - * The mapping in the JavaTM programming language + * The mapping in the Java™ programming language * for the SQL NCLOB type. * An SQL NCLOB is a built-in type * that stores a Character Large Object using the National Character Set diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/ResultSet.java --- a/jdk/src/share/classes/java/sql/ResultSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/ResultSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -90,7 +90,7 @@ * the intended columns, which can be assured with the SQL AS clause. *

      * A set of updater methods were added to this interface - * in the JDBC 2.0 API (JavaTM 2 SDK, + * in the JDBC 2.0 API (Java™ 2 SDK, * Standard Edition, version 1.2). The comments regarding parameters * to the getter methods also apply to parameters to the * updater methods. @@ -148,7 +148,7 @@ public interface ResultSet extends Wrapper, AutoCloseable { /** - * Moves the cursor froward one row from its current position. + * Moves the cursor forward one row from its current position. * A ResultSet cursor is initially positioned * before the first row; the first call to the method * next makes the first row the current row; the @@ -4101,7 +4101,7 @@ * Appendix B, Table B-3 and conversion of appropriate user defined SQL * types to a Java type which implements {@code SQLData}, or {@code Struct}. * Additional conversions may be supported and are vendor defined. - * + * @param the type of the class modeled by this Class object * @param columnIndex the first column is 1, the second is 2, ... * @param type Class representing the Java data type to convert the designated * column to. @@ -4135,6 +4135,7 @@ * of the column * @param type Class representing the Java data type to convert the designated * column to. + * @param the type of the class modeled by this Class object * @return an instance of {@code type} holding the column value * @throws SQLException if conversion is not supported, type is null or * another error occurs. The getCause() method of the @@ -4208,6 +4209,7 @@ * @param columnLabel the label for the column specified with the SQL AS * clause. If the SQL AS clause was not specified, then the label is * the name of the column + * @param x the new column value * @param targetSqlType the SQL type to be sent to the database * @param scaleOrLength for an object of {@code java.math.BigDecimal} , * this is the number of digits after the decimal point. For diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/SQLInput.java --- a/jdk/src/share/classes/java/sql/SQLInput.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/SQLInput.java Thu Jul 11 12:50:20 2013 -0700 @@ -444,6 +444,7 @@ *

      * The default implementation will throw {@code SQLFeatureNotSupportedException} * + * @param the type of the class modeled by this Class object * @param type Class representing the Java data type to convert the attribute to. * @return the attribute at the head of the stream as an {@code Object} in the * Java programming language;{@code null} if the attribute is SQL {@code NULL} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/SQLPermission.java --- a/jdk/src/share/classes/java/sql/SQLPermission.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/SQLPermission.java Thu Jul 11 12:50:20 2013 -0700 @@ -103,7 +103,6 @@ * Permits an application to remove a JDBC driver from the list of * registered Drivers and release its resources. * - * * *

      * @since 1.3 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/SQLXML.java --- a/jdk/src/share/classes/java/sql/SQLXML.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/SQLXML.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -360,6 +360,7 @@ * xmlReader.parse(saxSource.getInputSource()); *

      * + * @param the type of the class modeled by this Class object * @param sourceClass The class of the source, or null. * If the class is null, a vendor specifc Source implementation will be returned. * The following classes are supported at a minimum: @@ -401,6 +402,7 @@ * contentHandler.endDocument(); *
      * + * @param the type of the class modeled by this Class object * @param resultClass The class of the result, or null. * If resultClass is null, a vendor specific Result implementation will be returned. * The following classes are supported at a minimum: diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/sql/Wrapper.java --- a/jdk/src/share/classes/java/sql/Wrapper.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/sql/Wrapper.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,6 +53,7 @@ * or a proxy for that result. If the receiver is not a * wrapper and does not implement the interface, then an SQLException is thrown. * + * @param the type of the class modeled by this Class object * @param iface A Class defining an interface that the result must implement. * @return an object that implements the interface. May be a proxy for the actual implementing object. * @throws java.sql.SQLException If no object found that implements the interface diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/time/format/DateTimeFormatter.java --- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java Thu Jul 11 12:50:20 2013 -0700 @@ -1304,6 +1304,7 @@ * LocalTime time = parsed.query(LocalTime::from); * Period extraDays = parsed.query(DateTimeFormatter.parsedExcessDays()); *
      + * @return a query that provides access to the excess days that were parsed */ public static final TemporalQuery parsedExcessDays() { return PARSED_EXCESS_DAYS; @@ -1344,6 +1345,7 @@ * // validate leap-second is correct and apply correct smoothing * } *
      + * @return a query that provides access to whether a leap-second was parsed */ public static final TemporalQuery parsedLeapSecond() { return PARSED_LEAP_SECOND; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/ArrayPrefixHelpers.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/share/classes/java/util/ArrayPrefixHelpers.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,697 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package java.util; + +/* + * Written by Doug Lea with assistance from members of JCP JSR-166 + * Expert Group and released to the public domain, as explained at + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.CountedCompleter; +import java.util.function.BinaryOperator; +import java.util.function.IntBinaryOperator; +import java.util.function.LongBinaryOperator; +import java.util.function.DoubleBinaryOperator; + +/** + * ForkJoin tasks to perform Arrays.parallelPrefix operations. + * + * @author Doug Lea + * @since 1.8 + */ +class ArrayPrefixHelpers { + private ArrayPrefixHelpers() {}; // non-instantiable + + /* + * Parallel prefix (aka cumulate, scan) task classes + * are based loosely on Guy Blelloch's original + * algorithm (http://www.cs.cmu.edu/~scandal/alg/scan.html): + * Keep dividing by two to threshold segment size, and then: + * Pass 1: Create tree of partial sums for each segment + * Pass 2: For each segment, cumulate with offset of left sibling + * + * This version improves performance within FJ framework mainly by + * allowing the second pass of ready left-hand sides to proceed + * even if some right-hand side first passes are still executing. + * It also combines first and second pass for leftmost segment, + * and skips the first pass for rightmost segment (whose result is + * not needed for second pass). It similarly manages to avoid + * requiring that users supply an identity basis for accumulations + * by tracking those segments/subtasks for which the first + * existing element is used as base. + * + * Managing this relies on ORing some bits in the pendingCount for + * phases/states: CUMULATE, SUMMED, and FINISHED. CUMULATE is the + * main phase bit. When false, segments compute only their sum. + * When true, they cumulate array elements. CUMULATE is set at + * root at beginning of second pass and then propagated down. But + * it may also be set earlier for subtrees with lo==0 (the left + * spine of tree). SUMMED is a one bit join count. For leafs, it + * is set when summed. For internal nodes, it becomes true when + * one child is summed. When the second child finishes summing, + * we then moves up tree to trigger the cumulate phase. FINISHED + * is also a one bit join count. For leafs, it is set when + * cumulated. For internal nodes, it becomes true when one child + * is cumulated. When the second child finishes cumulating, it + * then moves up tree, completing at the root. + * + * To better exploit locality and reduce overhead, the compute + * method loops starting with the current task, moving if possible + * to one of its subtasks rather than forking. + * + * As usual for this sort of utility, there are 4 versions, that + * are simple copy/paste/adapt variants of each other. (The + * double and int versions differ from long version soley by + * replacing "long" (with case-matching)). + */ + + // see above + static final int CUMULATE = 1; + static final int SUMMED = 2; + static final int FINISHED = 4; + + /** The smallest subtask array partition size to use as threshold */ + static final int MIN_PARTITION = 16; + + static final class CumulateTask extends CountedCompleter { + final T[] array; + final BinaryOperator function; + CumulateTask left, right; + T in, out; + final int lo, hi, origin, fence, threshold; + + /** Root task constructor */ + public CumulateTask(CumulateTask parent, + BinaryOperator function, + T[] array, int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.lo = this.origin = lo; this.hi = this.fence = hi; + int p; + this.threshold = + (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3)) + <= MIN_PARTITION ? MIN_PARTITION : p; + } + + /** Subtask constructor */ + CumulateTask(CumulateTask parent, BinaryOperator function, + T[] array, int origin, int fence, int threshold, + int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.origin = origin; this.fence = fence; + this.threshold = threshold; + this.lo = lo; this.hi = hi; + } + + public final void compute() { + final BinaryOperator fn; + final T[] a; + if ((fn = this.function) == null || (a = this.array) == null) + throw new NullPointerException(); // hoist checks + int th = threshold, org = origin, fnc = fence, l, h; + CumulateTask t = this; + outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) { + if (h - l > th) { + CumulateTask lt = t.left, rt = t.right, f; + if (lt == null) { // first pass + int mid = (l + h) >>> 1; + f = rt = t.right = + new CumulateTask(t, fn, a, org, fnc, th, mid, h); + t = lt = t.left = + new CumulateTask(t, fn, a, org, fnc, th, l, mid); + } + else { // possibly refork + T pin = t.in; + lt.in = pin; + f = t = null; + if (rt != null) { + T lout = lt.out; + rt.in = (l == org ? lout : + fn.apply(pin, lout)); + for (int c;;) { + if (((c = rt.getPendingCount()) & CUMULATE) != 0) + break; + if (rt.compareAndSetPendingCount(c, c|CUMULATE)){ + t = rt; + break; + } + } + } + for (int c;;) { + if (((c = lt.getPendingCount()) & CUMULATE) != 0) + break; + if (lt.compareAndSetPendingCount(c, c|CUMULATE)) { + if (t != null) + f = t; + t = lt; + break; + } + } + if (t == null) + break; + } + if (f != null) + f.fork(); + } + else { + int state; // Transition to sum, cumulate, or both + for (int b;;) { + if (((b = t.getPendingCount()) & FINISHED) != 0) + break outer; // already done + state = ((b & CUMULATE) != 0? FINISHED : + (l > org) ? SUMMED : (SUMMED|FINISHED)); + if (t.compareAndSetPendingCount(b, b|state)) + break; + } + + T sum; + if (state != SUMMED) { + int first; + if (l == org) { // leftmost; no in + sum = a[org]; + first = org + 1; + } + else { + sum = t.in; + first = l; + } + for (int i = first; i < h; ++i) // cumulate + a[i] = sum = fn.apply(sum, a[i]); + } + else if (h < fnc) { // skip rightmost + sum = a[l]; + for (int i = l + 1; i < h; ++i) // sum only + sum = fn.apply(sum, a[i]); + } + else + sum = t.in; + t.out = sum; + for (CumulateTask par;;) { // propagate + if ((par = (CumulateTask)t.getCompleter()) == null) { + if ((state & FINISHED) != 0) // enable join + t.quietlyComplete(); + break outer; + } + int b = par.getPendingCount(); + if ((b & state & FINISHED) != 0) + t = par; // both done + else if ((b & state & SUMMED) != 0) { // both summed + int nextState; CumulateTask lt, rt; + if ((lt = par.left) != null && + (rt = par.right) != null) { + T lout = lt.out; + par.out = (rt.hi == fnc ? lout : + fn.apply(lout, rt.out)); + } + int refork = (((b & CUMULATE) == 0 && + par.lo == org) ? CUMULATE : 0); + if ((nextState = b|state|refork) == b || + par.compareAndSetPendingCount(b, nextState)) { + state = SUMMED; // drop finished + t = par; + if (refork != 0) + par.fork(); + } + } + else if (par.compareAndSetPendingCount(b, b|state)) + break outer; // sib not ready + } + } + } + } + } + + static final class LongCumulateTask extends CountedCompleter { + final long[] array; + final LongBinaryOperator function; + LongCumulateTask left, right; + long in, out; + final int lo, hi, origin, fence, threshold; + + /** Root task constructor */ + public LongCumulateTask(LongCumulateTask parent, + LongBinaryOperator function, + long[] array, int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.lo = this.origin = lo; this.hi = this.fence = hi; + int p; + this.threshold = + (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3)) + <= MIN_PARTITION ? MIN_PARTITION : p; + } + + /** Subtask constructor */ + LongCumulateTask(LongCumulateTask parent, LongBinaryOperator function, + long[] array, int origin, int fence, int threshold, + int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.origin = origin; this.fence = fence; + this.threshold = threshold; + this.lo = lo; this.hi = hi; + } + + public final void compute() { + final LongBinaryOperator fn; + final long[] a; + if ((fn = this.function) == null || (a = this.array) == null) + throw new NullPointerException(); // hoist checks + int th = threshold, org = origin, fnc = fence, l, h; + LongCumulateTask t = this; + outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) { + if (h - l > th) { + LongCumulateTask lt = t.left, rt = t.right, f; + if (lt == null) { // first pass + int mid = (l + h) >>> 1; + f = rt = t.right = + new LongCumulateTask(t, fn, a, org, fnc, th, mid, h); + t = lt = t.left = + new LongCumulateTask(t, fn, a, org, fnc, th, l, mid); + } + else { // possibly refork + long pin = t.in; + lt.in = pin; + f = t = null; + if (rt != null) { + long lout = lt.out; + rt.in = (l == org ? lout : + fn.applyAsLong(pin, lout)); + for (int c;;) { + if (((c = rt.getPendingCount()) & CUMULATE) != 0) + break; + if (rt.compareAndSetPendingCount(c, c|CUMULATE)){ + t = rt; + break; + } + } + } + for (int c;;) { + if (((c = lt.getPendingCount()) & CUMULATE) != 0) + break; + if (lt.compareAndSetPendingCount(c, c|CUMULATE)) { + if (t != null) + f = t; + t = lt; + break; + } + } + if (t == null) + break; + } + if (f != null) + f.fork(); + } + else { + int state; // Transition to sum, cumulate, or both + for (int b;;) { + if (((b = t.getPendingCount()) & FINISHED) != 0) + break outer; // already done + state = ((b & CUMULATE) != 0? FINISHED : + (l > org) ? SUMMED : (SUMMED|FINISHED)); + if (t.compareAndSetPendingCount(b, b|state)) + break; + } + + long sum; + if (state != SUMMED) { + int first; + if (l == org) { // leftmost; no in + sum = a[org]; + first = org + 1; + } + else { + sum = t.in; + first = l; + } + for (int i = first; i < h; ++i) // cumulate + a[i] = sum = fn.applyAsLong(sum, a[i]); + } + else if (h < fnc) { // skip rightmost + sum = a[l]; + for (int i = l + 1; i < h; ++i) // sum only + sum = fn.applyAsLong(sum, a[i]); + } + else + sum = t.in; + t.out = sum; + for (LongCumulateTask par;;) { // propagate + if ((par = (LongCumulateTask)t.getCompleter()) == null) { + if ((state & FINISHED) != 0) // enable join + t.quietlyComplete(); + break outer; + } + int b = par.getPendingCount(); + if ((b & state & FINISHED) != 0) + t = par; // both done + else if ((b & state & SUMMED) != 0) { // both summed + int nextState; LongCumulateTask lt, rt; + if ((lt = par.left) != null && + (rt = par.right) != null) { + long lout = lt.out; + par.out = (rt.hi == fnc ? lout : + fn.applyAsLong(lout, rt.out)); + } + int refork = (((b & CUMULATE) == 0 && + par.lo == org) ? CUMULATE : 0); + if ((nextState = b|state|refork) == b || + par.compareAndSetPendingCount(b, nextState)) { + state = SUMMED; // drop finished + t = par; + if (refork != 0) + par.fork(); + } + } + else if (par.compareAndSetPendingCount(b, b|state)) + break outer; // sib not ready + } + } + } + } + } + + static final class DoubleCumulateTask extends CountedCompleter { + final double[] array; + final DoubleBinaryOperator function; + DoubleCumulateTask left, right; + double in, out; + final int lo, hi, origin, fence, threshold; + + /** Root task constructor */ + public DoubleCumulateTask(DoubleCumulateTask parent, + DoubleBinaryOperator function, + double[] array, int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.lo = this.origin = lo; this.hi = this.fence = hi; + int p; + this.threshold = + (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3)) + <= MIN_PARTITION ? MIN_PARTITION : p; + } + + /** Subtask constructor */ + DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function, + double[] array, int origin, int fence, int threshold, + int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.origin = origin; this.fence = fence; + this.threshold = threshold; + this.lo = lo; this.hi = hi; + } + + public final void compute() { + final DoubleBinaryOperator fn; + final double[] a; + if ((fn = this.function) == null || (a = this.array) == null) + throw new NullPointerException(); // hoist checks + int th = threshold, org = origin, fnc = fence, l, h; + DoubleCumulateTask t = this; + outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) { + if (h - l > th) { + DoubleCumulateTask lt = t.left, rt = t.right, f; + if (lt == null) { // first pass + int mid = (l + h) >>> 1; + f = rt = t.right = + new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h); + t = lt = t.left = + new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid); + } + else { // possibly refork + double pin = t.in; + lt.in = pin; + f = t = null; + if (rt != null) { + double lout = lt.out; + rt.in = (l == org ? lout : + fn.applyAsDouble(pin, lout)); + for (int c;;) { + if (((c = rt.getPendingCount()) & CUMULATE) != 0) + break; + if (rt.compareAndSetPendingCount(c, c|CUMULATE)){ + t = rt; + break; + } + } + } + for (int c;;) { + if (((c = lt.getPendingCount()) & CUMULATE) != 0) + break; + if (lt.compareAndSetPendingCount(c, c|CUMULATE)) { + if (t != null) + f = t; + t = lt; + break; + } + } + if (t == null) + break; + } + if (f != null) + f.fork(); + } + else { + int state; // Transition to sum, cumulate, or both + for (int b;;) { + if (((b = t.getPendingCount()) & FINISHED) != 0) + break outer; // already done + state = ((b & CUMULATE) != 0? FINISHED : + (l > org) ? SUMMED : (SUMMED|FINISHED)); + if (t.compareAndSetPendingCount(b, b|state)) + break; + } + + double sum; + if (state != SUMMED) { + int first; + if (l == org) { // leftmost; no in + sum = a[org]; + first = org + 1; + } + else { + sum = t.in; + first = l; + } + for (int i = first; i < h; ++i) // cumulate + a[i] = sum = fn.applyAsDouble(sum, a[i]); + } + else if (h < fnc) { // skip rightmost + sum = a[l]; + for (int i = l + 1; i < h; ++i) // sum only + sum = fn.applyAsDouble(sum, a[i]); + } + else + sum = t.in; + t.out = sum; + for (DoubleCumulateTask par;;) { // propagate + if ((par = (DoubleCumulateTask)t.getCompleter()) == null) { + if ((state & FINISHED) != 0) // enable join + t.quietlyComplete(); + break outer; + } + int b = par.getPendingCount(); + if ((b & state & FINISHED) != 0) + t = par; // both done + else if ((b & state & SUMMED) != 0) { // both summed + int nextState; DoubleCumulateTask lt, rt; + if ((lt = par.left) != null && + (rt = par.right) != null) { + double lout = lt.out; + par.out = (rt.hi == fnc ? lout : + fn.applyAsDouble(lout, rt.out)); + } + int refork = (((b & CUMULATE) == 0 && + par.lo == org) ? CUMULATE : 0); + if ((nextState = b|state|refork) == b || + par.compareAndSetPendingCount(b, nextState)) { + state = SUMMED; // drop finished + t = par; + if (refork != 0) + par.fork(); + } + } + else if (par.compareAndSetPendingCount(b, b|state)) + break outer; // sib not ready + } + } + } + } + } + + static final class IntCumulateTask extends CountedCompleter { + final int[] array; + final IntBinaryOperator function; + IntCumulateTask left, right; + int in, out; + final int lo, hi, origin, fence, threshold; + + /** Root task constructor */ + public IntCumulateTask(IntCumulateTask parent, + IntBinaryOperator function, + int[] array, int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.lo = this.origin = lo; this.hi = this.fence = hi; + int p; + this.threshold = + (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3)) + <= MIN_PARTITION ? MIN_PARTITION : p; + } + + /** Subtask constructor */ + IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function, + int[] array, int origin, int fence, int threshold, + int lo, int hi) { + super(parent); + this.function = function; this.array = array; + this.origin = origin; this.fence = fence; + this.threshold = threshold; + this.lo = lo; this.hi = hi; + } + + public final void compute() { + final IntBinaryOperator fn; + final int[] a; + if ((fn = this.function) == null || (a = this.array) == null) + throw new NullPointerException(); // hoist checks + int th = threshold, org = origin, fnc = fence, l, h; + IntCumulateTask t = this; + outer: while ((l = t.lo) >= 0 && (h = t.hi) <= a.length) { + if (h - l > th) { + IntCumulateTask lt = t.left, rt = t.right, f; + if (lt == null) { // first pass + int mid = (l + h) >>> 1; + f = rt = t.right = + new IntCumulateTask(t, fn, a, org, fnc, th, mid, h); + t = lt = t.left = + new IntCumulateTask(t, fn, a, org, fnc, th, l, mid); + } + else { // possibly refork + int pin = t.in; + lt.in = pin; + f = t = null; + if (rt != null) { + int lout = lt.out; + rt.in = (l == org ? lout : + fn.applyAsInt(pin, lout)); + for (int c;;) { + if (((c = rt.getPendingCount()) & CUMULATE) != 0) + break; + if (rt.compareAndSetPendingCount(c, c|CUMULATE)){ + t = rt; + break; + } + } + } + for (int c;;) { + if (((c = lt.getPendingCount()) & CUMULATE) != 0) + break; + if (lt.compareAndSetPendingCount(c, c|CUMULATE)) { + if (t != null) + f = t; + t = lt; + break; + } + } + if (t == null) + break; + } + if (f != null) + f.fork(); + } + else { + int state; // Transition to sum, cumulate, or both + for (int b;;) { + if (((b = t.getPendingCount()) & FINISHED) != 0) + break outer; // already done + state = ((b & CUMULATE) != 0? FINISHED : + (l > org) ? SUMMED : (SUMMED|FINISHED)); + if (t.compareAndSetPendingCount(b, b|state)) + break; + } + + int sum; + if (state != SUMMED) { + int first; + if (l == org) { // leftmost; no in + sum = a[org]; + first = org + 1; + } + else { + sum = t.in; + first = l; + } + for (int i = first; i < h; ++i) // cumulate + a[i] = sum = fn.applyAsInt(sum, a[i]); + } + else if (h < fnc) { // skip rightmost + sum = a[l]; + for (int i = l + 1; i < h; ++i) // sum only + sum = fn.applyAsInt(sum, a[i]); + } + else + sum = t.in; + t.out = sum; + for (IntCumulateTask par;;) { // propagate + if ((par = (IntCumulateTask)t.getCompleter()) == null) { + if ((state & FINISHED) != 0) // enable join + t.quietlyComplete(); + break outer; + } + int b = par.getPendingCount(); + if ((b & state & FINISHED) != 0) + t = par; // both done + else if ((b & state & SUMMED) != 0) { // both summed + int nextState; IntCumulateTask lt, rt; + if ((lt = par.left) != null && + (rt = par.right) != null) { + int lout = lt.out; + par.out = (rt.hi == fnc ? lout : + fn.applyAsInt(lout, rt.out)); + } + int refork = (((b & CUMULATE) == 0 && + par.lo == org) ? CUMULATE : 0); + if ((nextState = b|state|refork) == b || + par.compareAndSetPendingCount(b, nextState)) { + state = SUMMED; // drop finished + t = par; + if (refork != 0) + par.fork(); + } + } + else if (par.compareAndSetPendingCount(b, b|state)) + break outer; // sib not ready + } + } + } + } + } + + +} \ No newline at end of file diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Arrays.java --- a/jdk/src/share/classes/java/util/Arrays.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Arrays.java Thu Jul 11 12:50:20 2013 -0700 @@ -1559,6 +1559,183 @@ } } + // Parallel prefix + + /** + * Cumulates, in parallel, each element of the given array in place, + * using the supplied function. For example if the array initially + * holds {@code [2, 1, 0, 3]} and the operation performs addition, + * then upon return the array holds {@code [2, 3, 3, 6]}. + * Parallel prefix computation is usually more efficient than + * sequential loops for large arrays. + * + * @param array the array, which is modified in-place by this method + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(T[] array, BinaryOperator op) { + if (array.length > 0) + new ArrayPrefixHelpers.CumulateTask<> + (null, op, array, 0, array.length).invoke(); + } + + /** + * Performs {@link #parallelPrefix(Object[], BinaryOperator)} + * for the given subrange of the array. + * + * @param array the array + * @param fromIndex the index of the first element, inclusive + * @param toIndex the index of the last element, exclusive + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws IllegalArgumentException if {@code fromIndex > toIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code fromIndex < 0} or {@code toIndex > array.length} + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(T[] array, int fromIndex, + int toIndex, BinaryOperator op) { + rangeCheck(array.length, fromIndex, toIndex); + if (fromIndex < toIndex) + new ArrayPrefixHelpers.CumulateTask<> + (null, op, array, fromIndex, toIndex).invoke(); + } + + /** + * Cumulates, in parallel, each element of the given array in place, + * using the supplied function. For example if the array initially + * holds {@code [2, 1, 0, 3]} and the operation performs addition, + * then upon return the array holds {@code [2, 3, 3, 6]}. + * Parallel prefix computation is usually more efficient than + * sequential loops for large arrays. + * + * @param array the array, which is modified in-place by this method + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(long[] array, LongBinaryOperator op) { + if (array.length > 0) + new ArrayPrefixHelpers.LongCumulateTask + (null, op, array, 0, array.length).invoke(); + } + + /** + * Performs {@link #parallelPrefix(long[], LongBinaryOperator)} + * for the given subrange of the array. + * + * @param array the array + * @param fromIndex the index of the first element, inclusive + * @param toIndex the index of the last element, exclusive + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws IllegalArgumentException if {@code fromIndex > toIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code fromIndex < 0} or {@code toIndex > array.length} + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(long[] array, int fromIndex, + int toIndex, LongBinaryOperator op) { + rangeCheck(array.length, fromIndex, toIndex); + if (fromIndex < toIndex) + new ArrayPrefixHelpers.LongCumulateTask + (null, op, array, fromIndex, toIndex).invoke(); + } + + /** + * Cumulates, in parallel, each element of the given array in place, + * using the supplied function. For example if the array initially + * holds {@code [2.0, 1.0, 0.0, 3.0]} and the operation performs addition, + * then upon return the array holds {@code [2.0, 3.0, 3.0, 6.0]}. + * Parallel prefix computation is usually more efficient than + * sequential loops for large arrays. + * + *

      Because floating-point operations may not be strictly associative, + * the returned result may not be identical to the value that would be + * obtained if the operation was performed sequentially. + * + * @param array the array, which is modified in-place by this method + * @param op a side-effect-free function to perform the cumulation + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(double[] array, DoubleBinaryOperator op) { + if (array.length > 0) + new ArrayPrefixHelpers.DoubleCumulateTask + (null, op, array, 0, array.length).invoke(); + } + + /** + * Performs {@link #parallelPrefix(double[], DoubleBinaryOperator)} + * for the given subrange of the array. + * + * @param array the array + * @param fromIndex the index of the first element, inclusive + * @param toIndex the index of the last element, exclusive + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws IllegalArgumentException if {@code fromIndex > toIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code fromIndex < 0} or {@code toIndex > array.length} + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(double[] array, int fromIndex, + int toIndex, DoubleBinaryOperator op) { + rangeCheck(array.length, fromIndex, toIndex); + if (fromIndex < toIndex) + new ArrayPrefixHelpers.DoubleCumulateTask + (null, op, array, fromIndex, toIndex).invoke(); + } + + /** + * Cumulates, in parallel, each element of the given array in place, + * using the supplied function. For example if the array initially + * holds {@code [2, 1, 0, 3]} and the operation performs addition, + * then upon return the array holds {@code [2, 3, 3, 6]}. + * Parallel prefix computation is usually more efficient than + * sequential loops for large arrays. + * + * @param array the array, which is modified in-place by this method + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(int[] array, IntBinaryOperator op) { + if (array.length > 0) + new ArrayPrefixHelpers.IntCumulateTask + (null, op, array, 0, array.length).invoke(); + } + + /** + * Performs {@link #parallelPrefix(int[], IntBinaryOperator)} + * for the given subrange of the array. + * + * @param array the array + * @param fromIndex the index of the first element, inclusive + * @param toIndex the index of the last element, exclusive + * @param op a side-effect-free, associative function to perform the + * cumulation + * @throws IllegalArgumentException if {@code fromIndex > toIndex} + * @throws ArrayIndexOutOfBoundsException + * if {@code fromIndex < 0} or {@code toIndex > array.length} + * @throws NullPointerException if the specified array or function is null + * @since 1.8 + */ + public static void parallelPrefix(int[] array, int fromIndex, + int toIndex, IntBinaryOperator op) { + rangeCheck(array.length, fromIndex, toIndex); + if (fromIndex < toIndex) + new ArrayPrefixHelpers.IntCumulateTask + (null, op, array, fromIndex, toIndex).invoke(); + } + // Searching /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Collections.java --- a/jdk/src/share/classes/java/util/Collections.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Collections.java Thu Jul 11 12:50:20 2013 -0700 @@ -4304,6 +4304,11 @@ } private Object readResolve() { return Collections.reverseOrder(); } + + @Override + public Comparator> reversed() { + return Comparator.naturalOrder(); + } } /** @@ -4367,6 +4372,11 @@ public int hashCode() { return cmp.hashCode() ^ Integer.MIN_VALUE; } + + @Override + public Comparator reversed() { + return cmp; + } } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Comparator.java --- a/jdk/src/share/classes/java/util/Comparator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Comparator.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,10 +25,12 @@ package java.util; +import java.io.Serializable; import java.util.function.Function; import java.util.function.ToIntFunction; import java.util.function.ToLongFunction; import java.util.function.ToDoubleFunction; +import java.util.Comparators; /** * A comparison function, which imposes a total ordering on some @@ -175,88 +177,357 @@ * Returns a comparator that imposes the reverse ordering of this * comparator. * - * @return A comparator that imposes the reverse ordering of this + * @return a comparator that imposes the reverse ordering of this * comparator. * @since 1.8 */ - default Comparator reverseOrder() { + default Comparator reversed() { return Collections.reverseOrder(this); } /** - * Constructs a lexicographic order comparator with another comparator. - * For example, a {@code Comparator byLastName} can be composed - * with another {@code Comparator byFirstName}, then {@code - * byLastName.thenComparing(byFirstName)} creates a {@code - * Comparator} which sorts by last name, and for equal last names - * sorts by first name. + * Returns a lexicographic-order comparator with another comparator. + * If this {@code Comparator} considers two elements equal, i.e. + * {@code compare(a, b) == 0}, {@code other} is used to determine the order. + * + *

      The returned comparator is serializable if the specified comparator + * is also serializable. * - * @param other the other comparator used when equals on this. + * @apiNote + * For example, to sort a collection of {@code String} based on the length + * and then case-insensitive natural ordering, the comparator can be + * composed using following code, + * + *

      {@code
      +     *     Comparator cmp = Comparator.comparing(String::length)
      +     *             .thenComparing(String.CASE_INSENSITIVE_ORDER);
      +     * }
      + * + * @param other the other comparator to be used when this comparator + * compares two objects that are equal. + * @return a lexicographic-order comparator composed of this and then the + * other comparator * @throws NullPointerException if the argument is null. * @since 1.8 */ default Comparator thenComparing(Comparator other) { - return Comparators.compose(this, other); + Objects.requireNonNull(other); + return (Comparator & Serializable) (c1, c2) -> { + int res = compare(c1, c2); + return (res != 0) ? res : other.compare(c1, c2); + }; + } + + /** + * Returns a lexicographic-order comparator with a function that + * extracts a key to be compared with the given {@code Comparator}. + * + * @implSpec This default implementation behaves as if {@code + * thenComparing(comparing(keyExtractor, cmp))}. + * + * @param the type of the sort key + * @param keyExtractor the function used to extract the sort key + * @param keyComparator the {@code Comparator} used to compare the sort key + * @return a lexicographic-order comparator composed of this comparator + * and then comparing on the key extracted by the keyExtractor function + * @throws NullPointerException if the argument is null. + * @see #comparing(Function, Comparator) + * @see #thenComparing(Comparator) + * @since 1.8 + */ + default > Comparator thenComparing( + Function keyExtractor, + Comparator keyComparator) + { + return thenComparing(comparing(keyExtractor, keyComparator)); } /** - * Constructs a lexicographic order comparator with a function that - * extracts a {@code Comparable} key. This default implementation calls - * {@code thenComparing(this, Comparators.comparing(keyExtractor))}. + * Returns a lexicographic-order comparator with a function that + * extracts a {@code Comparable} sort key. + * + * @implSpec This default implementation behaves as if {@code + * thenComparing(comparing(keyExtractor))}. * - * @param the {@link Comparable} type for comparison - * @param keyExtractor the function used to extract the {@link Comparable} sort key + * @param the type of the {@link Comparable} sort key + * @param keyExtractor the function used to extract the {@link + * Comparable} sort key + * @return a lexicographic-order comparator composed of this and then the + * {@link Comparable} sort key. * @throws NullPointerException if the argument is null. - * @see Comparators#comparing(Function) + * @see #comparing(Function) * @see #thenComparing(Comparator) * @since 1.8 */ - default > Comparator thenComparing(Function keyExtractor) { - return thenComparing(Comparators.comparing(keyExtractor)); + default > Comparator thenComparing( + Function keyExtractor) + { + return thenComparing(comparing(keyExtractor)); } /** - * Constructs a lexicographic order comparator with a function that - * extracts a {@code int} value. This default implementation calls {@code - * thenComparing(this, Comparators.comparing(keyExtractor))}. + * Returns a lexicographic-order comparator with a function that + * extracts a {@code int} sort key. + * + * @implSpec This default implementation behaves as if {@code + * thenComparing(comparing(keyExtractor))}. * - * @param keyExtractor the function used to extract the integer value + * @param keyExtractor the function used to extract the integer sort key + * @return a lexicographic-order comparator composed of this and then the + * {@code int} sort key * @throws NullPointerException if the argument is null. - * @see Comparators#comparing(ToIntFunction) + * @see #comparing(ToIntFunction) * @see #thenComparing(Comparator) * @since 1.8 */ default Comparator thenComparing(ToIntFunction keyExtractor) { - return thenComparing(Comparators.comparing(keyExtractor)); + return thenComparing(comparing(keyExtractor)); } /** - * Constructs a lexicographic order comparator with a function that - * extracts a {@code long} value. This default implementation calls - * {@code thenComparing(this, Comparators.comparing(keyExtractor))}. + * Returns a lexicographic-order comparator with a function that + * extracts a {@code long} sort key. + * + * @implSpec This default implementation behaves as if {@code + * thenComparing(comparing(keyExtractor))}. * - * @param keyExtractor the function used to extract the long value + * @param keyExtractor the function used to extract the long sort key + * @return a lexicographic-order comparator composed of this and then the + * {@code long} sort key * @throws NullPointerException if the argument is null. - * @see Comparators#comparing(ToLongFunction) + * @see #comparing(ToLongFunction) * @see #thenComparing(Comparator) * @since 1.8 */ default Comparator thenComparing(ToLongFunction keyExtractor) { - return thenComparing(Comparators.comparing(keyExtractor)); + return thenComparing(comparing(keyExtractor)); } /** - * Constructs a lexicographic order comparator with a function that - * extracts a {@code double} value. This default implementation calls - * {@code thenComparing(this, Comparators.comparing(keyExtractor))}. + * Returns a lexicographic-order comparator with a function that + * extracts a {@code double} sort key. + * + * @implSpec This default implementation behaves as if {@code + * thenComparing(comparing(keyExtractor))}. * - * @param keyExtractor the function used to extract the double value + * @param keyExtractor the function used to extract the double sort key + * @return a lexicographic-order comparator composed of this and then the + * {@code double} sort key * @throws NullPointerException if the argument is null. - * @see Comparators#comparing(ToDoubleFunction) + * @see #comparing(ToDoubleFunction) * @see #thenComparing(Comparator) * @since 1.8 */ default Comparator thenComparing(ToDoubleFunction keyExtractor) { - return thenComparing(Comparators.comparing(keyExtractor)); + return thenComparing(comparing(keyExtractor)); + } + + /** + * Returns a comparator that imposes the reverse of the natural + * ordering. + * + *

      The returned comparator is serializable and throws {@link + * NullPointerException} when comparing {@code null}. + * + * @param the {@link Comparable} type of element to be compared + * @return a comparator that imposes the reverse of the natural + * ordering on {@code Comparable} objects. + * @see Comparable + * @since 1.8 + */ + public static > Comparator reverseOrder() { + return Collections.reverseOrder(); + } + + /** + * Returns a comparator that compares {@link Comparable} objects in natural + * order. + * + *

      The returned comparator is serializable and throws {@link + * NullPointerException} when comparing {@code null}. + * + * @param the {@link Comparable} type of element to be compared + * @return a comparator that imposes the natural ordering on {@code + * Comparable} objects. + * @see Comparable + * @since 1.8 + */ + public static > Comparator naturalOrder() { + return (Comparator) Comparators.NaturalOrderComparator.INSTANCE; + } + + /** + * Returns a null-friendly comparator that considers {@code null} to be + * less than non-null. When both are {@code null}, they are considered + * equal. If both are non-null, the specified {@code Comparator} is used + * to determine the order. If the specified comparator is {@code null}, + * then the returned comparator considers all non-null values to be equal. + * + *

      The returned comparator is serializable if the specified comparator + * is serializable. + * + * @param the type of the elements to be compared + * @param comparator a {@code Comparator} for comparing non-null values + * @return a comparator that considers {@code null} to be less than + * non-null, and compares non-null objects with the supplied + * {@code Comparator}. + * @since 1.8 + */ + public static Comparator nullsFirst(Comparator comparator) { + return new Comparators.NullComparator(true, comparator); + } + + /** + * Returns a null-friendly comparator that considers {@code null} to be + * greater than non-null. When both are {@code null}, they are considered + * equal. If both are non-null, the specified {@code Comparator} is used + * to determine the order. If the specified comparator is {@code null}, + * then the returned comparator considers all non-null values to be equal. + * + *

      The returned comparator is serializable if the specified comparator + * is serializable. + * + * @param the type of the elements to be compared + * @param comparator a {@code Comparator} for comparing non-null values + * @return a comparator that considers {@code null} to be greater than + * non-null, and compares non-null objects with the supplied + * {@code Comparator}. + * @since 1.8 + */ + public static Comparator nullsLast(Comparator comparator) { + return new Comparators.NullComparator(false, comparator); + } + + /** + * Accepts a function that extracts a sort key from a type {@code T}, and + * returns a {@code Comparator} that compares by that sort key using + * the specified {@link Comparator}. + * + *

      The returned comparator is serializable if the specified function + * and comparator are both serializable. + * + * @apiNote + * For example, to obtain a {@code Comparator} that compares {@code + * Person} objects by their last name ignoring case differences, + * + *

      {@code
      +     *     Comparator cmp = Comparator.comparing(
      +     *             Person::getLastName,
      +     *             String.CASE_INSENSITIVE_ORDER);
      +     * }
      + * + * @param the type of element to be compared + * @param the type of the sort key + * @param keyExtractor the function used to extract the sort key + * @param keyComparator the {@code Comparator} used to compare the sort key + * @return a comparator that compares by an extracted key using the + * specified {@code Comparator} + * @throws NullPointerException if either argument is null + * @since 1.8 + */ + public static Comparator comparing( + Function keyExtractor, + Comparator keyComparator) + { + Objects.requireNonNull(keyExtractor); + Objects.requireNonNull(keyComparator); + return (Comparator & Serializable) + (c1, c2) -> keyComparator.compare(keyExtractor.apply(c1), + keyExtractor.apply(c2)); + } + + /** + * Accepts a function that extracts a {@link java.lang.Comparable + * Comparable} sort key from a type {@code T}, and returns a {@code + * Comparator} that compares by that sort key. + * + *

      The returned comparator is serializable if the specified function + * is also serializable. + * + * @apiNote + * For example, to obtain a {@code Comparator} that compares {@code + * Person} objects by their last name, + * + *

      {@code
      +     *     Comparator byLastName = Comparator.comparing(Person::getLastName);
      +     * }
      + * + * @param the type of element to be compared + * @param the type of the {@code Comparable} sort key + * @param keyExtractor the function used to extract the {@link + * Comparable} sort key + * @return a comparator that compares by an extracted key + * @throws NullPointerException if the argument is null + * @since 1.8 + */ + public static > Comparator comparing( + Function keyExtractor) + { + Objects.requireNonNull(keyExtractor); + return (Comparator & Serializable) + (c1, c2) -> keyExtractor.apply(c1).compareTo(keyExtractor.apply(c2)); + } + + /** + * Accepts a function that extracts an {@code int} sort key from a type + * {@code T}, and returns a {@code Comparator} that compares by that + * sort key. + * + *

      The returned comparator is serializable if the specified function + * is also serializable. + * + * @param the type of element to be compared + * @param keyExtractor the function used to extract the integer sort key + * @return a comparator that compares by an extracted key + * @see #comparing(Function) + * @throws NullPointerException if the argument is null + * @since 1.8 + */ + public static Comparator comparing(ToIntFunction keyExtractor) { + Objects.requireNonNull(keyExtractor); + return (Comparator & Serializable) + (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), keyExtractor.applyAsInt(c2)); + } + + /** + * Accepts a function that extracts a {@code long} sort key from a type + * {@code T}, and returns a {@code Comparator} that compares by that + * sort key. + * + *

      The returned comparator is serializable if the specified function is + * also serializable. + * + * @param the type of element to be compared + * @param keyExtractor the function used to extract the long sort key + * @return a comparator that compares by an extracted key + * @see #comparing(Function) + * @throws NullPointerException if the argument is null + * @since 1.8 + */ + public static Comparator comparing(ToLongFunction keyExtractor) { + Objects.requireNonNull(keyExtractor); + return (Comparator & Serializable) + (c1, c2) -> Long.compare(keyExtractor.applyAsLong(c1), keyExtractor.applyAsLong(c2)); + } + + /** + * Accepts a function that extracts a {@code double} sort key from a type + * {@code T}, and returns a {@code Comparator} that compares by that + * sort key. + * + *

      The returned comparator is serializable if the specified function + * is also serializable. + * + * @param the type of element to be compared + * @param keyExtractor the function used to extract the double sort key + * @return a comparator that compares by an extracted key + * @see #comparing(Function) + * @throws NullPointerException if the argument is null + * @since 1.8 + */ + public static Comparator comparing(ToDoubleFunction keyExtractor) { + Objects.requireNonNull(keyExtractor); + return (Comparator & Serializable) + (c1, c2) -> Double.compare(keyExtractor.applyAsDouble(c1), keyExtractor.applyAsDouble(c2)); } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Comparators.java --- a/jdk/src/share/classes/java/util/Comparators.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Comparators.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,16 +32,9 @@ import java.util.function.ToLongFunction; /** - * This class consists of {@code static} utility methods for comparators. Mostly - * factory method that returns a {@link Comparator}. - * - *

      Unless otherwise noted, passing a {@code null} argument to a method in - * this class will cause a {@link NullPointerException} to be thrown. - * - * @see Comparator - * @since 1.8 + * Package private supporting class for {@link Comparator}. */ -public class Comparators { +class Comparators { private Comparators() { throw new AssertionError("no instances"); } @@ -51,231 +44,55 @@ * * @see Comparable */ - private enum NaturalOrderComparator implements Comparator> { + enum NaturalOrderComparator implements Comparator> { INSTANCE; @Override public int compare(Comparable c1, Comparable c2) { return c1.compareTo(c2); } - } - /** - * Returns a comparator that imposes the reverse of the natural - * ordering. - * - *

      The returned comparator is serializable. - * - * @param {@link Comparable} type - * - * @return A comparator that imposes the reverse of the natural - * ordering on a collection of objects that implement - * the {@link Comparable} interface. - * @see Comparable - */ - public static > Comparator reverseOrder() { - return Collections.reverseOrder(); - } - - /** - * Returns a comparator that imposes the reverse ordering of the specified - * {@link Comparator}. - * - *

      The returned comparator is serializable (assuming the specified - * comparator is also serializable). - * - * @param the element type to be compared - * @param cmp a comparator whose ordering is to be reversed by the returned - * comparator - * @return A comparator that imposes the reverse ordering of the - * specified comparator. - */ - public static Comparator reverseOrder(Comparator cmp) { - Objects.requireNonNull(cmp); - return Collections.reverseOrder(cmp); - } - - /** - * Gets a comparator compares {@link Comparable} type in natural order. - * - * @param {@link Comparable} type - */ - public static > Comparator naturalOrder() { - return (Comparator) NaturalOrderComparator.INSTANCE; - } - - /** - * Gets a comparator compares {@link Map.Entry} in natural order on key. - * - * @param {@link Comparable} key type - * @param value type - */ - public static , V> Comparator> naturalOrderKeys() { - return (Comparator> & Serializable) - (c1, c2) -> c1.getKey().compareTo(c2.getKey()); - } - - /** - * Gets a comparator compares {@link Map.Entry} in natural order on value. - * - * @param key type - * @param {@link Comparable} value type - */ - public static > Comparator> naturalOrderValues() { - return (Comparator> & Serializable) - (c1, c2) -> c1.getValue().compareTo(c2.getValue()); - } - - /** - * Gets a comparator compares {@link Map.Entry} by key using the given - * {@link Comparator}. - * - *

      The returned comparator is serializable assuming the specified - * comparators are also serializable. - * - * @param key type - * @param value type - * @param cmp the key {@link Comparator} - */ - public static Comparator> byKey(Comparator cmp) { - Objects.requireNonNull(cmp); - return (Comparator> & Serializable) - (c1, c2) -> cmp.compare(c1.getKey(), c2.getKey()); - } - - /** - * Gets a comparator compares {@link Map.Entry} by value using the given - * {@link Comparator}. - * - * @param key type - * @param value type - * @param cmp the value {@link Comparator} - */ - public static Comparator> byValue(Comparator cmp) { - Objects.requireNonNull(cmp); - return (Comparator> & Serializable) - (c1, c2) -> cmp.compare(c1.getValue(), c2.getValue()); + @Override + public Comparator> reversed() { + return Comparator.reverseOrder(); + } } /** - * Accepts a function that extracts a {@link java.lang.Comparable - * Comparable} sort key from a type {@code T}, and returns a {@code - * Comparator} that compares by that sort key. For example, if a class - * {@code Person} has a {@code String}-valued getter {@code getLastName}, - * then {@code comparing(Person::getLastName)} would return a {@code - * Comparator} that compares {@code Person} objects by their last - * name. - * - * @param the original element type - * @param the {@link Comparable} type for comparison - * @param keyExtractor the function used to extract the {@link Comparable} sort key + * Null-friendly comparators */ - public static > Comparator comparing(Function keyExtractor) { - Objects.requireNonNull(keyExtractor); - return (Comparator & Serializable) - (c1, c2) -> keyExtractor.apply(c1).compareTo(keyExtractor.apply(c2)); - } + final static class NullComparator implements Comparator, Serializable { + private static final long serialVersionUID = -7569533591570686392L; + private final boolean nullFirst; + // if null, non-null Ts are considered equal + private final Comparator real; - /** - * Accepts a function that extracts an {@code int} value from a type {@code - * T}, and returns a {@code Comparator} that compares by that value. - * - *

      The returned comparator is serializable assuming the specified - * function is also serializable. - * - * @see #comparing(Function) - * @param the original element type - * @param keyExtractor the function used to extract the integer value - */ - public static Comparator comparing(ToIntFunction keyExtractor) { - Objects.requireNonNull(keyExtractor); - return (Comparator & Serializable) - (c1, c2) -> Integer.compare(keyExtractor.applyAsInt(c1), keyExtractor.applyAsInt(c2)); - } - - /** - * Accepts a function that extracts a {@code long} value from a type {@code - * T}, and returns a {@code Comparator} that compares by that value. - * - *

      The returned comparator is serializable assuming the specified - * function is also serializable. - * - * @see #comparing(Function) - * @param the original element type - * @param keyExtractor the function used to extract the long value - */ - public static Comparator comparing(ToLongFunction keyExtractor) { - Objects.requireNonNull(keyExtractor); - return (Comparator & Serializable) - (c1, c2) -> Long.compare(keyExtractor.applyAsLong(c1), keyExtractor.applyAsLong(c2)); - } + @SuppressWarnings("unchecked") + NullComparator(boolean nullFirst, Comparator real) { + this.nullFirst = nullFirst; + this.real = (Comparator) real; + } - /** - * Accepts a function that extracts a {@code double} value from a type - * {@code T}, and returns a {@code Comparator} that compares by that - * value. - * - *

      The returned comparator is serializable assuming the specified - * function is also serializable. - * - * @see #comparing(Function) - * @param the original element type - * @param keyExtractor the function used to extract the double value - */ - public static Comparator comparing(ToDoubleFunction keyExtractor) { - Objects.requireNonNull(keyExtractor); - return (Comparator & Serializable) - (c1, c2) -> Double.compare(keyExtractor.applyAsDouble(c1), keyExtractor.applyAsDouble(c2)); - } + @Override + public int compare(T a, T b) { + if (a == null) { + return (b == null) ? 0 : (nullFirst ? -1 : 1); + } else if (b == null) { + return nullFirst ? 1: -1; + } else { + return (real == null) ? 0 : real.compare(a, b); + } + } - /** - * Constructs a lexicographic order from two {@link Comparator}s. For - * example, if you have comparators {@code byLastName} and {@code - * byFirstName}, each of type {@code Comparator}, then {@code - * compose(byLastName, byFirstName)} creates a {@code Comparator} - * which sorts by last name, and for equal last names sorts by first name. - * - *

      The returned comparator is serializable assuming the specified - * comparators are also serializable. - * - * @param the element type to be compared - * @param first the first comparator - * @param second the secondary comparator used when equals on the first - */ - public static Comparator compose(Comparator first, Comparator second) { - Objects.requireNonNull(first); - Objects.requireNonNull(second); - return (Comparator & Serializable) (c1, c2) -> { - int res = first.compare(c1, c2); - return (res != 0) ? res : second.compare(c1, c2); - }; - } + @Override + public Comparator thenComparing(Comparator other) { + Objects.requireNonNull(other); + return new NullComparator(nullFirst, real == null ? other : real.thenComparing(other)); + } - /** - * Constructs a {@link BinaryOperator} which returns the lesser of two elements - * according to the specified {@code Comparator} - * - * @param comparator A {@code Comparator} for comparing the two values - * @param the type of the elements to be compared - * @return a {@code BinaryOperator} which returns the lesser of its operands, - * according to the supplied {@code Comparator} - */ - public static BinaryOperator lesserOf(Comparator comparator) { - Objects.requireNonNull(comparator); - return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; - } - - /** - * Constructs a {@link BinaryOperator} which returns the greater of two elements - * according to the specified {@code Comparator} - * - * @param comparator A {@code Comparator} for comparing the two values - * @param the type of the elements to be compared - * @return a {@code BinaryOperator} which returns the greater of its operands, - * according to the supplied {@code Comparator} - */ - public static BinaryOperator greaterOf(Comparator comparator) { - Objects.requireNonNull(comparator); - return (a, b) -> comparator.compare(a, b) >= 0 ? a : b; + @Override + public Comparator reversed() { + return new NullComparator(!nullFirst, real == null ? null : real.reversed()); + } } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Formatter.java --- a/jdk/src/share/classes/java/util/Formatter.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Formatter.java Thu Jul 11 12:50:20 2013 -0700 @@ -3297,18 +3297,29 @@ else if (precision == 0) prec = 1; - FormattedFloatingDecimal fd + char[] exp; + char[] mant; + int expRounded; + if (value == 0.0) { + exp = null; + mant = new char[] {'0'}; + expRounded = 0; + } else { + FormattedFloatingDecimal fd = FormattedFloatingDecimal.valueOf(value, prec, FormattedFloatingDecimal.Form.GENERAL); - - char[] exp = fd.getExponent(); + exp = fd.getExponent(); + mant = fd.getMantissa(); + expRounded = fd.getExponentRounded(); + } + if (exp != null) { prec -= 1; } else { - prec = prec - (value == 0 ? 0 : fd.getExponentRounded()) - 1; + prec -= expRounded + 1; } - char[] mant = addZeros(fd.getMantissa(), prec); + mant = addZeros(mant, prec); // If the precision is zero and the '#' flag is set, add the // requested decimal point. if (f.contains(Flags.ALTERNATE) && (prec == 0)) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/HashMap.java --- a/jdk/src/share/classes/java/util/HashMap.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/HashMap.java Thu Jul 11 12:50:20 2013 -0700 @@ -1749,25 +1749,25 @@ V oldValue = pEntry.value; if (oldValue != null) { V newValue = remappingFunction.apply(key, oldValue); - if (newValue == null) { // remove mapping - modCount++; - size--; - tb.deleteTreeNode(p); - pEntry.recordRemoval(this); - if (tb.root == null || tb.first == null) { - // assert tb.root == null && tb.first == null : - // "TreeBin.first and root should both be null"; - // TreeBin is now empty, we should blank this bin - table[i] = null; - } - } else { - pEntry.value = newValue; - pEntry.recordAccess(this); + if (newValue == null) { // remove mapping + modCount++; + size--; + tb.deleteTreeNode(p); + pEntry.recordRemoval(this); + if (tb.root == null || tb.first == null) { + // assert tb.root == null && tb.first == null : + // "TreeBin.first and root should both be null"; + // TreeBin is now empty, we should blank this bin + table[i] = null; } - return newValue; + } else { + pEntry.value = newValue; + pEntry.recordAccess(this); } + return newValue; } } + } return null; } @@ -1779,7 +1779,7 @@ if (key == null) { V oldValue = nullKeyEntry == null ? null : nullKeyEntry.value; V newValue = remappingFunction.apply(key, oldValue); - if (newValue != oldValue) { + if (newValue != oldValue || (oldValue == null && nullKeyEntry != null)) { if (newValue == null) { removeNullKey(); } else { @@ -1803,7 +1803,7 @@ if (e.hash == hash && Objects.equals(e.key, key)) { V oldValue = e.value; V newValue = remappingFunction.apply(key, oldValue); - if (newValue != oldValue) { + if (newValue != oldValue || oldValue == null) { if (newValue == null) { modCount++; size--; @@ -1829,7 +1829,7 @@ TreeNode p = tb.getTreeNode(hash, key); V oldValue = p == null ? null : (V)p.entry.value; V newValue = remappingFunction.apply(key, oldValue); - if (newValue != oldValue) { + if (newValue != oldValue || (oldValue == null && p != null)) { if (newValue == null) { Entry pEntry = (Entry)p.entry; modCount++; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Map.java --- a/jdk/src/share/classes/java/util/Map.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Map.java Thu Jul 11 12:50:20 2013 -0700 @@ -28,6 +28,7 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Function; +import java.io.Serializable; /** * An object that maps keys to values. A map cannot contain duplicate keys; @@ -446,6 +447,74 @@ * @see #equals(Object) */ int hashCode(); + + /** + * Returns a comparator that compares {@link Map.Entry} in natural order on key. + * + *

      The returned comparator is serializable and throws {@link + * NullPointerException} when comparing an entry with a null key. + * + * @param the {@link Comparable} type of then map keys + * @param the type of the map values + * @return a comparator that compares {@link Map.Entry} in natural order on key. + * @see Comparable + */ + public static , V> Comparator> comparingByKey() { + return (Comparator> & Serializable) + (c1, c2) -> c1.getKey().compareTo(c2.getKey()); + } + + /** + * Returns a comparator that compares {@link Map.Entry} in natural order on value. + * + *

      The returned comparator is serializable and throws {@link + * NullPointerException} when comparing an entry with null values. + * + * @param the type of the map keys + * @param the {@link Comparable} type of the map values + * @return a comparator that compares {@link Map.Entry} in natural order on value. + * @see Comparable + */ + public static > Comparator> comparingByValue() { + return (Comparator> & Serializable) + (c1, c2) -> c1.getValue().compareTo(c2.getValue()); + } + + /** + * Returns a comparator that compares {@link Map.Entry} by key using the given + * {@link Comparator}. + * + *

      The returned comparator is serializable if the specified comparator + * is also serializable. + * + * @param the type of the map keys + * @param the type of the map values + * @param cmp the key {@link Comparator} + * @return a comparator that compares {@link Map.Entry} by the key. + */ + public static Comparator> comparingByKey(Comparator cmp) { + Objects.requireNonNull(cmp); + return (Comparator> & Serializable) + (c1, c2) -> cmp.compare(c1.getKey(), c2.getKey()); + } + + /** + * Returns a comparator that compares {@link Map.Entry} by value using the given + * {@link Comparator}. + * + *

      The returned comparator is serializable if the specified comparator + * is also serializable. + * + * @param the type of the map keys + * @param the type of the map values + * @param cmp the value {@link Comparator} + * @return a comparator that compares {@link Map.Entry} by the value. + */ + public static Comparator> comparingByValue(Comparator cmp) { + Objects.requireNonNull(cmp); + return (Comparator> & Serializable) + (c1, c2) -> cmp.compare(c1.getValue(), c2.getValue()); + } } // Comparison and hashing @@ -640,7 +709,7 @@ * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key * @return the previous value associated with the specified key, or - * {@code 1} if there was no mapping for the key. + * {@code null} if there was no mapping for the key. * (A {@code null} return can also indicate that the map * previously associated {@code null} with the key, * if the implementation supports null values.) @@ -994,20 +1063,40 @@ V oldValue = get(key); for (;;) { V newValue = remappingFunction.apply(key, oldValue); - if (oldValue != null) { - if (newValue != null) { - if (replace(key, oldValue, newValue)) - return newValue; - } else if (remove(key, oldValue)) { + if (newValue == null) { + // delete mapping + if(oldValue != null || containsKey(key)) { + // something to remove + if (remove(key, oldValue)) { + // removed the old value as expected + return null; + } + + // some other value replaced old value. try again. + oldValue = get(key); + } else { + // nothing to do. Leave things as they were. return null; } - oldValue = get(key); } else { - if (newValue != null) { - if ((oldValue = putIfAbsent(key, newValue)) == null) + // add or replace old mapping + if (oldValue != null) { + // replace + if (replace(key, oldValue, newValue)) { + // replaced as expected. return newValue; + } + + // some other value replaced old value. try again. + oldValue = get(key); } else { - return null; + // add (replace if oldValue was null) + if ((oldValue = putIfAbsent(key, newValue)) == null) { + // replaced + return newValue; + } + + // some other value replaced old value. try again. } } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/PrimitiveIterator.java --- a/jdk/src/share/classes/java/util/PrimitiveIterator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/PrimitiveIterator.java Thu Jul 11 12:50:20 2013 -0700 @@ -55,16 +55,34 @@ * is set to {@code true} then diagnostic warnings are reported if boxing of * primitive values occur when operating on primitive subtype specializations. * - * @param the boxed type of the primitive type + * @param the type of elements returned by this PrimitiveIterator. The + * type must be a wrapper type for a primitive type, such as + * {@code Integer} for the primitive {@code int} type. + * @param the type of primitive consumer. The type must be a + * primitive specialization of {@link java.util.function.Consumer} for + * {@code T}, such as {@link java.util.function.IntConsumer} for + * {@code Integer}. + * * @since 1.8 */ -public interface PrimitiveIterator extends Iterator { +public interface PrimitiveIterator extends Iterator { + + /** + * Performs the given action for each remaining element, in the order + * elements occur when iterating, until all elements have been processed + * or the action throws an exception. Errors or runtime exceptions + * thrown by the action are relayed to the caller. + * + * @param action The action to be performed for each element + * @throws NullPointerException if the specified action is null + */ + void forEachRemaining(T_CONS action); /** * An Iterator specialized for {@code int} values. * @since 1.8 */ - public static interface OfInt extends PrimitiveIterator { + public static interface OfInt extends PrimitiveIterator { /** * Returns the next {@code int} element in the iteration. @@ -138,7 +156,7 @@ * An Iterator specialized for {@code long} values. * @since 1.8 */ - public static interface OfLong extends PrimitiveIterator { + public static interface OfLong extends PrimitiveIterator { /** * Returns the next {@code long} element in the iteration. @@ -211,7 +229,7 @@ * An Iterator specialized for {@code double} values. * @since 1.8 */ - public static interface OfDouble extends PrimitiveIterator { + public static interface OfDouble extends PrimitiveIterator { /** * Returns the next {@code double} element in the iteration. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/Properties.java --- a/jdk/src/share/classes/java/util/Properties.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/Properties.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -443,6 +443,9 @@ if (len == 0 || isCommentLine) { return -1; } + if (precedingBackslash) { + len--; + } return len; } } @@ -510,6 +513,9 @@ :inStream.read(inByteBuf); inOff = 0; if (inLimit <= 0) { + if (precedingBackslash) { + len--; + } return len; } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/TimeZone.java --- a/jdk/src/share/classes/java/util/TimeZone.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/TimeZone.java Thu Jul 11 12:50:20 2013 -0700 @@ -419,17 +419,6 @@ return ZoneInfoFile.toCustomID(offset); } - private static class DisplayNames { - // Cache for managing display names per timezone per locale - // The structure is: - // Map(key=id, value=SoftReference(Map(key=locale, value=displaynames))) - private static final Map>> CACHE = - new ConcurrentHashMap<>(); - - private DisplayNames() { - } - } - private static String[] getDisplayNames(String id, Locale locale) { return TimeZoneNameUtility.retrieveDisplayNames(id, locale); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/TreeMap.java --- a/jdk/src/share/classes/java/util/TreeMap.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/TreeMap.java Thu Jul 11 12:50:20 2013 -0700 @@ -2938,13 +2938,13 @@ public int characteristics() { return (side == 0 ? Spliterator.SIZED : 0) | - Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED; + Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED; } @Override public Comparator> getComparator() { return tree.comparator != null ? - Comparators.byKey(tree.comparator) : null; + Map.Entry.comparingByKey(tree.comparator) : null; } } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Thu Jul 11 12:50:20 2013 -0700 @@ -92,7 +92,7 @@ * * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(boolean expect, boolean update) { @@ -105,13 +105,13 @@ * Atomically sets the value to the given updated value * if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public boolean weakCompareAndSet(boolean expect, boolean update) { int e = expect ? 1 : 0; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java Thu Jul 11 12:50:20 2013 -0700 @@ -126,7 +126,7 @@ * * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int expect, int update) { @@ -137,13 +137,13 @@ * Atomically sets the value to the given updated value * if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(int expect, int update) { return unsafe.compareAndSwapInt(this, valueOffset, expect, update); @@ -155,7 +155,7 @@ * @return the previous value */ public final int getAndIncrement() { - return getAndAdd(1); + return unsafe.getAndAddInt(this, valueOffset, 1); } /** @@ -164,7 +164,7 @@ * @return the previous value */ public final int getAndDecrement() { - return getAndAdd(-1); + return unsafe.getAndAddInt(this, valueOffset, -1); } /** @@ -183,7 +183,7 @@ * @return the updated value */ public final int incrementAndGet() { - return getAndAdd(1) + 1; + return unsafe.getAndAddInt(this, valueOffset, 1) + 1; } /** @@ -192,7 +192,7 @@ * @return the updated value */ public final int decrementAndGet() { - return getAndAdd(-1) - 1; + return unsafe.getAndAddInt(this, valueOffset, -1) - 1; } /** @@ -202,7 +202,7 @@ * @return the updated value */ public final int addAndGet(int delta) { - return getAndAdd(delta) + delta; + return unsafe.getAndAddInt(this, valueOffset, delta) + delta; } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Thu Jul 11 12:50:20 2013 -0700 @@ -157,7 +157,7 @@ * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int i, int expect, int update) { @@ -172,14 +172,14 @@ * Atomically sets the element at position {@code i} to the given * updated value if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, int expect, int update) { return compareAndSet(i, expect, update); @@ -247,6 +247,7 @@ return getAndAdd(i, delta) + delta; } + /** * Atomically updates the element at index {@code i} with the results * of applying the given function, returning the previous value. The diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java Thu Jul 11 12:50:20 2013 -0700 @@ -37,14 +37,13 @@ import java.util.function.IntUnaryOperator; import java.util.function.IntBinaryOperator; import sun.misc.Unsafe; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import sun.reflect.CallerSensitive; +import sun.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to @@ -81,8 +80,10 @@ * access control */ @CallerSensitive - public static AtomicIntegerFieldUpdater newUpdater(Class tclass, String fieldName) { - return new AtomicIntegerFieldUpdaterImpl(tclass, fieldName, Reflection.getCallerClass()); + public static AtomicIntegerFieldUpdater newUpdater(Class tclass, + String fieldName) { + return new AtomicIntegerFieldUpdaterImpl + (tclass, fieldName, Reflection.getCallerClass()); } /** @@ -101,7 +102,7 @@ * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful * @throws ClassCastException if {@code obj} is not an instance * of the class possessing the field established in the constructor */ @@ -114,14 +115,14 @@ * other calls to {@code compareAndSet} and {@code set}, but not * necessarily with respect to other changes in the field. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful * @throws ClassCastException if {@code obj} is not an instance * of the class possessing the field established in the constructor */ @@ -363,7 +364,8 @@ /** * Standard hotspot implementation using intrinsics */ - private static class AtomicIntegerFieldUpdaterImpl extends AtomicIntegerFieldUpdater { + private static class AtomicIntegerFieldUpdaterImpl + extends AtomicIntegerFieldUpdater { private static final Unsafe unsafe = Unsafe.getUnsafe(); private final long offset; private final Class tclass; @@ -371,8 +373,7 @@ AtomicIntegerFieldUpdaterImpl(final Class tclass, final String fieldName, - final Class caller) - { + final Class caller) { final Field field; final int modifiers; try { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLong.java Thu Jul 11 12:50:20 2013 -0700 @@ -140,7 +140,7 @@ * * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(long expect, long update) { @@ -151,13 +151,13 @@ * Atomically sets the value to the given updated value * if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(long expect, long update) { return unsafe.compareAndSwapLong(this, valueOffset, expect, update); @@ -169,7 +169,7 @@ * @return the previous value */ public final long getAndIncrement() { - return getAndAdd(1); + return unsafe.getAndAddLong(this, valueOffset, 1L); } /** @@ -178,7 +178,7 @@ * @return the previous value */ public final long getAndDecrement() { - return getAndAdd(-1); + return unsafe.getAndAddLong(this, valueOffset, -1L); } /** @@ -197,7 +197,7 @@ * @return the updated value */ public final long incrementAndGet() { - return getAndAdd(1) + 1; + return unsafe.getAndAddLong(this, valueOffset, 1L) + 1L; } /** @@ -206,7 +206,7 @@ * @return the updated value */ public final long decrementAndGet() { - return getAndAdd(-1) - 1; + return unsafe.getAndAddLong(this, valueOffset, -1L) - 1L; } /** @@ -216,7 +216,7 @@ * @return the updated value */ public final long addAndGet(long delta) { - return getAndAdd(delta) + delta; + return unsafe.getAndAddLong(this, valueOffset, delta) + delta; } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Thu Jul 11 12:50:20 2013 -0700 @@ -156,7 +156,7 @@ * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int i, long expect, long update) { @@ -171,14 +171,14 @@ * Atomically sets the element at position {@code i} to the given * updated value if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, long expect, long update) { return compareAndSet(i, expect, update); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java Thu Jul 11 12:50:20 2013 -0700 @@ -37,14 +37,13 @@ import java.util.function.LongUnaryOperator; import java.util.function.LongBinaryOperator; import sun.misc.Unsafe; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import sun.reflect.CallerSensitive; +import sun.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to @@ -71,17 +70,18 @@ * generic types match. * * @param tclass the class of the objects holding the field - * @param fieldName the name of the field to be updated. + * @param fieldName the name of the field to be updated * @return the updater * @throws IllegalArgumentException if the field is not a - * volatile long type. + * volatile long type * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ @CallerSensitive - public static AtomicLongFieldUpdater newUpdater(Class tclass, String fieldName) { + public static AtomicLongFieldUpdater newUpdater(Class tclass, + String fieldName) { Class caller = Reflection.getCallerClass(); if (AtomicLong.VM_SUPPORTS_LONG_CAS) return new CASUpdater(tclass, fieldName, caller); @@ -105,9 +105,9 @@ * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful * @throws ClassCastException if {@code obj} is not an instance - * of the class possessing the field established in the constructor. + * of the class possessing the field established in the constructor */ public abstract boolean compareAndSet(T obj, long expect, long update); @@ -118,16 +118,16 @@ * other calls to {@code compareAndSet} and {@code set}, but not * necessarily with respect to other changes in the field. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful * @throws ClassCastException if {@code obj} is not an instance - * of the class possessing the field established in the constructor. + * of the class possessing the field established in the constructor */ public abstract boolean weakCompareAndSet(T obj, long expect, long update); @@ -370,7 +370,8 @@ private final Class tclass; private final Class cclass; - CASUpdater(final Class tclass, final String fieldName, final Class caller) { + CASUpdater(final Class tclass, final String fieldName, + final Class caller) { final Field field; final int modifiers; try { @@ -493,7 +494,8 @@ private final Class tclass; private final Class cclass; - LockedUpdater(final Class tclass, final String fieldName, final Class caller) { + LockedUpdater(final Class tclass, final String fieldName, + final Class caller) { Field field = null; int modifiers = 0; try { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicMarkableReference.java Thu Jul 11 12:50:20 2013 -0700 @@ -112,15 +112,15 @@ * current reference is {@code ==} to the expected reference * and the current mark is equal to the expected mark. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expectedReference the expected value of the reference * @param newReference the new value for the reference * @param expectedMark the expected value of the mark * @param newMark the new value for the mark - * @return true if successful + * @return {@code true} if successful */ public boolean weakCompareAndSet(V expectedReference, V newReference, @@ -140,7 +140,7 @@ * @param newReference the new value for the reference * @param expectedMark the expected value of the mark * @param newMark the new value for the mark - * @return true if successful + * @return {@code true} if successful */ public boolean compareAndSet(V expectedReference, V newReference, @@ -178,7 +178,7 @@ * * @param expectedReference the expected value of the reference * @param newMark the new value for the mark - * @return true if successful + * @return {@code true} if successful */ public boolean attemptMark(V expectedReference, boolean newMark) { Pair current = pair; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java Thu Jul 11 12:50:20 2013 -0700 @@ -109,7 +109,7 @@ * if the current value {@code ==} the expected value. * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(V expect, V update) { @@ -120,13 +120,13 @@ * Atomically sets the value to the given updated value * if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(V expect, V update) { return unsafe.compareAndSwapObject(this, valueOffset, expect, update); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Thu Jul 11 12:50:20 2013 -0700 @@ -34,10 +34,9 @@ */ package java.util.concurrent.atomic; - -import java.util.Arrays; import java.util.function.UnaryOperator; import java.util.function.BinaryOperator; +import java.util.Arrays; import java.lang.reflect.Array; import sun.misc.Unsafe; @@ -60,19 +59,18 @@ private final Object[] array; // must have exact type Object[] static { - int scale; try { unsafe = Unsafe.getUnsafe(); arrayFieldOffset = unsafe.objectFieldOffset (AtomicReferenceArray.class.getDeclaredField("array")); base = unsafe.arrayBaseOffset(Object[].class); - scale = unsafe.arrayIndexScale(Object[].class); + int scale = unsafe.arrayIndexScale(Object[].class); + if ((scale & (scale - 1)) != 0) + throw new Error("data type scale not a power of two"); + shift = 31 - Integer.numberOfLeadingZeros(scale); } catch (Exception e) { throw new Error(e); } - if ((scale & (scale - 1)) != 0) - throw new Error("data type scale not a power of two"); - shift = 31 - Integer.numberOfLeadingZeros(scale); } private long checkedByteOffset(int i) { @@ -173,7 +171,7 @@ * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that + * @return {@code true} if successful. False return indicates that * the actual value was not equal to the expected value. */ public final boolean compareAndSet(int i, E expect, E update) { @@ -188,20 +186,20 @@ * Atomically sets the element at position {@code i} to the given * updated value if the current value {@code ==} the expected value. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param i the index * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, E expect, E update) { return compareAndSet(i, expect, update); } - /** + /** * Atomically updates the element at index {@code i} with the results * of applying the given function, returning the previous value. The * function should be side-effect-free, since it may be re-applied diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java Thu Jul 11 12:50:20 2013 -0700 @@ -37,14 +37,13 @@ import java.util.function.UnaryOperator; import java.util.function.BinaryOperator; import sun.misc.Unsafe; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; - import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.security.AccessController; import java.security.PrivilegedExceptionAction; import java.security.PrivilegedActionException; +import sun.reflect.CallerSensitive; +import sun.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to @@ -82,29 +81,30 @@ * @param The type of the object holding the updatable field * @param The type of the field */ -public abstract class AtomicReferenceFieldUpdater { +public abstract class AtomicReferenceFieldUpdater { /** * Creates and returns an updater for objects with the given field. * The Class arguments are needed to check that reflective types and * generic types match. * - * @param tclass the class of the objects holding the field. + * @param tclass the class of the objects holding the field * @param vclass the class of the field - * @param fieldName the name of the field to be updated. + * @param fieldName the name of the field to be updated * @return the updater - * @throws IllegalArgumentException if the field is not a volatile reference type. + * @throws ClassCastException if the field is of the wrong type + * @throws IllegalArgumentException if the field is not volatile * @throws RuntimeException with a nested reflection-based * exception if the class does not hold field or is the wrong type, * or the field is inaccessible to the caller according to Java language * access control */ @CallerSensitive - public static AtomicReferenceFieldUpdater newUpdater(Class tclass, Class vclass, String fieldName) { - return new AtomicReferenceFieldUpdaterImpl(tclass, - vclass, - fieldName, - Reflection.getCallerClass()); + public static AtomicReferenceFieldUpdater newUpdater(Class tclass, + Class vclass, + String fieldName) { + return new AtomicReferenceFieldUpdaterImpl + (tclass, vclass, fieldName, Reflection.getCallerClass()); } /** @@ -123,7 +123,7 @@ * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public abstract boolean compareAndSet(T obj, V expect, V update); @@ -134,14 +134,14 @@ * other calls to {@code compareAndSet} and {@code set}, but not * necessarily with respect to other changes in the field. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param obj An object whose field to conditionally set * @param expect the expected value * @param update the new value - * @return true if successful + * @return {@code true} if successful */ public abstract boolean weakCompareAndSet(T obj, V expect, V update); @@ -301,10 +301,9 @@ */ AtomicReferenceFieldUpdaterImpl(final Class tclass, - Class vclass, + final Class vclass, final String fieldName, - final Class caller) - { + final Class caller) { final Field field; final Class fieldClass; final int modifiers; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java Thu Jul 11 12:50:20 2013 -0700 @@ -112,15 +112,15 @@ * current reference is {@code ==} to the expected reference * and the current stamp is equal to the expected stamp. * - *

      May fail spuriously - * and does not provide ordering guarantees, so is only rarely an - * appropriate alternative to {@code compareAndSet}. + *

      May fail + * spuriously and does not provide ordering guarantees, so is + * only rarely an appropriate alternative to {@code compareAndSet}. * * @param expectedReference the expected value of the reference * @param newReference the new value for the reference * @param expectedStamp the expected value of the stamp * @param newStamp the new value for the stamp - * @return true if successful + * @return {@code true} if successful */ public boolean weakCompareAndSet(V expectedReference, V newReference, @@ -140,7 +140,7 @@ * @param newReference the new value for the reference * @param expectedStamp the expected value of the stamp * @param newStamp the new value for the stamp - * @return true if successful + * @return {@code true} if successful */ public boolean compareAndSet(V expectedReference, V newReference, @@ -178,7 +178,7 @@ * * @param expectedReference the expected value of the reference * @param newStamp the new value for the stamp - * @return true if successful + * @return {@code true} if successful */ public boolean attemptStamp(V expectedReference, int newStamp) { Pair current = pair; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAccumulator.java Thu Jul 11 12:50:20 2013 -0700 @@ -65,7 +65,7 @@ *

      Class {@link DoubleAdder} provides analogs of the functionality * of this class for the common special case of maintaining sums. The * call {@code new DoubleAdder()} is equivalent to {@code new - * DoubleAccumulator((x, y) -> x + y, 0.0}. + * DoubleAccumulator((x, y) -> x + y, 0.0)}. * *

      This class extends {@link Number}, but does not define * methods such as {@code equals}, {@code hashCode} and {@code @@ -84,11 +84,13 @@ /** * Creates a new instance using the given accumulator function * and identity element. + * @param accumulatorFunction a side-effect-free function of two arguments + * @param identity identity (initial value) for the accumulator function */ public DoubleAccumulator(DoubleBinaryOperator accumulatorFunction, double identity) { this.function = accumulatorFunction; - base = this.identity = Double.doubleToRawLongBits(identity); + base = this.identity = Double.doubleToRawLongBits(identity); } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/DoubleAdder.java Thu Jul 11 12:50:20 2013 -0700 @@ -63,7 +63,7 @@ public class DoubleAdder extends Striped64 implements Serializable { private static final long serialVersionUID = 7249069246863182397L; - /** + /* * Note that we must use "long" for underlying representations, * because there is no compareAndSet for double, due to the fact * that the bitwise equals used in any CAS implementation is not diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/LongAccumulator.java Thu Jul 11 12:50:20 2013 -0700 @@ -86,6 +86,8 @@ /** * Creates a new instance using the given accumulator function * and identity element. + * @param accumulatorFunction a side-effect-free function of two arguments + * @param identity identity (initial value) for the accumulator function */ public LongAccumulator(LongBinaryOperator accumulatorFunction, long identity) { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/Striped64.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/Striped64.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/Striped64.java Thu Jul 11 12:50:20 2013 -0700 @@ -52,13 +52,13 @@ * accessed directly by subclasses. * * Table entries are of class Cell; a variant of AtomicLong padded - * to reduce cache contention on most processors. Padding is - * overkill for most Atomics because they are usually irregularly - * scattered in memory and thus don't interfere much with each - * other. But Atomic objects residing in arrays will tend to be - * placed adjacent to each other, and so will most often share - * cache lines (with a huge negative performance impact) without - * this precaution. + * (via @sun.misc.Contended) to reduce cache contention. Padding + * is overkill for most Atomics because they are usually + * irregularly scattered in memory and thus don't interfere much + * with each other. But Atomic objects residing in arrays will + * tend to be placed adjacent to each other, and so will most + * often share cache lines (with a huge negative performance + * impact) without this precaution. * * In part because Cells are relatively large, we avoid creating * them until they are needed. When there is no contention, all @@ -112,18 +112,13 @@ /** * Padded variant of AtomicLong supporting only raw accesses plus CAS. - * The value field is placed between pads, hoping that the JVM doesn't - * reorder them. * * JVM intrinsics note: It would be possible to use a release-only * form of CAS here, if it were provided. */ - static final class Cell { - volatile long p0, p1, p2, p3, p4, p5, p6; + @sun.misc.Contended static final class Cell { volatile long value; - volatile long q0, q1, q2, q3, q4, q5, q6; Cell(long x) { value = x; } - final boolean cas(long cmp, long val) { return UNSAFE.compareAndSwapLong(this, valueOffset, cmp, val); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/atomic/package-info.java --- a/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/atomic/package-info.java Thu Jul 11 12:50:20 2013 -0700 @@ -84,19 +84,18 @@ * write your utility method as follows: *

       {@code
        * long getAndTransform(AtomicLong var) {
      - *   while (true) {
      - *     long current = var.get();
      - *     long next = transform(current);
      - *     if (var.compareAndSet(current, next))
      - *         return current;
      - *         // return next; for transformAndGet
      - *   }
      + *   long prev, next;
      + *   do {
      + *     prev = var.get();
      + *     next = transform(prev);
      + *   } while (!var.compareAndSet(prev, next));
      + *   return prev; // return next; for transformAndGet
        * }}
      * *

      The memory effects for accesses and updates of atomics generally * follow the rules for volatiles, as stated in - * - * The Java Language Specification, Third Edition (17.4 Memory Model): + * + * The Java Language Specification (17.4 Memory Model): * *

        * @@ -152,13 +151,12 @@ * semantics for their array elements, which is not supported for * ordinary arrays. * - * - *

        The atomic classes also support method {@code weakCompareAndSet}, - * which has limited applicability. On some platforms, the weak version - * may be more efficient than {@code compareAndSet} in the normal case, - * but differs in that any given invocation of the - * {@code weakCompareAndSet} method may return {@code false} - * spuriously (that is, for no apparent reason). A + *

        The atomic classes also support method + * {@code weakCompareAndSet}, which has limited applicability. On some + * platforms, the weak version may be more efficient than {@code + * compareAndSet} in the normal case, but differs in that any given + * invocation of the {@code weakCompareAndSet} method may return {@code + * false} spuriously (that is, for no apparent reason). A * {@code false} return means only that the operation may be retried if * desired, relying on the guarantee that repeated invocation when the * variable holds {@code expectedValue} and no other thread is also @@ -194,7 +192,7 @@ * *

        Atomic classes are not general purpose replacements for * {@code java.lang.Integer} and related classes. They do not - * define methods such as {@code hashCode} and + * define methods such as {@code equals}, {@code hashCode} and * {@code compareTo}. (Because atomic variables are expected to be * mutated, they are poor choices for hash table keys.) Additionally, * classes are provided only for those types that are commonly useful in diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractOwnableSynchronizer.java Thu Jul 11 12:50:20 2013 -0700 @@ -39,7 +39,7 @@ * A synchronizer that may be exclusively owned by a thread. This * class provides a basis for creating locks and related synchronizers * that may entail a notion of ownership. The - * AbstractOwnableSynchronizer class itself does not manage or + * {@code AbstractOwnableSynchronizer} class itself does not manage or * use this information. However, subclasses and tools may use * appropriately maintained values to help control and monitor access * and provide diagnostics. @@ -64,20 +64,20 @@ private transient Thread exclusiveOwnerThread; /** - * Sets the thread that currently owns exclusive access. A - * null argument indicates that no thread owns access. + * Sets the thread that currently owns exclusive access. + * A {@code null} argument indicates that no thread owns access. * This method does not otherwise impose any synchronization or - * volatile field accesses. + * {@code volatile} field accesses. + * @param thread the owner thread */ - protected final void setExclusiveOwnerThread(Thread t) { - exclusiveOwnerThread = t; + protected final void setExclusiveOwnerThread(Thread thread) { + exclusiveOwnerThread = thread; } /** - * Returns the thread last set by - * setExclusiveOwnerThread, or null if never - * set. This method does not otherwise impose any synchronization - * or volatile field accesses. + * Returns the thread last set by {@code setExclusiveOwnerThread}, + * or {@code null} if never set. This method does not otherwise + * impose any synchronization or {@code volatile} field accesses. * @return the owner thread */ protected final Thread getExclusiveOwnerThread() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java Thu Jul 11 12:50:20 2013 -0700 @@ -42,11 +42,11 @@ /** * A version of {@link AbstractQueuedSynchronizer} in - * which synchronization state is maintained as a long. + * which synchronization state is maintained as a {@code long}. * This class has exactly the same structure, properties, and methods - * as AbstractQueuedSynchronizer with the exception + * as {@code AbstractQueuedSynchronizer} with the exception * that all state-related parameters and results are defined - * as long rather than int. This class + * as {@code long} rather than {@code int}. This class * may be useful when creating synchronizers such as * multilevel locks and barriers that require * 64 bits of state. @@ -71,7 +71,7 @@ */ /** - * Creates a new AbstractQueuedLongSynchronizer instance + * Creates a new {@code AbstractQueuedLongSynchronizer} instance * with initial synchronization state of zero. */ protected AbstractQueuedLongSynchronizer() { } @@ -104,7 +104,7 @@ * *

        Insertion into a CLH queue requires only a single atomic * operation on "tail", so there is a simple atomic point of - * demarcation from unqueued to queued. Similarly, dequeing + * demarcation from unqueued to queued. Similarly, dequeuing * involves only updating the "head". However, it takes a bit * more work for nodes to determine who their successors are, * in part to deal with possible cancellation due to timeouts @@ -211,7 +211,7 @@ /** * Link to predecessor node that current node/thread relies on - * for checking waitStatus. Assigned during enqueing, and nulled + * for checking waitStatus. Assigned during enqueuing, and nulled * out (for sake of GC) only upon dequeuing. Also, upon * cancellation of a predecessor, we short-circuit while * finding a non-cancelled one, which will always exist @@ -256,7 +256,7 @@ Node nextWaiter; /** - * Returns true if node is waiting in shared mode + * Returns true if node is waiting in shared mode. */ final boolean isShared() { return nextWaiter == SHARED; @@ -312,7 +312,7 @@ /** * Returns the current value of synchronization state. - * This operation has memory semantics of a volatile read. + * This operation has memory semantics of a {@code volatile} read. * @return current state value */ protected final long getState() { @@ -321,7 +321,7 @@ /** * Sets the value of synchronization state. - * This operation has memory semantics of a volatile write. + * This operation has memory semantics of a {@code volatile} write. * @param newState the new state value */ protected final void setState(long newState) { @@ -331,12 +331,12 @@ /** * Atomically sets synchronization state to the given updated * value if the current state value equals the expected value. - * This operation has memory semantics of a volatile read + * This operation has memory semantics of a {@code volatile} read * and write. * * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that the actual + * @return {@code true} if successful. False return indicates that the actual * value was not equal to the expected value. */ protected final boolean compareAndSetState(long expect, long update) { @@ -441,7 +441,7 @@ } /** - * Release action for shared mode -- signal successor and ensure + * Release action for shared mode -- signals successor and ensures * propagation. (Note: For exclusive mode, release just amounts * to calling unparkSuccessor of head if it needs signal.) */ @@ -562,7 +562,7 @@ /** * Checks and updates status for a node that failed to acquire. * Returns true if thread should block. This is the main signal - * control in all acquire loops. Requires that pred == node.prev + * control in all acquire loops. Requires that pred == node.prev. * * @param pred node's predecessor holding status * @param node the node @@ -1066,7 +1066,7 @@ * thread is queued, possibly repeatedly blocking and unblocking, * invoking {@link #tryAcquireShared} until success or the thread * is interrupted. - * @param arg the acquire argument + * @param arg the acquire argument. * This value is conveyed to {@link #tryAcquireShared} but is * otherwise uninterpreted and can represent anything * you like. @@ -1441,7 +1441,7 @@ * Returns true if successful. * @param node the node * @return true if successfully transferred (else the node was - * cancelled before signal). + * cancelled before signal) */ final boolean transferForSignal(Node node) { /* @@ -1464,11 +1464,10 @@ } /** - * Transfers node, if necessary, to sync queue after a cancelled - * wait. Returns true if thread was cancelled before being - * signalled. - * @param current the waiting thread - * @param node its node + * Transfers node, if necessary, to sync queue after a cancelled wait. + * Returns true if thread was cancelled before being signalled. + * + * @param node the node * @return true if cancelled before the node was signalled */ final boolean transferAfterCancelledWait(Node node) { @@ -1516,7 +1515,7 @@ * uses this synchronizer as its lock. * * @param condition the condition - * @return true if owned + * @return {@code true} if owned * @throws NullPointerException if the condition is null */ public final boolean owns(ConditionObject condition) { @@ -1526,13 +1525,13 @@ /** * Queries whether any threads are waiting on the given condition * associated with this synchronizer. Note that because timeouts - * and interrupts may occur at any time, a true return - * does not guarantee that a future signal will awaken + * and interrupts may occur at any time, a {@code true} return + * does not guarantee that a future {@code signal} will awaken * any threads. This method is designed primarily for use in * monitoring of the system state. * * @param condition the condition - * @return true if there are any waiting threads + * @return {@code true} if there are any waiting threads * @throws IllegalMonitorStateException if exclusive synchronization * is not held * @throws IllegalArgumentException if the given condition is @@ -1599,7 +1598,7 @@ * and Condition users. Exported versions of this class will in * general need to be accompanied by documentation describing * condition semantics that rely on those of the associated - * AbstractQueuedLongSynchronizer. + * {@code AbstractQueuedLongSynchronizer}. * *

        This class is Serializable, but all fields are transient, * so deserialized conditions have no waiters. @@ -1614,7 +1613,7 @@ private transient Node lastWaiter; /** - * Creates a new ConditionObject instance. + * Creates a new {@code ConditionObject} instance. */ public ConditionObject() { } @@ -1967,7 +1966,7 @@ /** * Queries whether any threads are waiting on this condition. - * Implements {@link AbstractQueuedLongSynchronizer#hasWaiters}. + * Implements {@link AbstractQueuedLongSynchronizer#hasWaiters(ConditionObject)}. * * @return {@code true} if there are any waiting threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} @@ -1986,7 +1985,7 @@ /** * Returns an estimate of the number of threads waiting on * this condition. - * Implements {@link AbstractQueuedLongSynchronizer#getWaitQueueLength}. + * Implements {@link AbstractQueuedLongSynchronizer#getWaitQueueLength(ConditionObject)}. * * @return the estimated number of waiting threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} @@ -2006,7 +2005,7 @@ /** * Returns a collection containing those threads that may be * waiting on this Condition. - * Implements {@link AbstractQueuedLongSynchronizer#getWaitingThreads}. + * Implements {@link AbstractQueuedLongSynchronizer#getWaitingThreads(ConditionObject)}. * * @return the collection of threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java --- a/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java Thu Jul 11 12:50:20 2013 -0700 @@ -45,12 +45,12 @@ * synchronizers (semaphores, events, etc) that rely on * first-in-first-out (FIFO) wait queues. This class is designed to * be a useful basis for most kinds of synchronizers that rely on a - * single atomic int value to represent state. Subclasses + * single atomic {@code int} value to represent state. Subclasses * must define the protected methods that change this state, and which * define what that state means in terms of this object being acquired * or released. Given these, the other methods in this class carry * out all queuing and blocking mechanics. Subclasses can maintain - * other state fields, but only the atomically updated int + * other state fields, but only the atomically updated {@code int} * value manipulated using methods {@link #getState}, {@link * #setState} and {@link #compareAndSetState} is tracked with respect * to synchronization. @@ -58,7 +58,7 @@ *

        Subclasses should be defined as non-public internal helper * classes that are used to implement the synchronization properties * of their enclosing class. Class - * AbstractQueuedSynchronizer does not implement any + * {@code AbstractQueuedSynchronizer} does not implement any * synchronization interface. Instead it defines methods such as * {@link #acquireInterruptibly} that can be invoked as * appropriate by concrete locks and related synchronizers to @@ -85,7 +85,7 @@ * invoked with the current {@link #getState} value fully releases * this object, and {@link #acquire}, given this saved state value, * eventually restores this object to its previous acquired state. No - * AbstractQueuedSynchronizer method otherwise creates such a + * {@code AbstractQueuedSynchronizer} method otherwise creates such a * condition, so if this constraint cannot be met, do not use it. The * behavior of {@link ConditionObject} depends of course on the * semantics of its synchronizer implementation. @@ -93,13 +93,13 @@ *

        This class provides inspection, instrumentation, and monitoring * methods for the internal queue, as well as similar methods for * condition objects. These can be exported as desired into classes - * using an AbstractQueuedSynchronizer for their + * using an {@code AbstractQueuedSynchronizer} for their * synchronization mechanics. * *

        Serialization of this class stores only the underlying atomic * integer maintaining state, so deserialized objects have empty * thread queues. Typical subclasses requiring serializability will - * define a readObject method that restores this to a known + * define a {@code readObject} method that restores this to a known * initial state upon deserialization. * *

        Usage

        @@ -115,14 +115,14 @@ *
      • {@link #tryAcquireShared} *
      • {@link #tryReleaseShared} *
      • {@link #isHeldExclusively} - *
      + * * * Each of these methods by default throws {@link * UnsupportedOperationException}. Implementations of these methods * must be internally thread-safe, and should in general be short and * not block. Defining these methods is the only supported * means of using this class. All other methods are declared - * final because they cannot be independently varied. + * {@code final} because they cannot be independently varied. * *

      You may also find the inherited methods from {@link * AbstractOwnableSynchronizer} useful to keep track of the thread @@ -148,16 +148,16 @@ * * (Shared mode is similar but may involve cascading signals.) * - *

      Because checks in acquire are invoked before + *

      Because checks in acquire are invoked before * enqueuing, a newly acquiring thread may barge ahead of * others that are blocked and queued. However, you can, if desired, - * define tryAcquire and/or tryAcquireShared to + * define {@code tryAcquire} and/or {@code tryAcquireShared} to * disable barging by internally invoking one or more of the inspection * methods, thereby providing a fair FIFO acquisition order. - * In particular, most fair synchronizers can define tryAcquire - * to return false if {@link #hasQueuedPredecessors} (a method + * In particular, most fair synchronizers can define {@code tryAcquire} + * to return {@code false} if {@link #hasQueuedPredecessors} (a method * specifically designed to be used by fair synchronizers) returns - * true. Other variations are possible. + * {@code true}. Other variations are possible. * *

      Throughput and scalability are generally highest for the * default barging (also known as greedy, @@ -167,7 +167,7 @@ * threads, and each recontention has an unbiased chance to succeed * against incoming threads. Also, while acquires do not * "spin" in the usual sense, they may perform multiple - * invocations of tryAcquire interspersed with other + * invocations of {@code tryAcquire} interspersed with other * computations before blocking. This gives most of the benefits of * spins when exclusive synchronization is only briefly held, without * most of the liabilities when it isn't. If so desired, you can @@ -178,7 +178,7 @@ * *

      This class provides an efficient and scalable basis for * synchronization in part by specializing its range of use to - * synchronizers that can rely on int state, acquire, and + * synchronizers that can rely on {@code int} state, acquire, and * release parameters, and an internal FIFO wait queue. When this does * not suffice, you can build synchronizers from a lower level using * {@link java.util.concurrent.atomic atomic} classes, your own custom @@ -200,12 +200,12 @@ * * // Our internal helper class * private static class Sync extends AbstractQueuedSynchronizer { - * // Report whether in locked state + * // Reports whether in locked state * protected boolean isHeldExclusively() { * return getState() == 1; * } * - * // Acquire the lock if state is zero + * // Acquires the lock if state is zero * public boolean tryAcquire(int acquires) { * assert acquires == 1; // Otherwise unused * if (compareAndSetState(0, 1)) { @@ -215,7 +215,7 @@ * return false; * } * - * // Release the lock by setting state to zero + * // Releases the lock by setting state to zero * protected boolean tryRelease(int releases) { * assert releases == 1; // Otherwise unused * if (getState() == 0) throw new IllegalMonitorStateException(); @@ -224,10 +224,10 @@ * return true; * } * - * // Provide a Condition + * // Provides a Condition * Condition newCondition() { return new ConditionObject(); } * - * // Deserialize properly + * // Deserializes properly * private void readObject(ObjectInputStream s) * throws IOException, ClassNotFoundException { * s.defaultReadObject(); @@ -255,8 +255,8 @@ * *

      Here is a latch class that is like a * {@link java.util.concurrent.CountDownLatch CountDownLatch} - * except that it only requires a single signal to - * fire. Because a latch is non-exclusive, it uses the shared + * except that it only requires a single {@code signal} to + * fire. Because a latch is non-exclusive, it uses the {@code shared} * acquire and release methods. * *

       {@code
      @@ -293,7 +293,7 @@
           private static final long serialVersionUID = 7373984972572414691L;
       
           /**
      -     * Creates a new AbstractQueuedSynchronizer instance
      +     * Creates a new {@code AbstractQueuedSynchronizer} instance
            * with initial synchronization state of zero.
            */
           protected AbstractQueuedSynchronizer() { }
      @@ -326,7 +326,7 @@
            *
            * 

      Insertion into a CLH queue requires only a single atomic * operation on "tail", so there is a simple atomic point of - * demarcation from unqueued to queued. Similarly, dequeing + * demarcation from unqueued to queued. Similarly, dequeuing * involves only updating the "head". However, it takes a bit * more work for nodes to determine who their successors are, * in part to deal with possible cancellation due to timeouts @@ -433,7 +433,7 @@ /** * Link to predecessor node that current node/thread relies on - * for checking waitStatus. Assigned during enqueing, and nulled + * for checking waitStatus. Assigned during enqueuing, and nulled * out (for sake of GC) only upon dequeuing. Also, upon * cancellation of a predecessor, we short-circuit while * finding a non-cancelled one, which will always exist @@ -478,7 +478,7 @@ Node nextWaiter; /** - * Returns true if node is waiting in shared mode + * Returns true if node is waiting in shared mode. */ final boolean isShared() { return nextWaiter == SHARED; @@ -534,7 +534,7 @@ /** * Returns the current value of synchronization state. - * This operation has memory semantics of a volatile read. + * This operation has memory semantics of a {@code volatile} read. * @return current state value */ protected final int getState() { @@ -543,7 +543,7 @@ /** * Sets the value of synchronization state. - * This operation has memory semantics of a volatile write. + * This operation has memory semantics of a {@code volatile} write. * @param newState the new state value */ protected final void setState(int newState) { @@ -553,12 +553,12 @@ /** * Atomically sets synchronization state to the given updated * value if the current state value equals the expected value. - * This operation has memory semantics of a volatile read + * This operation has memory semantics of a {@code volatile} read * and write. * * @param expect the expected value * @param update the new value - * @return true if successful. False return indicates that the actual + * @return {@code true} if successful. False return indicates that the actual * value was not equal to the expected value. */ protected final boolean compareAndSetState(int expect, int update) { @@ -663,7 +663,7 @@ } /** - * Release action for shared mode -- signal successor and ensure + * Release action for shared mode -- signals successor and ensures * propagation. (Note: For exclusive mode, release just amounts * to calling unparkSuccessor of head if it needs signal.) */ @@ -784,7 +784,7 @@ /** * Checks and updates status for a node that failed to acquire. * Returns true if thread should block. This is the main signal - * control in all acquire loops. Requires that pred == node.prev + * control in all acquire loops. Requires that pred == node.prev. * * @param pred node's predecessor holding status * @param node the node @@ -1288,7 +1288,7 @@ * thread is queued, possibly repeatedly blocking and unblocking, * invoking {@link #tryAcquireShared} until success or the thread * is interrupted. - * @param arg the acquire argument + * @param arg the acquire argument. * This value is conveyed to {@link #tryAcquireShared} but is * otherwise uninterpreted and can represent anything * you like. @@ -1663,7 +1663,7 @@ * Returns true if successful. * @param node the node * @return true if successfully transferred (else the node was - * cancelled before signal). + * cancelled before signal) */ final boolean transferForSignal(Node node) { /* @@ -1686,11 +1686,10 @@ } /** - * Transfers node, if necessary, to sync queue after a cancelled - * wait. Returns true if thread was cancelled before being - * signalled. - * @param current the waiting thread - * @param node its node + * Transfers node, if necessary, to sync queue after a cancelled wait. + * Returns true if thread was cancelled before being signalled. + * + * @param node the node * @return true if cancelled before the node was signalled */ final boolean transferAfterCancelledWait(Node node) { @@ -1738,7 +1737,7 @@ * uses this synchronizer as its lock. * * @param condition the condition - * @return true if owned + * @return {@code true} if owned * @throws NullPointerException if the condition is null */ public final boolean owns(ConditionObject condition) { @@ -1748,13 +1747,13 @@ /** * Queries whether any threads are waiting on the given condition * associated with this synchronizer. Note that because timeouts - * and interrupts may occur at any time, a true return - * does not guarantee that a future signal will awaken + * and interrupts may occur at any time, a {@code true} return + * does not guarantee that a future {@code signal} will awaken * any threads. This method is designed primarily for use in * monitoring of the system state. * * @param condition the condition - * @return true if there are any waiting threads + * @return {@code true} if there are any waiting threads * @throws IllegalMonitorStateException if exclusive synchronization * is not held * @throws IllegalArgumentException if the given condition is @@ -1821,7 +1820,7 @@ * and Condition users. Exported versions of this class will in * general need to be accompanied by documentation describing * condition semantics that rely on those of the associated - * AbstractQueuedSynchronizer. + * {@code AbstractQueuedSynchronizer}. * *

      This class is Serializable, but all fields are transient, * so deserialized conditions have no waiters. @@ -1834,7 +1833,7 @@ private transient Node lastWaiter; /** - * Creates a new ConditionObject instance. + * Creates a new {@code ConditionObject} instance. */ public ConditionObject() { } @@ -2187,7 +2186,7 @@ /** * Queries whether any threads are waiting on this condition. - * Implements {@link AbstractQueuedSynchronizer#hasWaiters}. + * Implements {@link AbstractQueuedSynchronizer#hasWaiters(ConditionObject)}. * * @return {@code true} if there are any waiting threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} @@ -2206,7 +2205,7 @@ /** * Returns an estimate of the number of threads waiting on * this condition. - * Implements {@link AbstractQueuedSynchronizer#getWaitQueueLength}. + * Implements {@link AbstractQueuedSynchronizer#getWaitQueueLength(ConditionObject)}. * * @return the estimated number of waiting threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} @@ -2226,7 +2225,7 @@ /** * Returns a collection containing those threads that may be * waiting on this Condition. - * Implements {@link AbstractQueuedSynchronizer#getWaitingThreads}. + * Implements {@link AbstractQueuedSynchronizer#getWaitingThreads(ConditionObject)}. * * @return the collection of threads * @throws IllegalMonitorStateException if {@link #isHeldExclusively} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/Condition.java --- a/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/Condition.java Thu Jul 11 12:50:20 2013 -0700 @@ -324,7 +324,7 @@ * } * }}

      * - *

      Design note: This method requires a nanosecond argument so + *

      Design note: This method requires a nanosecond argument so * as to avoid truncation errors in reporting remaining times. * Such precision loss would make it difficult for programmers to * ensure that total waiting times are not systematically shorter diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/Lock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/Lock.java Thu Jul 11 12:50:20 2013 -0700 @@ -121,8 +121,8 @@ *

      All {@code Lock} implementations must enforce the same * memory synchronization semantics as provided by the built-in monitor * lock, as described in - * - * The Java Language Specification, Third Edition (17.4 Memory Model): + * + * The Java Language Specification (17.4 Memory Model): *

        *
      • A successful {@code lock} operation has the same memory * synchronization effects as a successful Lock action. @@ -136,7 +136,7 @@ * *

        Implementation Considerations

        * - *

        The three forms of lock acquisition (interruptible, + *

        The three forms of lock acquisition (interruptible, * non-interruptible, and timed) may differ in their performance * characteristics, ordering guarantees, or other implementation * qualities. Further, the ability to interrupt the ongoing @@ -227,7 +227,7 @@ * * @throws InterruptedException if the current thread is * interrupted while acquiring the lock (and interruption - * of lock acquisition is supported). + * of lock acquisition is supported) */ void lockInterruptibly() throws InterruptedException; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java --- a/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java Thu Jul 11 12:50:20 2013 -0700 @@ -67,10 +67,10 @@ * {@code blocker} object parameter. This object is recorded while * the thread is blocked to permit monitoring and diagnostic tools to * identify the reasons that threads are blocked. (Such tools may - * access blockers using method {@link #getBlocker}.) The use of these - * forms rather than the original forms without this parameter is - * strongly encouraged. The normal argument to supply as a - * {@code blocker} within a lock implementation is {@code this}. + * access blockers using method {@link #getBlocker(Thread)}.) + * The use of these forms rather than the original forms without this + * parameter is strongly encouraged. The normal argument to supply as + * a {@code blocker} within a lock implementation is {@code this}. * *

        These methods are designed to be used as tools for creating * higher-level synchronization utilities, and are not in themselves diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReadWriteLock.java Thu Jul 11 12:50:20 2013 -0700 @@ -36,16 +36,16 @@ package java.util.concurrent.locks; /** - * A ReadWriteLock maintains a pair of associated {@link + * A {@code ReadWriteLock} maintains a pair of associated {@link * Lock locks}, one for read-only operations and one for writing. * The {@link #readLock read lock} may be held simultaneously by * multiple reader threads, so long as there are no writers. The * {@link #writeLock write lock} is exclusive. * - *

        All ReadWriteLock implementations must guarantee that - * the memory synchronization effects of writeLock operations + *

        All {@code ReadWriteLock} implementations must guarantee that + * the memory synchronization effects of {@code writeLock} operations * (as specified in the {@link Lock} interface) also hold with respect - * to the associated readLock. That is, a thread successfully + * to the associated {@code readLock}. That is, a thread successfully * acquiring the read lock will see all updates made upon previous * release of the write lock. * @@ -120,14 +120,14 @@ /** * Returns the lock used for reading. * - * @return the lock used for reading. + * @return the lock used for reading */ Lock readLock(); /** * Returns the lock used for writing. * - * @return the lock used for writing. + * @return the lock used for writing */ Lock writeLock(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantLock.java Thu Jul 11 12:50:20 2013 -0700 @@ -64,7 +64,7 @@ * fair lock may obtain it multiple times in succession while other * active threads are not progressing and not currently holding the * lock. - * Also note that the untimed {@link #tryLock() tryLock} method does not + * Also note that the untimed {@link #tryLock()} method does not * honor the fairness setting. It will succeed if the lock * is available even if other threads are waiting. * @@ -88,10 +88,9 @@ * }} * *

        In addition to implementing the {@link Lock} interface, this - * class defines methods {@code isLocked} and - * {@code getLockQueueLength}, as well as some associated - * {@code protected} access methods that may be useful for - * instrumentation and monitoring. + * class defines a number of {@code public} and {@code protected} + * methods for inspecting the state of the lock. Some of these + * methods are only useful for instrumentation and monitoring. * *

        Serialization of this class behaves in the same way as built-in * locks: a deserialized lock is in the unlocked state, regardless of @@ -124,9 +123,8 @@ abstract void lock(); /** - * Performs non-fair tryLock. tryAcquire is - * implemented in subclasses, but both need nonfair - * try for trylock method. + * Performs non-fair tryLock. tryAcquire is implemented in + * subclasses, but both need nonfair try for trylock method. */ final boolean nonfairTryAcquire(int acquires) { final Thread current = Thread.currentThread(); @@ -353,7 +351,7 @@ * {@link #tryLock(long, TimeUnit) tryLock(0, TimeUnit.SECONDS) } * which is almost equivalent (it also detects interruption). * - *

        If the current thread already holds this lock then the hold + *

        If the current thread already holds this lock then the hold * count is incremented by one and the method returns {@code true}. * *

        If the lock is held by another thread then this method will return @@ -538,10 +536,10 @@ /** * Queries if this lock is held by the current thread. * - *

        Analogous to the {@link Thread#holdsLock} method for built-in - * monitor locks, this method is typically used for debugging and - * testing. For example, a method that should only be called while - * a lock is held can assert that this is the case: + *

        Analogous to the {@link Thread#holdsLock(Object)} method for + * built-in monitor locks, this method is typically used for + * debugging and testing. For example, a method that should only be + * called while a lock is held can assert that this is the case: * *

         {@code
              * class X {
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java
        --- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -45,7 +45,7 @@
          * 
          *
        • Acquisition order * - *

          This class does not impose a reader or writer preference + *

          This class does not impose a reader or writer preference * ordering for lock access. However, it does support an optional * fairness policy. * @@ -59,7 +59,7 @@ *

          * *

          Fair mode - *
          When constructed as fair, threads contend for entry using an + *
          When constructed as fair, threads contend for entry using an * approximately arrival-order policy. When the currently held lock * is released, either the longest-waiting single writer thread will * be assigned the write lock, or if there is a group of reader threads @@ -277,7 +277,7 @@ static final class HoldCounter { int count = 0; // Use id, not reference, to avoid garbage retention - final long tid = Thread.currentThread().getId(); + final long tid = getThreadId(Thread.currentThread()); } /** @@ -420,7 +420,7 @@ firstReaderHoldCount--; } else { HoldCounter rh = cachedHoldCounter; - if (rh == null || rh.tid != current.getId()) + if (rh == null || rh.tid != getThreadId(current)) rh = readHolds.get(); int count = rh.count; if (count <= 1) { @@ -478,7 +478,7 @@ firstReaderHoldCount++; } else { HoldCounter rh = cachedHoldCounter; - if (rh == null || rh.tid != current.getId()) + if (rh == null || rh.tid != getThreadId(current)) cachedHoldCounter = rh = readHolds.get(); else if (rh.count == 0) readHolds.set(rh); @@ -515,7 +515,7 @@ } else { if (rh == null) { rh = cachedHoldCounter; - if (rh == null || rh.tid != current.getId()) { + if (rh == null || rh.tid != getThreadId(current)) { rh = readHolds.get(); if (rh.count == 0) readHolds.remove(); @@ -536,7 +536,7 @@ } else { if (rh == null) rh = cachedHoldCounter; - if (rh == null || rh.tid != current.getId()) + if (rh == null || rh.tid != getThreadId(current)) rh = readHolds.get(); else if (rh.count == 0) readHolds.set(rh); @@ -592,7 +592,7 @@ firstReaderHoldCount++; } else { HoldCounter rh = cachedHoldCounter; - if (rh == null || rh.tid != current.getId()) + if (rh == null || rh.tid != getThreadId(current)) cachedHoldCounter = rh = readHolds.get(); else if (rh.count == 0) readHolds.set(rh); @@ -643,7 +643,7 @@ return firstReaderHoldCount; HoldCounter rh = cachedHoldCounter; - if (rh != null && rh.tid == current.getId()) + if (rh != null && rh.tid == getThreadId(current)) return rh.count; int count = readHolds.get().count; @@ -875,7 +875,7 @@ /** * Attempts to release this lock. * - *

          If the number of readers is now zero then the lock + *

          If the number of readers is now zero then the lock * is made available for write lock attempts. */ public void unlock() { @@ -1017,7 +1017,7 @@ * #tryLock(long, TimeUnit) tryLock(0, TimeUnit.SECONDS) } * which is almost equivalent (it also detects interruption). * - *

          If the current thread already holds this lock then the + *

          If the current thread already holds this lock then the * hold count is incremented by one and the method returns * {@code true}. * @@ -1126,7 +1126,7 @@ * IllegalMonitorStateException} is thrown. * * @throws IllegalMonitorStateException if the current thread does not - * hold this lock. + * hold this lock */ public void unlock() { sync.release(1); @@ -1254,7 +1254,7 @@ * Queries the number of read locks held for this lock. This * method is designed for use in monitoring system state, not for * synchronization control. - * @return the number of read locks held. + * @return the number of read locks held */ public int getReadLockCount() { return sync.getReadLockCount(); @@ -1484,4 +1484,28 @@ "[Write locks = " + w + ", Read locks = " + r + "]"; } + /** + * Returns the thread id for the given thread. We must access + * this directly rather than via method Thread.getId() because + * getId() is not final, and has been known to be overridden in + * ways that do not preserve unique mappings. + */ + static final long getThreadId(Thread thread) { + return UNSAFE.getLongVolatile(thread, TID_OFFSET); + } + + // Unsafe mechanics + private static final sun.misc.Unsafe UNSAFE; + private static final long TID_OFFSET; + static { + try { + UNSAFE = sun.misc.Unsafe.getUnsafe(); + Class tk = Thread.class; + TID_OFFSET = UNSAFE.objectFieldOffset + (tk.getDeclaredField("tid")); + } catch (Exception e) { + throw new Error(e); + } + } + } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/concurrent/locks/StampedLock.java --- a/jdk/src/share/classes/java/util/concurrent/locks/StampedLock.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/concurrent/locks/StampedLock.java Thu Jul 11 12:50:20 2013 -0700 @@ -366,6 +366,8 @@ * Behavior under timeout and interruption matches that specified * for method {@link Lock#tryLock(long,TimeUnit)}. * + * @param time the maximum time to wait for the lock + * @param unit the time unit of the {@code time} argument * @return a stamp that can be used to unlock or convert mode, * or zero if the lock is not available * @throws InterruptedException if the current thread is interrupted @@ -445,6 +447,8 @@ * Behavior under timeout and interruption matches that specified * for method {@link Lock#tryLock(long,TimeUnit)}. * + * @param time the maximum time to wait for the lock + * @param unit the time unit of the {@code time} argument * @return a stamp that can be used to unlock or convert mode, * or zero if the lock is not available * @throws InterruptedException if the current thread is interrupted @@ -510,7 +514,8 @@ * obtained from {@link #tryOptimisticRead} or a locking method * for this lock has no defined effect or result. * - * @return true if the lock has not been exclusively acquired + * @param stamp a stamp + * @return {@code true} if the lock has not been exclusively acquired * since issuance of the given stamp; else false */ public boolean validate(long stamp) { @@ -723,7 +728,7 @@ * stamp value. This method may be useful for recovery after * errors. * - * @return true if the lock was held, else false + * @return {@code true} if the lock was held, else false */ public boolean tryUnlockWrite() { long s; WNode h; @@ -741,7 +746,7 @@ * requiring a stamp value. This method may be useful for recovery * after errors. * - * @return true if the read lock was held, else false + * @return {@code true} if the read lock was held, else false */ public boolean tryUnlockRead() { long s, m; WNode h; @@ -773,18 +778,18 @@ } /** - * Returns true if the lock is currently held exclusively. + * Returns {@code true} if the lock is currently held exclusively. * - * @return true if the lock is currently held exclusively + * @return {@code true} if the lock is currently held exclusively */ public boolean isWriteLocked() { return (state & WBIT) != 0L; } /** - * Returns true if the lock is currently held non-exclusively. + * Returns {@code true} if the lock is currently held non-exclusively. * - * @return true if the lock is currently held non-exclusively + * @return {@code true} if the lock is currently held non-exclusively */ public boolean isReadLocked() { return (state & RBITS) != 0L; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/function/BinaryOperator.java --- a/jdk/src/share/classes/java/util/function/BinaryOperator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/function/BinaryOperator.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,6 +24,9 @@ */ package java.util.function; +import java.util.Objects; +import java.util.Comparator; + /** * An operation upon two operands yielding a result. This is a specialization of * {@code BiFunction} where the operands and the result are all of the same type. @@ -35,4 +38,33 @@ */ @FunctionalInterface public interface BinaryOperator extends BiFunction { + /** + * Returns a {@link BinaryOperator} which returns the lesser of two elements + * according to the specified {@code Comparator} + * + * @param the type of values to be compared and returned + * @param comparator a {@code Comparator} for comparing the two values + * @return a {@code BinaryOperator} which returns the lesser of its operands, + * according to the supplied {@code Comparator} + * @throws NullPointerException if the argument is null + */ + public static BinaryOperator minBy(Comparator comparator) { + Objects.requireNonNull(comparator); + return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; + } + + /** + * Returns a {@link BinaryOperator} which returns the greater of two elements + * according to the specified {@code Comparator} + * + * @param the type of values to be compared and returned + * @param comparator a {@code Comparator} for comparing the two values + * @return a {@code BinaryOperator} which returns the greater of its operands, + * according to the supplied {@code Comparator} + * @throws NullPointerException if the argument is null + */ + public static BinaryOperator maxBy(Comparator comparator) { + Objects.requireNonNull(comparator); + return (a, b) -> comparator.compare(a, b) >= 0 ? a : b; + } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/function/Function.java --- a/jdk/src/share/classes/java/util/function/Function.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/function/Function.java Thu Jul 11 12:50:20 2013 -0700 @@ -87,6 +87,7 @@ * Returns a {@code Function} whose {@code apply} method returns its input. * * @param the type of the input and output objects to the function + * @return a {@code Function} whose {@code apply} method returns its input */ static Function identity() { return t -> t; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/function/UnaryOperator.java --- a/jdk/src/share/classes/java/util/function/UnaryOperator.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/function/UnaryOperator.java Thu Jul 11 12:50:20 2013 -0700 @@ -40,6 +40,7 @@ /** * Returns a unary operator that provides its input value as the result. * + * @param the type of the input and output objects to the function * @return a unary operator that provides its input value as the result */ static UnaryOperator identity() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/jar/Pack200.java --- a/jdk/src/share/classes/java/util/jar/Pack200.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/jar/Pack200.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,7 +112,7 @@ // Static methods of the Pack200 class. /** * Obtain new instance of a class that implements Packer. - * + *

            *
          • If the system property java.util.jar.Pack200.Packer * is defined, then the value is taken to be the fully-qualified name * of a concrete implementation class, which must implement Packer. @@ -122,6 +122,7 @@ *

          • If an implementation has not been specified with the system * property, then the system-default implementation class is instantiated, * and the result is returned.

          • + *
          * *

          Note: The returned object is not guaranteed to operate * correctly if multiple threads use it at the same time. @@ -137,7 +138,7 @@ /** * Obtain new instance of a class that implements Unpacker. - * + *

            *
          • If the system property java.util.jar.Pack200.Unpacker * is defined, then the value is taken to be the fully-qualified * name of a concrete implementation class, which must implement Unpacker. @@ -147,6 +148,7 @@ *

          • If an implementation has not been specified with the * system property, then the system-default implementation class * is instantiated, and the result is returned.

          • + *
          * *

          Note: The returned object is not guaranteed to operate * correctly if multiple threads use it at the same time. @@ -350,14 +352,14 @@ * directory will be passed also. *

          * Examples: - *

          
          +         * 
          {@code
                    *     Map p = packer.properties();
                    *     p.put(PASS_FILE_PFX+0, "mutants/Rogue.class");
                    *     p.put(PASS_FILE_PFX+1, "mutants/Wolverine.class");
                    *     p.put(PASS_FILE_PFX+2, "mutants/Storm.class");
                    *     # Pass all files in an entire directory hierarchy:
                    *     p.put(PASS_FILE_PFX+3, "police/");
          -         * 
          . + * }
          */ String PASS_FILE_PFX = "pack.pass.file."; @@ -378,12 +380,12 @@ * This is the default value for this property. *

          * Examples: - *

          
          +         * 
          {@code
                    *     Map p = pack200.getProperties();
                    *     p.put(UNKNOWN_ATTRIBUTE, ERROR);
                    *     p.put(UNKNOWN_ATTRIBUTE, STRIP);
                    *     p.put(UNKNOWN_ATTRIBUTE, PASS);
          -         * 
          + * }
          */ String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute"; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/logging/Handler.java --- a/jdk/src/share/classes/java/util/logging/Handler.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/logging/Handler.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -209,6 +209,7 @@ /** * Retrieves the ErrorManager for this Handler. * + * @return the ErrorManager for this Handler * @exception SecurityException if a security manager exists and if * the caller does not have LoggingPermission("control"). */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/logging/LogManager.java --- a/jdk/src/share/classes/java/util/logging/LogManager.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/logging/LogManager.java Thu Jul 11 12:50:20 2013 -0700 @@ -193,13 +193,27 @@ // Create and retain Logger for the root of the namespace. manager.rootLogger = manager.new RootLogger(); + // since by design the global manager's userContext and + // systemContext don't have their requiresDefaultLoggers + // flag set - we make sure to add the root logger to + // the global manager's default contexts here. manager.addLogger(manager.rootLogger); - manager.systemContext.addLocalLogger(manager.rootLogger); + manager.systemContext.addLocalLogger(manager.rootLogger, false); + manager.userContext.addLocalLogger(manager.rootLogger, false); // Adding the global Logger. Doing so in the Logger. // would deadlock with the LogManager.. - Logger.global.setLogManager(manager); - manager.addLogger(Logger.global); + // Do not call Logger.getGlobal() here as this might trigger + // the deadlock too. + @SuppressWarnings("deprecation") + final Logger global = Logger.global; + global.setLogManager(manager); + + // Make sure the global logger will be registered in the + // global manager's default contexts. + manager.addLogger(global); + manager.systemContext.addLocalLogger(global, false); + manager.userContext.addLocalLogger(global, false); // We don't call readConfiguration() here, as we may be running // very early in the JVM startup sequence. Instead readConfiguration @@ -257,7 +271,8 @@ } /** - * Return the global LogManager object. + * Returns the global LogManager object. + * @return the global LogManager object */ public static LogManager getLogManager() { if (manager != null) { @@ -400,7 +415,11 @@ if (javaAwtAccess.isMainAppContext()) { context = userContext; } else { - context = new LoggerContext(); + // Create a new LoggerContext for the applet. + // The new logger context has its requiresDefaultLoggers + // flag set to true - so that these loggers will be + // lazily added when the context is firt accessed. + context = new LoggerContext(true); } javaAwtAccess.put(ecx, LoggerContext.class, context); } @@ -507,9 +526,13 @@ private final Hashtable namedLoggers = new Hashtable<>(); // Tree of named Loggers private final LogNode root; - + private final boolean requiresDefaultLoggers; private LoggerContext() { + this(false); + } + private LoggerContext(boolean requiresDefaultLoggers) { this.root = new LogNode(null, this); + this.requiresDefaultLoggers = requiresDefaultLoggers; } Logger demandLogger(String name, String resourceBundleName) { @@ -518,7 +541,27 @@ return manager.demandLogger(name, resourceBundleName, null); } + + // Due to subtle deadlock issues getUserContext() no longer + // calls addLocalLogger(rootLogger); + // Therefore - we need to add the default loggers later on. + // Checks that the context is properly initialized + // This is necessary before calling e.g. find(name) + // or getLoggerNames() + // + private void ensureInitialized() { + if (requiresDefaultLoggers) { + // Ensure that the root and global loggers are set. + ensureDefaultLogger(manager.rootLogger); + ensureDefaultLogger(Logger.global); + } + } + + synchronized Logger findLogger(String name) { + // ensure that this context is properly initialized before + // looking for loggers. + ensureInitialized(); LoggerWeakRef ref = namedLoggers.get(name); if (ref == null) { return null; @@ -532,21 +575,76 @@ return logger; } - synchronized void ensureRootLogger(Logger logger) { - if (logger.getName().isEmpty()) - return; + // This method is called before adding a logger to the + // context. + // 'logger' is the context that will be added. + // This method will ensure that the defaults loggers are added + // before adding 'logger'. + // + private void ensureAllDefaultLoggers(Logger logger) { + if (requiresDefaultLoggers) { + final String name = logger.getName(); + if (!name.isEmpty()) { + ensureDefaultLogger(manager.rootLogger); + } + if (!Logger.GLOBAL_LOGGER_NAME.equals(name)) { + ensureDefaultLogger(Logger.global); + } + } + } + + private void ensureDefaultLogger(Logger logger) { + // Used for lazy addition of root logger and global logger + // to a LoggerContext. - // during initialization, rootLogger is null when - // instantiating itself RootLogger - if (findLogger("") == null && manager.rootLogger != null) { - addLocalLogger(manager.rootLogger); + // This check is simple sanity: we do not want that this + // method be called for anything else than Logger.global + // or owner.rootLogger. + if (!requiresDefaultLoggers || logger == null + || logger != Logger.global && logger != manager.rootLogger) { + + // the case where we have a non null logger which is neither + // Logger.global nor manager.rootLogger indicates a serious + // issue - as ensureDefaultLogger should never be called + // with any other loggers than one of these two (or null - if + // e.g manager.rootLogger is not yet initialized)... + assert logger == null; + + return; } + + // Adds the logger if it's not already there. + if (!namedLoggers.containsKey(logger.getName())) { + // It is important to prevent addLocalLogger to + // call ensureAllDefaultLoggers when we're in the process + // off adding one of those default loggers - as this would + // immediately cause a stack overflow. + // Therefore we must pass addDefaultLoggersIfNeeded=false, + // even if requiresDefaultLoggers is true. + addLocalLogger(logger, false); + } + } + + boolean addLocalLogger(Logger logger) { + // no need to add default loggers if it's not required + return addLocalLogger(logger, requiresDefaultLoggers); } // Add a logger to this context. This method will only set its level // and process parent loggers. It doesn't set its handlers. - synchronized boolean addLocalLogger(Logger logger) { - ensureRootLogger(logger); + synchronized boolean addLocalLogger(Logger logger, boolean addDefaultLoggersIfNeeded) { + // addDefaultLoggersIfNeeded serves to break recursion when adding + // default loggers. If we're adding one of the default loggers + // (we're being called from ensureDefaultLogger()) then + // addDefaultLoggersIfNeeded will be false: we don't want to + // call ensureAllDefaultLoggers again. + // + // Note: addDefaultLoggersIfNeeded can also be false when + // requiresDefaultLoggers is false - since calling + // ensureAllDefaultLoggers would have no effect in this case. + if (addDefaultLoggersIfNeeded) { + ensureAllDefaultLoggers(logger); + } final String name = logger.getName(); if (name == null) { @@ -614,6 +712,9 @@ } synchronized Enumeration getLoggerNames() { + // ensure that this context is properly initialized before + // returning logger names. + ensureInitialized(); return namedLoggers.keys(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/logging/LogRecord.java --- a/jdk/src/share/classes/java/util/logging/LogRecord.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/logging/LogRecord.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,6 +211,7 @@ * the message string before formatting it. The result may * be null if the message is not localizable, or if no suitable * ResourceBundle is available. + * @return the localization resource bundle */ public ResourceBundle getResourceBundle() { return resourceBundle; @@ -231,6 +232,7 @@ * This is the name for the ResourceBundle that should be * used to localize the message string before formatting it. * The result may be null if the message is not localizable. + * @return the localization resource bundle name */ public String getResourceBundleName() { return resourceBundleName; @@ -281,6 +283,7 @@ *

          * Sequence numbers are normally assigned in the LogRecord constructor, * so it should not normally be necessary to use this method. + * @param seq the sequence number */ public void setSequenceNumber(long seq) { sequenceNumber = seq; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/logging/Logger.java --- a/jdk/src/share/classes/java/util/logging/Logger.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/logging/Logger.java Thu Jul 11 12:50:20 2013 -0700 @@ -232,6 +232,27 @@ * @since 1.7 */ public static final Logger getGlobal() { + // In order to break a cyclic dependence between the LogManager + // and Logger static initializers causing deadlocks, the global + // logger is created with a special constructor that does not + // initialize its log manager. + // + // If an application calls Logger.getGlobal() before any logger + // has been initialized, it is therefore possible that the + // LogManager class has not been initialized yet, and therefore + // Logger.global.manager will be null. + // + // In order to finish the initialization of the global logger, we + // will therefore call LogManager.getLogManager() here. + // + // Care must be taken *not* to call Logger.getGlobal() in + // LogManager static initializers in order to avoid such + // deadlocks. + // + if (global != null && global.manager == null) { + // Complete initialization of the global Logger. + global.manager = LogManager.getLogManager(); + } return global; } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/prefs/AbstractPreferences.java --- a/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/prefs/AbstractPreferences.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1121,6 +1121,8 @@ * removed. (The implementor needn't check for any of these things.) * *

          This method is invoked with the lock on this node held. + * @param key the key + * @param value the value */ protected abstract void putSpi(String key, String value); @@ -1139,6 +1141,7 @@ * *

          This method is invoked with the lock on this node held. * + * @param key the key * @return the value associated with the specified key at this preference * node, or null if there is no association for this * key, or the association cannot be determined at this time. @@ -1152,6 +1155,7 @@ * (The implementor needn't check for either of these things.) * *

          This method is invoked with the lock on this node held. + * @param key the key */ protected abstract void removeSpi(String key); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/prefs/PreferencesFactory.java --- a/jdk/src/share/classes/java/util/prefs/PreferencesFactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/prefs/PreferencesFactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,6 +45,7 @@ /** * Returns the system root preference node. (Multiple calls on this * method will return the same object reference.) + * @return the system root preference node */ Preferences systemRoot(); @@ -52,6 +53,8 @@ * Returns the user root preference node corresponding to the calling * user. In a server, the returned value will typically depend on * some implicit client-context. + * @return the user root preference node corresponding to the calling + * user */ Preferences userRoot(); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java --- a/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/spi/LocaleServiceProvider.java Thu Jul 11 12:50:20 2013 -0700 @@ -42,7 +42,7 @@ * interfaces to offer support for locales beyond the set of locales * supported by the Java runtime environment itself. *

          - *

          Packaging of Locale Sensitive Service Provider Implementations

          + *

          Packaging of Locale Sensitive Service Provider Implementations

          * Implementations of these locale sensitive services are packaged using the * Java Extension Mechanism * as installed extensions. A provider identifies itself with a @@ -94,7 +94,7 @@ * supports the requested locale, the methods go through a list of candidate * locales and repeat the availability check for each until a match is found. * The algorithm used for creating a list of candidate locales is same as - * the one used by ResourceBunlde by default (see + * the one used by ResourceBundle by default (see * {@link java.util.ResourceBundle.Control#getCandidateLocales getCandidateLocales} * for the details). Even if a locale is resolved from the candidate list, * methods that return requested objects or names are invoked with the original @@ -165,7 +165,7 @@ /** * Returns {@code true} if the given {@code locale} is supported by * this locale service provider. The given {@code locale} may contain - * extensions that should be + * extensions that should be * taken into account for the support determination. * *

          The default implementation returns {@code true} if the given {@code locale} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/AbstractPipeline.java --- a/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/AbstractPipeline.java Thu Jul 11 12:50:20 2013 -0700 @@ -375,6 +375,12 @@ // NOTE: there are no size-injecting ops if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) { backPropagationHead = p; + // Clear the short circuit flag for next pipeline stage + // This stage encapsulates short-circuiting, the next + // stage may not have any short-circuit operations, and + // if so spliterator.forEachRemaining should be be used + // for traversal + thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT; } depth = 0; @@ -448,6 +454,15 @@ // PipelineHelper @Override + final StreamShape getSourceShape() { + AbstractPipeline p = AbstractPipeline.this; + while (p.depth > 0) { + p = p.previousStage; + } + return p.getOutputShape(); + } + + @Override final long exactOutputSizeIfKnown(Spliterator spliterator) { return StreamOpFlag.SIZED.isKnown(getStreamAndOpFlags()) ? spliterator.getExactSizeIfKnown() : -1; } @@ -503,6 +518,16 @@ } @Override + final Spliterator wrapSpliterator(Spliterator sourceSpliterator) { + if (depth == 0) { + return (Spliterator) sourceSpliterator; + } + else { + return wrap(this, () -> sourceSpliterator, isParallel()); + } + } + + @Override @SuppressWarnings("unchecked") final Node evaluate(Spliterator spliterator, boolean flatten, diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/AbstractTask.java --- a/jdk/src/share/classes/java/util/stream/AbstractTask.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/AbstractTask.java Thu Jul 11 12:50:20 2013 -0700 @@ -316,6 +316,7 @@ else { K l = task.leftChild = task.makeChild(split); K r = task.rightChild = task.makeChild(task.spliterator); + task.spliterator = null; task.setPendingCount(1); l.fork(); task = r; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/Collectors.java --- a/jdk/src/share/classes/java/util/stream/Collectors.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/Collectors.java Thu Jul 11 12:50:20 2013 -0700 @@ -30,7 +30,6 @@ import java.util.Collection; import java.util.Collections; import java.util.Comparator; -import java.util.Comparators; import java.util.DoubleSummaryStatistics; import java.util.EnumSet; import java.util.HashMap; @@ -78,7 +77,7 @@ * * // Find highest-paid employee * Employee highestPaid = employees.stream() - * .collect(Collectors.maxBy(Comparators.comparing(Employee::getSalary))); + * .collect(Collectors.maxBy(Comparator.comparing(Employee::getSalary))); * * // Group employees by department * Map> byDept @@ -89,7 +88,7 @@ * Map highestPaidByDept * = employees.stream() * .collect(Collectors.groupingBy(Employee::getDepartment, - * Collectors.maxBy(Comparators.comparing(Employee::getSalary)))); + * Collectors.maxBy(Comparator.comparing(Employee::getSalary)))); * * // Partition students into passing and failing * Map> passingFailing = @@ -404,7 +403,7 @@ * @implSpec * This produces a result equivalent to: *

          {@code
          -     *     reducing(Comparators.lesserOf(comparator))
          +     *     reducing(BinaryOperator.minBy(comparator))
                * }
          * * @param the type of the input elements @@ -413,7 +412,7 @@ */ public static Collector minBy(Comparator comparator) { - return reducing(Comparators.lesserOf(comparator)); + return reducing(BinaryOperator.minBy(comparator)); } /** @@ -423,7 +422,7 @@ * @implSpec * This produces a result equivalent to: *
          {@code
          -     *     reducing(Comparators.greaterOf(comparator))
          +     *     reducing(BinaryOperator.maxBy(comparator))
                * }
          * * @param the type of the input elements @@ -432,7 +431,7 @@ */ public static Collector maxBy(Comparator comparator) { - return reducing(Comparators.greaterOf(comparator)); + return reducing(BinaryOperator.maxBy(comparator)); } /** @@ -491,8 +490,8 @@ *

          For example, given a stream of {@code Person}, to calculate tallest * person in each city: *

          {@code
          -     *     Comparator byHeight = Comparators.comparing(Person::getHeight);
          -     *     BinaryOperator tallerOf = Comparators.greaterOf(byHeight);
          +     *     Comparator byHeight = Comparator.comparing(Person::getHeight);
          +     *     BinaryOperator tallerOf = BinaryOperator.greaterOf(byHeight);
                *     Map tallestByCity
                *         = people.stream().collect(groupingBy(Person::getCity, reducing(tallerOf)));
                * }
          @@ -531,8 +530,8 @@ *

          For example, given a stream of {@code Person}, to calculate the longest * last name of residents in each city: *

          {@code
          -     *     Comparator byLength = Comparators.comparing(String::length);
          -     *     BinaryOperator longerOf = Comparators.greaterOf(byLength);
          +     *     Comparator byLength = Comparator.comparing(String::length);
          +     *     BinaryOperator longerOf = BinaryOperator.greaterOf(byLength);
                *     Map longestLastNameByCity
                *         = people.stream().collect(groupingBy(Person::getCity,
                *                                              reducing(Person::getLastName, longerOf)));
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/DoublePipeline.java
          --- a/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/DoublePipeline.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -258,6 +258,12 @@
                       @Override
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedDouble(sink) {
          +                    @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(double t) {
                                   // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
                                   DoubleStream result = mapper.apply(t);
          @@ -290,6 +296,11 @@
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedDouble(sink) {
                               @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(double t) {
                                   if (predicate.test(t))
                                       downstream.accept(t);
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/DoubleStream.java
          --- a/jdk/src/share/classes/java/util/stream/DoubleStream.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/DoubleStream.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -743,14 +743,7 @@
                */
               public static DoubleStream generate(DoubleSupplier s) {
                   Objects.requireNonNull(s);
          -        return StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(
          -                new PrimitiveIterator.OfDouble() {
          -                    @Override
          -                    public boolean hasNext() { return true; }
          -
          -                    @Override
          -                    public double nextDouble() { return s.getAsDouble(); }
          -                },
          -                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
          +        return StreamSupport.doubleStream(
          +                new StreamSpliterators.InfiniteSupplyingSpliterator.OfDouble(Long.MAX_VALUE, s));
               }
           }
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/ForEachOps.java
          --- a/jdk/src/share/classes/java/util/stream/ForEachOps.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/ForEachOps.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -342,7 +342,7 @@
                       doCompute(this);
                   }
           
          -        private static void doCompute(ForEachOrderedTask task) {
          +        private static  void doCompute(ForEachOrderedTask task) {
                       while (true) {
                           Spliterator split;
                           if (!AbstractTask.suggestSplit(task.spliterator, task.targetSize)
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/IntPipeline.java
          --- a/jdk/src/share/classes/java/util/stream/IntPipeline.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/IntPipeline.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -294,6 +294,12 @@
                       @Override
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedInt(sink) {
          +                    @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(int t) {
                                   // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
                                   IntStream result = mapper.apply(t);
          @@ -326,6 +332,11 @@
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedInt(sink) {
                               @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(int t) {
                                   if (predicate.test(t))
                                       downstream.accept(t);
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/IntStream.java
          --- a/jdk/src/share/classes/java/util/stream/IntStream.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/IntStream.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -745,15 +745,8 @@
                */
               public static IntStream generate(IntSupplier s) {
                   Objects.requireNonNull(s);
          -        return StreamSupport.intStream(Spliterators.spliteratorUnknownSize(
          -                new PrimitiveIterator.OfInt() {
          -                    @Override
          -                    public boolean hasNext() { return true; }
          -
          -                    @Override
          -                    public int nextInt() { return s.getAsInt(); }
          -                },
          -                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
          +        return StreamSupport.intStream(
          +                new StreamSpliterators.InfiniteSupplyingSpliterator.OfInt(Long.MAX_VALUE, s));
               }
           
               /**
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/LongPipeline.java
          --- a/jdk/src/share/classes/java/util/stream/LongPipeline.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/LongPipeline.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -275,6 +275,12 @@
                       @Override
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedLong(sink) {
          +                    @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(long t) {
                                   // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it
                                   LongStream result = mapper.apply(t);
          @@ -307,6 +313,11 @@
                       Sink opWrapSink(int flags, Sink sink) {
                           return new Sink.ChainedLong(sink) {
                               @Override
          +                    public void begin(long size) {
          +                        downstream.begin(-1);
          +                    }
          +
          +                    @Override
                               public void accept(long t) {
                                   if (predicate.test(t))
                                       downstream.accept(t);
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/LongStream.java
          --- a/jdk/src/share/classes/java/util/stream/LongStream.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/LongStream.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -736,15 +736,8 @@
                */
               public static LongStream generate(LongSupplier s) {
                   Objects.requireNonNull(s);
          -        return StreamSupport.longStream(Spliterators.spliteratorUnknownSize(
          -                new PrimitiveIterator.OfLong() {
          -                    @Override
          -                    public boolean hasNext() { return true; }
          -
          -                    @Override
          -                    public long nextLong() { return s.getAsLong(); }
          -                },
          -                Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL));
          +        return StreamSupport.longStream(
          +                new StreamSpliterators.InfiniteSupplyingSpliterator.OfLong(Long.MAX_VALUE, s));
               }
           
               /**
          diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/Node.java
          --- a/jdk/src/share/classes/java/util/stream/Node.java	Tue Jul 02 17:38:10 2013 -0700
          +++ b/jdk/src/share/classes/java/util/stream/Node.java	Thu Jul 11 12:50:20 2013 -0700
          @@ -105,6 +105,32 @@
               }
           
               /**
          +     * Return a node describing a subsequence of the elements of this node,
          +     * starting at the given inclusive start offset and ending at the given
          +     * exclusive end offset.
          +     *
          +     * @param from The (inclusive) starting offset of elements to include, must
          +     *             be in range 0..count().
          +     * @param to The (exclusive) end offset of elements to include, must be
          +     *           in range 0..count().
          +     * @param generator A function to be used to create a new array, if needed,
          +     *                  for reference nodes.
          +     * @return the truncated node
          +     */
          +    default Node truncate(long from, long to, IntFunction generator) {
          +        if (from == 0 && to == count())
          +            return this;
          +        Spliterator spliterator = spliterator();
          +        long size = to - from;
          +        Node.Builder nodeBuilder = Nodes.builder(size, generator);
          +        nodeBuilder.begin(size);
          +        for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { }
          +        for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { }
          +        nodeBuilder.end();
          +        return nodeBuilder.build();
          +    }
          +
          +    /**
                * Provides an array view of the contents of this node.
                *
                * 

          Depending on the underlying implementation, this may return a @@ -192,19 +218,90 @@ } } - /** - * Specialized {@code Node} for int elements - */ - interface OfInt extends Node { + public interface OfPrimitive, + T_NODE extends OfPrimitive> + extends Node { + + /** + * {@inheritDoc} + * + * @return a {@link Spliterator.OfPrimitive} describing the elements of + * this node + */ + @Override + T_SPLITR spliterator(); + + /** + * Traverses the elements of this node, and invoke the provided + * {@code action} with each element. + * + * @param action a consumer that is to be invoked with each + * element in this {@code Node.OfPrimitive} + */ + void forEach(T_CONS action); + + @Override + default T_NODE getChild(int i) { + throw new IndexOutOfBoundsException(); + } + + T_NODE truncate(long from, long to, IntFunction generator); /** * {@inheritDoc} * - * @return a {@link Spliterator.OfInt} describing the elements of this - * node + * @implSpec the default implementation invokes the generator to create + * an instance of a boxed primitive array with a length of + * {@link #count()} and then invokes {@link #copyInto(T[], int)} with + * that array at an offset of 0. */ @Override - Spliterator.OfInt spliterator(); + default T[] asArray(IntFunction generator) { + T[] boxed = generator.apply((int) count()); + copyInto(boxed, 0); + return boxed; + } + + /** + * Views this node as a primitive array. + * + *

          Depending on the underlying implementation this may return a + * reference to an internal array rather than a copy. It is the callers + * responsibility to decide if either this node or the array is utilized + * as the primary reference for the data.

          + * + * @return an array containing the contents of this {@code Node} + */ + T_ARR asPrimitiveArray(); + + /** + * Creates a new primitive array. + * + * @param count the length of the primitive array. + * @return the new primitive array. + */ + T_ARR newArray(int count); + + /** + * Copies the content of this {@code Node} into a primitive array, + * starting at a given offset into the array. It is the caller's + * responsibility to ensure there is sufficient room in the array. + * + * @param array the array into which to copy the contents of this + * {@code Node} + * @param offset the starting offset within the array + * @throws IndexOutOfBoundsException if copying would cause access of + * data outside array bounds + * @throws NullPointerException if {@code array} is {@code null} + */ + void copyInto(T_ARR array, int offset); + } + + /** + * Specialized {@code Node} for int elements + */ + interface OfInt extends OfPrimitive { /** * {@inheritDoc} @@ -227,37 +324,12 @@ } /** - * Traverses the elements of this node, and invoke the provided - * {@code IntConsumer} with each element. - * - * @param consumer a {@code IntConsumer} that is to be invoked with each - * element in this {@code Node} - */ - void forEach(IntConsumer consumer); - - /** - * {@inheritDoc} - * - * @implSpec the default implementation invokes the generator to create - * an instance of an Integer[] array with a length of {@link #count()} - * and then invokes {@link #copyInto(Integer[], int)} with that - * Integer[] array at an offset of 0. This is not efficient and it is - * recommended to invoke {@link #asPrimitiveArray()}. - */ - @Override - default Integer[] asArray(IntFunction generator) { - Integer[] boxed = generator.apply((int) count()); - copyInto(boxed, 0); - return boxed; - } - - /** * {@inheritDoc} * * @implSpec the default implementation invokes {@link #asPrimitiveArray()} to * obtain an int[] array then and copies the elements from that int[] * array into the boxed Integer[] array. This is not efficient and it - * is recommended to invoke {@link #copyInto(int[], int)}. + * is recommended to invoke {@link #copyInto(Object, int)}. */ @Override default void copyInto(Integer[] boxed, int offset) { @@ -271,35 +343,23 @@ } @Override - default Node.OfInt getChild(int i) { - throw new IndexOutOfBoundsException(); + default Node.OfInt truncate(long from, long to, IntFunction generator) { + if (from == 0 && to == count()) + return this; + long size = to - from; + Spliterator.OfInt spliterator = spliterator(); + Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size); + nodeBuilder.begin(size); + for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { } + for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { } + nodeBuilder.end(); + return nodeBuilder.build(); } - /** - * Views this node as an int[] array. - * - *

          Depending on the underlying implementation this may return a - * reference to an internal array rather than a copy. It is the callers - * responsibility to decide if either this node or the array is utilized - * as the primary reference for the data.

          - * - * @return an array containing the contents of this {@code Node} - */ - int[] asPrimitiveArray(); - - /** - * Copies the content of this {@code Node} into an int[] array, starting - * at a given offset into the array. It is the caller's responsibility - * to ensure there is sufficient room in the array. - * - * @param array the array into which to copy the contents of this - * {@code Node} - * @param offset the starting offset within the array - * @throws IndexOutOfBoundsException if copying would cause access of - * data outside array bounds - * @throws NullPointerException if {@code array} is {@code null} - */ - void copyInto(int[] array, int offset); + @Override + default int[] newArray(int count) { + return new int[count]; + } /** * {@inheritDoc} @@ -309,22 +369,12 @@ default StreamShape getShape() { return StreamShape.INT_VALUE; } - } /** * Specialized {@code Node} for long elements */ - interface OfLong extends Node { - - /** - * {@inheritDoc} - * - * @return a {@link Spliterator.OfLong} describing the elements of this - * node - */ - @Override - Spliterator.OfLong spliterator(); + interface OfLong extends OfPrimitive { /** * {@inheritDoc} @@ -347,37 +397,12 @@ } /** - * Traverses the elements of this node, and invoke the provided - * {@code LongConsumer} with each element. - * - * @param consumer a {@code LongConsumer} that is to be invoked with - * each element in this {@code Node} - */ - void forEach(LongConsumer consumer); - - /** - * {@inheritDoc} - * - * @implSpec the default implementation invokes the generator to create - * an instance of a Long[] array with a length of {@link #count()} and - * then invokes {@link #copyInto(Long[], int)} with that Long[] array at - * an offset of 0. This is not efficient and it is recommended to - * invoke {@link #asPrimitiveArray()}. - */ - @Override - default Long[] asArray(IntFunction generator) { - Long[] boxed = generator.apply((int) count()); - copyInto(boxed, 0); - return boxed; - } - - /** * {@inheritDoc} * * @implSpec the default implementation invokes {@link #asPrimitiveArray()} * to obtain a long[] array then and copies the elements from that * long[] array into the boxed Long[] array. This is not efficient and - * it is recommended to invoke {@link #copyInto(long[], int)}. + * it is recommended to invoke {@link #copyInto(Object, int)}. */ @Override default void copyInto(Long[] boxed, int offset) { @@ -391,35 +416,23 @@ } @Override - default Node.OfLong getChild(int i) { - throw new IndexOutOfBoundsException(); + default Node.OfLong truncate(long from, long to, IntFunction generator) { + if (from == 0 && to == count()) + return this; + long size = to - from; + Spliterator.OfLong spliterator = spliterator(); + Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size); + nodeBuilder.begin(size); + for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { } + for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { } + nodeBuilder.end(); + return nodeBuilder.build(); } - /** - * Views this node as a long[] array. - * - *

          Depending on the underlying implementation this may return a - * reference to an internal array rather than a copy. It is the callers - * responsibility to decide if either this node or the array is utilized - * as the primary reference for the data. - * - * @return an array containing the contents of this {@code Node} - */ - long[] asPrimitiveArray(); - - /** - * Copies the content of this {@code Node} into a long[] array, starting - * at a given offset into the array. It is the caller's responsibility - * to ensure there is sufficient room in the array. - * - * @param array the array into which to copy the contents of this - * {@code Node} - * @param offset the starting offset within the array - * @throws IndexOutOfBoundsException if copying would cause access of - * data outside array bounds - * @throws NullPointerException if {@code array} is {@code null} - */ - void copyInto(long[] array, int offset); + @Override + default long[] newArray(int count) { + return new long[count]; + } /** * {@inheritDoc} @@ -429,23 +442,12 @@ default StreamShape getShape() { return StreamShape.LONG_VALUE; } - - } /** * Specialized {@code Node} for double elements */ - interface OfDouble extends Node { - - /** - * {@inheritDoc} - * - * @return A {@link Spliterator.OfDouble} describing the elements of - * this node - */ - @Override - Spliterator.OfDouble spliterator(); + interface OfDouble extends OfPrimitive { /** * {@inheritDoc} @@ -467,40 +469,15 @@ } } - /** - * Traverses the elements of this node, and invoke the provided - * {@code DoubleConsumer} with each element. - * - * @param consumer A {@code DoubleConsumer} that is to be invoked with - * each element in this {@code Node} - */ - void forEach(DoubleConsumer consumer); - // /** * {@inheritDoc} * - * @implSpec the default implementation invokes the generator to create - * an instance of a Double[] array with a length of {@link #count()} and - * then invokes {@link #copyInto(Double[], int)} with that Double[] - * array at an offset of 0. This is not efficient and it is recommended - * to invoke {@link #asPrimitiveArray()}. - */ - @Override - default Double[] asArray(IntFunction generator) { - Double[] boxed = generator.apply((int) count()); - copyInto(boxed, 0); - return boxed; - } - - /** - * {@inheritDoc} - * * @implSpec the default implementation invokes {@link #asPrimitiveArray()} * to obtain a double[] array then and copies the elements from that * double[] array into the boxed Double[] array. This is not efficient - * and it is recommended to invoke {@link #copyInto(double[], int)}. + * and it is recommended to invoke {@link #copyInto(Object, int)}. */ @Override default void copyInto(Double[] boxed, int offset) { @@ -514,35 +491,23 @@ } @Override - default Node.OfDouble getChild(int i) { - throw new IndexOutOfBoundsException(); + default Node.OfDouble truncate(long from, long to, IntFunction generator) { + if (from == 0 && to == count()) + return this; + long size = to - from; + Spliterator.OfDouble spliterator = spliterator(); + Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size); + nodeBuilder.begin(size); + for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { } + for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { } + nodeBuilder.end(); + return nodeBuilder.build(); } - /** - * Views this node as a double[] array. - * - *

          Depending on the underlying implementation this may return a - * reference to an internal array rather than a copy. It is the callers - * responsibility to decide if either this node or the array is utilized - * as the primary reference for the data. - * - * @return an array containing the contents of this {@code Node} - */ - double[] asPrimitiveArray(); - - /** - * Copies the content of this {@code Node} into a double[] array, starting - * at a given offset into the array. It is the caller's responsibility - * to ensure there is sufficient room in the array. - * - * @param array the array into which to copy the contents of this - * {@code Node} - * @param offset the starting offset within the array - * @throws IndexOutOfBoundsException if copying would cause access of - * data outside array bounds - * @throws NullPointerException if {@code array} is {@code null} - */ - void copyInto(double[] array, int offset); + @Override + default double[] newArray(int count) { + return new double[count]; + } /** * {@inheritDoc} diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/Nodes.java --- a/jdk/src/share/classes/java/util/stream/Nodes.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/Nodes.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,11 +33,13 @@ import java.util.Spliterator; import java.util.Spliterators; import java.util.concurrent.CountedCompleter; +import java.util.function.BinaryOperator; import java.util.function.Consumer; import java.util.function.DoubleConsumer; import java.util.function.IntConsumer; import java.util.function.IntFunction; import java.util.function.LongConsumer; +import java.util.function.LongFunction; /** * Factory methods for constructing implementations of {@link Node} and @@ -97,131 +99,28 @@ * * @param the type of elements of the concatenated node * @param shape the shape of the concatenated node to be created - * @param nodes the input nodes + * @param left the left input node + * @param right the right input node * @return a {@code Node} covering the elements of the input nodes * @throws IllegalStateException if all {@link Node} elements of the list * are an not instance of type supported by this factory. */ @SuppressWarnings("unchecked") - static Node conc(StreamShape shape, List> nodes) { - int size = nodes.size(); - if (size == 0) - return emptyNode(shape); - else if (size == 1) - return nodes.get(0); - else { - // Create a right-balanced tree when there are more that 2 nodes - switch (shape) { - case REFERENCE: { - List> refNodes = (List>) nodes; - ConcNode c = new ConcNode<>(refNodes.get(size - 2), refNodes.get(size - 1)); - for (int i = size - 3; i >= 0; i--) { - c = new ConcNode<>(refNodes.get(i), c); - } - return c; - } - case INT_VALUE: { - List intNodes = (List) nodes; - IntConcNode c = new IntConcNode(intNodes.get(size - 2), intNodes.get(size - 1)); - for (int i = size - 3; i >= 0; i--) { - c = new IntConcNode(intNodes.get(i), c); - } - return (Node) c; - } - case LONG_VALUE: { - List longNodes = (List) nodes; - LongConcNode c = new LongConcNode(longNodes.get(size - 2), longNodes.get(size - 1)); - for (int i = size - 3; i >= 0; i--) { - c = new LongConcNode(longNodes.get(i), c); - } - return (Node) c; - } - case DOUBLE_VALUE: { - List doubleNodes = (List) nodes; - DoubleConcNode c = new DoubleConcNode(doubleNodes.get(size - 2), doubleNodes.get(size - 1)); - for (int i = size - 3; i >= 0; i--) { - c = new DoubleConcNode(doubleNodes.get(i), c); - } - return (Node) c; - } - default: - throw new IllegalStateException("Unknown shape " + shape); - } - } - - } - - /** - * Truncate a {@link Node}, returning a node describing a subsequence of - * the contents of the input node. - * - * @param the type of elements of the input node and truncated node - * @param input the input node - * @param from the starting offset to include in the truncated node (inclusive) - * @param to the ending offset ot include in the truncated node (exclusive) - * @param generator the array factory (only used for reference nodes) - * @return the truncated node - */ - @SuppressWarnings("unchecked") - static Node truncateNode(Node input, long from, long to, IntFunction generator) { - StreamShape shape = input.getShape(); - long size = truncatedSize(input.count(), from, to); - if (size == 0) - return emptyNode(shape); - else if (from == 0 && to >= input.count()) - return input; - + static Node conc(StreamShape shape, Node left, Node right) { switch (shape) { - case REFERENCE: { - Spliterator spliterator = input.spliterator(); - Node.Builder nodeBuilder = Nodes.builder(size, generator); - nodeBuilder.begin(size); - for (int i = 0; i < from && spliterator.tryAdvance(e -> { }); i++) { } - for (int i = 0; (i < size) && spliterator.tryAdvance(nodeBuilder); i++) { } - nodeBuilder.end(); - return nodeBuilder.build(); - } - case INT_VALUE: { - Spliterator.OfInt spliterator = ((Node.OfInt) input).spliterator(); - Node.Builder.OfInt nodeBuilder = Nodes.intBuilder(size); - nodeBuilder.begin(size); - for (int i = 0; i < from && spliterator.tryAdvance((IntConsumer) e -> { }); i++) { } - for (int i = 0; (i < size) && spliterator.tryAdvance((IntConsumer) nodeBuilder); i++) { } - nodeBuilder.end(); - return (Node) nodeBuilder.build(); - } - case LONG_VALUE: { - Spliterator.OfLong spliterator = ((Node.OfLong) input).spliterator(); - Node.Builder.OfLong nodeBuilder = Nodes.longBuilder(size); - nodeBuilder.begin(size); - for (int i = 0; i < from && spliterator.tryAdvance((LongConsumer) e -> { }); i++) { } - for (int i = 0; (i < size) && spliterator.tryAdvance((LongConsumer) nodeBuilder); i++) { } - nodeBuilder.end(); - return (Node) nodeBuilder.build(); - } - case DOUBLE_VALUE: { - Spliterator.OfDouble spliterator = ((Node.OfDouble) input).spliterator(); - Node.Builder.OfDouble nodeBuilder = Nodes.doubleBuilder(size); - nodeBuilder.begin(size); - for (int i = 0; i < from && spliterator.tryAdvance((DoubleConsumer) e -> { }); i++) { } - for (int i = 0; (i < size) && spliterator.tryAdvance((DoubleConsumer) nodeBuilder); i++) { } - nodeBuilder.end(); - return (Node) nodeBuilder.build(); - } + case REFERENCE: + return new ConcNode<>(left, right); + case INT_VALUE: + return (Node) new ConcNode.OfInt((Node.OfInt) left, (Node.OfInt) right); + case LONG_VALUE: + return (Node) new ConcNode.OfLong((Node.OfLong) left, (Node.OfLong) right); + case DOUBLE_VALUE: + return (Node) new ConcNode.OfDouble((Node.OfDouble) left, (Node.OfDouble) right); default: throw new IllegalStateException("Unknown shape " + shape); } } - private static long truncatedSize(long size, long from, long to) { - if (from >= 0) - size = Math.max(0, size - from); - long limit = to - from; - if (limit >= 0) - size = Math.min(size, limit); - return size; - } - // Reference-based node methods /** @@ -422,7 +321,7 @@ new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke(); return node(array); } else { - Node node = new CollectorTask<>(helper, generator, spliterator).invoke(); + Node node = new CollectorTask.OfRef<>(helper, generator, spliterator).invoke(); return flattenTree ? flatten(node, generator) : node; } } @@ -460,7 +359,7 @@ return node(array); } else { - Node.OfInt node = new IntCollectorTask<>(helper, spliterator).invoke(); + Node.OfInt node = new CollectorTask.OfInt<>(helper, spliterator).invoke(); return flattenTree ? flattenInt(node) : node; } } @@ -498,7 +397,7 @@ return node(array); } else { - Node.OfLong node = new LongCollectorTask<>(helper, spliterator).invoke(); + Node.OfLong node = new CollectorTask.OfLong<>(helper, spliterator).invoke(); return flattenTree ? flattenLong(node) : node; } } @@ -536,7 +435,7 @@ return node(array); } else { - Node.OfDouble node = new DoubleCollectorTask<>(helper, spliterator).invoke(); + Node.OfDouble node = new CollectorTask.OfDouble<>(helper, spliterator).invoke(); return flattenTree ? flattenDouble(node) : node; } } @@ -763,8 +662,6 @@ return curSize; } - // Traversable - @Override public void forEach(Consumer consumer) { for (int i = 0; i < curSize; i++) { @@ -829,13 +726,12 @@ /** * Node class for an internal node with two or more children */ - static final class ConcNode implements Node { - private final Node left; - private final Node right; - + private static abstract class AbstractConcNode> implements Node { + protected final T_NODE left; + protected final T_NODE right; private final long size; - ConcNode(Node left, Node right) { + AbstractConcNode(T_NODE left, T_NODE right) { this.left = left; this.right = right; // The Node count will be required when the Node spliterator is @@ -845,26 +741,38 @@ this.size = left.count() + right.count(); } - // Node - - @Override - public Spliterator spliterator() { - return new Nodes.InternalNodeSpliterator.OfRef<>(this); - } - @Override public int getChildCount() { return 2; } @Override - public Node getChild(int i) { + public T_NODE getChild(int i) { if (i == 0) return left; if (i == 1) return right; throw new IndexOutOfBoundsException(); } @Override + public long count() { + return size; + } + } + + static final class ConcNode + extends AbstractConcNode> + implements Node { + + ConcNode(Node left, Node right) { + super(left, right); + } + + @Override + public Spliterator spliterator() { + return new Nodes.InternalNodeSpliterator.OfRef<>(this); + } + + @Override public void copyInto(T[] array, int offset) { Objects.requireNonNull(array); left.copyInto(array, offset); @@ -879,14 +787,24 @@ } @Override - public long count() { - return size; + public void forEach(Consumer consumer) { + left.forEach(consumer); + right.forEach(consumer); } @Override - public void forEach(Consumer consumer) { - left.forEach(consumer); - right.forEach(consumer); + public Node truncate(long from, long to, IntFunction generator) { + if (from == 0 && to == count()) + return this; + long leftCount = left.count(); + if (from >= leftCount) + return right.truncate(from - leftCount, to - leftCount, generator); + else if (to <= leftCount) + return left.truncate(from, to, generator); + else { + return Nodes.conc(getShape(), left.truncate(from, leftCount, generator), + right.truncate(0, to - leftCount, generator)); + } } @Override @@ -897,12 +815,92 @@ return String.format("ConcNode[size=%d]", count()); } } + + private abstract static class OfPrimitive, + T_NODE extends Node.OfPrimitive> + extends AbstractConcNode + implements Node.OfPrimitive { + + OfPrimitive(T_NODE left, T_NODE right) { + super(left, right); + } + + @Override + public void forEach(T_CONS consumer) { + left.forEach(consumer); + right.forEach(consumer); + } + + @Override + public void copyInto(T_ARR array, int offset) { + left.copyInto(array, offset); + right.copyInto(array, offset + (int) left.count()); + } + + @Override + public T_ARR asPrimitiveArray() { + T_ARR array = newArray((int) count()); + copyInto(array, 0); + return array; + } + + @Override + public String toString() { + if (count() < 32) + return String.format("%s[%s.%s]", this.getClass().getName(), left, right); + else + return String.format("%s[size=%d]", this.getClass().getName(), count()); + } + } + + static final class OfInt + extends ConcNode.OfPrimitive + implements Node.OfInt { + + OfInt(Node.OfInt left, Node.OfInt right) { + super(left, right); + } + + @Override + public Spliterator.OfInt spliterator() { + return new InternalNodeSpliterator.OfInt(this); + } + } + + static final class OfLong + extends ConcNode.OfPrimitive + implements Node.OfLong { + + OfLong(Node.OfLong left, Node.OfLong right) { + super(left, right); + } + + @Override + public Spliterator.OfLong spliterator() { + return new InternalNodeSpliterator.OfLong(this); + } + } + + static final class OfDouble + extends ConcNode.OfPrimitive + implements Node.OfDouble { + + OfDouble(Node.OfDouble left, Node.OfDouble right) { + super(left, right); + } + + @Override + public Spliterator.OfDouble spliterator() { + return new InternalNodeSpliterator.OfDouble(this); + } + } } /** Abstract class for spliterator for all internal node classes */ private static abstract class InternalNodeSpliterator, - N extends Node, C> + N extends Node> implements Spliterator { // Node we are pointing to // null if full traversal has occurred @@ -960,7 +958,7 @@ return null; } - protected final boolean internalTryAdvance(C consumer) { + protected final boolean initTryAdvance() { if (curNode == null) return false; @@ -981,29 +979,12 @@ else tryAdvanceSpliterator = lastNodeSpliterator; } - - boolean hasNext = tryAdvance(tryAdvanceSpliterator, consumer); - if (!hasNext) { - if (lastNodeSpliterator == null) { - // Advance to the spliterator of the next non-empty leaf node - Node leaf = findNextLeafNode(tryAdvanceStack); - if (leaf != null) { - tryAdvanceSpliterator = (S) leaf.spliterator(); - // Since the node is not-empty the spliterator can be advanced - return tryAdvance(tryAdvanceSpliterator, consumer); - } - } - // No more elements to traverse - curNode = null; - } - return hasNext; + return true; } - protected abstract boolean tryAdvance(S spliterator, C consumer); - @Override @SuppressWarnings("unchecked") - public S trySplit() { + public final S trySplit() { if (curNode == null || tryAdvanceSpliterator != null) return null; // Cannot split if fully or partially traversed else if (lastNodeSpliterator != null) @@ -1024,7 +1005,7 @@ } @Override - public long estimateSize() { + public final long estimateSize() { if (curNode == null) return 0; @@ -1041,12 +1022,12 @@ } @Override - public int characteristics() { + public final int characteristics() { return Spliterator.SIZED; } private static final class OfRef - extends InternalNodeSpliterator, Node, Consumer> { + extends InternalNodeSpliterator, Node> { OfRef(Node curNode) { super(curNode); @@ -1054,13 +1035,24 @@ @Override public boolean tryAdvance(Consumer consumer) { - return internalTryAdvance(consumer); - } + if (!initTryAdvance()) + return false; - @Override - protected boolean tryAdvance(Spliterator spliterator, - Consumer consumer) { - return spliterator.tryAdvance(consumer); + boolean hasNext = tryAdvanceSpliterator.tryAdvance(consumer); + if (!hasNext) { + if (lastNodeSpliterator == null) { + // Advance to the spliterator of the next non-empty leaf node + Node leaf = findNextLeafNode(tryAdvanceStack); + if (leaf != null) { + tryAdvanceSpliterator = leaf.spliterator(); + // Since the node is not-empty the spliterator can be advanced + return tryAdvanceSpliterator.tryAdvance(consumer); + } + } + // No more elements to traverse + curNode = null; + } + return hasNext; } @Override @@ -1085,34 +1077,47 @@ } } - private static final class OfInt - extends InternalNodeSpliterator - implements Spliterator.OfInt { + private static abstract class OfPrimitive, + N extends Node.OfPrimitive> + extends InternalNodeSpliterator + implements Spliterator.OfPrimitive { - OfInt(Node.OfInt cur) { + OfPrimitive(N cur) { super(cur); } @Override - public boolean tryAdvance(IntConsumer consumer) { - return internalTryAdvance(consumer); + public boolean tryAdvance(T_CONS consumer) { + if (!initTryAdvance()) + return false; + + boolean hasNext = tryAdvanceSpliterator.tryAdvance(consumer); + if (!hasNext) { + if (lastNodeSpliterator == null) { + // Advance to the spliterator of the next non-empty leaf node + N leaf = findNextLeafNode(tryAdvanceStack); + if (leaf != null) { + tryAdvanceSpliterator = leaf.spliterator(); + // Since the node is not-empty the spliterator can be advanced + return tryAdvanceSpliterator.tryAdvance(consumer); + } + } + // No more elements to traverse + curNode = null; + } + return hasNext; } @Override - protected boolean tryAdvance(Spliterator.OfInt spliterator, - IntConsumer consumer) { - return spliterator.tryAdvance(consumer); - } - - @Override - public void forEachRemaining(IntConsumer consumer) { + public void forEachRemaining(T_CONS consumer) { if (curNode == null) return; if (tryAdvanceSpliterator == null) { if (lastNodeSpliterator == null) { - Deque stack = initStack(); - Node.OfInt leaf; + Deque stack = initStack(); + N leaf; while ((leaf = findNextLeafNode(stack)) != null) { leaf.forEach(consumer); } @@ -1126,86 +1131,31 @@ } } + private static final class OfInt + extends OfPrimitive + implements Spliterator.OfInt { + + OfInt(Node.OfInt cur) { + super(cur); + } + } + private static final class OfLong - extends InternalNodeSpliterator + extends OfPrimitive implements Spliterator.OfLong { OfLong(Node.OfLong cur) { super(cur); } - - @Override - public boolean tryAdvance(LongConsumer consumer) { - return internalTryAdvance(consumer); - } - - @Override - protected boolean tryAdvance(Spliterator.OfLong spliterator, - LongConsumer consumer) { - return spliterator.tryAdvance(consumer); - } - - @Override - public void forEachRemaining(LongConsumer consumer) { - if (curNode == null) - return; - - if (tryAdvanceSpliterator == null) { - if (lastNodeSpliterator == null) { - Deque stack = initStack(); - Node.OfLong leaf; - while ((leaf = findNextLeafNode(stack)) != null) { - leaf.forEach(consumer); - } - curNode = null; - } - else - lastNodeSpliterator.forEachRemaining(consumer); - } - else - while(tryAdvance(consumer)) { } - } } private static final class OfDouble - extends InternalNodeSpliterator + extends OfPrimitive implements Spliterator.OfDouble { OfDouble(Node.OfDouble cur) { super(cur); } - - @Override - public boolean tryAdvance(DoubleConsumer consumer) { - return internalTryAdvance(consumer); - } - - @Override - protected boolean tryAdvance(Spliterator.OfDouble spliterator, - DoubleConsumer consumer) { - return spliterator.tryAdvance(consumer); - } - - @Override - public void forEachRemaining(DoubleConsumer consumer) { - if (curNode == null) - return; - - if (tryAdvanceSpliterator == null) { - if (lastNodeSpliterator == null) { - Deque stack = initStack(); - Node.OfDouble leaf; - while ((leaf = findNextLeafNode(stack)) != null) { - leaf.forEach(consumer); - } - curNode = null; - } - else - lastNodeSpliterator.forEachRemaining(consumer); - } - else - while(tryAdvance(consumer)) { } - } } } @@ -1330,47 +1280,6 @@ private static final long[] EMPTY_LONG_ARRAY = new long[0]; private static final double[] EMPTY_DOUBLE_ARRAY = new double[0]; - private abstract static class AbstractPrimitiveConcNode> - implements Node { - final N left; - final N right; - final long size; - - AbstractPrimitiveConcNode(N left, N right) { - this.left = left; - this.right = right; - // The Node count will be required when the Node spliterator is - // obtained and it is cheaper to aggressively calculate bottom up as - // the tree is built rather than later on by traversing the tree - this.size = left.count() + right.count(); - } - - @Override - public int getChildCount() { - return 2; - } - - @Override - public N getChild(int i) { - if (i == 0) return left; - if (i == 1) return right; - throw new IndexOutOfBoundsException(); - } - - @Override - public long count() { - return size; - } - - @Override - public String toString() { - if (count() < 32) - return String.format("%s[%s.%s]", this.getClass().getName(), left, right); - else - return String.format("%s[size=%d]", this.getClass().getName(), count()); - } - } - private static class IntArrayNode implements Node.OfInt { final int[] array; int curSize; @@ -1535,105 +1444,6 @@ } } - static final class IntConcNode - extends AbstractPrimitiveConcNode - implements Node.OfInt { - - IntConcNode(Node.OfInt left, Node.OfInt right) { - super(left, right); - } - - @Override - public void forEach(IntConsumer consumer) { - left.forEach(consumer); - right.forEach(consumer); - } - - @Override - public Spliterator.OfInt spliterator() { - return new InternalNodeSpliterator.OfInt(this); - } - - @Override - public void copyInto(int[] array, int offset) { - left.copyInto(array, offset); - right.copyInto(array, offset + (int) left.count()); - } - - @Override - public int[] asPrimitiveArray() { - int[] array = new int[(int) count()]; - copyInto(array, 0); - return array; - } - } - - static final class LongConcNode - extends AbstractPrimitiveConcNode - implements Node.OfLong { - - LongConcNode(Node.OfLong left, Node.OfLong right) { - super(left, right); - } - - @Override - public void forEach(LongConsumer consumer) { - left.forEach(consumer); - right.forEach(consumer); - } - - @Override - public Spliterator.OfLong spliterator() { - return new InternalNodeSpliterator.OfLong(this); - } - - @Override - public void copyInto(long[] array, int offset) { - left.copyInto(array, offset); - right.copyInto(array, offset + (int) left.count()); - } - - @Override - public long[] asPrimitiveArray() { - long[] array = new long[(int) count()]; - copyInto(array, 0); - return array; - } - } - - static final class DoubleConcNode - extends AbstractPrimitiveConcNode - implements Node.OfDouble { - - DoubleConcNode(Node.OfDouble left, Node.OfDouble right) { - super(left, right); - } - - @Override - public void forEach(DoubleConsumer consumer) { - left.forEach(consumer); - right.forEach(consumer); - } - - @Override - public Spliterator.OfDouble spliterator() { - return new InternalNodeSpliterator.OfDouble(this); - } - - @Override - public void copyInto(double[] array, int offset) { - left.copyInto(array, offset); - right.copyInto(array, offset + (int) left.count()); - } - - @Override - public double[] asPrimitiveArray() { - double[] array = new double[(int) count()]; - copyInto(array, 0); - return array; - } - } - private static final class IntFixedNodeBuilder extends IntArrayNode implements Node.Builder.OfInt { @@ -2245,48 +2055,25 @@ } } - private static final class OfInt - extends ToArrayTask { - private final int[] array; + private static class OfPrimitive, + T_NODE extends Node.OfPrimitive> + extends ToArrayTask> { + private final T_ARR array; - private OfInt(Node.OfInt node, int[] array, int offset) { + private OfPrimitive(T_NODE node, T_ARR array, int offset) { super(node, offset); this.array = array; } - private OfInt(OfInt parent, Node.OfInt node, int offset) { + private OfPrimitive(OfPrimitive parent, T_NODE node, int offset) { super(parent, node, offset); this.array = parent.array; } @Override - OfInt makeChild(int childIndex, int offset) { - return new OfInt(this, node.getChild(childIndex), offset); - } - - @Override - void copyNodeToArray() { - node.copyInto(array, offset); - } - } - - private static final class OfLong - extends ToArrayTask { - private final long[] array; - - private OfLong(Node.OfLong node, long[] array, int offset) { - super(node, offset); - this.array = array; - } - - private OfLong(OfLong parent, Node.OfLong node, int offset) { - super(parent, node, offset); - this.array = parent.array; - } - - @Override - OfLong makeChild(int childIndex, int offset) { - return new OfLong(this, node.getChild(childIndex), offset); + OfPrimitive makeChild(int childIndex, int offset) { + return new OfPrimitive<>(this, node.getChild(childIndex), offset); } @Override @@ -2295,173 +2082,98 @@ } } - private static final class OfDouble - extends ToArrayTask { - private final double[] array; - - private OfDouble(Node.OfDouble node, double[] array, int offset) { - super(node, offset); - this.array = array; + private static final class OfInt + extends OfPrimitive { + private OfInt(Node.OfInt node, int[] array, int offset) { + super(node, array, offset); } + } - private OfDouble(OfDouble parent, Node.OfDouble node, int offset) { - super(parent, node, offset); - this.array = parent.array; + private static final class OfLong + extends OfPrimitive { + private OfLong(Node.OfLong node, long[] array, int offset) { + super(node, array, offset); } + } - @Override - OfDouble makeChild(int childIndex, int offset) { - return new OfDouble(this, node.getChild(childIndex), offset); - } - - @Override - void copyNodeToArray() { - node.copyInto(array, offset); + private static final class OfDouble + extends OfPrimitive { + private OfDouble(Node.OfDouble node, double[] array, int offset) { + super(node, array, offset); } } } - private static final class CollectorTask - extends AbstractTask, CollectorTask> { - private final PipelineHelper helper; - private final IntFunction generator; + private static class CollectorTask, T_BUILDER extends Node.Builder> + extends AbstractTask> { + protected final PipelineHelper helper; + protected final LongFunction builderFactory; + protected final BinaryOperator concFactory; CollectorTask(PipelineHelper helper, - IntFunction generator, - Spliterator spliterator) { + Spliterator spliterator, + LongFunction builderFactory, + BinaryOperator concFactory) { super(helper, spliterator); this.helper = helper; - this.generator = generator; + this.builderFactory = builderFactory; + this.concFactory = concFactory; } - CollectorTask(CollectorTask parent, Spliterator spliterator) { + CollectorTask(CollectorTask parent, + Spliterator spliterator) { super(parent, spliterator); helper = parent.helper; - generator = parent.generator; + builderFactory = parent.builderFactory; + concFactory = parent.concFactory; } @Override - protected CollectorTask makeChild(Spliterator spliterator) { + protected CollectorTask makeChild(Spliterator spliterator) { return new CollectorTask<>(this, spliterator); } @Override - protected Node doLeaf() { - Node.Builder builder - = builder(helper.exactOutputSizeIfKnown(spliterator), - generator); - return helper.wrapAndCopyInto(builder, spliterator).build(); + protected T_NODE doLeaf() { + T_BUILDER builder = builderFactory.apply(helper.exactOutputSizeIfKnown(spliterator)); + return (T_NODE) helper.wrapAndCopyInto(builder, spliterator).build(); } @Override public void onCompletion(CountedCompleter caller) { - if (!isLeaf()) { - setLocalResult(new ConcNode<>(leftChild.getLocalResult(), rightChild.getLocalResult())); - } + if (!isLeaf()) + setLocalResult(concFactory.apply(leftChild.getLocalResult(), rightChild.getLocalResult())); super.onCompletion(caller); } - } - - private static final class IntCollectorTask - extends AbstractTask> { - private final PipelineHelper helper; - - IntCollectorTask(PipelineHelper helper, Spliterator spliterator) { - super(helper, spliterator); - this.helper = helper; - } - - IntCollectorTask(IntCollectorTask parent, Spliterator spliterator) { - super(parent, spliterator); - helper = parent.helper; - } - @Override - protected IntCollectorTask makeChild(Spliterator spliterator) { - return new IntCollectorTask<>(this, spliterator); - } - - @Override - protected Node.OfInt doLeaf() { - Node.Builder.OfInt builder = intBuilder(helper.exactOutputSizeIfKnown(spliterator)); - return helper.wrapAndCopyInto(builder, spliterator).build(); - } - - @Override - public void onCompletion(CountedCompleter caller) { - if (!isLeaf()) { - setLocalResult(new IntConcNode(leftChild.getLocalResult(), rightChild.getLocalResult())); + private static final class OfRef + extends CollectorTask, Node.Builder> { + OfRef(PipelineHelper helper, + IntFunction generator, + Spliterator spliterator) { + super(helper, spliterator, s -> builder(s, generator), ConcNode::new); } - super.onCompletion(caller); - } - } - - private static final class LongCollectorTask - extends AbstractTask> { - private final PipelineHelper helper; - - LongCollectorTask(PipelineHelper helper, Spliterator spliterator) { - super(helper, spliterator); - this.helper = helper; } - LongCollectorTask(LongCollectorTask parent, Spliterator spliterator) { - super(parent, spliterator); - helper = parent.helper; - } - - @Override - protected LongCollectorTask makeChild(Spliterator spliterator) { - return new LongCollectorTask<>(this, spliterator); - } - - @Override - protected Node.OfLong doLeaf() { - Node.Builder.OfLong builder = longBuilder(helper.exactOutputSizeIfKnown(spliterator)); - return helper.wrapAndCopyInto(builder, spliterator).build(); + private static final class OfInt + extends CollectorTask { + OfInt(PipelineHelper helper, Spliterator spliterator) { + super(helper, spliterator, Nodes::intBuilder, ConcNode.OfInt::new); + } } - @Override - public void onCompletion(CountedCompleter caller) { - if (!isLeaf()) { - setLocalResult(new LongConcNode(leftChild.getLocalResult(), rightChild.getLocalResult())); + private static final class OfLong + extends CollectorTask { + OfLong(PipelineHelper helper, Spliterator spliterator) { + super(helper, spliterator, Nodes::longBuilder, ConcNode.OfLong::new); } - super.onCompletion(caller); - } - } - - private static final class DoubleCollectorTask - extends AbstractTask> { - private final PipelineHelper helper; - - DoubleCollectorTask(PipelineHelper helper, Spliterator spliterator) { - super(helper, spliterator); - this.helper = helper; } - DoubleCollectorTask(DoubleCollectorTask parent, Spliterator spliterator) { - super(parent, spliterator); - helper = parent.helper; - } - - @Override - protected DoubleCollectorTask makeChild(Spliterator spliterator) { - return new DoubleCollectorTask<>(this, spliterator); - } - - @Override - protected Node.OfDouble doLeaf() { - Node.Builder.OfDouble builder - = doubleBuilder(helper.exactOutputSizeIfKnown(spliterator)); - return helper.wrapAndCopyInto(builder, spliterator).build(); - } - - @Override - public void onCompletion(CountedCompleter caller) { - if (!isLeaf()) { - setLocalResult(new DoubleConcNode(leftChild.getLocalResult(), rightChild.getLocalResult())); + private static final class OfDouble + extends CollectorTask { + OfDouble(PipelineHelper helper, Spliterator spliterator) { + super(helper, spliterator, Nodes::doubleBuilder, ConcNode.OfDouble::new); } - super.onCompletion(caller); } } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/PipelineHelper.java --- a/jdk/src/share/classes/java/util/stream/PipelineHelper.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/PipelineHelper.java Thu Jul 11 12:50:20 2013 -0700 @@ -44,7 +44,7 @@ * and {@link AbstractPipeline#opEvaluateParallel(PipelineHelper, java.util.Spliterator, * java.util.function.IntFunction)}, methods, which can use the * {@code PipelineHelper} to access information about the pipeline such as - * input shape, output shape, stream flags, and size, and use the helper methods + * head shape, stream flags, and size, and use the helper methods * such as {@link #wrapAndCopyInto(Sink, Spliterator)}, * {@link #copyInto(Sink, Spliterator)}, and {@link #wrapSink(Sink)} to execute * pipeline operations. @@ -55,6 +55,13 @@ abstract class PipelineHelper { /** + * Gets the stream shape for the source of the pipeline segment. + * + * @return the stream shape for the source of the pipeline segment. + */ + abstract StreamShape getSourceShape(); + + /** * Gets the combined stream and operation flags for the output of the described * pipeline. This will incorporate stream flags from the stream source, all * the intermediate operations and the terminal operation. @@ -146,6 +153,14 @@ abstract Sink wrapSink(Sink sink); /** + * + * @param spliterator + * @param + * @return + */ + abstract Spliterator wrapSpliterator(Spliterator spliterator); + + /** * Constructs a @{link Node.Builder} compatible with the output shape of * this {@code PipelineHelper}. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/ReferencePipeline.java --- a/jdk/src/share/classes/java/util/stream/ReferencePipeline.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/ReferencePipeline.java Thu Jul 11 12:50:20 2013 -0700 @@ -25,7 +25,6 @@ package java.util.stream; import java.util.Comparator; -import java.util.Comparators; import java.util.Iterator; import java.util.Objects; import java.util.Optional; @@ -166,6 +165,11 @@ Sink opWrapSink(int flags, Sink sink) { return new Sink.ChainedReference(sink) { @Override + public void begin(long size) { + downstream.begin(-1); + } + + @Override public void accept(P_OUT u) { if (predicate.test(u)) downstream.accept(u); @@ -252,6 +256,12 @@ @Override Sink opWrapSink(int flags, Sink sink) { return new Sink.ChainedReference(sink) { + @Override + public void begin(long size) { + downstream.begin(-1); + } + + @Override public void accept(P_OUT u) { // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it Stream result = mapper.apply(u); @@ -273,6 +283,12 @@ Sink opWrapSink(int flags, Sink sink) { return new Sink.ChainedReference(sink) { IntConsumer downstreamAsInt = downstream::accept; + @Override + public void begin(long size) { + downstream.begin(-1); + } + + @Override public void accept(P_OUT u) { // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it IntStream result = mapper.apply(u); @@ -294,6 +310,12 @@ Sink opWrapSink(int flags, Sink sink) { return new Sink.ChainedReference(sink) { DoubleConsumer downstreamAsDouble = downstream::accept; + @Override + public void begin(long size) { + downstream.begin(-1); + } + + @Override public void accept(P_OUT u) { // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it DoubleStream result = mapper.apply(u); @@ -315,6 +337,12 @@ Sink opWrapSink(int flags, Sink sink) { return new Sink.ChainedReference(sink) { LongConsumer downstreamAsLong = downstream::accept; + @Override + public void begin(long size) { + downstream.begin(-1); + } + + @Override public void accept(P_OUT u) { // We can do better that this too; optimize for depth=0 case and just grab spliterator and forEach it LongStream result = mapper.apply(u); @@ -483,12 +511,12 @@ @Override public final Optional max(Comparator comparator) { - return reduce(Comparators.greaterOf(comparator)); + return reduce(BinaryOperator.maxBy(comparator)); } @Override public final Optional min(Comparator comparator) { - return reduce(Comparators.lesserOf(comparator)); + return reduce(BinaryOperator.minBy(comparator)); } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/SliceOps.java --- a/jdk/src/share/classes/java/util/stream/SliceOps.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/SliceOps.java Thu Jul 11 12:50:20 2013 -0700 @@ -24,8 +24,6 @@ */ package java.util.stream; -import java.util.ArrayList; -import java.util.List; import java.util.Spliterator; import java.util.concurrent.CountedCompleter; import java.util.function.IntFunction; @@ -42,6 +40,63 @@ private SliceOps() { } /** + * Calculates the sliced size given the current size, number of elements + * skip, and the number of elements to limit. + * + * @param size the current size + * @param skip the number of elements to skip, assumed to be >= 0 + * @param limit the number of elements to limit, assumed to be >= 0, with + * a value of {@code Long.MAX_VALUE} if there is no limit + * @return the sliced size + */ + private static long calcSize(long size, long skip, long limit) { + return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1; + } + + /** + * Calculates the slice fence, which is one past the index of the slice + * range + * @param skip the number of elements to skip, assumed to be >= 0 + * @param limit the number of elements to limit, assumed to be >= 0, with + * a value of {@code Long.MAX_VALUE} if there is no limit + * @return the slice fence. + */ + private static long calcSliceFence(long skip, long limit) { + long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE; + // Check for overflow + return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE; + } + + /** + * Creates a slice spliterator given a stream shape governing the + * spliterator type. Requires that the underlying Spliterator + * be SUBSIZED. + */ + @SuppressWarnings("unchecked") + private static Spliterator sliceSpliterator(StreamShape shape, + Spliterator s, + long skip, long limit) { + assert s.hasCharacteristics(Spliterator.SUBSIZED); + long sliceFence = calcSliceFence(skip, limit); + switch (shape) { + case REFERENCE: + return new StreamSpliterators + .SliceSpliterator.OfRef<>(s, skip, sliceFence); + case INT_VALUE: + return (Spliterator) new StreamSpliterators + .SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence); + case LONG_VALUE: + return (Spliterator) new StreamSpliterators + .SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence); + case DOUBLE_VALUE: + return (Spliterator) new StreamSpliterators + .SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence); + default: + throw new IllegalStateException("Unknown shape " + shape); + } + } + + /** * Appends a "slice" operation to the provided stream. The slice operation * may be may be skip-only, limit-only, or skip-and-limit. * @@ -58,11 +113,71 @@ return new ReferencePipeline.StatefulOp(upstream, StreamShape.REFERENCE, flags(limit)) { + Spliterator unorderedSkipLimitSpliterator(Spliterator s, + long skip, long limit, long sizeIfKnown) { + if (skip <= sizeIfKnown) { + // Use just the limit if the number of elements + // to skip is <= the known pipeline size + limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip; + skip = 0; + } + return new StreamSpliterators.UnorderedSliceSpliterator.OfRef<>(s, skip, limit); + } + + @Override + Spliterator opEvaluateParallelLazy(PipelineHelper helper, Spliterator spliterator) { + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + return new StreamSpliterators.SliceSpliterator.OfRef<>( + helper.wrapSpliterator(spliterator), + skip, + calcSliceFence(skip, limit)); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + return unorderedSkipLimitSpliterator( + helper.wrapSpliterator(spliterator), + skip, limit, size); + } + else { + // @@@ OOMEs will occur for LongStream.longs().filter(i -> true).limit(n) + // regardless of the value of n + // Need to adjust the target size of splitting for the + // SliceTask from say (size / k) to say min(size / k, 1 << 14) + // This will limit the size of the buffers created at the leaf nodes + // cancellation will be more aggressive cancelling later tasks + // if the target slice size has been reached from a given task, + // cancellation should also clear local results if any + return new SliceTask<>(this, helper, spliterator, i -> (T[]) new Object[i], skip, limit). + invoke().spliterator(); + } + } + @Override Node opEvaluateParallel(PipelineHelper helper, Spliterator spliterator, IntFunction generator) { - return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + // Because the pipeline is SIZED the slice spliterator + // can be created from the source, this requires matching + // to shape of the source, and is potentially more efficient + // than creating the slice spliterator from the pipeline + // wrapping spliterator + Spliterator s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit); + return Nodes.collect(helper, s, true, generator); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + Spliterator s = unorderedSkipLimitSpliterator( + helper.wrapSpliterator(spliterator), + skip, limit, size); + // Collect using this pipeline, which is empty and therefore + // can be used with the pipeline wrapping spliterator + // Note that we cannot create a slice spliterator from + // the source spliterator if the pipeline is not SIZED + return Nodes.collect(this, s, true, generator); + } + else { + return new SliceTask<>(this, helper, spliterator, generator, skip, limit). + invoke(); + } } @Override @@ -72,6 +187,11 @@ long m = limit >= 0 ? limit : Long.MAX_VALUE; @Override + public void begin(long size) { + downstream.begin(calcSize(size, skip, m)); + } + + @Override public void accept(T t) { if (n == 0) { if (m > 0) { @@ -109,11 +229,64 @@ return new IntPipeline.StatefulOp(upstream, StreamShape.INT_VALUE, flags(limit)) { + Spliterator.OfInt unorderedSkipLimitSpliterator( + Spliterator.OfInt s, long skip, long limit, long sizeIfKnown) { + if (skip <= sizeIfKnown) { + // Use just the limit if the number of elements + // to skip is <= the known pipeline size + limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip; + skip = 0; + } + return new StreamSpliterators.UnorderedSliceSpliterator.OfInt(s, skip, limit); + } + + @Override + Spliterator opEvaluateParallelLazy(PipelineHelper helper, + Spliterator spliterator) { + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + return new StreamSpliterators.SliceSpliterator.OfInt( + (Spliterator.OfInt) helper.wrapSpliterator(spliterator), + skip, + calcSliceFence(skip, limit)); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + return unorderedSkipLimitSpliterator( + (Spliterator.OfInt) helper.wrapSpliterator(spliterator), + skip, limit, size); + } + else { + return new SliceTask<>(this, helper, spliterator, Integer[]::new, skip, limit). + invoke().spliterator(); + } + } + @Override Node opEvaluateParallel(PipelineHelper helper, Spliterator spliterator, IntFunction generator) { - return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + // Because the pipeline is SIZED the slice spliterator + // can be created from the source, this requires matching + // to shape of the source, and is potentially more efficient + // than creating the slice spliterator from the pipeline + // wrapping spliterator + Spliterator s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit); + return Nodes.collectInt(helper, s, true); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + Spliterator.OfInt s = unorderedSkipLimitSpliterator( + (Spliterator.OfInt) helper.wrapSpliterator(spliterator), + skip, limit, size); + // Collect using this pipeline, which is empty and therefore + // can be used with the pipeline wrapping spliterator + // Note that we cannot create a slice spliterator from + // the source spliterator if the pipeline is not SIZED + return Nodes.collectInt(this, s, true); + } + else { + return new SliceTask<>(this, helper, spliterator, generator, skip, limit). + invoke(); + } } @Override @@ -123,6 +296,11 @@ long m = limit >= 0 ? limit : Long.MAX_VALUE; @Override + public void begin(long size) { + downstream.begin(calcSize(size, skip, m)); + } + + @Override public void accept(int t) { if (n == 0) { if (m > 0) { @@ -160,11 +338,64 @@ return new LongPipeline.StatefulOp(upstream, StreamShape.LONG_VALUE, flags(limit)) { + Spliterator.OfLong unorderedSkipLimitSpliterator( + Spliterator.OfLong s, long skip, long limit, long sizeIfKnown) { + if (skip <= sizeIfKnown) { + // Use just the limit if the number of elements + // to skip is <= the known pipeline size + limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip; + skip = 0; + } + return new StreamSpliterators.UnorderedSliceSpliterator.OfLong(s, skip, limit); + } + + @Override + Spliterator opEvaluateParallelLazy(PipelineHelper helper, + Spliterator spliterator) { + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + return new StreamSpliterators.SliceSpliterator.OfLong( + (Spliterator.OfLong) helper.wrapSpliterator(spliterator), + skip, + calcSliceFence(skip, limit)); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + return unorderedSkipLimitSpliterator( + (Spliterator.OfLong) helper.wrapSpliterator(spliterator), + skip, limit, size); + } + else { + return new SliceTask<>(this, helper, spliterator, Long[]::new, skip, limit). + invoke().spliterator(); + } + } + @Override Node opEvaluateParallel(PipelineHelper helper, Spliterator spliterator, IntFunction generator) { - return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + // Because the pipeline is SIZED the slice spliterator + // can be created from the source, this requires matching + // to shape of the source, and is potentially more efficient + // than creating the slice spliterator from the pipeline + // wrapping spliterator + Spliterator s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit); + return Nodes.collectLong(helper, s, true); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + Spliterator.OfLong s = unorderedSkipLimitSpliterator( + (Spliterator.OfLong) helper.wrapSpliterator(spliterator), + skip, limit, size); + // Collect using this pipeline, which is empty and therefore + // can be used with the pipeline wrapping spliterator + // Note that we cannot create a slice spliterator from + // the source spliterator if the pipeline is not SIZED + return Nodes.collectLong(this, s, true); + } + else { + return new SliceTask<>(this, helper, spliterator, generator, skip, limit). + invoke(); + } } @Override @@ -174,6 +405,11 @@ long m = limit >= 0 ? limit : Long.MAX_VALUE; @Override + public void begin(long size) { + downstream.begin(calcSize(size, skip, m)); + } + + @Override public void accept(long t) { if (n == 0) { if (m > 0) { @@ -211,11 +447,64 @@ return new DoublePipeline.StatefulOp(upstream, StreamShape.DOUBLE_VALUE, flags(limit)) { + Spliterator.OfDouble unorderedSkipLimitSpliterator( + Spliterator.OfDouble s, long skip, long limit, long sizeIfKnown) { + if (skip <= sizeIfKnown) { + // Use just the limit if the number of elements + // to skip is <= the known pipeline size + limit = limit >= 0 ? Math.min(limit, sizeIfKnown - skip) : sizeIfKnown - skip; + skip = 0; + } + return new StreamSpliterators.UnorderedSliceSpliterator.OfDouble(s, skip, limit); + } + + @Override + Spliterator opEvaluateParallelLazy(PipelineHelper helper, + Spliterator spliterator) { + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + return new StreamSpliterators.SliceSpliterator.OfDouble( + (Spliterator.OfDouble) helper.wrapSpliterator(spliterator), + skip, + calcSliceFence(skip, limit)); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + return unorderedSkipLimitSpliterator( + (Spliterator.OfDouble) helper.wrapSpliterator(spliterator), + skip, limit, size); + } + else { + return new SliceTask<>(this, helper, spliterator, Double[]::new, skip, limit). + invoke().spliterator(); + } + } + @Override Node opEvaluateParallel(PipelineHelper helper, Spliterator spliterator, IntFunction generator) { - return new SliceTask<>(this, helper, spliterator, generator, skip, limit).invoke(); + long size = helper.exactOutputSizeIfKnown(spliterator); + if (size > 0 && spliterator.hasCharacteristics(Spliterator.SUBSIZED)) { + // Because the pipeline is SIZED the slice spliterator + // can be created from the source, this requires matching + // to shape of the source, and is potentially more efficient + // than creating the slice spliterator from the pipeline + // wrapping spliterator + Spliterator s = sliceSpliterator(helper.getSourceShape(), spliterator, skip, limit); + return Nodes.collectDouble(helper, s, true); + } else if (!StreamOpFlag.ORDERED.isKnown(helper.getStreamAndOpFlags())) { + Spliterator.OfDouble s = unorderedSkipLimitSpliterator( + (Spliterator.OfDouble) helper.wrapSpliterator(spliterator), + skip, limit, size); + // Collect using this pipeline, which is empty and therefore + // can be used with the pipeline wrapping spliterator + // Note that we cannot create a slice spliterator from + // the source spliterator if the pipeline is not SIZED + return Nodes.collectDouble(this, s, true); + } + else { + return new SliceTask<>(this, helper, spliterator, generator, skip, limit). + invoke(); + } } @Override @@ -225,6 +514,11 @@ long m = limit >= 0 ? limit : Long.MAX_VALUE; @Override + public void begin(long size) { + downstream.begin(calcSize(size, skip, m)); + } + + @Override public void accept(double t) { if (n == 0) { if (m > 0) { @@ -250,20 +544,6 @@ return StreamOpFlag.NOT_SIZED | ((limit != -1) ? StreamOpFlag.IS_SHORT_CIRCUIT : 0); } - // Parallel strategy -- two cases - // IF we have full size information - // - decompose, keeping track of each leaf's (offset, size) - // - calculate leaf only if intersection between (offset, size) and desired slice - // - Construct a Node containing the appropriate sections of the appropriate leaves - // IF we don't - // - decompose, and calculate size of each leaf - // - on complete of any node, compute completed initial size from the root, and if big enough, cancel later nodes - // - @@@ this can be significantly improved - - // @@@ Currently we don't do the sized version at all - - // @@@ Should take into account ORDERED flag; if not ORDERED, we can limit in temporal order instead - /** * {@code ForkJoinTask} implementing slice computation. * @@ -316,19 +596,18 @@ ? op.exactOutputSizeIfKnown(spliterator) : -1; final Node.Builder nb = op.makeNodeBuilder(sizeIfKnown, generator); - Sink opSink = op.opWrapSink(op.sourceOrOpFlags, nb); - - if (!StreamOpFlag.SHORT_CIRCUIT.isKnown(op.sourceOrOpFlags)) - helper.wrapAndCopyInto(opSink, spliterator); - else - helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator); - return nb.build(); + Sink opSink = op.opWrapSink(helper.getStreamAndOpFlags(), nb); + helper.copyIntoWithCancel(helper.wrapSink(opSink), spliterator); + // It is necessary to truncate here since the result at the root + // can only be set once + return doTruncate(nb.build()); } else { Node node = helper.wrapAndCopyInto(helper.makeNodeBuilder(-1, generator), - spliterator).build(); + spliterator).build(); thisNodeSize = node.count(); completed = true; + spliterator = null; return node; } } @@ -336,176 +615,95 @@ @Override public final void onCompletion(CountedCompleter caller) { if (!isLeaf()) { + Node result; thisNodeSize = leftChild.thisNodeSize + rightChild.thisNodeSize; + if (canceled) { + thisNodeSize = 0; + result = getEmptyResult(); + } + else if (thisNodeSize == 0) + result = getEmptyResult(); + else if (leftChild.thisNodeSize == 0) + result = rightChild.getLocalResult(); + else { + result = Nodes.conc(op.getOutputShape(), + leftChild.getLocalResult(), rightChild.getLocalResult()); + } + setLocalResult(isRoot() ? doTruncate(result) : result); completed = true; - - if (isRoot()) { - // Only collect nodes once absolute size information is known + } + if (targetSize >= 0 + && !isRoot() + && isLeftCompleted(targetOffset + targetSize)) + cancelLaterNodes(); - ArrayList> nodes = new ArrayList<>(); - visit(nodes, 0); - Node result; - if (nodes.size() == 0) - result = Nodes.emptyNode(op.getOutputShape()); - else if (nodes.size() == 1) - result = nodes.get(0); - else - // This will create a tree of depth 1 and will not be a sub-tree - // for leaf nodes within the require range - result = Nodes.conc(op.getOutputShape(), nodes); - setLocalResult(result); - } - } - if (targetSize >= 0) { - if (((SliceTask) getRoot()).leftSize() >= targetOffset + targetSize) - cancelLaterNodes(); - } - // Don't call super.onCompletion(), we don't look at the child nodes until farther up the tree + super.onCompletion(caller); } - /** Compute the cumulative size of the longest leading prefix of completed children */ - private long leftSize() { + @Override + protected void cancel() { + super.cancel(); if (completed) - return thisNodeSize; - else if (isLeaf()) - return 0; - else { - long leftSize = 0; - for (SliceTask child = leftChild, p = null; child != p; - p = child, child = rightChild) { - if (child.completed) - leftSize += child.thisNodeSize; - else { - leftSize += child.leftSize(); - break; - } - } - return leftSize; - } + setLocalResult(getEmptyResult()); + } + + private Node doTruncate(Node input) { + long to = targetSize >= 0 ? Math.min(input.count(), targetOffset + targetSize) : thisNodeSize; + return input.truncate(targetOffset, to, generator); } - private void visit(List> results, int offset) { - if (!isLeaf()) { - for (SliceTask child = leftChild, p = null; child != p; - p = child, child = rightChild) { - child.visit(results, offset); - offset += child.thisNodeSize; - } - } - else { - if (results.size() == 0) { - if (offset + thisNodeSize >= targetOffset) - results.add(truncateNode(getLocalResult(), - Math.max(0, targetOffset - offset), - targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0)); - } - else { - if (targetSize == -1 || offset < targetOffset + targetSize) { - results.add(truncateNode(getLocalResult(), - 0, - targetSize >= 0 ? Math.max(0, offset + thisNodeSize - (targetOffset + targetSize)) : 0)); + /** + * Determine if the number of completed elements in this node and nodes + * to the left of this node is greater than or equal to the target size. + * + * @param target the target size + * @return true if the number of elements is greater than or equal to + * the target size, otherwise false. + */ + private boolean isLeftCompleted(long target) { + long size = completed ? thisNodeSize : completedSize(target); + if (size >= target) + return true; + for (SliceTask parent = getParent(), node = this; + parent != null; + node = parent, parent = parent.getParent()) { + if (node == parent.rightChild) { + SliceTask left = parent.leftChild; + if (left != null) { + size += left.completedSize(target); + if (size >= target) + return true; } } } + return size >= target; } /** - * Return a new node describing the result of truncating an existing Node - * at the left and/or right. + * Compute the number of completed elements in this node. + *

          + * Computation terminates if all nodes have been processed or the + * number of completed elements is greater than or equal to the target + * size. + * + * @param target the target size + * @return return the number of completed elements */ - private Node truncateNode(Node input, - long skipLeft, long skipRight) { - if (skipLeft == 0 && skipRight == 0) - return input; + private long completedSize(long target) { + if (completed) + return thisNodeSize; else { - return Nodes.truncateNode(input, skipLeft, thisNodeSize - skipRight, generator); + SliceTask left = leftChild; + SliceTask right = rightChild; + if (left == null || right == null) { + // must be completed + return thisNodeSize; + } + else { + long leftSize = left.completedSize(target); + return (leftSize >= target) ? leftSize : leftSize + right.completedSize(target); + } } } } - - // @@@ Currently unused -- optimization for when all sizes are known -// private static class SizedSliceTask extends AbstractShortCircuitTask, SizedSliceTask> { -// private final int targetOffset, targetSize; -// private final int offset, size; -// -// private SizedSliceTask(ParallelPipelineHelper helper, int offset, int size) { -// super(helper); -// targetOffset = offset; -// targetSize = size; -// this.offset = 0; -// this.size = spliterator.getSizeIfKnown(); -// } -// -// private SizedSliceTask(SizedSliceTask parent, Spliterator spliterator) { -// // Makes assumptions about order in which siblings are created and linked into parent! -// super(parent, spliterator); -// targetOffset = parent.targetOffset; -// targetSize = parent.targetSize; -// int siblingSizes = 0; -// for (SizedSliceTask sibling = parent.children; sibling != null; sibling = sibling.nextSibling) -// siblingSizes += sibling.size; -// size = spliterator.getSizeIfKnown(); -// offset = parent.offset + siblingSizes; -// } -// -// @Override -// protected SizedSliceTask makeChild(Spliterator spliterator) { -// return new SizedSliceTask<>(this, spliterator); -// } -// -// @Override -// protected Node getEmptyResult() { -// return Nodes.emptyNode(); -// } -// -// @Override -// public boolean taskCanceled() { -// if (offset > targetOffset+targetSize || offset+size < targetOffset) -// return true; -// else -// return super.taskCanceled(); -// } -// -// @Override -// protected Node doLeaf() { -// int skipLeft = Math.max(0, targetOffset - offset); -// int skipRight = Math.max(0, offset + size - (targetOffset + targetSize)); -// if (skipLeft == 0 && skipRight == 0) -// return helper.into(Nodes.makeBuilder(spliterator.getSizeIfKnown())).build(); -// else { -// // If we're the first or last node that intersects the target range, peel off irrelevant elements -// int truncatedSize = size - skipLeft - skipRight; -// NodeBuilder builder = Nodes.makeBuilder(truncatedSize); -// Sink wrappedSink = helper.wrapSink(builder); -// wrappedSink.begin(truncatedSize); -// Iterator iterator = spliterator.iterator(); -// for (int i=0; i caller) { -// if (!isLeaf()) { -// Node result = null; -// for (SizedSliceTask child = children.nextSibling; child != null; child = child.nextSibling) { -// Node childResult = child.getRawResult(); -// if (childResult == null) -// continue; -// else if (result == null) -// result = childResult; -// else -// result = Nodes.node(result, childResult); -// } -// setRawResult(result); -// if (offset <= targetOffset && offset+size >= targetOffset+targetSize) -// shortCircuit(result); -// } -// } -// } - } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/SortedOps.java --- a/jdk/src/share/classes/java/util/stream/SortedOps.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/SortedOps.java Thu Jul 11 12:50:20 2013 -0700 @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; -import java.util.Comparators; import java.util.Objects; import java.util.Spliterator; import java.util.concurrent.ForkJoinTask; @@ -114,7 +113,7 @@ StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SORTED); this.isNaturalSort = true; // Will throw CCE when we try to sort if T is not Comparable - this.comparator = (Comparator) Comparators.naturalOrder(); + this.comparator = (Comparator) Comparator.naturalOrder(); } /** diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/Stream.java --- a/jdk/src/share/classes/java/util/stream/Stream.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/Stream.java Thu Jul 11 12:50:20 2013 -0700 @@ -880,14 +880,7 @@ */ public static Stream generate(Supplier s) { Objects.requireNonNull(s); - return StreamSupport.stream(Spliterators.spliteratorUnknownSize( - new Iterator() { - @Override - public boolean hasNext() { return true; } - - @Override - public T next() { return s.get(); } - }, - Spliterator.ORDERED | Spliterator.IMMUTABLE)); + return StreamSupport.stream( + new StreamSpliterators.InfiniteSupplyingSpliterator.OfRef<>(Long.MAX_VALUE, s)); } } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/stream/StreamSpliterators.java --- a/jdk/src/share/classes/java/util/stream/StreamSpliterators.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/stream/StreamSpliterators.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,11 +26,15 @@ import java.util.Comparator; import java.util.Spliterator; +import java.util.concurrent.atomic.AtomicLong; import java.util.function.BooleanSupplier; import java.util.function.Consumer; import java.util.function.DoubleConsumer; +import java.util.function.DoubleSupplier; import java.util.function.IntConsumer; +import java.util.function.IntSupplier; import java.util.function.LongConsumer; +import java.util.function.LongSupplier; import java.util.function.Supplier; /** @@ -212,9 +216,10 @@ @Override public final long estimateSize() { init(); - return StreamOpFlag.SIZED.isKnown(ph.getStreamAndOpFlags()) - ? spliterator.estimateSize() - : Long.MAX_VALUE; + // Use the estimate of the wrapped spliterator + // Note this may not be accurate if there are filter/flatMap + // operations filtering or adding elements to the stream + return spliterator.estimateSize(); } @Override @@ -240,7 +245,7 @@ // but for sub-splits only an estimate is known if ((c & Spliterator.SIZED) != 0) { c &= ~(Spliterator.SIZED | Spliterator.SUBSIZED); - c |= (spliterator.characteristics() & Spliterator.SIZED & Spliterator.SUBSIZED); + c |= (spliterator.characteristics() & (Spliterator.SIZED | Spliterator.SUBSIZED)); } return c; @@ -304,7 +309,7 @@ finished = true; } else { - while (tryAdvance(consumer)) { } + do { } while (tryAdvance(consumer)); } } } @@ -360,7 +365,7 @@ finished = true; } else { - while (tryAdvance(consumer)) { } + do { } while (tryAdvance(consumer)); } } } @@ -416,7 +421,7 @@ finished = true; } else { - while (tryAdvance(consumer)) { } + do { } while (tryAdvance(consumer)); } } } @@ -472,7 +477,7 @@ finished = true; } else { - while (tryAdvance(consumer)) { } + do { } while (tryAdvance(consumer)); } } } @@ -483,17 +488,17 @@ * first call to any spliterator method. * @param */ - static class DelegatingSpliterator implements Spliterator { - private final Supplier> supplier; + static class DelegatingSpliterator> + implements Spliterator { + private final Supplier supplier; - private Spliterator s; + private T_SPLITR s; - @SuppressWarnings("unchecked") - DelegatingSpliterator(Supplier> supplier) { - this.supplier = (Supplier>) supplier; + DelegatingSpliterator(Supplier supplier) { + this.supplier = supplier; } - Spliterator get() { + T_SPLITR get() { if (s == null) { s = supplier.get(); } @@ -501,8 +506,8 @@ } @Override - public Spliterator trySplit() { - return get().trySplit(); + public T_SPLITR trySplit() { + return (T_SPLITR) get().trySplit(); } @Override @@ -540,97 +545,881 @@ return getClass().getName() + "[" + get() + "]"; } - static final class OfInt extends DelegatingSpliterator implements Spliterator.OfInt { - private Spliterator.OfInt s; - - OfInt(Supplier supplier) { - super(supplier); - } - - @Override - Spliterator.OfInt get() { - if (s == null) { - s = (Spliterator.OfInt) super.get(); - } - return s; - } - - @Override - public Spliterator.OfInt trySplit() { - return get().trySplit(); - } - - @Override - public boolean tryAdvance(IntConsumer consumer) { - return get().tryAdvance(consumer); - } - - @Override - public void forEachRemaining(IntConsumer consumer) { - get().forEachRemaining(consumer); - } - } - - static final class OfLong extends DelegatingSpliterator implements Spliterator.OfLong { - private Spliterator.OfLong s; - - OfLong(Supplier supplier) { + static class OfPrimitive> + extends DelegatingSpliterator + implements Spliterator.OfPrimitive { + OfPrimitive(Supplier supplier) { super(supplier); } @Override - Spliterator.OfLong get() { - if (s == null) { - s = (Spliterator.OfLong) super.get(); - } - return s; - } - - @Override - public Spliterator.OfLong trySplit() { - return get().trySplit(); - } - - @Override - public boolean tryAdvance(LongConsumer consumer) { + public boolean tryAdvance(T_CONS consumer) { return get().tryAdvance(consumer); } @Override - public void forEachRemaining(LongConsumer consumer) { + public void forEachRemaining(T_CONS consumer) { get().forEachRemaining(consumer); } } - static final class OfDouble extends DelegatingSpliterator implements Spliterator.OfDouble { - private Spliterator.OfDouble s; + static final class OfInt + extends OfPrimitive + implements Spliterator.OfInt { + + OfInt(Supplier supplier) { + super(supplier); + } + } + + static final class OfLong + extends OfPrimitive + implements Spliterator.OfLong { + + OfLong(Supplier supplier) { + super(supplier); + } + } + + static final class OfDouble + extends OfPrimitive + implements Spliterator.OfDouble { OfDouble(Supplier supplier) { super(supplier); } + } + } + + /** + * A slice Spliterator from a source Spliterator that reports + * {@code SUBSIZED}. + * + */ + static abstract class SliceSpliterator> { + // The start index of the slice + final long sliceOrigin; + // One past the last index of the slice + final long sliceFence; + + // The spliterator to slice + T_SPLITR s; + // current (absolute) index, modified on advance/split + long index; + // one past last (absolute) index or sliceFence, which ever is smaller + long fence; + + SliceSpliterator(T_SPLITR s, long sliceOrigin, long sliceFence, long origin, long fence) { + assert s.hasCharacteristics(Spliterator.SUBSIZED); + this.s = s; + this.sliceOrigin = sliceOrigin; + this.sliceFence = sliceFence; + this.index = origin; + this.fence = fence; + } + + protected abstract T_SPLITR makeSpliterator(T_SPLITR s, long sliceOrigin, long sliceFence, long origin, long fence); + + public T_SPLITR trySplit() { + if (sliceOrigin >= fence) + return null; + + if (index >= fence) + return null; + + // Keep splitting until the left and right splits intersect with the slice + // thereby ensuring the size estimate decreases. + // This also avoids creating empty spliterators which can result in + // existing and additionally created F/J tasks that perform + // redundant work on no elements. + while (true) { + T_SPLITR leftSplit = (T_SPLITR) s.trySplit(); + if (leftSplit == null) + return null; + + long leftSplitFenceUnbounded = index + leftSplit.estimateSize(); + long leftSplitFence = Math.min(leftSplitFenceUnbounded, sliceFence); + if (sliceOrigin >= leftSplitFence) { + // The left split does not intersect with, and is to the left of, the slice + // The right split does intersect + // Discard the left split and split further with the right split + index = leftSplitFence; + } + else if (leftSplitFence >= sliceFence) { + // The right split does not intersect with, and is to the right of, the slice + // The left split does intersect + // Discard the right split and split further with the left split + s = leftSplit; + fence = leftSplitFence; + } + else if (index >= sliceOrigin && leftSplitFenceUnbounded <= sliceFence) { + // The left split is contained within the slice, return the underlying left split + // Right split is contained within or intersects with the slice + index = leftSplitFence; + return leftSplit; + } else { + // The left split intersects with the slice + // Right split is contained within or intersects with the slice + return makeSpliterator(leftSplit, sliceOrigin, sliceFence, index, index = leftSplitFence); + } + } + } + + public long estimateSize() { + return (sliceOrigin < fence) + ? fence - Math.max(sliceOrigin, index) : 0; + } + + public int characteristics() { + return s.characteristics(); + } + + static final class OfRef + extends SliceSpliterator> + implements Spliterator { + + OfRef(Spliterator s, long sliceOrigin, long sliceFence) { + this(s, sliceOrigin, sliceFence, 0, Math.min(s.estimateSize(), sliceFence)); + } + + private OfRef(Spliterator s, + long sliceOrigin, long sliceFence, long origin, long fence) { + super(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected Spliterator makeSpliterator(Spliterator s, + long sliceOrigin, long sliceFence, + long origin, long fence) { + return new OfRef<>(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + public boolean tryAdvance(Consumer action) { + if (sliceOrigin >= fence) + return false; + + while (sliceOrigin > index) { + s.tryAdvance(e -> {}); + index++; + } + + if (index >= fence) + return false; + + index++; + return s.tryAdvance(action); + } + + @Override + public void forEachRemaining(Consumer action) { + if (sliceOrigin >= fence) + return; + + if (index >= fence) + return; + + if (index >= sliceOrigin && (index + s.estimateSize()) <= sliceFence) { + // The spliterator is contained within the slice + s.forEachRemaining(action); + index = fence; + } else { + // The spliterator intersects with the slice + while (sliceOrigin > index) { + s.tryAdvance(e -> {}); + index++; + } + // Traverse elements up to the fence + for (;index < fence; index++) { + s.tryAdvance(action); + } + } + } + } + + static abstract class OfPrimitive, + T_CONS> + extends SliceSpliterator + implements Spliterator.OfPrimitive { + + OfPrimitive(T_SPLITR s, long sliceOrigin, long sliceFence) { + this(s, sliceOrigin, sliceFence, 0, Math.min(s.estimateSize(), sliceFence)); + } + + private OfPrimitive(T_SPLITR s, + long sliceOrigin, long sliceFence, long origin, long fence) { + super(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + public boolean tryAdvance(T_CONS action) { + if (sliceOrigin >= fence) + return false; + + while (sliceOrigin > index) { + s.tryAdvance(emptyConsumer()); + index++; + } + + if (index >= fence) + return false; + + index++; + return s.tryAdvance(action); + } + + @Override + public void forEachRemaining(T_CONS action) { + if (sliceOrigin >= fence) + return; + + if (index >= fence) + return; + + if (index >= sliceOrigin && (index + s.estimateSize()) <= sliceFence) { + // The spliterator is contained within the slice + s.forEachRemaining(action); + index = fence; + } else { + // The spliterator intersects with the slice + while (sliceOrigin > index) { + s.tryAdvance(emptyConsumer()); + index++; + } + // Traverse elements up to the fence + for (;index < fence; index++) { + s.tryAdvance(action); + } + } + } + + protected abstract T_CONS emptyConsumer(); + } + + static final class OfInt extends OfPrimitive + implements Spliterator.OfInt { + OfInt(Spliterator.OfInt s, long sliceOrigin, long sliceFence) { + super(s, sliceOrigin, sliceFence); + } + + OfInt(Spliterator.OfInt s, + long sliceOrigin, long sliceFence, long origin, long fence) { + super(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected Spliterator.OfInt makeSpliterator(Spliterator.OfInt s, + long sliceOrigin, long sliceFence, + long origin, long fence) { + return new SliceSpliterator.OfInt(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected IntConsumer emptyConsumer() { + return e -> {}; + } + } + + static final class OfLong extends OfPrimitive + implements Spliterator.OfLong { + OfLong(Spliterator.OfLong s, long sliceOrigin, long sliceFence) { + super(s, sliceOrigin, sliceFence); + } + + OfLong(Spliterator.OfLong s, + long sliceOrigin, long sliceFence, long origin, long fence) { + super(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected Spliterator.OfLong makeSpliterator(Spliterator.OfLong s, + long sliceOrigin, long sliceFence, + long origin, long fence) { + return new SliceSpliterator.OfLong(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected LongConsumer emptyConsumer() { + return e -> {}; + } + } + + static final class OfDouble extends OfPrimitive + implements Spliterator.OfDouble { + OfDouble(Spliterator.OfDouble s, long sliceOrigin, long sliceFence) { + super(s, sliceOrigin, sliceFence); + } + + OfDouble(Spliterator.OfDouble s, + long sliceOrigin, long sliceFence, long origin, long fence) { + super(s, sliceOrigin, sliceFence, origin, fence); + } + + @Override + protected Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s, + long sliceOrigin, long sliceFence, + long origin, long fence) { + return new SliceSpliterator.OfDouble(s, sliceOrigin, sliceFence, origin, fence); + } @Override - Spliterator.OfDouble get() { - if (s == null) { - s = (Spliterator.OfDouble) super.get(); + protected DoubleConsumer emptyConsumer() { + return e -> {}; + } + } + } + + /** + * A slice Spliterator that does not preserve order, if any, of a source + * Spliterator. + * + * Note: The source spliterator may report {@code ORDERED} since that + * spliterator be the result of a previous pipeline stage that was + * collected to a {@code Node}. It is the order of the pipeline stage + * that governs whether the this slice spliterator is to be used or not. + */ + static abstract class UnorderedSliceSpliterator> { + static final int CHUNK_SIZE = 1 << 7; + + // The spliterator to slice + protected final T_SPLITR s; + protected final boolean unlimited; + private final long skipThreshold; + private final AtomicLong permits; + + UnorderedSliceSpliterator(T_SPLITR s, long skip, long limit) { + this.s = s; + this.unlimited = limit < 0; + this.skipThreshold = limit >= 0 ? limit : 0; + this.permits = new AtomicLong(limit >= 0 ? skip + limit : skip); + } + + UnorderedSliceSpliterator(T_SPLITR s, UnorderedSliceSpliterator parent) { + this.s = s; + this.unlimited = parent.unlimited; + this.permits = parent.permits; + this.skipThreshold = parent.skipThreshold; + } + + /** + * Acquire permission to skip or process elements. The caller must + * first acquire the elements, then consult this method for guidance + * as to what to do with the data. + * + *

          We use an {@code AtomicLong} to atomically maintain a counter, + * which is initialized as skip+limit if we are limiting, or skip only + * if we are not limiting. The user should consult the method + * {@code checkPermits()} before acquiring data elements. + * + * @param numElements the number of elements the caller has in hand + * @return the number of elements that should be processed; any + * remaining elements should be discarded. + */ + protected final long acquirePermits(long numElements) { + long remainingPermits; + long grabbing; + // permits never increase, and don't decrease below zero + assert numElements > 0; + do { + remainingPermits = permits.get(); + if (remainingPermits == 0) + return unlimited ? numElements : 0; + grabbing = Math.min(remainingPermits, numElements); + } while (grabbing > 0 && + !permits.compareAndSet(remainingPermits, remainingPermits - grabbing)); + + if (unlimited) + return Math.max(numElements - grabbing, 0); + else if (remainingPermits > skipThreshold) + return Math.max(grabbing - (remainingPermits - skipThreshold), 0); + else + return grabbing; + } + + enum PermitStatus { NO_MORE, MAYBE_MORE, UNLIMITED } + + /** Call to check if permits might be available before acquiring data */ + protected final PermitStatus permitStatus() { + if (permits.get() > 0) + return PermitStatus.MAYBE_MORE; + else + return unlimited ? PermitStatus.UNLIMITED : PermitStatus.NO_MORE; + } + + public final T_SPLITR trySplit() { + // Stop splitting when there are no more limit permits + if (permits.get() == 0) + return null; + T_SPLITR split = (T_SPLITR) s.trySplit(); + return split == null ? null : makeSpliterator(split); + } + + protected abstract T_SPLITR makeSpliterator(T_SPLITR s); + + public final long estimateSize() { + return s.estimateSize(); + } + + public final int characteristics() { + return s.characteristics() & + ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.ORDERED); + } + + static final class OfRef extends UnorderedSliceSpliterator> + implements Spliterator, Consumer { + T tmpSlot; + + OfRef(Spliterator s, long skip, long limit) { + super(s, skip, limit); + } + + OfRef(Spliterator s, OfRef parent) { + super(s, parent); + } + + @Override + public final void accept(T t) { + tmpSlot = t; + } + + @Override + public boolean tryAdvance(Consumer action) { + while (permitStatus() != PermitStatus.NO_MORE) { + if (!s.tryAdvance(this)) + return false; + else if (acquirePermits(1) == 1) { + action.accept(tmpSlot); + tmpSlot = null; + return true; + } + } + return false; + } + + @Override + public void forEachRemaining(Consumer action) { + ArrayBuffer.OfRef sb = null; + PermitStatus permitStatus; + while ((permitStatus = permitStatus()) != PermitStatus.NO_MORE) { + if (permitStatus == PermitStatus.MAYBE_MORE) { + // Optimistically traverse elements up to a threshold of CHUNK_SIZE + if (sb == null) + sb = new ArrayBuffer.OfRef<>(CHUNK_SIZE); + else + sb.reset(); + long permitsRequested = 0; + do { } while (s.tryAdvance(sb) && ++permitsRequested < CHUNK_SIZE); + if (permitsRequested == 0) + return; + sb.forEach(action, acquirePermits(permitsRequested)); + } + else { + // Must be UNLIMITED; let 'er rip + s.forEachRemaining(action); + return; + } + } + } + + @Override + protected Spliterator makeSpliterator(Spliterator s) { + return new UnorderedSliceSpliterator.OfRef<>(s, this); + } + } + + /** + * Concrete sub-types must also be an instance of type {@code T_CONS}. + * + * @param the type of the spined buffer. Must also be a type of + * {@code T_CONS}. + */ + static abstract class OfPrimitive< + T, + T_CONS, + T_BUFF extends ArrayBuffer.OfPrimitive, + T_SPLITR extends Spliterator.OfPrimitive> + extends UnorderedSliceSpliterator + implements Spliterator.OfPrimitive { + OfPrimitive(T_SPLITR s, long skip, long limit) { + super(s, skip, limit); + } + + OfPrimitive(T_SPLITR s, UnorderedSliceSpliterator.OfPrimitive parent) { + super(s, parent); + } + + @Override + public boolean tryAdvance(T_CONS action) { + while (permitStatus() != PermitStatus.NO_MORE) { + if (!s.tryAdvance((T_CONS) this)) + return false; + else if (acquirePermits(1) == 1) { + acceptConsumed(action); + return true; + } } - return s; + return false; + } + + protected abstract void acceptConsumed(T_CONS action); + + @Override + public void forEachRemaining(T_CONS action) { + T_BUFF sb = null; + PermitStatus permitStatus; + while ((permitStatus = permitStatus()) != PermitStatus.NO_MORE) { + if (permitStatus == PermitStatus.MAYBE_MORE) { + // Optimistically traverse elements up to a threshold of CHUNK_SIZE + if (sb == null) + sb = bufferCreate(CHUNK_SIZE); + else + sb.reset(); + @SuppressWarnings("unchecked") + T_CONS sbc = (T_CONS) sb; + long permitsRequested = 0; + do { } while (s.tryAdvance(sbc) && ++permitsRequested < CHUNK_SIZE); + if (permitsRequested == 0) + return; + sb.forEach(action, acquirePermits(permitsRequested)); + } + else { + // Must be UNLIMITED; let 'er rip + s.forEachRemaining(action); + return; + } + } + } + + protected abstract T_BUFF bufferCreate(int initialCapacity); + } + + static final class OfInt + extends OfPrimitive + implements Spliterator.OfInt, IntConsumer { + + int tmpValue; + + OfInt(Spliterator.OfInt s, long skip, long limit) { + super(s, skip, limit); + } + + OfInt(Spliterator.OfInt s, UnorderedSliceSpliterator.OfInt parent) { + super(s, parent); + } + + @Override + public void accept(int value) { + tmpValue = value; + } + + @Override + protected void acceptConsumed(IntConsumer action) { + action.accept(tmpValue); + } + + @Override + protected ArrayBuffer.OfInt bufferCreate(int initialCapacity) { + return new ArrayBuffer.OfInt(initialCapacity); + } + + @Override + protected Spliterator.OfInt makeSpliterator(Spliterator.OfInt s) { + return new UnorderedSliceSpliterator.OfInt(s, this); + } + } + + static final class OfLong + extends OfPrimitive + implements Spliterator.OfLong, LongConsumer { + + long tmpValue; + + OfLong(Spliterator.OfLong s, long skip, long limit) { + super(s, skip, limit); + } + + OfLong(Spliterator.OfLong s, UnorderedSliceSpliterator.OfLong parent) { + super(s, parent); + } + + @Override + public void accept(long value) { + tmpValue = value; + } + + @Override + protected void acceptConsumed(LongConsumer action) { + action.accept(tmpValue); + } + + @Override + protected ArrayBuffer.OfLong bufferCreate(int initialCapacity) { + return new ArrayBuffer.OfLong(initialCapacity); + } + + @Override + protected Spliterator.OfLong makeSpliterator(Spliterator.OfLong s) { + return new UnorderedSliceSpliterator.OfLong(s, this); + } + } + + static final class OfDouble + extends OfPrimitive + implements Spliterator.OfDouble, DoubleConsumer { + + double tmpValue; + + OfDouble(Spliterator.OfDouble s, long skip, long limit) { + super(s, skip, limit); + } + + OfDouble(Spliterator.OfDouble s, UnorderedSliceSpliterator.OfDouble parent) { + super(s, parent); + } + + @Override + public void accept(double value) { + tmpValue = value; + } + + @Override + protected void acceptConsumed(DoubleConsumer action) { + action.accept(tmpValue); + } + + @Override + protected ArrayBuffer.OfDouble bufferCreate(int initialCapacity) { + return new ArrayBuffer.OfDouble(initialCapacity); + } + + @Override + protected Spliterator.OfDouble makeSpliterator(Spliterator.OfDouble s) { + return new UnorderedSliceSpliterator.OfDouble(s, this); + } + } + } + + /** + * A Spliterator that infinitely supplies elements in no particular order. + * + *

          Splitting divides the estimated size in two and stops when the + * estimate size is 0. + * + *

          The {@code forEachRemaining} method if invoked will never terminate. + * The {@coe tryAdvance} method always returns true. + * + */ + static abstract class InfiniteSupplyingSpliterator implements Spliterator { + long estimate; + + protected InfiniteSupplyingSpliterator(long estimate) { + this.estimate = estimate; + } + + @Override + public long estimateSize() { + return estimate; + } + + @Override + public int characteristics() { + return IMMUTABLE; + } + + static final class OfRef extends InfiniteSupplyingSpliterator { + final Supplier s; + + OfRef(long size, Supplier s) { + super(size); + this.s = s; + } + + @Override + public boolean tryAdvance(Consumer action) { + action.accept(s.get()); + return true; + } + + @Override + public Spliterator trySplit() { + if (estimate == 0) + return null; + return new InfiniteSupplyingSpliterator.OfRef<>(estimate >>>= 1, s); + } + } + + static final class OfInt extends InfiniteSupplyingSpliterator + implements Spliterator.OfInt { + final IntSupplier s; + + OfInt(long size, IntSupplier s) { + super(size); + this.s = s; + } + + @Override + public boolean tryAdvance(IntConsumer action) { + action.accept(s.getAsInt()); + return true; + } + + @Override + public Spliterator.OfInt trySplit() { + if (estimate == 0) + return null; + return new InfiniteSupplyingSpliterator.OfInt(estimate = estimate >>> 1, s); + } + } + + static final class OfLong extends InfiniteSupplyingSpliterator + implements Spliterator.OfLong { + final LongSupplier s; + + OfLong(long size, LongSupplier s) { + super(size); + this.s = s; + } + + @Override + public boolean tryAdvance(LongConsumer action) { + action.accept(s.getAsLong()); + return true; + } + + @Override + public Spliterator.OfLong trySplit() { + if (estimate == 0) + return null; + return new InfiniteSupplyingSpliterator.OfLong(estimate = estimate >>> 1, s); + } + } + + static final class OfDouble extends InfiniteSupplyingSpliterator + implements Spliterator.OfDouble { + final DoubleSupplier s; + + OfDouble(long size, DoubleSupplier s) { + super(size); + this.s = s; + } + + @Override + public boolean tryAdvance(DoubleConsumer action) { + action.accept(s.getAsDouble()); + return true; } @Override public Spliterator.OfDouble trySplit() { - return get().trySplit(); + if (estimate == 0) + return null; + return new InfiniteSupplyingSpliterator.OfDouble(estimate = estimate >>> 1, s); + } + } + } + + // @@@ Consolidate with Node.Builder + static abstract class ArrayBuffer { + int index; + + void reset() { + index = 0; + } + + static final class OfRef extends ArrayBuffer implements Consumer { + final Object[] array; + + OfRef(int size) { + this.array = new Object[size]; + } + + @Override + public void accept(T t) { + array[index++] = t; + } + + public void forEach(Consumer action, long fence) { + for (int i = 0; i < fence; i++) { + @SuppressWarnings("unchecked") + T t = (T) array[i]; + action.accept(t); + } + } + } + + static abstract class OfPrimitive extends ArrayBuffer { + int index; + + @Override + void reset() { + index = 0; + } + + abstract void forEach(T_CONS action, long fence); + } + + static final class OfInt extends OfPrimitive + implements IntConsumer { + final int[] array; + + OfInt(int size) { + this.array = new int[size]; } @Override - public boolean tryAdvance(DoubleConsumer consumer) { - return get().tryAdvance(consumer); + public void accept(int t) { + array[index++] = t; + } + + @Override + public void forEach(IntConsumer action, long fence) { + for (int i = 0; i < fence; i++) { + action.accept(array[i]); + } + } + } + + static final class OfLong extends OfPrimitive + implements LongConsumer { + final long[] array; + + OfLong(int size) { + this.array = new long[size]; + } + + @Override + public void accept(long t) { + array[index++] = t; } @Override - public void forEachRemaining(DoubleConsumer consumer) { - get().forEachRemaining(consumer); + public void forEach(LongConsumer action, long fence) { + for (int i = 0; i < fence; i++) { + action.accept(array[i]); + } + } + } + + static final class OfDouble extends OfPrimitive + implements DoubleConsumer { + final double[] array; + + OfDouble(int size) { + this.array = new double[size]; + } + + @Override + public void accept(double t) { + array[index++] = t; + } + + @Override + void forEach(DoubleConsumer action, long fence) { + for (int i = 0; i < fence; i++) { + action.accept(array[i]); + } } } } -} +} \ No newline at end of file diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/zip/Deflater.java --- a/jdk/src/share/classes/java/util/zip/Deflater.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/zip/Deflater.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -461,7 +461,7 @@ } /** - * Returns the total number of uncompressed bytes input so far.

          + * Returns the total number of uncompressed bytes input so far. * * @return the total (non-negative) number of uncompressed bytes input so far * @since 1.5 @@ -487,7 +487,7 @@ } /** - * Returns the total number of compressed bytes output so far.

          + * Returns the total number of compressed bytes output so far. * * @return the total (non-negative) number of compressed bytes output so far * @since 1.5 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/java/util/zip/Inflater.java --- a/jdk/src/share/classes/java/util/zip/Inflater.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/java/util/zip/Inflater.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -305,7 +305,7 @@ } /** - * Returns the total number of compressed bytes input so far.

          + * Returns the total number of compressed bytes input so far. * * @return the total (non-negative) number of compressed bytes input so far * @since 1.5 @@ -331,7 +331,7 @@ } /** - * Returns the total number of uncompressed bytes output so far.

          + * Returns the total number of uncompressed bytes output so far. * * @return the total (non-negative) number of uncompressed bytes output so far * @since 1.5 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/CompositeName.java --- a/jdk/src/share/classes/javax/naming/CompositeName.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/CompositeName.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -42,7 +42,7 @@ * The most significant component is at index 0. * An empty composite name has no components. *

          - *

          JNDI Composite Name Syntax

          + *

          JNDI Composite Name Syntax

          * JNDI defines a standard string representation for composite names. This * representation is the concatenation of the components of a composite name * from left to right using the component separator (a forward @@ -73,12 +73,12 @@ * a separator) denotes a trailing empty component. * Adjacent component separators denote an empty component. *

          - *

          Composite Name Examples

          + *

          Composite Name Examples

          *This table shows examples of some composite names. Each row shows *the string form of a composite name and its corresponding structural form *(CompositeName). *

          - +
          @@ -137,14 +137,14 @@
          String Name
          *

          - *

          Composition Examples

          + *

          Composition Examples

          * Here are some composition examples. The right column shows composing * string composite names while the left column shows composing the * corresponding CompositeNames. Notice that composing the * string forms of two composite names simply involves concatenating * their string forms together. -

          +

          @@ -189,7 +189,7 @@
          String Names
          *

          - *

          Multithreaded Access

          + *

          Multithreaded Access

          * A CompositeName instance is not synchronized against concurrent * multithreaded access. Multiple threads trying to access and modify a * CompositeName should lock the object. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/CompoundName.java --- a/jdk/src/share/classes/javax/naming/CompoundName.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/CompoundName.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,7 +39,7 @@ * The most significant component is at index 0. * An empty compound name has no components. *

          - *

          Compound Name Syntax

          + *

          Compound Name Syntax

          * The syntax of a compound name is specified using a set of properties: *
          *
          jndi.syntax.direction @@ -136,7 +136,7 @@ * so that when the same string is parsed, it will yield the same components * of the original compound name. *

          - *

          Multithreaded Access

          + *

          Multithreaded Access

          * A CompoundName instance is not synchronized against concurrent * multithreaded access. Multiple threads trying to access and modify a * CompoundName should lock the object. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/Context.java --- a/jdk/src/share/classes/javax/naming/Context.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/Context.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * consists of a set of name-to-object bindings. * It contains methods for examining and updating these bindings. *

          - *

          Names

          + *

          Names

          * Each name passed as an argument to a Context method is relative * to that context. The empty name is used to name the context itself. * A name parameter may never be null. @@ -69,12 +69,12 @@ * names in a composite namespace, at the discretion of the service * provider. *

          - *

          Exceptions

          + *

          Exceptions

          * All the methods in this interface can throw a NamingException or * any of its subclasses. See NamingException and their subclasses * for details on each exception. *

          - *

          Concurrent Access

          + *

          Concurrent Access

          * A Context instance is not guaranteed to be synchronized against * concurrent access by multiple threads. Threads that need to access * a single Context instance concurrently should synchronize amongst @@ -91,7 +91,7 @@ * being followed. * *

          - *

          Parameters

          + *

          Parameters

          * A Name parameter passed to any method of the * Context interface or one of its subinterfaces * will not be modified by the service provider. @@ -103,7 +103,7 @@ * The caller may subsequently modify it; the service provider may not. * *

          - *

          Environment Properties

          + *

          Environment Properties

          *

          * JNDI applications need a way to communicate various preferences * and properties that define the environment in which naming and @@ -138,7 +138,7 @@ * *

          * - *

          Resource Files

          + *

          Resource Files

          *

          * To simplify the task of setting up the environment * required by a JNDI application, @@ -151,11 +151,11 @@ * and the value is a string in the format defined * for that property. Here is an example of a JNDI resource file: * - *

          + * 
          {@code * java.naming.factory.object=com.sun.jndi.ldap.AttrsToCorba:com.wiz.from.Person * java.naming.factory.state=com.sun.jndi.ldap.CorbaToAttrs:com.wiz.from.Person * java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory - *
          + * } * * The JNDI class library reads the resource files and makes the property * values freely available. Thus JNDI resource files should be considered @@ -165,7 +165,7 @@ * There are two kinds of JNDI resource files: * provider and application. * - *
          Provider Resource Files
          + *

          Provider Resource Files

          * * Each service provider has an optional resource that lists properties * specific to that provider. The name of this resource is: @@ -200,7 +200,7 @@ * The service provider's documentation should clearly state which * properties are allowed; other properties in the file will be ignored. * - *
          Application Resource Files
          + *

          Application Resource Files

          * * When an application is deployed, it will generally have several * codebase directories and JARs in its classpath. Similarly, when an @@ -232,7 +232,7 @@ * collects and uses all of these export lists when searching for factory * classes. * - *
          Search Algorithm for Properties
          + *

          Search Algorithm for Properties

          * * When JNDI constructs an initial context, the context's environment * is initialized with properties defined in the environment parameter diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/InitialContext.java --- a/jdk/src/share/classes/javax/naming/InitialContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/InitialContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -258,6 +258,7 @@ * environment may be modified independently and it may be accessed * concurrently). * + * @param the type of the returned object * @param name * the name of the object to look up * @return the object bound to name @@ -276,11 +277,12 @@ /** * A static method to retrieve the named object. * See {@link #doLookup(Name)} for details. + * @param the type of the returned object * @param name * the name of the object to look up * @return the object bound to name * @throws NamingException if a naming exception is encountered - * @since 1.6 + * @since 1.6 */ @SuppressWarnings("unchecked") public static T doLookup(String name) diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/RefAddr.java --- a/jdk/src/share/classes/javax/naming/RefAddr.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/RefAddr.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -91,7 +91,8 @@ * Determines whether obj is equal to this RefAddr. *

          * obj is equal to this RefAddr all of these conditions are true - *

            non-null + *
              + *
            • non-null *
            • instance of RefAddr *
            • obj has the same address type as this RefAddr (using String.compareTo()) *
            • both obj and this RefAddr's contents are null or they are equal diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/ReferralException.java --- a/jdk/src/share/classes/javax/naming/ReferralException.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/ReferralException.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ * constructors and/or corresponding "set" methods). *

              * The following code sample shows how ReferralException can be used. - *

              + * 
              {@code * while (true) { * try { * bindings = ctx.listBindings(name); @@ -51,7 +51,7 @@ * ctx = e.getReferralContext(); * } * } - *

              + * } *

              * ReferralException is an abstract class. Concrete implementations * determine its synchronization and serialization properties. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/directory/DirContext.java --- a/jdk/src/share/classes/javax/naming/directory/DirContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/directory/DirContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * methods for examining and updating attributes * associated with objects, and for searching the directory. *

              - *

              Names

              + *

              Names

              * Each name passed as an argument to a DirContext method is relative * to that context. The empty name is used to name the context itself. * The name parameter may never be null. @@ -51,7 +51,7 @@ * name argument to the Context methods. These same rules * apply to the name argument to the DirContext methods. *

              - *

              Attribute Models

              + *

              Attribute Models

              * There are two basic models of what attributes should be * associated with. First, attributes may be directly associated with a * DirContext object. @@ -81,7 +81,7 @@ * whether an object's attributes are stored as part of the object, or stored * within the parent object and associated with the object's name. *

              - *

              Attribute Type Names

              + *

              Attribute Type Names

              * In the getAttributes() and search() methods, * you can supply the attributes to return by supplying a list of * attribute names (strings). @@ -113,7 +113,7 @@ *
            * *

            - *

            Operational Attributes

            + *

            Operational Attributes

            *

            * Some directories have the notion of "operational attributes" which are * attributes associated with a directory object for administrative @@ -127,7 +127,7 @@ * In order to retrieve operational attributes, you must name them explicitly. * *

            - *

            Named Context

            + *

            Named Context

            *

            * There are certain methods in which the name must resolve to a context * (for example, when searching a single level context). The documentation @@ -138,7 +138,7 @@ * Aside from these methods, there is no requirement that the * named object be a DirContext. *

            - *

            Parameters

            + *

            Parameters

            *

            * An Attributes, SearchControls, or array object * passed as a parameter to any method will not be modified by the @@ -150,7 +150,7 @@ * the caller. The caller may subsequently modify it; the service * provider will not. *

            - *

            Exceptions

            + *

            Exceptions

            *

            * All the methods in this interface can throw a NamingException or * any of its subclasses. See NamingException and their subclasses diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/event/EventContext.java --- a/jdk/src/share/classes/javax/naming/event/EventContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/event/EventContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ * Contains methods for registering/deregistering listeners to be notified of * events fired when objects named in a context changes. *

            - *

            Target

            + *

            Target

            * The name parameter in the addNamingListener() methods is referred * to as the target. The target, along with the scope, identify * the object(s) that the listener is interested in. @@ -59,7 +59,7 @@ * whether a EventContext supports registration * of nonexistent targets. *

            - *

            Event Source

            + *

            Event Source

            * The EventContext instance on which you invoke the * registration methods is the event source of the events that are * (potentially) generated. @@ -93,7 +93,7 @@ * it needs to keep a reference to the listener in order to remove it * later). It cannot expect to do a lookup() and get another instance of * a EventContext on which to perform the deregistration. - *

            Lifetime of Registration

            + *

            Lifetime of Registration

            * A registered listener becomes deregistered when: *
              *
            • It is removed using removeNamingListener(). @@ -105,7 +105,7 @@ * Until that point, a EventContext instance that has outstanding * listeners will continue to exist and be maintained by the service provider. * - *

              Listener Implementations

              + *

              Listener Implementations

              * The registration/deregistration methods accept an instance of * NamingListener. There are subinterfaces of NamingListener * for different of event types of NamingEvent. @@ -118,7 +118,7 @@ * of the listeners, this allows some service providers to optimize the * registration. * - *

              Threading Issues

              + *

              Threading Issues

              * * Like Context instances in general, instances of * EventContext are not guaranteed to be thread-safe. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/ldap/ControlFactory.java --- a/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/ldap/ControlFactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ */ public abstract class ControlFactory { - /* + /** * Creates a new instance of a control factory. */ protected ControlFactory() { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java --- a/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/ldap/InitialLdapContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -38,7 +38,7 @@ * javax.naming.InitialDirContext for details on synchronization, * and the policy for how an initial context is created. * - *

              Request Controls

              + *

              Request Controls

              * When you create an initial context (InitialLdapContext), * you can specify a list of request controls. * These controls will be used as the request controls for any diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/naming/ldap/LdapContext.java --- a/jdk/src/share/classes/javax/naming/ldap/LdapContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/naming/ldap/LdapContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,10 +78,8 @@ *

              Context Request Controls

              * There are two ways in which a context instance gets its request controls: *
                - * - *
              1. ldapContext.newInstance(reqCtls) - *
              2. ldapContext.setRequestControls(reqCtls) - * + *
              3. ldapContext.newInstance(reqCtls) + *
              4. ldapContext.setRequestControls(reqCtls) *
              * where ldapContext is an instance of LdapContext. * Specifying null or an empty array for reqCtls @@ -102,12 +100,10 @@ *

              Connection Request Controls

              * There are three ways in which connection request controls are set: *
                - * - *
              1. - * new InitialLdapContext(env, connCtls) - *
              2. refException.getReferralContext(env, connCtls) - *
              3. ldapContext.reconnect(connCtls); - * + *
              4. + * new InitialLdapContext(env, connCtls) + *
              5. refException.getReferralContext(env, connCtls) + *
              6. ldapContext.reconnect(connCtls); *
              * where refException is an instance of * LdapReferralException, and ldapContext is an diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/script/Invocable.java --- a/jdk/src/share/classes/javax/script/Invocable.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/script/Invocable.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,6 +63,7 @@ /** * Used to call top-level procedures and functions defined in scripts. * + * @param name of the procedure or function to call * @param args Arguments to pass to the procedure or function * @return The value returned by the procedure or function * @@ -79,6 +80,7 @@ * the interpreter. The methods of the interface * may be implemented using the invokeFunction method. * + * @param the type of the interface to return * @param clasz The Class object of the interface to return. * * @return An instance of requested interface - null if the requested interface is unavailable, @@ -95,6 +97,7 @@ * a scripting object compiled in the interpreter. The methods of the * interface may be implemented using the invokeMethod method. * + * @param the type of the interface to return * @param thiz The scripting object whose member functions are used to implement the methods of the interface. * @param clasz The Class object of the interface to return. * diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/script/ScriptContext.java --- a/jdk/src/share/classes/javax/script/ScriptContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/script/ScriptContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -78,6 +78,7 @@ * @return The associated Bindings. Returns null if it has not * been set. * + * @param scope The scope * @throws IllegalArgumentException If no Bindings is defined for the * specified scope value in ScriptContext of this type. */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/script/ScriptEngineFactory.java --- a/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/script/ScriptEngineFactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,6 +80,7 @@ * identify the ScriptEngine by the ScriptEngineManager. * For instance, an implementation based on the Mozilla Rhino Javascript engine might * return list containing {"javascript", "rhino"}. + * @return an immutable list of short names */ public List getNames(); diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/script/SimpleScriptContext.java --- a/jdk/src/share/classes/javax/script/SimpleScriptContext.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/script/SimpleScriptContext.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,9 @@ */ protected Bindings globalScope; - + /** + * Create a {@code SimpleScriptContext}. + */ public SimpleScriptContext() { engineScope = new SimpleBindings(); globalScope = null; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/CommonDataSource.java --- a/jdk/src/share/classes/javax/sql/CommonDataSource.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/CommonDataSource.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -122,7 +122,8 @@ * In the worst case, this may be the root Logger. * * @return the parent Logger for this data source - * @throws SQLFeatureNotSupportedException if the data source does not use java.util.logging. + * @throws SQLFeatureNotSupportedException if the data source does not use + * {@code java.util.logging} * @since 1.7 */ public Logger getParentLogger() throws SQLFeatureNotSupportedException; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/ConnectionPoolDataSource.java --- a/jdk/src/share/classes/javax/sql/ConnectionPoolDataSource.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/ConnectionPoolDataSource.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ * A factory for PooledConnection * objects. An object that implements this interface will typically be * registered with a naming service that is based on the - * JavaTM Naming and Directory Interface + * Java™ Naming and Directory Interface * (JNDI). * * @since 1.4 diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/DataSource.java --- a/jdk/src/share/classes/javax/sql/DataSource.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/DataSource.java Thu Jul 11 12:50:20 2013 -0700 @@ -36,7 +36,7 @@ * is the preferred means of getting a connection. An object that implements * the {@code DataSource} interface will typically be * registered with a naming service based on the - * JavaTM Naming and Directory (JNDI) API. + * Java™ Naming and Directory (JNDI) API. *

              * The {@code DataSource} interface is implemented by a driver vendor. * There are three types of implementations: diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/RowSet.java --- a/jdk/src/share/classes/javax/sql/RowSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/RowSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ /** * The interface that adds support to the JDBC API for the - * JavaBeansTM component model. + * JavaBeans™ component model. * A rowset, which can be used as a JavaBeans component in * a visual Bean development environment, can be created and * configured at design time and executed at run time. diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/XADataSource.java --- a/jdk/src/share/classes/javax/sql/XADataSource.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/XADataSource.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ * A factory for {@code XAConnection} objects that is used internally. * An object that implements the {@code XADataSource} interface is * typically registered with a naming service that uses the - * Java Naming and Directory InterfaceTM + * Java Naming and Directory Interface™ * (JNDI). *

              * An implementation of {@code XADataSource} must include a public no-arg diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ /** * An abstract class providing a RowSet object with its basic functionality. * The basic functions include having properties and sending event notifications, - * which all JavaBeansTM components must implement. + * which all JavaBeans™ components must implement. *

              *

              1.0 Overview

              * The BaseRowSet class provides the core functionality @@ -93,7 +93,7 @@ * NOTE: In order to use a DataSource object for making a * connection, the DataSource object must have been registered * with a naming service that uses the Java Naming and Directory - * InterfaceTM (JNDI) API. This registration + * Interface™ (JNDI) API. This registration * is usually done by a person acting in the capacity of a system administrator. *

              *

              3.0 Setting the Command and Its Parameters

              @@ -106,7 +106,7 @@ * to null if required. *

              * The following code fragment illustrates how the - * CachedRowSetTM + * CachedRowSet™ * object crs might have its command property set. Note that if a * tool is used to set properties, this is the code that the tool would use. *

              {@code
              diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
              --- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Tue Jul 02 17:38:10 2013 -0700
              +++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Thu Jul 11 12:50:20 2013 -0700
              @@ -1,5 +1,5 @@
               /*
              - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
              + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
                * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
                *
                * This code is free software; you can redistribute it and/or modify it
              @@ -46,7 +46,7 @@
                * A CachedRowSet object is a container for rows of data
                * that caches its rows in memory, which makes it possible to operate without always being
                * connected to its data source. Further, it is a
              - * JavaBeansTM component and is scrollable,
              + * JavaBeans™ component and is scrollable,
                * updatable, and serializable. A CachedRowSet object typically
                * contains rows from a result set, but it can also contain rows from any file
                * with a tabular format, such as a spread sheet.  The reference implementation
              @@ -410,7 +410,7 @@
                * NOTE:  In order to use a DataSource object for making a
                * connection, the DataSource object must have been registered
                * with a naming service that uses the Java Naming and Directory
              - * InterfaceTM (JNDI) API.  This registration
              + * Interface™ (JNDI) API.  This registration
                * is usually done by a person acting in the capacity of a system
                * administrator.
                * 

              @@ -734,7 +734,6 @@ * source. Otherwise, the application must explicity call the * commit() or rollback() methods as appropriate. * - * @throws SQLException if the cursor is on the insert row * @throws SyncProviderException if the underlying * synchronization provider's writer fails to write the updates * back to the data source @@ -805,7 +804,6 @@ * commit or rollback methods as appropriate. * * @param con a standard JDBC Connection object - * @throws SQLException if the cursor is on the insert row * @throws SyncProviderException if the underlying * synchronization provider's writer fails to write the updates * back to the data source @@ -1371,7 +1369,7 @@ * Applications can form a WebRowSet object from the CachedRowSet * object returned by this method in order * to export the RowSet schema definition to XML for future use. - * + * @return An empty copy of this {@code CachedRowSet} object * @throws SQLException if an error occurs in cloning the structure of this * CachedRowSet object * @see #createShared @@ -1543,6 +1541,7 @@ * @param numRows when populating, the number of rows interval on which the * CachedRowSet populated should fire; the default value * is zero; cannot be less than fetchSize or zero + * @throws SQLException {@code numRows < 0 or numRows < getFetchSize() } */ public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException; diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/FilteredRowSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ *

              * A JDBC FilteredRowSet standard implementation implements the * RowSet interfaces and extends the - * CachedRowSetTM class. The + * CachedRowSet™ class. The * CachedRowSet class provides a set of protected cursor manipulation * methods, which a FilteredRowSet implementation can override * to supply filtering support. @@ -69,8 +69,8 @@ * class JavaDoc), a FilteredRowSet could then be used as described * below. *

              - * *

              + * {@code
                *     FilteredRowSet frs = new FilteredRowSetImpl();
                *     frs.populate(rs);
                *
              @@ -78,8 +78,8 @@
                *     frs.setFilter(name);
                *
                *     frs.next() // only names from "Alpha" to "Bravo" will be returned
              + * }
                * 
              - * * In the example above, we initialize a Range object which * implements the Predicate interface. This object expresses * the following constraints: All rows outputted or modified from this diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ * *

              1.0 Overview

              * A wrapper around a ResultSet object that makes it possible - * to use the result set as a JavaBeansTM + * to use the result set as a JavaBeans™ * component. Thus, a JdbcRowSet object can be one of the Beans that * a tool makes available for composing an application. Because * a JdbcRowSet is a connected rowset, that is, it continually @@ -113,7 +113,7 @@ *

              * The implementation of the RowSet method execute in the * JdbcRowSet reference implementation differs from that in the - * CachedRowSetTM + * CachedRowSet™ * reference implementation to account for the different * requirements of connected and disconnected RowSet objects. *

              @@ -238,6 +238,7 @@ * call to either the method commit or the method rollback. By default, * new connections are in auto-commit mode. * + * @return {@code true} if auto-commit is enabled; {@code false} otherwise * @throws SQLException if a database access error occurs * @see java.sql.Connection#getAutoCommit() */ @@ -251,7 +252,8 @@ * to allow an application to set the JdbcRowSet transaction behavior. *

              * Sets the current auto-commit mode for this Connection object. - * + * @param autoCommit {@code true} to enable auto-commit; {@code false} to + * disable auto-commit * @throws SQLException if a database access error occurs * @see java.sql.Connection#setAutoCommit(boolean) */ @@ -277,7 +279,7 @@ * Undoes all changes made in the current transaction to the last set savepoint * and releases any database locks currently held by this Connection * object. This method should be used only when auto-commit mode has been disabled. - * + * @param s The {@code Savepoint} to rollback to * @throws SQLException if a database access error occurs or this Connection * object within this JdbcRowSet is in auto-commit mode. * @see #rollback diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/Joinable.java --- a/jdk/src/share/classes/javax/sql/rowset/Joinable.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/Joinable.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -137,7 +137,7 @@ * object. A JoinRowSet object can now add this RowSet * object based on the match column. *

              - * Sub-interfaces such as the CachedRowSetTM + * Sub-interfaces such as the CachedRowSet™ * interface define the method CachedRowSet.setKeyColumns, which allows * primary key semantics to be enforced on specific columns. * Implementations of the setMatchColumn(int columnIdx) method diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/Predicate.java --- a/jdk/src/share/classes/javax/sql/rowset/Predicate.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/Predicate.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ * cursor moving from row to the next. In addition, if this internal method * moves the cursor onto a row that has been deleted, the internal method will * continue to ove the cursor until a valid row is found. - * + * @param rs The {@code RowSet} to be evaluated * @return true if there are more rows in the filter; * false otherwise */ diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,9 @@ debug = val != null && !"false".equals(val); } - + /** + * RowSetProvider constructor + */ protected RowSetProvider () { } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java --- a/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetWarning.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,7 @@ * This class complements the SQLWarning class. *

              * Rowset warnings may be retrieved from JdbcRowSet, - * CachedRowSetTM, + * CachedRowSet™, * WebRowSet, FilteredRowSet, or JoinRowSet * implementations. To retrieve the first warning reported on any * RowSet diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/WebRowSet.java --- a/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/WebRowSet.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,306 +33,310 @@ import org.xml.sax.*; /** - * The standard interface that all implementations of a WebRowSet + * The standard interface that all implementations of a {@code WebRowSet} * must implement. *

              *

              1.0 Overview

              - * The WebRowSetImpl provides the standard + * The {@code WebRowSetImpl} provides the standard * reference implementation, which may be extended if required. *

              * The standard WebRowSet XML Schema definition is available at the following * URI: *

              * It describes the standard XML document format required when describing a - * RowSet object in XML and must be used be all standard implementations - * of the WebRowSet interface to ensure interoperability. In addition, - * the WebRowSet schema uses specific SQL/XML Schema annotations, + * {@code RowSet} object in XML and must be used be all standard implementations + * of the {@code WebRowSet} interface to ensure interoperability. In addition, + * the {@code WebRowSet} schema uses specific SQL/XML Schema annotations, * thus ensuring greater cross * platform inter-operability. This is an effort currently under way at the ISO * organization. The SQL/XML definition is available at the following URI: * - * The schema definition describes the internal data of a RowSet object + * The schema definition describes the internal data of a {@code RowSet} object * in three distinct areas: *
                - *
              • properties
              • - * These properties describe the standard synchronization provider properties in - * addition to the more general RowSet properties. - *

                - *

              • metadata
              • - * This describes the metadata associated with the tabular structure governed by a - * WebRowSet object. The metadata described is closely aligned with the - * metadata accessible in the underlying java.sql.ResultSet interface. - *

                - *

              • data
              • - * This describes the original data (the state of data since the last population - * or last synchronization of the WebRowSet object) and the current + *
              • properties - These properties describe the standard synchronization + * provider properties in addition to the more general {@code RowSet} properties. + *
              • + *
              • metadata - This describes the metadata associated with the tabular structure governed by a + * {@code WebRowSet} object. The metadata described is closely aligned with the + * metadata accessible in the underlying {@code java.sql.ResultSet} interface. + *
              • + *
              • data - This describes the original data (the state of data since the + * last population + * or last synchronization of the {@code WebRowSet} object) and the current * data. By keeping track of the delta between the original data and the current data, - * a WebRowSet maintains - * the ability to synchronize changes in its data back to the originating data source. + * a {@code WebRowSet} maintains the ability to synchronize changes + * in its data back to the originating data source. + *
              • *
              *

              *

              2.0 WebRowSet States

              - * The following sections demonstrates how a WebRowSet implementation + * The following sections demonstrates how a {@code WebRowSet} implementation * should use the XML Schema to describe update, insert, and delete operations - * and to describe the state of a WebRowSet object in XML. + * and to describe the state of a {@code WebRowSet} object in XML. *

              - *

              2.1 State 1 - Outputting a WebRowSet Object to XML

              - * In this example, a WebRowSet object is created and populated with a simple 2 column, - * 5 row table from a data source. Having the 5 rows in a WebRowSet object + *

              2.1 State 1 - Outputting a {@code WebRowSet} Object to XML

              + * In this example, a {@code WebRowSet} object is created and populated with a simple 2 column, + * 5 row table from a data source. Having the 5 rows in a {@code WebRowSet} object * makes it possible to describe them in XML. The * metadata describing the various standard JavaBeans properties as defined * in the RowSet interface plus the standard properties defined in - * the CachedRowSetTM interface + * the {@code CachedRowSet}™ interface * provide key details that describe WebRowSet * properties. Outputting the WebRowSet object to XML using the standard - * writeXml methods describes the internal properties as follows: + * {@code writeXml} methods describes the internal properties as follows: *
              - * <properties>
              - *       <command>select co1, col2 from test_table</command>
              - *      <concurrency>1</concurrency>
              - *      <datasource/>
              - *      <escape-processing>true</escape-processing>
              - *      <fetch-direction>0</fetch-direction>
              - *      <fetch-size>0</fetch-size>
              - *      <isolation-level>1</isolation-level>
              - *      <key-columns/>
              - *      <map/>
              - *      <max-field-size>0</max-field-size>
              - *      <max-rows>0</max-rows>
              - *      <query-timeout>0</query-timeout>
              - *      <read-only>false</read-only>
              - *      <rowset-type>TRANSACTION_READ_UNCOMMITED</rowset-type>
              - *      <show-deleted>false</show-deleted>
              - *      <table-name/>
              - *      <url>jdbc:thin:oracle</url>
              - *      <sync-provider>
              - *              <sync-provider-name>.com.rowset.provider.RIOptimisticProvider</sync-provider-name>
              - *              <sync-provider-vendor>Oracle Corporation</sync-provider-vendor>
              - *              <sync-provider-version>1.0</sync-provider-name>
              - *              <sync-provider-grade>LOW</sync-provider-grade>
              - *              <data-source-lock>NONE</data-source-lock>
              - *      </sync-provider>
              - * </properties>
              - * 
              + * {@code + * + * select co1, col2 from test_table + * 1 + * + * true + * 0 + * 0 + * 1 + * + * + * 0 + * 0 + * 0 + * false + * TRANSACTION_READ_UNCOMMITED + * false + * + * jdbc:thin:oracle + * + * .com.rowset.provider.RIOptimisticProvider + * Oracle Corporation + * 1.0 + * LOW + * NONE + * + * + * }
              * The meta-data describing the make up of the WebRowSet is described * in XML as detailed below. Note both columns are described between the - * column-definition tags. + * {@code column-definition} tags. *
              - * <metadata>
              - *      <column-count>2</column-count>
              - *      <column-definition>
              - *              <column-index>1</column-index>
              - *              <auto-increment>false</auto-increment>
              - *              <case-sensitive>true</case-sensitive>
              - *              <currency>false</currency>
              - *              <nullable>1</nullable>
              - *              <signed>false</signed>
              - *              <searchable>true</searchable>
              - *              <column-display-size>10</column-display-size>
              - *              <column-label>COL1</column-label>
              - *              <column-name>COL1</column-name>
              - *              <schema-name/>
              - *              <column-precision>10</column-precision>
              - *              <column-scale>0</column-scale>
              - *              <table-name/>
              - *              <catalog-name/>
              - *              <column-type>1</column-type>
              - *              <column-type-name>CHAR</column-type-name>
              - *      </column-definition>
              - *      <column-definition>
              - *              <column-index>2</column-index>
              - *              <auto-increment>false</auto-increment>
              - *              <case-sensitive>false</case-sensitive>
              - *              <currency>false</currency>
              - *              <nullable>1</nullable>
              - *              <signed>true</signed>
              - *              <searchable>true</searchable>
              - *              <column-display-size>39</column-display-size>
              - *              <column-label>COL2</column-label>
              - *              <column-name>COL2</column-name>
              - *              <schema-name/>
              - *              <column-precision>38</column-precision>
              - *              <column-scale>0</column-scale>
              - *              <table-name/>
              - *              <catalog-name/>
              - *              <column-type>3</column-type>
              - *              <column-type-name>NUMBER</column-type-name>
              - *      </column-definition>
              - * </metadata>
              - * 
              + * {@code + * + * 2 + * + * 1 + * false + * true + * false + * 1 + * false + * true + * 10 + * COL1 + * COL1 + * + * 10 + * 0 + * + * + * 1 + * CHAR + * + * + * 2 + * false + * false + * false + * 1 + * true + * true + * 39 + * COL2 + * COL2 + * + * 38 + * 0 + * + * + * 3 + * NUMBER + * + * + * }
          * Having detailed how the properties and metadata are described, the following details - * how the contents of a WebRowSet object is described in XML. Note, that - * this describes a WebRowSet object that has not undergone any + * how the contents of a {@code WebRowSet} object is described in XML. Note, that + * this describes a {@code WebRowSet} object that has not undergone any * modifications since its instantiation. - * A currentRow tag is mapped to each row of the table structure that the - * WebRowSet object provides. A columnValue tag may contain - * either the stringData or binaryData tag, according to + * A {@code currentRow} tag is mapped to each row of the table structure that the + * {@code WebRowSet} object provides. A {@code columnValue} tag may contain + * either the {@code stringData} or {@code binaryData} tag, according to * the SQL type that - * the XML value is mapping back to. The binaryData tag contains data in the - * Base64 encoding and is typically used for BLOB and CLOB type data. + * the XML value is mapping back to. The {@code binaryData} tag contains data in the + * Base64 encoding and is typically used for {@code BLOB} and {@code CLOB} type data. *
          - * <data>
          - *      <currentRow>
          - *              <columnValue>
          + * {@code
          + * 
          + *      
          + *              
            *                      firstrow
          - *              </columnValue>
          - *              <columnValue>
          + *              
          + *              
            *                      1
          - *              </columnValue>
          - *      </currentRow>
          - *      <currentRow>
          - *              <columnValue>
          + *              
          + *      
          + *      
          + *              
            *                      secondrow
          - *              </columnValue>
          - *              <columnValue>
          + *              
          + *              
            *                      2
          - *              </columnValue>
          - *      </currentRow>
          - *      <currentRow>
          - *              <columnValue>
          + *              
          + *      
          + *      
          + *              
            *                      thirdrow
          - *              </columnValue>
          - *              <columnValue>
          + *              
          + *              
            *                      3
          - *              </columnValue>
          - *      </currentRow>
          - *      <currentRow>
          - *              <columnValue>
          + *              
          + *      
          + *      
          + *              
            *                      fourthrow
          - *              </columnValue>
          - *              <columnValue>
          + *              
          + *              
            *                      4
          - *              </columnValue>
          - *      </currentRow>
          - * </data>
          - * 
          + * + * + * + * }
        *

        2.2 State 2 - Deleting a Row

        - * Deleting a row in a WebRowSet object involves simply moving to the row - * to be deleted and then calling the method deleteRow, as in any other - * RowSet object. The following - * two lines of code, in which wrs is a WebRowSet object, delete + * Deleting a row in a {@code WebRowSet} object involves simply moving to the row + * to be deleted and then calling the method {@code deleteRow}, as in any other + * {@code RowSet} object. The following + * two lines of code, in which wrs is a {@code WebRowSet} object, delete * the third row. *
          *     wrs.absolute(3);
          *     wrs.deleteRow();
          * 
        - * The XML description shows the third row is marked as a deleteRow, - * which eliminates the third row in the WebRowSet object. + * The XML description shows the third row is marked as a {@code deleteRow}, + * which eliminates the third row in the {@code WebRowSet} object. *
        - * <data>
        - *      <currentRow>
        - *              <columnValue>
        + * {@code
        + * 
        + *      
        + *              
          *                      firstrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      1
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      secondrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      2
        - *              </columnValue>
        - *      </currentRow>
        - *      <deleteRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      thirdrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      3
        - *              </columnValue>
        - *      </deleteRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      fourthrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      4
        - *              </columnValue>
        - *      </currentRow>
        - * </data>
        - * 
        + * + * + * + *} *

        2.3 State 3 - Inserting a Row

        - * A WebRowSet object can insert a new row by moving to the insert row, + * A {@code WebRowSet} object can insert a new row by moving to the insert row, * calling the appropriate updater methods for each column in the row, and then - * calling the method insertRow. + * calling the method {@code insertRow}. *
        + * {@code
          * wrs.moveToInsertRow();
          * wrs.updateString(1, "fifththrow");
          * wrs.updateString(2, "5");
          * wrs.insertRow();
        - * 
        + * } * The following code fragment changes the second column value in the row just inserted. * Note that this code applies when new rows are inserted right after the current row, - * which is why the method next moves the cursor to the correct row. - * Calling the method acceptChanges writes the change to the data source. + * which is why the method {@code next} moves the cursor to the correct row. + * Calling the method {@code acceptChanges} writes the change to the data source. * *
        - * wrs.moveToCurrentRow();
        + * {@code wrs.moveToCurrentRow();
          * wrs.next();
          * wrs.updateString(2, "V");
          * wrs.acceptChanges();
        - * :
        - * 
        + * } * Describing this in XML demonstrates where the Java code inserts a new row and then * performs an update on the newly inserted row on an individual field. *
        - * <data>
        - *      <currentRow>
        - *              <columnValue>
        + * {@code
        + * 
        + *      
        + *              
          *                      firstrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      1
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      secondrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      2
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      newthirdrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      III
        - *              </columnValue>
        - *      </currentRow>
        - *      <insertRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      fifthrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      5
        - *              </columnValue>
        - *              <updateValue>
        + *              
        + *              
          *                      V
        - *              </updateValue>
        - *      </insertRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      fourthrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      4
        - *              </columnValue>
        - *      </currentRow>
        - * </date>
        - * 
        + * + * + * + *} *

        2.4 State 4 - Modifying a Row

        * Modifying a row produces specific XML that records both the new value and the * value that was replaced. The value that was replaced becomes the original value, @@ -340,63 +344,65 @@ * code moves the cursor to a specific row, performs some modifications, and updates * the row when complete. *
        + *{@code
          * wrs.absolute(5);
          * wrs.updateString(1, "new4thRow");
          * wrs.updateString(2, "IV");
          * wrs.updateRow();
        - * 
        - * In XML, this is described by the modifyRow tag. Both the original and new + * } + * In XML, this is described by the {@code modifyRow} tag. Both the original and new * values are contained within the tag for original row tracking purposes. *
        - * <data>
        - *      <currentRow>
        - *              <columnValue>
        + * {@code
        + * 
        + *      
        + *              
          *                      firstrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      1
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      secondrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      2
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      newthirdrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      III
        - *              </columnValue>
        - *      </currentRow>
        - *      <currentRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      fifthrow
        - *              </columnValue>
        - *              <columnValue>
        + *              
        + *              
          *                      5
        - *              </columnValue>
        - *      </currentRow>
        - *      <modifyRow>
        - *              <columnValue>
        + *              
        + *      
        + *      
        + *              
          *                      fourthrow
        - *              </columnValue>
        - *              <updateValue>
        + *              
        + *              
          *                      new4thRow
        - *              </updateValue>
        - *              <columnValue>
        + *              
        + *              
          *                      4
        - *              </columnValue>
        - *              <updateValue>
        + *              
        + *              
          *                      IV
        - *              </updateValue>
        - *      </modifyRow>
        - * </data>
        - * 
        + * + * + * + * } * * @see javax.sql.rowset.JdbcRowSet * @see javax.sql.rowset.CachedRowSet @@ -407,78 +413,78 @@ public interface WebRowSet extends CachedRowSet { /** - * Reads a WebRowSet object in its XML format from the given - * Reader object. + * Reads a {@code WebRowSet} object in its XML format from the given + * {@code Reader} object. * - * @param reader the java.io.Reader stream from which this - * WebRowSet object will be populated + * @param reader the {@code java.io.Reader} stream from which this + * {@code WebRowSet} object will be populated * @throws SQLException if a database access error occurs */ public void readXml(java.io.Reader reader) throws SQLException; /** - * Reads a stream based XML input to populate this WebRowSet + * Reads a stream based XML input to populate this {@code WebRowSet} * object. * - * @param iStream the java.io.InputStream from which this - * WebRowSet object will be populated + * @param iStream the {@code java.io.InputStream} from which this + * {@code WebRowSet} object will be populated * @throws SQLException if a data source access error occurs * @throws IOException if an IO exception occurs */ public void readXml(java.io.InputStream iStream) throws SQLException, IOException; /** - * Populates this WebRowSet object with - * the contents of the given ResultSet object and writes its + * Populates this {@code WebRowSet} object with + * the contents of the given {@code ResultSet} object and writes its * data, properties, and metadata - * to the given Writer object in XML format. + * to the given {@code Writer} object in XML format. *

        - * NOTE: The WebRowSet cursor may be moved to write out the + * NOTE: The {@code WebRowSet} cursor may be moved to write out the * contents to the XML data source. If implemented in this way, the cursor must - * be returned to its position just prior to the writeXml() call. + * be returned to its position just prior to the {@code writeXml()} call. * - * @param rs the ResultSet object with which to populate this - * WebRowSet object - * @param writer the java.io.Writer object to write to. + * @param rs the {@code ResultSet} object with which to populate this + * {@code WebRowSet} object + * @param writer the {@code java.io.Writer} object to write to. * @throws SQLException if an error occurs writing out the rowset * contents in XML format */ public void writeXml(ResultSet rs, java.io.Writer writer) throws SQLException; /** - * Populates this WebRowSet object with - * the contents of the given ResultSet object and writes its + * Populates this {@code WebRowSet} object with + * the contents of the given {@code ResultSet} object and writes its * data, properties, and metadata - * to the given OutputStream object in XML format. + * to the given {@code OutputStream} object in XML format. *

        - * NOTE: The WebRowSet cursor may be moved to write out the + * NOTE: The {@code WebRowSet} cursor may be moved to write out the * contents to the XML data source. If implemented in this way, the cursor must - * be returned to its position just prior to the writeXml() call. + * be returned to its position just prior to the {@code writeXml()} call. * - * @param rs the ResultSet object with which to populate this - * WebRowSet object - * @param oStream the java.io.OutputStream to write to + * @param rs the {@code ResultSet} object with which to populate this + * {@code WebRowSet} object + * @param oStream the {@code java.io.OutputStream} to write to * @throws SQLException if a data source access error occurs * @throws IOException if a IO exception occurs */ public void writeXml(ResultSet rs, java.io.OutputStream oStream) throws SQLException, IOException; /** - * Writes the data, properties, and metadata for this WebRowSet object - * to the given Writer object in XML format. + * Writes the data, properties, and metadata for this {@code WebRowSet} object + * to the given {@code Writer} object in XML format. * - * @param writer the java.io.Writer stream to write to + * @param writer the {@code java.io.Writer} stream to write to * @throws SQLException if an error occurs writing out the rowset * contents to XML */ public void writeXml(java.io.Writer writer) throws SQLException; /** - * Writes the data, properties, and metadata for this WebRowSet object - * to the given OutputStream object in XML format. + * Writes the data, properties, and metadata for this {@code WebRowSet} object + * to the given {@code OutputStream} object in XML format. * - * @param oStream the java.io.OutputStream stream to write to + * @param oStream the {@code java.io.OutputStream} stream to write to * @throws SQLException if a data source access error occurs * @throws IOException if a IO exception occurs */ @@ -486,14 +492,14 @@ /** * The public identifier for the XML Schema definition that defines the XML - * tags and their valid values for a WebRowSet implementation. + * tags and their valid values for a {@code WebRowSet} implementation. */ public static String PUBLIC_XML_SCHEMA = "--//Oracle Corporation//XSD Schema//EN"; /** * The URL for the XML Schema definition file that defines the XML tags and - * their valid values for a WebRowSet implementation. + * their valid values for a {@code WebRowSet} implementation. */ public static String SCHEMA_SYSTEM_ID = "http://java.sun.com/xml/ns/jdbc/webrowset.xsd"; } diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/package.html --- a/jdk/src/share/classes/javax/sql/rowset/package.html Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/package.html Thu Jul 11 12:50:20 2013 -0700 @@ -67,7 +67,7 @@

        • JdbcRowSet - A wrapper around a ResultSet object that makes it possible to use the result set as a -JavaBeansTM component. Thus, +JavaBeans™ component. Thus, a JdbcRowSet object can be a Bean that any tool makes available for assembling an application as part of a component based architecture . A JdbcRowSet object is a connected RowSet @@ -79,7 +79,7 @@

        • CachedRowSet - - A CachedRowSet object is a JavaBeansTM + - A CachedRowSet object is a JavaBeans™ component that is scrollable, updatable, serializable, and generally disconnected from the source of its data. A CachedRowSet object typically contains rows from a result set, but it can also contain rows from any diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ * if necessary. At this time, logical pointers to the data in the data source, * such as locators, are not currently supported. * - *

          Thread safety

          + *

          Thread safety

          * * A SerialArray is not safe for use by multiple concurrent threads. If a * SerialArray is to be used by more than one thread then access to the diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ * Blob object within a SerialBlob object * and to update or truncate a Blob object. * - *

          Thread safety

          + *

          Thread safety

          * *

          A SerialBlob is not safe for use by multiple concurrent threads. If a * SerialBlob is to be used by more than one thread then access to the SerialBlob diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialClob.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ * from a SerialClob object or to locate the start of * a pattern of characters. * - *

          Thread safety

          + *

          Thread safety

          * *

          A SerialClob is not safe for use by multiple concurrent threads. If a * SerialClob is to be used by more than one thread then access to the SerialClob diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ * java.net.URL url = rowset.getURL(1); * * - *

          Thread safety

          + *

          Thread safety

          * * A SerialDatalink is not safe for use by multiple concurrent threads. If a * SerialDatalink is to be used by more than one thread then access to the @@ -77,6 +77,7 @@ * Constructs a new SerialDatalink object from the given * java.net.URL object. *

          + * @param url the {@code URL} to create the {@code SerialDataLink} from * @throws SerialException if url parameter is a null */ public SerialDatalink(URL url) throws SerialException { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java Thu Jul 11 12:50:20 2013 -0700 @@ -47,7 +47,7 @@ * Static or transient fields cannot be serialized; an attempt to serialize * them will result in a SerialException object being thrown. * - *

          Thread safety

          + *

          Thread safety

          * * A SerialJavaObject is not safe for use by multiple concurrent threads. If a * SerialJavaObject is to be used by more than one thread then access to the diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,7 +37,7 @@ * creating a SerialRef instance from a Ref * object and provides methods for getting and setting the Ref object. * - *

          Thread safety

          + *

          Thread safety

          * * A SerialRef is not safe for use by multiple concurrent threads. If a * SerialRef is to be used by more than one thread then access to the SerialRef diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java --- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,7 @@ * the SQL type name of the SQL structured type in the database, and methods * for retrieving its attribute values. * - *

          Thread safety

          + *

          Thread safety

          * * A SerialStruct is not safe for use by multiple concurrent threads. If a * SerialStruct is to be used by more than one thread then access to the diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncFactory.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -260,13 +260,14 @@ *

          * Synchronization providers bound to a JNDI context can be * registered by binding a SyncProvider instance to a JNDI namespace. - *

            + * *
            +     * {@code
                  * SyncProvider p = new MySyncProvider();
                  * InitialContext ic = new InitialContext();
                  * ic.bind ("jdbc/rowset/MySyncProvider", p);
            -     * 
            - *
          + * } + * * Furthermore, an initial JNDI context should be set with the * SyncFactory using the setJNDIContext method. * The SyncFactory leverages this context to search for @@ -564,6 +565,8 @@ * * @return Enumeration A enumeration of available synchronization * providers that are registered with this Factory + * @throws SyncFactoryException If an error occurs obtaining the registered + * providers */ public static Enumeration getRegisteredProviders() throws SyncFactoryException { @@ -648,7 +651,8 @@ /** * Returns the logging object for applications to retrieve * synchronization events posted by SyncProvider implementations. - * + * @return The {@code Logger} that has been specified for use by + * {@code SyncProvider} implementations * @throws SyncFactoryException if no logging object has been set. */ public static Logger getLogger() throws SyncFactoryException { diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java --- a/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,10 +81,13 @@ * SyncProviderException method getSyncResolver to get * the SyncResolver object resolver. *
          + * {@code
            *     } catch (SyncProviderException spe) {
            *         SyncResolver resolver = spe.getSyncResolver();
            *     ...
            *     }
          + *
          + * }
            * 
          *

          * With resolver in hand, an application can use it to get the information @@ -97,7 +100,7 @@ * The following kinds of information can be obtained from a SyncResolver * object: *

          - *

        • What operation was being attempted when a conflict occurred
          + *

          What operation was being attempted when a conflict occurred

          * The SyncProvider interface defines four constants * describing states that may occur. Three * constants describe the type of operation (update, delete, or insert) that a @@ -106,10 +109,10 @@ * These constants are the possible return values when a SyncResolver object * calls the method getStatus. *
          - *     int operation = resolver.getStatus();
          + *     {@code int operation = resolver.getStatus(); }
            * 
          *

          - *

        • The value in the data source that caused a conflict
          + *

          The value in the data source that caused a conflict

          * A conflict exists when a value that a RowSet object has changed * and is attempting to write to the data source * has also been changed in the data source since the last synchronization. An @@ -122,7 +125,6 @@ * * Note that the column in resolver can be designated by the column number, * as is done in the preceding line of code, or by the column name. - *
        *

        * With the information retrieved from the methods getStatus and * getConflictValue, the application may make a determination as to @@ -193,7 +195,8 @@ * code fragment, the value in crs is the one set as the resolved value, which means * that it will be used to overwrite the conflict value in the data source. * - *

        {@code
        + * 
        + * {@code
          *     try {
          *
          *         crs.acceptChanges(con);
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java
        --- a/jdk/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/javax/xml/crypto/dsig/dom/DOMValidateContext.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/misc/FDBigInteger.java
        --- a/jdk/src/share/classes/sun/misc/FDBigInteger.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/misc/FDBigInteger.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -782,7 +782,7 @@
                 assert this.size() >= subtrahend.size() : "result should be positive";
                 FDBigInteger minuend;
                 if (this.isImmutable) {
        -            minuend = new FDBigInteger(this.data, this.offset);
        +            minuend = new FDBigInteger(this.data.clone(), this.offset);
                 } else {
                     minuend = this;
                 }
        @@ -851,7 +851,7 @@
                 assert this.size() >= subtrahend.size() : "result should be positive";
                 FDBigInteger minuend = this;
                 if (subtrahend.isImmutable) {
        -            subtrahend = new FDBigInteger(subtrahend.data, subtrahend.offset);
        +            subtrahend = new FDBigInteger(subtrahend.data.clone(), subtrahend.offset);
                 }
                 int offsetDiff = minuend.offset - subtrahend.offset;
                 int[] sData = subtrahend.data;
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/misc/FloatingDecimal.java
        --- a/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/misc/FloatingDecimal.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -49,12 +49,14 @@
             static final int    MAX_DECIMAL_EXPONENT = 308;
             static final int    MIN_DECIMAL_EXPONENT = -324;
             static final int    BIG_DECIMAL_EXPONENT = 324; // i.e. abs(MIN_DECIMAL_EXPONENT)
        +    static final int    MAX_NDIGITS = 1100;
         
             static final int    SINGLE_EXP_SHIFT  =   FloatConsts.SIGNIFICAND_WIDTH - 1;
             static final int    SINGLE_FRACT_HOB  =   1<ASCIIToBinaryConverter.
        @@ -1038,7 +1036,6 @@
                 int         decExponent;
                 char        digits[];
                 int         nDigits;
        -        int         roundDir = 0; // set by doubleValue
         
                 ASCIIToBinaryBuffer( boolean negSign, int decExponent, char[] digits, int n)
                 {
        @@ -1048,40 +1045,6 @@
                     this.nDigits = n;
                 }
         
        -        @Override
        -        public double doubleValue() {
        -            return doubleValue(false);
        -        }
        -
        -        /**
        -         * Computes a number that is the ULP of the given value,
        -         * for purposes of addition/subtraction. Generally easy.
        -         * More difficult if subtracting and the argument
        -         * is a normalized a power of 2, as the ULP changes at these points.
        -         */
        -        private static double ulp(double dval, boolean subtracting) {
        -            long lbits = Double.doubleToLongBits(dval) & ~DoubleConsts.SIGN_BIT_MASK;
        -            int binexp = (int) (lbits >>> EXP_SHIFT);
        -            double ulpval;
        -            if (subtracting && (binexp >= EXP_SHIFT) && ((lbits & DoubleConsts.SIGNIF_BIT_MASK) == 0L)) {
        -                // for subtraction from normalized, powers of 2,
        -                // use next-smaller exponent
        -                binexp -= 1;
        -            }
        -            if (binexp > EXP_SHIFT) {
        -                ulpval = Double.longBitsToDouble(((long) (binexp - EXP_SHIFT)) << EXP_SHIFT);
        -            } else if (binexp == 0) {
        -                ulpval = Double.MIN_VALUE;
        -            } else {
        -                ulpval = Double.longBitsToDouble(1L << (binexp - 1));
        -            }
        -            if (subtracting) {
        -                ulpval = -ulpval;
        -            }
        -
        -            return ulpval;
        -        }
        -
                 /**
                  * Takes a FloatingDecimal, which we presumably just scanned in,
                  * and finds out what its value is, as a double.
        @@ -1090,15 +1053,9 @@
                  * ROUNDING DIRECTION in case the result is really destined
                  * for a single-precision float.
                  */
        -        private strictfp double doubleValue(boolean mustSetRoundDir) {
        +        @Override
        +        public double doubleValue() {
                     int kDigits = Math.min(nDigits, MAX_DECIMAL_DIGITS + 1);
        -            long lValue;
        -            double dValue;
        -            double rValue;
        -
        -            if (mustSetRoundDir) {
        -                roundDir = 0;
        -            }
                     //
                     // convert the lead kDigits to a long integer.
                     //
        @@ -1108,11 +1065,11 @@
                     for (int i = 1; i < iDigits; i++) {
                         iValue = iValue * 10 + (int) digits[i] - (int) '0';
                     }
        -            lValue = (long) iValue;
        +            long lValue = (long) iValue;
                     for (int i = iDigits; i < kDigits; i++) {
                         lValue = lValue * 10L + (long) ((int) digits[i] - (int) '0');
                     }
        -            dValue = (double) lValue;
        +            double dValue = (double) lValue;
                     int exp = decExponent - kDigits;
                     //
                     // lValue now contains a long integer with the value of
        @@ -1140,13 +1097,7 @@
                                 // Can get the answer with one operation,
                                 // thus one roundoff.
                                 //
        -                        rValue = dValue * SMALL_10_POW[exp];
        -                        if (mustSetRoundDir) {
        -                            double tValue = rValue / SMALL_10_POW[exp];
        -                            roundDir = (tValue == dValue) ? 0
        -                                    : (tValue < dValue) ? 1
        -                                    : -1;
        -                        }
        +                        double rValue = dValue * SMALL_10_POW[exp];
                                 return (isNegative) ? -rValue : rValue;
                             }
                             int slop = MAX_DECIMAL_DIGITS - kDigits;
        @@ -1158,14 +1109,7 @@
                                 // with one rounding.
                                 //
                                 dValue *= SMALL_10_POW[slop];
        -                        rValue = dValue * SMALL_10_POW[exp - slop];
        -
        -                        if (mustSetRoundDir) {
        -                            double tValue = rValue / SMALL_10_POW[exp - slop];
        -                            roundDir = (tValue == dValue) ? 0
        -                                    : (tValue < dValue) ? 1
        -                                    : -1;
        -                        }
        +                        double rValue = dValue * SMALL_10_POW[exp - slop];
                                 return (isNegative) ? -rValue : rValue;
                             }
                             //
        @@ -1176,13 +1120,7 @@
                                 //
                                 // Can get the answer in one division.
                                 //
        -                        rValue = dValue / SMALL_10_POW[-exp];
        -                        if (mustSetRoundDir) {
        -                            double tValue = rValue * SMALL_10_POW[-exp];
        -                            roundDir = (tValue == dValue) ? 0
        -                                    : (tValue < dValue) ? 1
        -                                    : -1;
        -                        }
        +                        double rValue = dValue / SMALL_10_POW[-exp];
                                 return (isNegative) ? -rValue : rValue;
                             }
                             //
        @@ -1303,9 +1241,14 @@
                     // Formulate the EXACT big-number result as
                     // bigD0 * 10^exp
                     //
        +            if (nDigits > MAX_NDIGITS) {
        +                nDigits = MAX_NDIGITS + 1;
        +                digits[MAX_NDIGITS] = '1';
        +            }
                     FDBigInteger bigD0 = new FDBigInteger(lValue, digits, kDigits, nDigits);
                     exp = decExponent - nDigits;
         
        +            long ieeeBits = Double.doubleToRawLongBits(dValue); // IEEE-754 bits of double candidate
                     final int B5 = Math.max(0, -exp); // powers of 5 in bigB, value is not modified inside correctionLoop
                     final int D5 = Math.max(0, exp); // powers of 5 in bigD, value is not modified inside correctionLoop
                     bigD0 = bigD0.multByPow52(D5, 0);
        @@ -1315,10 +1258,9 @@
         
                     correctionLoop:
                     while (true) {
        -                // here dValue can't be NaN, Infinity or zero
        -                long bigBbits = Double.doubleToRawLongBits(dValue) & ~DoubleConsts.SIGN_BIT_MASK;
        -                int binexp = (int) (bigBbits >>> EXP_SHIFT);
        -                bigBbits &= DoubleConsts.SIGNIF_BIT_MASK;
        +                // here ieeeBits can't be NaN, Infinity or zero
        +                int binexp = (int) (ieeeBits >>> EXP_SHIFT);
        +                long bigBbits = ieeeBits & DoubleConsts.SIGNIF_BIT_MASK;
                         if (binexp > 0) {
                             bigBbits |= FRACT_HOB;
                         } else { // Normalize denormalized numbers.
        @@ -1358,7 +1300,7 @@
                         if (binexp <= -DoubleConsts.EXP_BIAS) {
                             // This is going to be a denormalized number
                             // (if not actually zero).
        -                    // half an ULP is at 2^-(expBias+EXP_SHIFT+1)
        +                    // half an ULP is at 2^-(DoubleConsts.EXP_BIAS+EXP_SHIFT+1)
                             hulpbias = binexp + lowOrderZeros + DoubleConsts.EXP_BIAS;
                         } else {
                             hulpbias = 1 + lowOrderZeros;
        @@ -1422,17 +1364,12 @@
                         if ((cmpResult) < 0) {
                             // difference is small.
                             // this is close enough
        -                    if (mustSetRoundDir) {
        -                        roundDir = overvalue ? -1 : 1;
        -                    }
                             break correctionLoop;
                         } else if (cmpResult == 0) {
                             // difference is exactly half an ULP
                             // round to some other value maybe, then finish
        -                    dValue += 0.5 * ulp(dValue, overvalue);
        -                    // should check for bigIntNBits == 1 here??
        -                    if (mustSetRoundDir) {
        -                        roundDir = overvalue ? -1 : 1;
        +                    if ((ieeeBits & 1) != 0) { // half ties to even
        +                        ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
                             }
                             break correctionLoop;
                         } else {
        @@ -1440,15 +1377,18 @@
                             // could scale addend by ratio of difference to
                             // halfUlp here, if we bothered to compute that difference.
                             // Most of the time ( I hope ) it is about 1 anyway.
        -                    dValue += ulp(dValue, overvalue);
        -                    if (dValue == 0.0 || dValue == Double.POSITIVE_INFINITY) {
        +                    ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
        +                    if (ieeeBits == 0 || ieeeBits == DoubleConsts.EXP_BIT_MASK) { // 0.0 or Double.POSITIVE_INFINITY
                                 break correctionLoop; // oops. Fell off end of range.
                             }
                             continue; // try again.
                         }
         
                     }
        -            return (isNegative) ? -dValue : dValue;
        +            if (isNegative) {
        +                ieeeBits |= DoubleConsts.SIGN_BIT_MASK;
        +            }
        +            return Double.longBitsToDouble(ieeeBits);
                 }
         
                 /**
        @@ -1461,18 +1401,16 @@
                  * ( because of the preference to a zero low-order bit ).
                  */
                 @Override
        -        public strictfp float floatValue() {
        +        public float floatValue() {
                     int kDigits = Math.min(nDigits, SINGLE_MAX_DECIMAL_DIGITS + 1);
        -            int iValue;
        -            float fValue;
                     //
                     // convert the lead kDigits to an integer.
                     //
        -            iValue = (int) digits[0] - (int) '0';
        +            int iValue = (int) digits[0] - (int) '0';
                     for (int i = 1; i < kDigits; i++) {
                         iValue = iValue * 10 + (int) digits[i] - (int) '0';
                     }
        -            fValue = (float) iValue;
        +            float fValue = (float) iValue;
                     int exp = decExponent - kDigits;
                     //
                     // iValue now contains an integer with the value of
        @@ -1505,7 +1443,7 @@
                             int slop = SINGLE_MAX_DECIMAL_DIGITS - kDigits;
                             if (exp <= SINGLE_MAX_SMALL_TEN + slop) {
                                 //
        -                        // We can multiply dValue by 10^(slop)
        +                        // We can multiply fValue by 10^(slop)
                                 // and it is still "small" and exact.
                                 // Then we can multiply by 10^(exp-slop)
                                 // with one rounding.
        @@ -1555,38 +1493,208 @@
                     // The sum of digits plus exponent is greater than
                     // what we think we can do with one error.
                     //
        -            // Start by weeding out obviously out-of-range
        -            // results, then convert to double and go to
        -            // common hard-case code.
        +            // Start by approximating the right answer by,
        +            // naively, scaling by powers of 10.
        +            // Scaling uses doubles to avoid overflow/underflow.
                     //
        -            if (decExponent > SINGLE_MAX_DECIMAL_EXPONENT + 1) {
        -                //
        -                // Lets face it. This is going to be
        -                // Infinity. Cut to the chase.
        -                //
        -                return (isNegative) ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
        -            } else if (decExponent < SINGLE_MIN_DECIMAL_EXPONENT - 1) {
        -                //
        -                // Lets face it. This is going to be
        -                // zero. Cut to the chase.
        -                //
        -                return (isNegative) ? -0.0f : 0.0f;
        +            double dValue = fValue;
        +            if (exp > 0) {
        +                if (decExponent > SINGLE_MAX_DECIMAL_EXPONENT + 1) {
        +                    //
        +                    // Lets face it. This is going to be
        +                    // Infinity. Cut to the chase.
        +                    //
        +                    return (isNegative) ? Float.NEGATIVE_INFINITY : Float.POSITIVE_INFINITY;
        +                }
        +                if ((exp & 15) != 0) {
        +                    dValue *= SMALL_10_POW[exp & 15];
        +                }
        +                if ((exp >>= 4) != 0) {
        +                    int j;
        +                    for (j = 0; exp > 0; j++, exp >>= 1) {
        +                        if ((exp & 1) != 0) {
        +                            dValue *= BIG_10_POW[j];
        +                        }
        +                    }
        +                }
        +            } else if (exp < 0) {
        +                exp = -exp;
        +                if (decExponent < SINGLE_MIN_DECIMAL_EXPONENT - 1) {
        +                    //
        +                    // Lets face it. This is going to be
        +                    // zero. Cut to the chase.
        +                    //
        +                    return (isNegative) ? -0.0f : 0.0f;
        +                }
        +                if ((exp & 15) != 0) {
        +                    dValue /= SMALL_10_POW[exp & 15];
        +                }
        +                if ((exp >>= 4) != 0) {
        +                    int j;
        +                    for (j = 0; exp > 0; j++, exp >>= 1) {
        +                        if ((exp & 1) != 0) {
        +                            dValue *= TINY_10_POW[j];
        +                        }
        +                    }
        +                }
                     }
        +            fValue = Math.max(Float.MIN_VALUE, Math.min(Float.MAX_VALUE, (float) dValue));
         
                     //
        -            // Here, we do 'way too much work, but throwing away
        -            // our partial results, and going and doing the whole
        -            // thing as double, then throwing away half the bits that computes
        -            // when we convert back to float.
        +            // fValue is now approximately the result.
        +            // The hard part is adjusting it, by comparison
        +            // with FDBigInteger arithmetic.
        +            // Formulate the EXACT big-number result as
        +            // bigD0 * 10^exp
                     //
        -            // The alternative is to reproduce the whole multiple-precision
        -            // algorithm for float precision, or to try to parameterize it
        -            // for common usage. The former will take about 400 lines of code,
        -            // and the latter I tried without success. Thus the semi-hack
        -            // answer here.
        -            //
        -            double dValue = doubleValue(true);
        -            return stickyRound(dValue, roundDir);
        +            if (nDigits > SINGLE_MAX_NDIGITS) {
        +                nDigits = SINGLE_MAX_NDIGITS + 1;
        +                digits[SINGLE_MAX_NDIGITS] = '1';
        +            }
        +            FDBigInteger bigD0 = new FDBigInteger(iValue, digits, kDigits, nDigits);
        +            exp = decExponent - nDigits;
        +
        +            int ieeeBits = Float.floatToRawIntBits(fValue); // IEEE-754 bits of float candidate
        +            final int B5 = Math.max(0, -exp); // powers of 5 in bigB, value is not modified inside correctionLoop
        +            final int D5 = Math.max(0, exp); // powers of 5 in bigD, value is not modified inside correctionLoop
        +            bigD0 = bigD0.multByPow52(D5, 0);
        +            bigD0.makeImmutable();   // prevent bigD0 modification inside correctionLoop
        +            FDBigInteger bigD = null;
        +            int prevD2 = 0;
        +
        +            correctionLoop:
        +            while (true) {
        +                // here ieeeBits can't be NaN, Infinity or zero
        +                int binexp = ieeeBits >>> SINGLE_EXP_SHIFT;
        +                int bigBbits = ieeeBits & FloatConsts.SIGNIF_BIT_MASK;
        +                if (binexp > 0) {
        +                    bigBbits |= SINGLE_FRACT_HOB;
        +                } else { // Normalize denormalized numbers.
        +                    assert bigBbits != 0 : bigBbits; // floatToBigInt(0.0)
        +                    int leadingZeros = Integer.numberOfLeadingZeros(bigBbits);
        +                    int shift = leadingZeros - (31 - SINGLE_EXP_SHIFT);
        +                    bigBbits <<= shift;
        +                    binexp = 1 - shift;
        +                }
        +                binexp -= FloatConsts.EXP_BIAS;
        +                int lowOrderZeros = Integer.numberOfTrailingZeros(bigBbits);
        +                bigBbits >>>= lowOrderZeros;
        +                final int bigIntExp = binexp - SINGLE_EXP_SHIFT + lowOrderZeros;
        +                final int bigIntNBits = SINGLE_EXP_SHIFT + 1 - lowOrderZeros;
        +
        +                //
        +                // Scale bigD, bigB appropriately for
        +                // big-integer operations.
        +                // Naively, we multiply by powers of ten
        +                // and powers of two. What we actually do
        +                // is keep track of the powers of 5 and
        +                // powers of 2 we would use, then factor out
        +                // common divisors before doing the work.
        +                //
        +                int B2 = B5; // powers of 2 in bigB
        +                int D2 = D5; // powers of 2 in bigD
        +                int Ulp2;   // powers of 2 in halfUlp.
        +                if (bigIntExp >= 0) {
        +                    B2 += bigIntExp;
        +                } else {
        +                    D2 -= bigIntExp;
        +                }
        +                Ulp2 = B2;
        +                // shift bigB and bigD left by a number s. t.
        +                // halfUlp is still an integer.
        +                int hulpbias;
        +                if (binexp <= -FloatConsts.EXP_BIAS) {
        +                    // This is going to be a denormalized number
        +                    // (if not actually zero).
        +                    // half an ULP is at 2^-(FloatConsts.EXP_BIAS+SINGLE_EXP_SHIFT+1)
        +                    hulpbias = binexp + lowOrderZeros + FloatConsts.EXP_BIAS;
        +                } else {
        +                    hulpbias = 1 + lowOrderZeros;
        +                }
        +                B2 += hulpbias;
        +                D2 += hulpbias;
        +                // if there are common factors of 2, we might just as well
        +                // factor them out, as they add nothing useful.
        +                int common2 = Math.min(B2, Math.min(D2, Ulp2));
        +                B2 -= common2;
        +                D2 -= common2;
        +                Ulp2 -= common2;
        +                // do multiplications by powers of 5 and 2
        +                FDBigInteger bigB = FDBigInteger.valueOfMulPow52(bigBbits, B5, B2);
        +                if (bigD == null || prevD2 != D2) {
        +                    bigD = bigD0.leftShift(D2);
        +                    prevD2 = D2;
        +                }
        +                //
        +                // to recap:
        +                // bigB is the scaled-big-int version of our floating-point
        +                // candidate.
        +                // bigD is the scaled-big-int version of the exact value
        +                // as we understand it.
        +                // halfUlp is 1/2 an ulp of bigB, except for special cases
        +                // of exact powers of 2
        +                //
        +                // the plan is to compare bigB with bigD, and if the difference
        +                // is less than halfUlp, then we're satisfied. Otherwise,
        +                // use the ratio of difference to halfUlp to calculate a fudge
        +                // factor to add to the floating value, then go 'round again.
        +                //
        +                FDBigInteger diff;
        +                int cmpResult;
        +                boolean overvalue;
        +                if ((cmpResult = bigB.cmp(bigD)) > 0) {
        +                    overvalue = true; // our candidate is too big.
        +                    diff = bigB.leftInplaceSub(bigD); // bigB is not user further - reuse
        +                    if ((bigIntNBits == 1) && (bigIntExp > -FloatConsts.EXP_BIAS + 1)) {
        +                        // candidate is a normalized exact power of 2 and
        +                        // is too big (larger than Float.MIN_NORMAL). We will be subtracting.
        +                        // For our purposes, ulp is the ulp of the
        +                        // next smaller range.
        +                        Ulp2 -= 1;
        +                        if (Ulp2 < 0) {
        +                            // rats. Cannot de-scale ulp this far.
        +                            // must scale diff in other direction.
        +                            Ulp2 = 0;
        +                            diff = diff.leftShift(1);
        +                        }
        +                    }
        +                } else if (cmpResult < 0) {
        +                    overvalue = false; // our candidate is too small.
        +                    diff = bigD.rightInplaceSub(bigB); // bigB is not user further - reuse
        +                } else {
        +                    // the candidate is exactly right!
        +                    // this happens with surprising frequency
        +                    break correctionLoop;
        +                }
        +                cmpResult = diff.cmpPow52(B5, Ulp2);
        +                if ((cmpResult) < 0) {
        +                    // difference is small.
        +                    // this is close enough
        +                    break correctionLoop;
        +                } else if (cmpResult == 0) {
        +                    // difference is exactly half an ULP
        +                    // round to some other value maybe, then finish
        +                    if ((ieeeBits & 1) != 0) { // half ties to even
        +                        ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
        +                    }
        +                    break correctionLoop;
        +                } else {
        +                    // difference is non-trivial.
        +                    // could scale addend by ratio of difference to
        +                    // halfUlp here, if we bothered to compute that difference.
        +                    // Most of the time ( I hope ) it is about 1 anyway.
        +                    ieeeBits += overvalue ? -1 : 1; // nextDown or nextUp
        +                    if (ieeeBits == 0 || ieeeBits == FloatConsts.EXP_BIT_MASK) { // 0.0 or Float.POSITIVE_INFINITY
        +                        break correctionLoop; // oops. Fell off end of range.
        +                    }
        +                    continue; // try again.
        +                }
        +
        +            }
        +            if (isNegative) {
        +                ieeeBits |= FloatConsts.SIGN_BIT_MASK;
        +            }
        +            return Float.intBitsToFloat(ieeeBits);
                 }
         
         
        @@ -1935,32 +2043,6 @@
                 throw new NumberFormatException("For input string: \"" + in + "\"");
             }
         
        -    /**
        -     * Rounds a double to a float.
        -     * In addition to the fraction bits of the double,
        -     * look at the class instance variable roundDir,
        -     * which should help us avoid double-rounding error.
        -     * roundDir was set in hardValueOf if the estimate was
        -     * close enough, but not exact. It tells us which direction
        -     * of rounding is preferred.
        -     */
        -    static float stickyRound( double dval, int roundDirection ){
        -        if(roundDirection!=0) {
        -            long lbits = Double.doubleToRawLongBits( dval );
        -            long binexp = lbits & DoubleConsts.EXP_BIT_MASK;
        -            if ( binexp == 0L || binexp == DoubleConsts.EXP_BIT_MASK ){
        -                // what we have here is special.
        -                // don't worry, the right thing will happen.
        -                return (float) dval;
        -            }
        -            lbits += (long)roundDirection; // hack-o-matic.
        -            return (float)Double.longBitsToDouble( lbits );
        -        } else {
        -            return (float)dval;
        -        }
        -    }
        -
        -
             private static class HexFloatPattern {
                 /**
                  * Grammar is compatible with hexadecimal floating-point constants
        @@ -2282,6 +2364,39 @@
                         // else all of string was seen, round and sticky are
                         // correct as false.
         
        +                // Float calculations
        +                int floatBits = isNegative ? FloatConsts.SIGN_BIT_MASK : 0;
        +                if (exponent >= FloatConsts.MIN_EXPONENT) {
        +                    if (exponent > FloatConsts.MAX_EXPONENT) {
        +                        // Float.POSITIVE_INFINITY
        +                        floatBits |= FloatConsts.EXP_BIT_MASK;
        +                    } else {
        +                        int threshShift = DoubleConsts.SIGNIFICAND_WIDTH - FloatConsts.SIGNIFICAND_WIDTH - 1;
        +                        boolean floatSticky = (significand & ((1L << threshShift) - 1)) != 0 || round || sticky;
        +                        int iValue = (int) (significand >>> threshShift);
        +                        if ((iValue & 3) != 1 || floatSticky) {
        +                            iValue++;
        +                        }
        +                        floatBits |= (((((int) exponent) + (FloatConsts.EXP_BIAS - 1))) << SINGLE_EXP_SHIFT) + (iValue >> 1);
        +                    }
        +                } else {
        +                    if (exponent < FloatConsts.MIN_SUB_EXPONENT - 1) {
        +                        // 0
        +                    } else {
        +                        // exponent == -127 ==> threshShift = 53 - 2 + (-149) - (-127) = 53 - 24
        +                        int threshShift = (int) ((DoubleConsts.SIGNIFICAND_WIDTH - 2 + FloatConsts.MIN_SUB_EXPONENT) - exponent);
        +                        assert threshShift >= DoubleConsts.SIGNIFICAND_WIDTH - FloatConsts.SIGNIFICAND_WIDTH;
        +                        assert threshShift < DoubleConsts.SIGNIFICAND_WIDTH;
        +                        boolean floatSticky = (significand & ((1L << threshShift) - 1)) != 0 || round || sticky;
        +                        int iValue = (int) (significand >>> threshShift);
        +                        if ((iValue & 3) != 1 || floatSticky) {
        +                            iValue++;
        +                        }
        +                        floatBits |= iValue >> 1;
        +                    }
        +                }
        +                float fValue = Float.intBitsToFloat(floatBits);
        +
                         // Check for overflow and update exponent accordingly.
                         if (exponent > DoubleConsts.MAX_EXPONENT) {         // Infinite result
                             // overflow to properly signed infinity
        @@ -2390,87 +2505,7 @@
                                     Double.longBitsToDouble(significand | DoubleConsts.SIGN_BIT_MASK) :
                                     Double.longBitsToDouble(significand );
         
        -                    int roundDir = 0;
        -                    //
        -                    // Set roundingDir variable field of fd properly so
        -                    // that the input string can be properly rounded to a
        -                    // float value.  There are two cases to consider:
        -                    //
        -                    // 1. rounding to double discards sticky bit
        -                    // information that would change the result of a float
        -                    // rounding (near halfway case between two floats)
        -                    //
        -                    // 2. rounding to double rounds up when rounding up
        -                    // would not occur when rounding to float.
        -                    //
        -                    // For former case only needs to be considered when
        -                    // the bits rounded away when casting to float are all
        -                    // zero; otherwise, float round bit is properly set
        -                    // and sticky will already be true.
        -                    //
        -                    // The lower exponent bound for the code below is the
        -                    // minimum (normalized) subnormal exponent - 1 since a
        -                    // value with that exponent can round up to the
        -                    // minimum subnormal value and the sticky bit
        -                    // information must be preserved (i.e. case 1).
        -                    //
        -                    if ((exponent >= FloatConsts.MIN_SUB_EXPONENT - 1) &&
        -                            (exponent <= FloatConsts.MAX_EXPONENT)) {
        -                        // Outside above exponent range, the float value
        -                        // will be zero or infinity.
        -
        -                        //
        -                        // If the low-order 28 bits of a rounded double
        -                        // significand are 0, the double could be a
        -                        // half-way case for a rounding to float.  If the
        -                        // double value is a half-way case, the double
        -                        // significand may have to be modified to round
        -                        // the the right float value (see the stickyRound
        -                        // method).  If the rounding to double has lost
        -                        // what would be float sticky bit information, the
        -                        // double significand must be incremented.  If the
        -                        // double value's significand was itself
        -                        // incremented, the float value may end up too
        -                        // large so the increment should be undone.
        -                        //
        -                        if ((significand & 0xfffffffL) == 0x0L) {
        -                            // For negative values, the sign of the
        -                            // roundDir is the same as for positive values
        -                            // since adding 1 increasing the significand's
        -                            // magnitude and subtracting 1 decreases the
        -                            // significand's magnitude.  If neither round
        -                            // nor sticky is true, the double value is
        -                            // exact and no adjustment is required for a
        -                            // proper float rounding.
        -                            if (round || sticky) {
        -                                if (leastZero) { // prerounding lsb is 0
        -                                    // If round and sticky were both true,
        -                                    // and the least significant
        -                                    // significand bit were 0, the rounded
        -                                    // significand would not have its
        -                                    // low-order bits be zero.  Therefore,
        -                                    // we only need to adjust the
        -                                    // significand if round XOR sticky is
        -                                    // true.
        -                                    if (round ^ sticky) {
        -                                        roundDir = 1;
        -                                    }
        -                                } else { // prerounding lsb is 1
        -                                    // If the prerounding lsb is 1 and the
        -                                    // resulting significand has its
        -                                    // low-order bits zero, the significand
        -                                    // was incremented.  Here, we undo the
        -                                    // increment, which will ensure the
        -                                    // right guard and sticky bits for the
        -                                    // float rounding.
        -                                    if (round) {
        -                                        roundDir = -1;
        -                                    }
        -                                }
        -                            }
        -                        }
        -                    }
        -                    return new PreparedASCIIToBinaryBuffer(value,roundDir);
        +                    return new PreparedASCIIToBinaryBuffer(value, fValue);
                         }
                     }
             }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java
        --- a/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/net/www/http/PosterOutputStream.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -30,7 +30,7 @@
         
         /**
          * Instances of this class are returned to applications for the purpose of
        - * sending user data for a HTTP POST or PUT request. This class is used
        + * sending user data for a HTTP request (excluding TRACE). This class is used
          * when the content-length will be specified in the header of the request.
          * The semantics of ByteArrayOutputStream are extended so that
          * when close() is called, it is no longer possible to write
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java
        --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1167,7 +1167,7 @@
         
             /*
              * Allowable input/output sequences:
        -     * [interpreted as POST/PUT]
        +     * [interpreted as request entity]
              * - get output, [write output,] get input, [read input]
              * - get output, [write output]
              * [interpreted as GET]
        @@ -1209,9 +1209,8 @@
                     if (method.equals("GET")) {
                         method = "POST"; // Backward compatibility
                     }
        -            if (!"POST".equals(method) && !"PUT".equals(method) &&
        -                "http".equals(url.getProtocol())) {
        -                throw new ProtocolException("HTTP method " + method +
        +            if ("TRACE".equals(method) && "http".equals(url.getProtocol())) {
        +                throw new ProtocolException("HTTP method TRACE" +
                                                     " doesn't support output");
                     }
         
        @@ -2807,9 +2806,10 @@
         
                 if (SET_COOKIE.equalsIgnoreCase(name) ||
                     SET_COOKIE2.equalsIgnoreCase(name)) {
        +
                     // Filtering only if there is a cookie handler. [Assumption: the
                     // cookie handler will store/retrieve the HttpOnly cookies]
        -            if (cookieHandler == null)
        +            if (cookieHandler == null || value.length() == 0)
                         return value;
         
                     sun.misc.JavaNetHttpCookieAccess access =
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
        --- a/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -38,6 +38,10 @@
             public CGIClientException(String s) {
                 super(s);
             }
        +
        +    public CGIClientException(String s, Throwable cause) {
        +        super(s, cause);
        +    }
         }
         
         /**
        @@ -50,6 +54,10 @@
             public CGIServerException(String s) {
                 super(s);
             }
        +
        +    public CGIServerException(String s, Throwable cause) {
        +        super(s, cause);
        +    }
         }
         
         /**
        @@ -148,13 +156,16 @@
                         try {
                             handler.execute(param);
                         } catch (CGIClientException e) {
        +                    e.printStackTrace();
                             returnClientError(e.getMessage());
                         } catch (CGIServerException e) {
        +                    e.printStackTrace();
                             returnServerError(e.getMessage());
                         }
                     else
                         returnClientError("invalid command.");
                 } catch (Exception e) {
        +            e.printStackTrace();
                     returnServerError("internal error: " + e.getMessage());
                 }
                 System.exit(0);
        @@ -225,7 +236,7 @@
                 try {
                     port = Integer.parseInt(param);
                 } catch (NumberFormatException e) {
        -            throw new CGIClientException("invalid port number.");
        +            throw new CGIClientException("invalid port number.", e);
                 }
                 if (port <= 0 || port > 0xFFFF)
                     throw new CGIClientException("invalid port: " + port);
        @@ -238,7 +249,7 @@
                 try {
                     socket = new Socket(InetAddress.getLocalHost(), port);
                 } catch (IOException e) {
        -            throw new CGIServerException("could not connect to local port");
        +            throw new CGIServerException("could not connect to local port", e);
                 }
         
                 /*
        @@ -249,9 +260,9 @@
                 try {
                     clientIn.readFully(buffer);
                 } catch (EOFException e) {
        -            throw new CGIClientException("unexpected EOF reading request body");
        +            throw new CGIClientException("unexpected EOF reading request body", e);
                 } catch (IOException e) {
        -            throw new CGIClientException("error reading request body");
        +            throw new CGIClientException("error reading request body", e);
                 }
         
                 /*
        @@ -266,7 +277,7 @@
                     socketOut.write(buffer);
                     socketOut.flush();
                 } catch (IOException e) {
        -            throw new CGIServerException("error writing to server");
        +            throw new CGIServerException("error writing to server", e);
                 }
         
                 /*
        @@ -276,7 +287,7 @@
                 try {
                     socketIn = new DataInputStream(socket.getInputStream());
                 } catch (IOException e) {
        -            throw new CGIServerException("error reading from server");
        +            throw new CGIServerException("error reading from server", e);
                 }
                 String key = "Content-length:".toLowerCase();
                 boolean contentLengthFound = false;
        @@ -286,7 +297,7 @@
                     try {
                         line = getLine(socketIn);
                     } catch (IOException e) {
        -                throw new CGIServerException("error reading from server");
        +                throw new CGIServerException("error reading from server", e);
                     }
                     if (line == null)
                         throw new CGIServerException(
        @@ -313,9 +324,9 @@
                     socketIn.readFully(buffer);
                 } catch (EOFException e) {
                     throw new CGIServerException(
        -                "unexpected EOF reading server response");
        +                "unexpected EOF reading server response", e);
                 } catch (IOException e) {
        -            throw new CGIServerException("error reading from server");
        +            throw new CGIServerException("error reading from server", e);
                 }
         
                 /*
        @@ -327,7 +338,7 @@
                 try {
                     System.out.write(buffer);
                 } catch (IOException e) {
        -            throw new CGIServerException("error writing response");
        +            throw new CGIServerException("error writing response", e);
                 }
                 System.out.flush();
             }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/jgss/krb5/AcceptSecContextToken.java
        --- a/jdk/src/share/classes/sun/security/jgss/krb5/AcceptSecContextToken.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/jgss/krb5/AcceptSecContextToken.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -27,9 +27,10 @@
         
         import org.ietf.jgss.*;
         import java.io.InputStream;
        -import java.io.OutputStream;
         import java.io.IOException;
        -import java.io.ByteArrayInputStream;
        +import java.security.AccessController;
        +
        +import sun.security.action.GetBooleanAction;
         import sun.security.krb5.*;
         
         class AcceptSecContextToken extends InitialToken {
        @@ -42,23 +43,19 @@
              */
             public AcceptSecContextToken(Krb5Context context,
                                          KrbApReq apReq)
        -        throws KrbException, IOException {
        +        throws KrbException, IOException, GSSException {
         
        -        /*
        -         * RFC 1964, section 1.2 states:
        -         *  (1) context key: uses Kerberos session key (or subkey, if
        -         *  present in authenticator emitted by context initiator) directly
        -         *
        -         * This does not mention context acceptor. Hence we will not
        -         * generate a subkey on the acceptor side. Note: Our initiator will
        -         * still allow another acceptor to generate a subkey, even though
        -         * our acceptor does not do so.
        -         */
        -        boolean useSubkey = false;
        +        boolean useSubkey = AccessController.doPrivileged(
        +                new GetBooleanAction("sun.security.krb5.acceptor.subkey"));
         
                 boolean useSequenceNumber = true;
         
        -        apRep = new KrbApRep(apReq, useSequenceNumber, useSubkey);
        +        EncryptionKey subKey = null;
        +        if (useSubkey) {
        +            subKey = new EncryptionKey(apReq.getCreds().getSessionKey());
        +            context.setKey(Krb5Context.ACCEPTOR_SUBKEY, subKey);
        +        }
        +        apRep = new KrbApRep(apReq, useSequenceNumber, subKey);
         
                 context.resetMySequenceNumber(apRep.getSeqNumber().intValue());
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/EncryptionKey.java
        --- a/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/krb5/EncryptionKey.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -297,9 +297,11 @@
         
             /**
              * Generates a sub-sessionkey from a given session key.
        +     *
        +     * Used in AcceptSecContextToken and KrbApReq by acceptor- and initiator-
        +     * side respectively.
              */
        -     // Used in KrbApRep, KrbApReq
        -    EncryptionKey(EncryptionKey key) throws KrbCryptoException {
        +    public EncryptionKey(EncryptionKey key) throws KrbCryptoException {
                 // generate random sub-session key
                 keyValue = Confounder.bytes(key.keyValue.length);
                 for (int i = 0; i < keyValue.length; i++) {
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/KdcComm.java
        --- a/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/krb5/KdcComm.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -46,6 +46,7 @@
         import java.util.List;
         import java.util.Set;
         import java.util.HashSet;
        +import java.util.Iterator;
         import sun.security.krb5.internal.KRBError;
         
         /**
        @@ -203,7 +204,6 @@
         
                 if (obuf == null)
                     return null;
        -        Exception savedException = null;
                 Config cfg = Config.getInstance();
         
                 if (realm == null) {
        @@ -218,42 +218,51 @@
                 if (kdcList == null) {
                     throw new KrbException("Cannot get kdc for realm " + realm);
                 }
        -        String tempKdc = null; // may include the port number also
        -        byte[] ibuf = null;
        -        for (String tmp: KdcAccessibility.list(kdcList)) {
        -            tempKdc = tmp;
        -            try {
        -                ibuf = send(obuf,tempKdc,useTCP);
        -                KRBError ke = null;
        +        // tempKdc may include the port number also
        +        Iterator tempKdc = KdcAccessibility.list(kdcList).iterator();
        +        if (!tempKdc.hasNext()) {
        +            throw new KrbException("Cannot get kdc for realm " + realm);
        +        }
        +        try {
        +            return sendIfPossible(obuf, tempKdc.next(), useTCP);
        +        } catch(Exception first) {
        +            while(tempKdc.hasNext()) {
                         try {
        -                    ke = new KRBError(ibuf);
        -                } catch (Exception e) {
        -                    // OK
        -                }
        -                if (ke != null && ke.getErrorCode() ==
        -                        Krb5.KRB_ERR_RESPONSE_TOO_BIG) {
        -                    ibuf = send(obuf, tempKdc, true);
        -                }
        -                KdcAccessibility.removeBad(tempKdc);
        -                break;
        +                    return sendIfPossible(obuf, tempKdc.next(), useTCP);
        +                } catch(Exception ignore) {}
        +            }
        +            throw first;
        +        }
        +    }
        +
        +    // send the AS Request to the specified KDC
        +    // failover to using TCP if useTCP is not set and response is too big
        +    private byte[] sendIfPossible(byte[] obuf, String tempKdc, boolean useTCP)
        +        throws IOException, KrbException {
        +
        +        try {
        +            byte[] ibuf = send(obuf, tempKdc, useTCP);
        +            KRBError ke = null;
        +            try {
        +                ke = new KRBError(ibuf);
                     } catch (Exception e) {
        -                if (DEBUG) {
        -                    System.out.println(">>> KrbKdcReq send: error trying " +
        -                            tempKdc);
        -                    e.printStackTrace(System.out);
        -                }
        -                KdcAccessibility.addBad(tempKdc);
        -                savedException = e;
        +                // OK
        +            }
        +            if (ke != null && ke.getErrorCode() ==
        +                    Krb5.KRB_ERR_RESPONSE_TOO_BIG) {
        +                ibuf = send(obuf, tempKdc, true);
                     }
        +            KdcAccessibility.removeBad(tempKdc);
        +            return ibuf;
        +        } catch(Exception e) {
        +            if (DEBUG) {
        +                System.out.println(">>> KrbKdcReq send: error trying " +
        +                        tempKdc);
        +                e.printStackTrace(System.out);
        +            }
        +            KdcAccessibility.addBad(tempKdc);
        +            throw e;
                 }
        -        if (ibuf == null && savedException != null) {
        -            if (savedException instanceof IOException) {
        -                throw (IOException) savedException;
        -            } else {
        -                throw (KrbException) savedException;
        -            }
        -        }
        -        return ibuf;
             }
         
             // send the AS Request to the specified KDC
        @@ -496,7 +505,7 @@
                 }
         
                 // Returns a preferred KDC list by putting the bad ones at the end
        -        private static synchronized String[] list(String kdcList) {
        +        private static synchronized List list(String kdcList) {
                     StringTokenizer st = new StringTokenizer(kdcList);
                     List list = new ArrayList<>();
                     if (badPolicy == BpType.TRY_LAST) {
        @@ -515,7 +524,7 @@
                             list.add(st.nextToken());
                         }
                     }
        -            return list.toArray(new String[list.size()]);
        +            return list;
                 }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/KrbApRep.java
        --- a/jdk/src/share/classes/sun/security/krb5/KrbApRep.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/krb5/KrbApRep.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -53,12 +53,10 @@
              */
              // Used in AcceptSecContextToken
             public KrbApRep(KrbApReq incomingReq,
        -                    boolean useSeqNumber,
        -        boolean useSubKey) throws KrbException, IOException {
        +                     boolean useSeqNumber,
        +                     EncryptionKey subKey)
        +            throws KrbException, IOException {
         
        -        EncryptionKey subKey =
        -            (useSubKey?
        -             new EncryptionKey(incomingReq.getCreds().getSessionKey()):null);
                 SeqNumber seqNum = new LocalSeqNumber();
         
                 init(incomingReq, subKey, seqNum);
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/KrbApReq.java
        --- a/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/krb5/KrbApReq.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,12 +33,14 @@
         
         import sun.security.krb5.internal.*;
         import sun.security.krb5.internal.crypto.*;
        -import sun.security.krb5.internal.rcache.*;
         import sun.security.jgss.krb5.Krb5AcceptCredential;
         import java.net.InetAddress;
         import sun.security.util.*;
         import java.io.IOException;
         import java.util.Arrays;
        +import java.security.MessageDigest;
        +import java.security.NoSuchAlgorithmException;
        +import sun.security.krb5.internal.rcache.AuthTimeWithHash;
         
         /**
          * This class encapsulates a KRB-AP-REQ that a client sends to a
        @@ -53,11 +55,23 @@
             private Credentials creds;
             private APReq apReqMessg;
         
        -    private static CacheTable table = new CacheTable();
        +    // Used by acceptor side
        +    private static ReplayCache rcache = ReplayCache.getInstance();
             private static boolean DEBUG = Krb5.DEBUG;
        +    private static final char[] hexConst = "0123456789ABCDEF".toCharArray();
        +
        +    private static final MessageDigest md;
        +
        +    static {
        +        try {
        +            md = MessageDigest.getInstance("MD5");
        +        } catch (NoSuchAlgorithmException ex) {
        +            throw new RuntimeException("Impossible");
        +        }
        +    }
         
             /**
        -     * Contructs a AP-REQ message to send to the peer.
        +     * Constructs an AP-REQ message to send to the peer.
              * @param tgsCred the Credentials to be used to construct the
              *          AP Request  protocol message.
              * @param mutualRequired Whether mutual authentication is required
        @@ -81,7 +95,7 @@
         */
         
             /**
        -     * Contructs a AP-REQ message to send to the peer.
        +     * Constructs an AP-REQ message to send to the peer.
              * @param tgsCred the Credentials to be used to construct the
              *          AP Request  protocol message.
              * @param mutualRequired Whether mutual authentication is required
        @@ -125,7 +139,7 @@
             }
         
             /**
        -     * Contructs a AP-REQ message from the bytes received from the
        +     * Constructs an AP-REQ message from the bytes received from the
              * peer.
              * @param message The message received from the peer
              * @param keys EncrtyptionKeys to decrypt the message;
        @@ -146,7 +160,7 @@
             }
         
             /**
        -     * Contructs a AP-REQ message from the bytes received from the
        +     * Constructs an AP-REQ message from the bytes received from the
              * peer.
              * @param value The DerValue that contains the
              *              DER enoded AP-REQ protocol message
        @@ -297,15 +311,19 @@
                 if (!authenticator.ctime.inClockSkew())
                     throw new KrbApErrException(Krb5.KRB_AP_ERR_SKEW);
         
        -        // start to check if it is a replay attack.
        -        AuthTime time =
        -            new AuthTime(authenticator.ctime.getTime(), authenticator.cusec);
        -        String client = authenticator.cname.toString();
        -        if (table.get(time, authenticator.cname.toString()) != null) {
        -            throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
        -        } else {
        -            table.put(client, time, System.currentTimeMillis());
        +        byte[] hash = md.digest(apReqMessg.authenticator.cipher);
        +        char[] h = new char[hash.length * 2];
        +        for (int i=0; i>4];
        +            h[2*i+1] = hexConst[hash[i]&0xf];
                 }
        +        AuthTimeWithHash time = new AuthTimeWithHash(
        +                authenticator.cname.toString(),
        +                apReqMessg.ticket.sname.toString(),
        +                authenticator.ctime.getSeconds(),
        +                authenticator.cusec,
        +                new String(h));
        +        rcache.checkAndStore(KerberosTime.now(), time);
         
                 if (initiator != null) {
                     // sender host address
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/ReplayCache.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/ReplayCache.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,72 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.  Oracle designates this
        + * particular file as subject to the "Classpath" exception as provided
        + * by Oracle in the LICENSE file that accompanied this code.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +package sun.security.krb5.internal;
        +
        +import sun.security.action.GetPropertyAction;
        +import sun.security.krb5.internal.rcache.AuthTimeWithHash;
        +import sun.security.krb5.internal.rcache.MemoryCache;
        +import sun.security.krb5.internal.rcache.DflCache;
        +
        +import java.security.AccessController;
        +
        +/**
        + * Models the replay cache of an acceptor as described in
        + * RFC 4120 3.2.3.
        + * @since 1.8
        + */
        +public abstract class ReplayCache {
        +    public static ReplayCache getInstance(String type) {
        +        if (type == null) {
        +            return new MemoryCache();
        +        } else if (type.equals("dfl") || type.startsWith("dfl:")) {
        +            return new DflCache(type);
        +        } else if (type.equals("none")) {
        +            return new ReplayCache() {
        +                @Override
        +                public void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
        +                        throws KrbApErrException {
        +                    // no check at all
        +                }
        +            };
        +        } else {
        +            throw new IllegalArgumentException("Unknown type: " + type);
        +        }
        +    }
        +    public static ReplayCache getInstance() {
        +        String type = AccessController.doPrivileged(
        +                new GetPropertyAction("sun.security.krb5.rcache"));
        +        return getInstance(type);
        +    }
        +
        +    /**
        +     * Accepts or rejects an AuthTime.
        +     * @param currTime the current time
        +     * @param time AuthTimeWithHash object calculated from authenticator
        +     * @throws KrbApErrException if the authenticator is a replay
        +     */
        +    public abstract void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
        +            throws KrbApErrException;
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthList.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,144 @@
        +/*
        + * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.  Oracle designates this
        + * particular file as subject to the "Classpath" exception as provided
        + * by Oracle in the LICENSE file that accompanied this code.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + *
        + *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
        + *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
        + */
        +
        +package sun.security.krb5.internal.rcache;
        +
        +import sun.security.krb5.internal.Krb5;
        +
        +import java.util.Iterator;
        +import java.util.LinkedList;
        +import java.util.ListIterator;
        +import sun.security.krb5.internal.KerberosTime;
        +import sun.security.krb5.internal.KrbApErrException;
        +
        +/**
        + * This class provides an efficient caching mechanism to store AuthTimeWithHash
        + * from client authenticators. The cache minimizes the memory usage by doing
        + * self-cleanup of expired items in the cache.
        + *
        + * AuthTimeWithHash objects inside a cache are always sorted from big (new) to
        + * small (old) as determined by {@see AuthTimeWithHash#compareTo}. In the most
        + * common case a newcomer should be newer than the first element.
        + *
        + * @author Yanni Zhang
        + */
        +public class AuthList {
        +
        +    private final LinkedList entries;
        +    private final int lifespan;
        +
        +    /**
        +     * Constructs a AuthList.
        +     */
        +    public AuthList(int lifespan) {
        +        this.lifespan = lifespan;
        +        entries = new LinkedList<>();
        +    }
        +
        +    /**
        +     * Puts the authenticator timestamp into the cache in descending order,
        +     * and throw an exception if it's already there.
        +     */
        +    public void put(AuthTimeWithHash t, KerberosTime currentTime)
        +            throws KrbApErrException {
        +
        +        if (entries.isEmpty()) {
        +            entries.addFirst(t);
        +        } else {
        +            AuthTimeWithHash temp = entries.getFirst();
        +            int cmp = temp.compareTo(t);
        +            if (cmp < 0) {
        +                // This is the most common case, newly received authenticator
        +                // has larger timestamp.
        +                entries.addFirst(t);
        +            } else if (cmp == 0) {
        +                throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
        +            } else {
        +                //unless client clock being re-adjusted.
        +                ListIterator it = entries.listIterator(1);
        +                boolean found = false;
        +                while (it.hasNext()) {
        +                    temp = it.next();
        +                    cmp = temp.compareTo(t);
        +                    if (cmp < 0) {
        +                        // Find an older one, put in front of it
        +                        entries.add(entries.indexOf(temp), t);
        +                        found = true;
        +                        break;
        +                    } else if (cmp == 0) {
        +                        throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
        +                    }
        +                }
        +                if (!found) {
        +                    // All is newer than the newcomer. Sigh.
        +                    entries.addLast(t);
        +                }
        +            }
        +        }
        +
        +        // let us cleanup while we are here
        +        long timeLimit = currentTime.getSeconds() - lifespan;
        +        ListIterator it = entries.listIterator(0);
        +        AuthTimeWithHash temp = null;
        +        int index = -1;
        +        while (it.hasNext()) {
        +            // search expired timestamps.
        +            temp = it.next();
        +            if (temp.ctime < timeLimit) {
        +                index = entries.indexOf(temp);
        +                break;
        +            }
        +        }
        +        // It would be nice if LinkedList has a method called truncate(index).
        +        if (index > -1) {
        +            do {
        +                // remove expired timestamps from the list.
        +                entries.removeLast();
        +            } while(entries.size() > index);
        +        }
        +    }
        +
        +    public boolean isEmpty() {
        +        return entries.isEmpty();
        +    }
        +
        +    public String toString() {
        +        StringBuilder sb = new StringBuilder();
        +        Iterator iter = entries.descendingIterator();
        +        int pos = entries.size();
        +        while (iter.hasNext()) {
        +            AuthTimeWithHash at = iter.next();
        +            sb.append('#').append(pos--).append(": ")
        +                    .append(at.toString()).append('\n');
        +        }
        +        return sb.toString();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTime.java
        --- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTime.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTime.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,4 +1,5 @@
         /*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -30,54 +31,126 @@
         
         package sun.security.krb5.internal.rcache;
         
        -import sun.security.krb5.internal.KerberosTime;
        +import java.io.IOException;
        +import java.nio.BufferUnderflowException;
        +import java.nio.ByteBuffer;
        +import java.nio.ByteOrder;
        +import java.nio.channels.SeekableByteChannel;
        +import java.nio.charset.StandardCharsets;
        +import java.util.StringTokenizer;
         
         /**
        - * The class represents the timestamp in authenticator.
        + * The class represents an old style replay cache entry. It is only used in
        + * a dfl file.
          *
        + * @author Sun/Oracle
          * @author Yanni Zhang
          */
         public class AuthTime {
        -    long kerberosTime;
        -    int cusec;
        +    final int ctime;
        +    final int cusec;
        +    final String client;
        +    final String server;
        +
        +    /**
        +     * Constructs an AuthTime.
        +     */
        +    public AuthTime(String client, String server,
        +            int ctime, int cusec) {
        +        this.ctime = ctime;
        +        this.cusec = cusec;
        +        this.client = client;
        +        this.server = server;
        +    }
        +
        +    @Override
        +    public String toString() {
        +        return String.format("%d/%06d/----/%s", ctime, cusec, client);
        +    }
        +
        +    // Methods used when saved in a dfl file. See DflCache.java
         
             /**
        -     * Constructs a new AuthTime.
        -     * @param time time from the Authenticator.
        -     * @param cusec microsecond field from the Authenticator.
        +     * Reads an LC style string from a channel, which is a int32 length
        +     * plus a UTF-8 encoded string possibly ends with \0.
        +     * @throws IOException if there is a format error
        +     * @throws BufferUnderflowException if goes beyond the end
              */
        -    public AuthTime(long time, int c) {
        -        kerberosTime = time;
        -        cusec = c;
        +    private static String readStringWithLength(SeekableByteChannel chan)
        +            throws IOException {
        +        ByteBuffer bb = ByteBuffer.allocate(4);
        +        bb.order(ByteOrder.nativeOrder());
        +        chan.read(bb);
        +        bb.flip();
        +        int len = bb.getInt();
        +        if (len > 1024) {
        +            // Memory attack? The string should be fairly short.
        +            throw new IOException("Invalid string length");
        +        }
        +        bb = ByteBuffer.allocate(len);
        +        if (chan.read(bb) != len) {
        +            throw new IOException("Not enough string");
        +        }
        +        byte[] data = bb.array();
        +        return (data[len-1] == 0)?
        +                new String(data, 0, len-1, StandardCharsets.UTF_8):
        +                new String(data, StandardCharsets.UTF_8);
             }
         
             /**
        -     * Compares if an object equals to an AuthTime object.
        -     * @param o an object.
        -     * @return true if two objects are equivalent, otherwise, return false.
        +     * Reads an AuthTime or AuthTimeWithHash object from a channel.
        +     * @throws IOException if there is a format error
        +     * @throws BufferUnderflowException if goes beyond the end
              */
        -    public boolean equals(Object o) {
        -        if (o instanceof AuthTime) {
        -            if ((((AuthTime)o).kerberosTime == kerberosTime)
        -                && (((AuthTime)o).cusec == cusec)) {
        -                return true;
        +    public static AuthTime readFrom(SeekableByteChannel chan)
        +            throws IOException {
        +        String client = readStringWithLength(chan);
        +        String server = readStringWithLength(chan);
        +        ByteBuffer bb = ByteBuffer.allocate(8);
        +        chan.read(bb);
        +        bb.order(ByteOrder.nativeOrder());
        +        int cusec = bb.getInt(0);
        +        int ctime = bb.getInt(4);
        +        if (client.isEmpty()) {
        +            StringTokenizer st = new StringTokenizer(server, " :");
        +            if (st.countTokens() != 6) {
        +                throw new IOException("Incorrect rcache style");
                     }
        +            st.nextToken();
        +            String hash = st.nextToken();
        +            st.nextToken();
        +            client = st.nextToken();
        +            st.nextToken();
        +            server = st.nextToken();
        +            return new AuthTimeWithHash(
        +                    client, server, ctime, cusec, hash);
        +        } else {
        +            return new AuthTime(
        +                    client, server, ctime, cusec);
                 }
        -        return false;
             }
         
             /**
        -     * Returns a hash code for this AuthTime object.
        -     *
        -     * @return  a hash code value for this object.
        +     * Encodes to be used in a dfl file
              */
        -    public int hashCode() {
        -        int result = 17;
        -
        -        result = 37 * result + (int)(kerberosTime ^ (kerberosTime >>> 32));
        -        result = 37 * result + cusec;
        -
        -        return result;
        +    protected byte[] encode0(String cstring, String sstring) {
        +        byte[] c = cstring.getBytes(StandardCharsets.UTF_8);;
        +        byte[] s = sstring.getBytes(StandardCharsets.UTF_8);;
        +        byte[] zero = new byte[1];
        +        int len = 4 + c.length + 1 + 4 + s.length + 1 + 4 + 4;
        +        ByteBuffer bb = ByteBuffer.allocate(len)
        +                .order(ByteOrder.nativeOrder());
        +        bb.putInt(c.length+1).put(c).put(zero)
        +                .putInt(s.length+1).put(s).put(zero)
        +                .putInt(cusec).putInt(ctime);
        +        return bb.array();
             }
         
        +    /**
        +     * Encodes to be used in a dfl file
        +     * @param withHash useless here
        +     */
        +    public byte[] encode(boolean withHash) {
        +        return encode0(client, server);
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTimeWithHash.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/AuthTimeWithHash.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,124 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.  Oracle designates this
        + * particular file as subject to the "Classpath" exception as provided
        + * by Oracle in the LICENSE file that accompanied this code.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +package sun.security.krb5.internal.rcache;
        +
        +import java.util.Objects;
        +
        +/**
        + * The class represents a new style replay cache entry. It can be either used
        + * inside memory or in a dfl file.
        + */
        +public class AuthTimeWithHash extends AuthTime
        +        implements Comparable {
        +
        +    final String hash;
        +
        +    /**
        +     * Constructs a new AuthTimeWithHash.
        +     */
        +    public AuthTimeWithHash(String client, String server,
        +            int ctime, int cusec, String hash) {
        +        super(client, server, ctime, cusec);
        +        this.hash = hash;
        +    }
        +
        +    /**
        +     * Compares if an object equals to an AuthTimeWithHash object.
        +     * @param o an object.
        +     * @return true if two objects are equivalent, otherwise, return false.
        +     */
        +    @Override
        +    public boolean equals(Object o) {
        +        if (this == o) return true;
        +        if (!(o instanceof AuthTimeWithHash)) return false;
        +        AuthTimeWithHash that = (AuthTimeWithHash)o;
        +        return Objects.equals(hash, that.hash)
        +                && Objects.equals(client, that.client)
        +                && Objects.equals(server, that.server)
        +                && ctime == that.ctime
        +                && cusec == that.cusec;
        +    }
        +
        +    /**
        +     * Returns a hash code for this AuthTimeWithHash object.
        +     */
        +    @Override
        +    public int hashCode() {
        +        return Objects.hash(hash);
        +    }
        +
        +    @Override
        +    public String toString() {
        +        return String.format("%d/%06d/%s/%s", ctime, cusec, hash, client);
        +    }
        +
        +    @Override
        +    public int compareTo(AuthTimeWithHash other) {
        +        int cmp = 0;
        +        if (ctime != other.ctime) {
        +            cmp = Integer.compare(ctime, other.ctime);
        +        } else if (cusec != other.cusec) {
        +            cmp = Integer.compare(cusec, other.cusec);
        +        } else {
        +            cmp = hash.compareTo(other.hash);
        +        }
        +        return cmp;
        +    }
        +
        +    /**
        +     * Compares with a possibly old style object. Used
        +     * in DflCache$Storage#loadAndCheck.
        +     * @return true if all AuthTime fields are the same
        +     */
        +    public boolean isSameIgnoresHash(AuthTime old) {
        +        return  client.equals(old.client) &&
        +                server.equals(old.server) &&
        +                ctime == old.ctime &&
        +                cusec == old.cusec;
        +    }
        +
        +    // Methods used when saved in a dfl file. See DflCache.java
        +
        +    /**
        +     * Encodes to be used in a dfl file
        +     * @param withHash write new style if true
        +     */
        +    @Override
        +    public byte[] encode(boolean withHash) {
        +        String cstring;
        +        String sstring;
        +        if (withHash) {
        +            cstring = "";
        +            sstring = String.format("HASH:%s %d:%s %d:%s", hash,
        +                    client.length(), client,
        +                    server.length(), server);
        +        } else {
        +            cstring = client;
        +            sstring = server;
        +        }
        +        return encode0(cstring, sstring);
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/CacheTable.java
        --- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/CacheTable.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,91 +0,0 @@
        -/*
        - * 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.
        - */
        -
        -/*
        - *
        - *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
        - *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
        - */
        -
        -package sun.security.krb5.internal.rcache;
        -
        -import java.util.Hashtable;
        -
        -/**
        - * This class implements Hashtable to store the replay caches.
        - *
        - * @author Yanni Zhang
        - */
        -public class CacheTable extends Hashtable {
        -
        -    private static final long serialVersionUID = -4695501354546664910L;
        -
        -    private boolean DEBUG = sun.security.krb5.internal.Krb5.DEBUG;
        -    public CacheTable () {
        -    }
        -
        -    /**
        -     * Puts the client timestamp in replay cache.
        -     * @params principal the client's principal name.
        -     * @params time authenticator timestamp.
        -     */
        -    public synchronized void put(String principal, AuthTime time, long currTime) {
        -        ReplayCache rc = super.get(principal);
        -        if (rc == null) {
        -            if (DEBUG) {
        -                System.out.println("replay cache for " + principal + " is null.");
        -            }
        -            rc = new ReplayCache(principal, this);
        -            rc.put(time, currTime);
        -            if (!rc.isEmpty()) {
        -                super.put(principal, rc);
        -            }
        -        }
        -        else {
        -            rc.put(time, currTime);
        -            if (rc.isEmpty()) {
        -                super.remove(rc);
        -            }
        -            if (DEBUG) {
        -                System.out.println("replay cache found.");
        -            }
        -        }
        -
        -    }
        -
        -    /**
        -     * This method tests if replay cache keeps a record of the authenticator's time stamp.
        -     * If there is a record (replay attack detected), the server should reject the client request.
        -     * @params principal the client's principal name.
        -     * @params time authenticator timestamp.
        -     * @return null if no record found, else return an AuthTime object.
        -     */
        -    public Object get(AuthTime time, String principal) {
        -        ReplayCache rc = super.get(principal);
        -        if ((rc != null) && (rc.contains(time))) {
        -            return time;
        -        }
        -        return null;
        -    }
        -}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/DflCache.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,365 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.  Oracle designates this
        + * particular file as subject to the "Classpath" exception as provided
        + * by Oracle in the LICENSE file that accompanied this code.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +
        +package sun.security.krb5.internal.rcache;
        +
        +import java.io.*;
        +import java.nio.BufferUnderflowException;
        +import java.nio.ByteBuffer;
        +import java.nio.ByteOrder;
        +import java.nio.channels.SeekableByteChannel;
        +import java.nio.file.Files;
        +import java.nio.file.Path;
        +import java.nio.file.StandardCopyOption;
        +import java.nio.file.StandardOpenOption;
        +import java.nio.file.attribute.PosixFilePermission;
        +import java.security.AccessController;
        +import java.util.*;
        +
        +import sun.security.action.GetPropertyAction;
        +import sun.security.krb5.internal.KerberosTime;
        +import sun.security.krb5.internal.Krb5;
        +import sun.security.krb5.internal.KrbApErrException;
        +import sun.security.krb5.internal.ReplayCache;
        +
        +
        +/**
        + * A dfl file is used to sustores AuthTime entries when the system property
        + * sun.security.krb5.rcache is set to
        + *
        + *    dfl(|:path/|:path/name|:name)
        + *
        + * The file will be path/name. If path is not given, it will be
        + *
        + *    System.getProperty("java.io.tmpdir")
        + *
        + * If name is not given, it will be
        + *
        + *    service_euid
        + *
        + * Java does not have a method to get euid, so uid is used instead. This
        + * should normally to be since a Java program is seldom used as a setuid app.
        + *
        + * The file has a header:
        + *
        + *    i16 0x0501 (KRB5_RC_VNO) in network order
        + *    i32 number of seconds for lifespan (in native order, same below)
        + *
        + * followed by cache entries concatenated, which can be encoded in
        + * 2 styles:
        + *
        + * The traditional style is:
        + *
        + *    LC of client principal
        + *    LC of server principal
        + *    i32 cusec of Authenticator
        + *    i32 ctime of Authenticator
        + *
        + * The new style has a hash:
        + *
        + *    LC of ""
        + *    LC of "HASH:%s %lu:%s %lu:%s" of (hash, clientlen, client, serverlen,
        + *          server) where msghash is 32 char (lower case) text mode md5sum
        + *          of the ciphertext of authenticator.
        + *    i32 cusec of Authenticator
        + *    i32 ctime of Authenticator
        + *
        + * where LC of a string means
        + *
        + *    i32 strlen(string) + 1
        + *    octets of string, with the \0x00 ending
        + *
        + * The old style block is always created by MIT krb5 used even if a new style
        + * is available, which means there can be 2 entries for a single Authenticator.
        + * Java also does this way.
        + *
        + * See src/lib/krb5/rcache/rc_io.c and src/lib/krb5/rcache/rc_dfl.c.
        + */
        +public class DflCache extends ReplayCache {
        +
        +    private static final int KRB5_RV_VNO = 0x501;
        +    private static final int EXCESSREPS = 30;   // if missed-hit>this, recreate
        +
        +    private final String source;
        +
        +    private static int uid;
        +    static {
        +        try {
        +            // Available on Solaris, Linux and Mac. Otherwise, no _euid suffix
        +            Class clazz = Class.forName("com.sun.security.auth.module.UnixSystem");
        +            uid = (int)(long)(Long)
        +                    clazz.getMethod("getUid").invoke(clazz.newInstance());
        +        } catch (Exception e) {
        +            uid = -1;
        +        }
        +    }
        +
        +    public DflCache (String source) {
        +        this.source = source;
        +    }
        +
        +    private static String defaultPath() {
        +        return AccessController.doPrivileged(
        +                new GetPropertyAction("java.io.tmpdir"));
        +    }
        +
        +    private static String defaultFile(String server) {
        +        // service/host@REALM -> service
        +        int slash = server.indexOf('/');
        +        if (slash == -1) {
        +            // A normal principal? say, dummy@REALM
        +            slash = server.indexOf('@');
        +        }
        +        if (slash != -1) {
        +            // Should not happen, but be careful
        +            server= server.substring(0, slash);
        +        }
        +        if (uid != -1) {
        +            server += "_" + uid;
        +        }
        +        return server;
        +    }
        +
        +    private static Path getFileName(String source, String server) {
        +        String path, file;
        +        if (source.equals("dfl")) {
        +            path = defaultPath();
        +            file = defaultFile(server);
        +        } else if (source.startsWith("dfl:")) {
        +            source = source.substring(4);
        +            int pos = source.lastIndexOf('/');
        +            int pos1 = source.lastIndexOf('\\');
        +            if (pos1 > pos) pos = pos1;
        +            if (pos == -1) {
        +                // Only file name
        +                path = defaultPath();
        +                file = source;
        +            } else if (new File(source).isDirectory()) {
        +                // Only path
        +                path = source;
        +                file = defaultFile(server);
        +            } else {
        +                // Full pathname
        +                path = null;
        +                file = source;
        +            }
        +        } else {
        +            throw new IllegalArgumentException();
        +        }
        +        return new File(path, file).toPath();
        +    }
        +
        +    @Override
        +    public void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
        +            throws KrbApErrException {
        +        try {
        +            checkAndStore0(currTime, time);
        +        } catch (IOException ioe) {
        +            KrbApErrException ke = new KrbApErrException(Krb5.KRB_ERR_GENERIC);
        +            ke.initCause(ioe);
        +            throw ke;
        +        }
        +    }
        +
        +    private synchronized void checkAndStore0(KerberosTime currTime, AuthTimeWithHash time)
        +            throws IOException, KrbApErrException {
        +        Path p = getFileName(source, time.server);
        +        int missed = 0;
        +        try (Storage s = new Storage()) {
        +            try {
        +                missed = s.loadAndCheck(p, time, currTime);
        +            } catch (IOException ioe) {
        +                // Non-existing or invalid file
        +                Storage.create(p);
        +                missed = s.loadAndCheck(p, time, currTime);
        +            }
        +            s.append(time);
        +        }
        +        if (missed > EXCESSREPS) {
        +            Storage.expunge(p, currTime);
        +        }
        +    }
        +
        +
        +    private static class Storage implements Closeable {
        +        // Static methods
        +        @SuppressWarnings("try")
        +        private static void create(Path p) throws IOException {
        +            try (SeekableByteChannel newChan = createNoClose(p)) {
        +                // Do nothing, wait for close
        +            }
        +            makeMine(p);
        +        }
        +
        +        private static void makeMine(Path p) throws IOException {
        +            // chmod to owner-rw only, otherwise MIT krb5 rejects
        +            try {
        +                Set attrs = new HashSet<>();
        +                attrs.add(PosixFilePermission.OWNER_READ);
        +                attrs.add(PosixFilePermission.OWNER_WRITE);
        +                Files.setPosixFilePermissions(p, attrs);
        +            } catch (UnsupportedOperationException uoe) {
        +                // No POSIX permission. That's OK.
        +            }
        +        }
        +
        +        private static SeekableByteChannel createNoClose(Path p)
        +                throws IOException {
        +            SeekableByteChannel newChan = Files.newByteChannel(
        +                    p, StandardOpenOption.CREATE,
        +                        StandardOpenOption.TRUNCATE_EXISTING,
        +                        StandardOpenOption.WRITE);
        +            ByteBuffer buffer = ByteBuffer.allocate(6);
        +            buffer.putShort((short)KRB5_RV_VNO);
        +            buffer.order(ByteOrder.nativeOrder());
        +            buffer.putInt(KerberosTime.getDefaultSkew());
        +            buffer.flip();
        +            newChan.write(buffer);
        +            return newChan;
        +        }
        +
        +        private static void expunge(Path p, KerberosTime currTime)
        +                throws IOException {
        +            Path p2 = Files.createTempFile(p.getParent(), "rcache", null);
        +            try (SeekableByteChannel oldChan = Files.newByteChannel(p);
        +                    SeekableByteChannel newChan = createNoClose(p2)) {
        +                long timeLimit = currTime.getSeconds() - readHeader(oldChan);
        +                while (true) {
        +                    try {
        +                        AuthTime at = AuthTime.readFrom(oldChan);
        +                        if (at.ctime > timeLimit) {
        +                            ByteBuffer bb = ByteBuffer.wrap(at.encode(true));
        +                            newChan.write(bb);
        +                        }
        +                    } catch (BufferUnderflowException e) {
        +                        break;
        +                    }
        +                }
        +            }
        +            makeMine(p2);
        +            Files.move(p2, p,
        +                    StandardCopyOption.REPLACE_EXISTING,
        +                    StandardCopyOption.ATOMIC_MOVE);
        +        }
        +
        +        // Instance methods
        +        SeekableByteChannel chan;
        +        private int loadAndCheck(Path p, AuthTimeWithHash time,
        +                KerberosTime currTime)
        +                throws IOException, KrbApErrException {
        +            int missed = 0;
        +            if (Files.isSymbolicLink(p)) {
        +                throw new IOException("Symlink not accepted");
        +            }
        +            try {
        +                Set perms =
        +                        Files.getPosixFilePermissions(p);
        +                if (uid != -1 &&
        +                        (Integer)Files.getAttribute(p, "unix:uid") != uid) {
        +                    throw new IOException("Not mine");
        +                }
        +                if (perms.contains(PosixFilePermission.GROUP_READ) ||
        +                        perms.contains(PosixFilePermission.GROUP_WRITE) ||
        +                        perms.contains(PosixFilePermission.GROUP_EXECUTE) ||
        +                        perms.contains(PosixFilePermission.OTHERS_READ) ||
        +                        perms.contains(PosixFilePermission.OTHERS_WRITE) ||
        +                        perms.contains(PosixFilePermission.OTHERS_EXECUTE)) {
        +                    throw new IOException("Accessible by someone else");
        +                }
        +            } catch (UnsupportedOperationException uoe) {
        +                // No POSIX permissions? Ignore it.
        +            }
        +            chan = Files.newByteChannel(p, StandardOpenOption.WRITE,
        +                    StandardOpenOption.READ);
        +
        +            long timeLimit = currTime.getSeconds() - readHeader(chan);
        +
        +            long pos = 0;
        +            boolean seeNewButNotSame = false;
        +            while (true) {
        +                try {
        +                    pos = chan.position();
        +                    AuthTime a = AuthTime.readFrom(chan);
        +                    if (a instanceof AuthTimeWithHash) {
        +                        if (time.equals(a)) {
        +                            // Exact match, must be a replay
        +                            throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
        +                        } else if (time.isSameIgnoresHash(a)) {
        +                            // Two different authenticators in the same second.
        +                            // Remember it
        +                            seeNewButNotSame = true;
        +                        }
        +                    } else {
        +                        if (time.isSameIgnoresHash(a)) {
        +                            // Two authenticators in the same second. Considered
        +                            // same if we haven't seen a new style version of it
        +                            if (!seeNewButNotSame) {
        +                                throw new KrbApErrException(Krb5.KRB_AP_ERR_REPEAT);
        +                            }
        +                        }
        +                    }
        +                    if (a.ctime < timeLimit) {
        +                        missed++;
        +                    } else {
        +                        missed--;
        +                    }
        +                } catch (BufferUnderflowException e) {
        +                    // Half-written file?
        +                    chan.position(pos);
        +                    break;
        +                }
        +            }
        +            return missed;
        +        }
        +
        +        private static int readHeader(SeekableByteChannel chan)
        +                throws IOException {
        +            ByteBuffer bb = ByteBuffer.allocate(6);
        +            chan.read(bb);
        +            if (bb.getShort(0) != KRB5_RV_VNO) {
        +                throw new IOException("Not correct rcache version");
        +            }
        +            bb.order(ByteOrder.nativeOrder());
        +            return bb.getInt(2);
        +        }
        +
        +        private void append(AuthTimeWithHash at) throws IOException {
        +            // Write an entry with hash, to be followed by one without it,
        +            // for the benefit of old implementations.
        +            ByteBuffer bb;
        +            bb = ByteBuffer.wrap(at.encode(true));
        +            chan.write(bb);
        +            bb = ByteBuffer.wrap(at.encode(false));
        +            chan.write(bb);
        +        }
        +
        +        @Override
        +        public void close() throws IOException {
        +            if (chan != null) chan.close();
        +            chan = null;
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/MemoryCache.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/security/krb5/internal/rcache/MemoryCache.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,85 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.  Oracle designates this
        + * particular file as subject to the "Classpath" exception as provided
        + * by Oracle in the LICENSE file that accompanied this code.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/*
        + *
        + *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
        + *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
        + */
        +
        +package sun.security.krb5.internal.rcache;
        +
        +import java.util.*;
        +import sun.security.krb5.internal.KerberosTime;
        +import sun.security.krb5.internal.KrbApErrException;
        +import sun.security.krb5.internal.ReplayCache;
        +
        +/**
        + * This class stores replay caches. AuthTimeWithHash objects are categorized
        + * into AuthLists keyed by the names of client and server.
        + *
        + * @author Yanni Zhang
        + */
        +public class MemoryCache extends ReplayCache {
        +
        +    // TODO: One day we'll need to read dynamic krb5.conf.
        +    private static final int lifespan = KerberosTime.getDefaultSkew();
        +    private static final boolean DEBUG = sun.security.krb5.internal.Krb5.DEBUG;
        +
        +    private final Map content = new HashMap<>();
        +
        +    @Override
        +    public synchronized void checkAndStore(KerberosTime currTime, AuthTimeWithHash time)
        +            throws KrbApErrException {
        +        String key = time.client + "|" + time.server;
        +        AuthList rc = content.get(key);
        +        if (DEBUG) {
        +            System.out.println("MemoryCache: add " + time + " to " + key);
        +        }
        +        if (rc == null) {
        +            rc = new AuthList(lifespan);
        +            rc.put(time, currTime);
        +            if (!rc.isEmpty()) {
        +                content.put(key, rc);
        +            }
        +        } else {
        +            if (DEBUG) {
        +                System.out.println("MemoryCache: Existing AuthList:\n" + rc);
        +            }
        +            rc.put(time, currTime);
        +            if (rc.isEmpty()) {
        +                content.remove(key);
        +            }
        +        }
        +    }
        +
        +    public String toString() {
        +        StringBuilder sb = new StringBuilder();
        +        for (AuthList rc: content.values()) {
        +            sb.append(rc.toString());
        +        }
        +        return sb.toString();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/krb5/internal/rcache/ReplayCache.java
        --- a/jdk/src/share/classes/sun/security/krb5/internal/rcache/ReplayCache.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,143 +0,0 @@
        -/*
        - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
        - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        - *
        - * This code is free software; you can redistribute it and/or modify it
        - * under the terms of the GNU General Public License version 2 only, as
        - * published by the Free Software Foundation.  Oracle designates this
        - * particular file as subject to the "Classpath" exception as provided
        - * by Oracle in the LICENSE file that accompanied this code.
        - *
        - * This code is distributed in the hope that it will be useful, but WITHOUT
        - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        - * version 2 for more details (a copy is included in the LICENSE file that
        - * accompanied this code).
        - *
        - * You should have received a copy of the GNU General Public License version
        - * 2 along with this work; if not, write to the Free Software Foundation,
        - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        - *
        - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        - * or visit www.oracle.com if you need additional information or have any
        - * questions.
        - */
        -
        -/*
        - *
        - *  (C) Copyright IBM Corp. 1999 All Rights Reserved.
        - *  Copyright 1997 The Open Group Research Institute.  All rights reserved.
        - */
        -
        -package sun.security.krb5.internal.rcache;
        -
        -import sun.security.krb5.internal.Krb5;
        -import java.util.LinkedList;
        -import java.util.ListIterator;
        -import sun.security.krb5.internal.KerberosTime;
        -
        -/**
        - * This class provides an efficient caching mechanism to store the timestamp of client authenticators.
        - * The cache minimizes the memory usage by doing self-cleanup of expired items in the cache.
        - *
        - * @author Yanni Zhang
        - */
        -public class ReplayCache extends LinkedList {
        -
        -    private static final long serialVersionUID = 2997933194993803994L;
        -
        -    // These 3 fields are now useless, keep for serialization compatibility
        -    private String principal;
        -    private CacheTable table;
        -    private int nap = 10 * 60 * 1000; //10 minutes break
        -
        -    private boolean DEBUG = Krb5.DEBUG;
        -
        -    /**
        -     * Constructs a ReplayCache for a client principal in specified CacheTable.
        -     * @param p client principal name.
        -     * @param ct CacheTable.
        -     */
        -    public ReplayCache (String p, CacheTable ct) {
        -        principal = p;
        -        table = ct;
        -    }
        -
        -    /**
        -     * Puts the authenticator timestamp into the cache in descending order.
        -     * @param t AuthTime
        -     */
        -    public synchronized void put(AuthTime t, long currentTime) {
        -
        -        if (this.size() == 0) {
        -            addFirst(t);
        -        }
        -        else {
        -            AuthTime temp = getFirst();
        -            if (temp.kerberosTime < t.kerberosTime) {
        -                // in most cases, newly received authenticator has
        -                // larger timestamp.
        -                addFirst(t);
        -            }
        -            else if (temp.kerberosTime == t.kerberosTime) {
        -                if (temp.cusec < t.cusec) {
        -                    addFirst(t);
        -                }
        -            }
        -            else {
        -                //unless client clock being re-adjusted.
        -                ListIterator it = listIterator(1);
        -                while (it.hasNext()) {
        -                    temp = it.next();
        -                    if (temp.kerberosTime < t.kerberosTime) {
        -                        add(indexOf(temp), t);
        -                        break;
        -                        //we always put the bigger timestamp at the front.
        -                    }
        -                    else if (temp.kerberosTime == t.kerberosTime) {
        -                        if (temp.cusec < t.cusec) {
        -                            add(indexOf(temp), t);
        -                            break;
        -                        }
        -                    }
        -                }
        -            }
        -        }
        -
        -        // let us cleanup while we are here
        -        long timeLimit = currentTime - KerberosTime.getDefaultSkew() * 1000L;
        -        ListIterator it = listIterator(0);
        -        AuthTime temp = null;
        -        int index = -1;
        -        while (it.hasNext()) {
        -            //search expired timestamps.
        -            temp = it.next();
        -            if (temp.kerberosTime < timeLimit) {
        -                index = indexOf(temp);
        -                break;
        -            }
        -        }
        -        if (index > -1) {
        -            do {
        -                //remove expired timestamps from the list.
        -                removeLast();
        -            } while(size() > index);
        -        }
        -        if (DEBUG) {
        -            printList();
        -        }
        -    }
        -
        -
        -    /**
        -     * Prints out the debug message.
        -     */
        -    private void printList() {
        -        Object[] total = toArray();
        -        for (int i = 0; i < total.length; i++) {
        -            System.out.println("object " + i + ": " + ((AuthTime)total[i]).kerberosTime + "/"
        -                               + ((AuthTime)total[i]).cusec);
        -        }
        -    }
        -
        -}
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java
        --- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -675,8 +675,12 @@
                                               responderURI, respCert, params.date(),
                                               ocspExtensions);
                     }
        -        } catch (IOException e) {
        -            throw new CertPathValidatorException(e);
        +        } catch (Exception e) {
        +            if (e instanceof CertPathValidatorException) {
        +                throw (CertPathValidatorException) e;
        +            } else {
        +                throw new CertPathValidatorException(e);
        +            }
                 }
         
                 RevocationStatus rs =
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/ssl/Handshaker.java
        --- a/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/ssl/Handshaker.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -187,14 +187,14 @@
                             "sun.security.ssl.allowLegacyHelloMessages", true);
         
             // To prevent the TLS renegotiation issues, by setting system property
        -    // "jdk.tls.rejectClientInitializedRenego" to true, applications in server
        -    // side can disable all client initiated SSL renegotiations regardless
        -    // of the support of TLS protocols.
        +    // "jdk.tls.rejectClientInitiatedRenegotiation" to true, applications in
        +    // server side can disable all client initiated SSL renegotiations
        +    // regardless of the support of TLS protocols.
             //
             // By default, allow client initiated renegotiations.
             static final boolean rejectClientInitiatedRenego =
                     Debug.getBooleanProperty(
        -                "jdk.tls.rejectClientInitializedRenego", false);
        +                "jdk.tls.rejectClientInitiatedRenegotiation", false);
         
             // need to dispose the object when it is invalidated
             boolean invalidated;
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java
        --- a/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/classes/sun/security/ssl/ServerHandshaker.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -281,7 +281,15 @@
         
                 // Reject client initiated renegotiation?
                 //
        -        // Should not have any impact on server initiated renegotiation.
        +        // If server side should reject client-initiated renegotiation,
        +        // send an alert_handshake_failure fatal alert, not a no_renegotiation
        +        // warning alert (no_renegotiation must be a warning: RFC 2246).
        +        // no_renegotiation might seem more natural at first, but warnings
        +        // are not appropriate because the sending party does not know how
        +        // the receiving party will behave.  This state must be treated as
        +        // a fatal server condition.
        +        //
        +        // This will not have any impact on server initiated renegotiation.
                 if (rejectClientInitiatedRenego && !isInitialHandshake &&
                         state != HandshakeMessage.ht_hello_request) {
                     fatalSE(Alerts.alert_handshake_failure,
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/classes/sun/util/resources/pt/CalendarData_pt_BR.properties
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/src/share/classes/sun/util/resources/pt/CalendarData_pt_BR.properties	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,40 @@
        +#
        +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        +#
        +# This code is free software; you can redistribute it and/or modify it
        +# under the terms of the GNU General Public License version 2 only, as
        +# published by the Free Software Foundation.  Oracle designates this
        +# particular file as subject to the "Classpath" exception as provided
        +# by Oracle in the LICENSE file that accompanied this code.
        +#
        +# This code is distributed in the hope that it will be useful, but WITHOUT
        +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        +# version 2 for more details (a copy is included in the LICENSE file that
        +# accompanied this code).
        +#
        +# You should have received a copy of the GNU General Public License version
        +# 2 along with this work; if not, write to the Free Software Foundation,
        +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        +#
        +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        +# or visit www.oracle.com if you need additional information or have any
        +# questions.
        +#
        +
        +# (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
        +# (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
        +#
        +# The original version of this source code and documentation
        +# is copyrighted and owned by Taligent, Inc., a wholly-owned
        +# subsidiary of IBM. These materials are provided under terms
        +# of a License Agreement between Taligent and Sun. This technology
        +# is protected by multiple US and International patents.
        +#
        +# This notice and attribution to Taligent may not be removed.
        +# Taligent is a registered trademark of Taligent, Inc.
        +
        +
        +firstDayOfWeek=1
        +minimalDaysInFirstWeek=1
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/native/sun/font/layout/GlyphIterator.cpp
        --- a/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/native/sun/font/layout/GlyphIterator.cpp	Thu Jul 11 12:50:20 2013 -0700
        @@ -66,6 +66,7 @@
                 nextLimit = -1;
                 prevLimit = glyphCount;
             }
        +    filterResetCache();
         }
         
         GlyphIterator::GlyphIterator(GlyphIterator &that)
        @@ -84,6 +85,7 @@
             glyphGroup  = that.glyphGroup;
             glyphClassDefinitionTable = that.glyphClassDefinitionTable;
             markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
        +    filterResetCache();
         }
         
         GlyphIterator::GlyphIterator(GlyphIterator &that, FeatureMask newFeatureMask)
        @@ -102,6 +104,7 @@
             glyphGroup  = 0;
             glyphClassDefinitionTable = that.glyphClassDefinitionTable;
             markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
        +    filterResetCache();
         }
         
         GlyphIterator::GlyphIterator(GlyphIterator &that, le_uint16 newLookupFlags)
        @@ -120,6 +123,7 @@
             glyphGroup  = that.glyphGroup;
             glyphClassDefinitionTable = that.glyphClassDefinitionTable;
             markAttachClassDefinitionTable = that.markAttachClassDefinitionTable;
        +    filterResetCache();
         }
         
         GlyphIterator::~GlyphIterator()
        @@ -133,6 +137,7 @@
             featureMask  = newFeatureMask;
             glyphGroup   = 0;
             lookupFlags  = newLookupFlags;
        +    filterResetCache();
         }
         
         LEGlyphID *GlyphIterator::insertGlyphs(le_int32 count, LEErrorCode& success)
        @@ -381,53 +386,68 @@
             glyphPositionAdjustments->setCursiveGlyph(position, baselineIsLogicalEnd());
         }
         
        -le_bool GlyphIterator::filterGlyph(le_uint32 index) const
        -{
        -    LEErrorCode success = LE_NO_ERROR;
        -    LEGlyphID glyphID = glyphStorage[index];
        -    le_int32 glyphClass = gcdNoGlyphClass;
        -
        -    if (LE_GET_GLYPH(glyphID) >= 0xFFFE) {
        -        return TRUE;
        +void GlyphIterator::filterResetCache(void) {
        +  filterCacheValid = FALSE;
             }
         
        +le_bool GlyphIterator::filterGlyph(le_uint32 index)
        +{
        +    LEGlyphID glyphID = glyphStorage[index];
        +
        +    if (!filterCacheValid || filterCache.id != glyphID) {
        +      filterCache.id = glyphID;
        +
        +      le_bool &filterResult = filterCache.result;  // NB: Making this a reference to accept the updated value, in case
        +                                               // we want more fancy cacheing in the future.
        +    if (LE_GET_GLYPH(glyphID) >= 0xFFFE) {
        +        filterResult = TRUE;
        +      } else {
        +        LEErrorCode success = LE_NO_ERROR;
        +        le_int32 glyphClass = gcdNoGlyphClass;
             if (glyphClassDefinitionTable.isValid()) {
               glyphClass = glyphClassDefinitionTable->getGlyphClass(glyphClassDefinitionTable, glyphID, success);
             }
        -
        -    switch (glyphClass)
        -    {
        +        switch (glyphClass) {
             case gcdNoGlyphClass:
        -        return FALSE;
        +          filterResult = FALSE;
        +          break;
         
             case gcdSimpleGlyph:
        -        return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
        +          filterResult = (lookupFlags & lfIgnoreBaseGlyphs) != 0;
        +          break;
         
             case gcdLigatureGlyph:
        -        return (lookupFlags & lfIgnoreLigatures) != 0;
        +          filterResult = (lookupFlags & lfIgnoreLigatures) != 0;
        +          break;
         
             case gcdMarkGlyph:
        -    {
                 if ((lookupFlags & lfIgnoreMarks) != 0) {
        -            return TRUE;
        -        }
        -
        +            filterResult = TRUE;
        +          } else {
                 le_uint16 markAttachType = (lookupFlags & lfMarkAttachTypeMask) >> lfMarkAttachTypeShift;
         
                 if ((markAttachType != 0) && (markAttachClassDefinitionTable.isValid())) {
        -          return markAttachClassDefinitionTable
        -            -> getGlyphClass(markAttachClassDefinitionTable, glyphID, success) != markAttachType;
        +              filterResult = (markAttachClassDefinitionTable
        +                          -> getGlyphClass(markAttachClassDefinitionTable, glyphID, success) != markAttachType);
        +            } else {
        +              filterResult = FALSE;
        +        }
        +    }
        +          break;
        +
        +    case gcdComponentGlyph:
        +          filterResult = ((lookupFlags & lfIgnoreBaseGlyphs) != 0);
        +          break;
        +
        +    default:
        +          filterResult = FALSE;
        +          break;
        +    }
        +      }
        +      filterCacheValid = TRUE;
                 }
         
        -        return FALSE;
        -    }
        -
        -    case gcdComponentGlyph:
        -        return (lookupFlags & lfIgnoreBaseGlyphs) != 0;
        -
        -    default:
        -        return FALSE;
        -    }
        +    return filterCache.result;
         }
         
         le_bool GlyphIterator::hasFeatureTag(le_bool matchGroup) const
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/native/sun/font/layout/GlyphIterator.h
        --- a/jdk/src/share/native/sun/font/layout/GlyphIterator.h	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/native/sun/font/layout/GlyphIterator.h	Thu Jul 11 12:50:20 2013 -0700
        @@ -98,7 +98,7 @@
             le_int32 applyInsertions();
         
         private:
        -    le_bool filterGlyph(le_uint32 index) const;
        +    le_bool filterGlyph(le_uint32 index);
             le_bool hasFeatureTag(le_bool matchGroup) const;
             le_bool nextInternal(le_uint32 delta = 1);
             le_bool prevInternal(le_uint32 delta = 1);
        @@ -121,6 +121,14 @@
             LEReferenceTo markAttachClassDefinitionTable;
         
             GlyphIterator &operator=(const GlyphIterator &other); // forbid copying of this class
        +
        +    struct {
        +      LEGlyphID   id;
        +      le_bool     result;
        +    } filterCache;
        +    le_bool   filterCacheValid;
        +
        +    void filterResetCache(void);
         };
         
         U_NAMESPACE_END
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/native/sun/font/layout/LETableReference.h
        --- a/jdk/src/share/native/sun/font/layout/LETableReference.h	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/native/sun/font/layout/LETableReference.h	Thu Jul 11 12:50:20 2013 -0700
        @@ -376,7 +376,7 @@
            * @param success error status
            * @param atPtr location of reference - if NULL, will be at offset zero (i.e. downcast of parent). Otherwise must be a pointer within parent's bounds.
            */
        -  LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr)
        + inline LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr)
             : LETableReference(parent, parent.ptrToOffset(atPtr, success), LE_UINTPTR_MAX, success) {
             verifyLength(0, LETableVarSizer::getSize(), success);
             if(LE_FAILURE(success)) clear();
        @@ -384,31 +384,31 @@
           /**
            * ptr plus offset
            */
        - LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr, size_t offset)
        + inline LEReferenceTo(const LETableReference &parent, LEErrorCode &success, const void* atPtr, size_t offset)
             : LETableReference(parent, parent.ptrToOffset(atPtr, success)+offset, LE_UINTPTR_MAX, success) {
             verifyLength(0, LETableVarSizer::getSize(), success);
             if(LE_FAILURE(success)) clear();
           }
        -  LEReferenceTo(const LETableReference &parent, LEErrorCode &success, size_t offset)
        + inline LEReferenceTo(const LETableReference &parent, LEErrorCode &success, size_t offset)
             : LETableReference(parent, offset, LE_UINTPTR_MAX, success) {
             verifyLength(0, LETableVarSizer::getSize(), success);
             if(LE_FAILURE(success)) clear();
           }
        -  LEReferenceTo(const LETableReference &parent, LEErrorCode &success)
        + inline LEReferenceTo(const LETableReference &parent, LEErrorCode &success)
             : LETableReference(parent, 0, LE_UINTPTR_MAX, success) {
             verifyLength(0, LETableVarSizer::getSize(), success);
             if(LE_FAILURE(success)) clear();
           }
        - LEReferenceTo(const LEFontInstance *font, LETag tableTag, LEErrorCode &success)
        + inline LEReferenceTo(const LEFontInstance *font, LETag tableTag, LEErrorCode &success)
            : LETableReference(font, tableTag, success) {
             verifyLength(0, LETableVarSizer::getSize(), success);
             if(LE_FAILURE(success)) clear();
           }
        - LEReferenceTo(const le_uint8 *data, size_t length = LE_UINTPTR_MAX) : LETableReference(data, length) {}
        - LEReferenceTo(const T *data, size_t length = LE_UINTPTR_MAX) : LETableReference((const le_uint8*)data, length) {}
        -  LEReferenceTo() : LETableReference(NULL) {}
        + inline LEReferenceTo(const le_uint8 *data, size_t length = LE_UINTPTR_MAX) : LETableReference(data, length) {}
        + inline LEReferenceTo(const T *data, size_t length = LE_UINTPTR_MAX) : LETableReference((const le_uint8*)data, length) {}
        + inline LEReferenceTo() : LETableReference(NULL) {}
         
        -  LEReferenceTo& operator=(const T* other) {
        + inline LEReferenceTo& operator=(const T* other) {
             setRaw(other);
             return *this;
           }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp
        --- a/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/native/sun/font/layout/OpenTypeUtilities.cpp	Thu Jul 11 12:50:20 2013 -0700
        @@ -79,6 +79,7 @@
         
         Offset OpenTypeUtilities::getTagOffset(LETag tag, const LEReferenceToArrayOf &records, LEErrorCode &success)
         {
        +  const TagAndOffsetRecord *r0 = (const TagAndOffsetRecord*)records.getAlias();
           if(LE_FAILURE(success)) return 0;
         
           le_uint32 recordCount = records.getCount();
        @@ -89,17 +90,17 @@
           le_int32 index = 0;
         
           {
        -    const ATag &aTag = records.getAlias(extra,success)->tag;
        +    const ATag &aTag = (r0+extra)->tag;
             if (SWAPT(aTag) <= tag) {
               index = extra;
             }
           }
         
        -  while (probe > (1 << 0) && LE_SUCCESS(success)) {
        +  while (probe > (1 << 0)) {
             probe >>= 1;
         
             {
        -      const ATag &aTag = records.getAlias(index+probe,success)->tag;
        +      const ATag &aTag = (r0+index+probe)->tag;
               if (SWAPT(aTag) <= tag) {
                 index += probe;
               }
        @@ -107,9 +108,9 @@
           }
         
           {
        -    const ATag &aTag = records.getAlias(index,success)->tag;
        +    const ATag &aTag = (r0+index)->tag;
             if (SWAPT(aTag) == tag) {
        -      return SWAPW(records.getAlias(index,success)->offset);
        +      return SWAPW((r0+index)->offset);
             }
           }
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/share/native/sun/java2d/opengl/OGLContext.c
        --- a/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/share/native/sun/java2d/opengl/OGLContext.c	Thu Jul 11 12:50:20 2013 -0700
        @@ -662,6 +662,13 @@
                 return JNI_FALSE;
             }
         
        +    // next see if the depth texture extension is available
        +    if (!OGLContext_IsExtensionAvailable(extString,
        +                                         "GL_ARB_depth_texture"))
        +    {
        +        return JNI_FALSE;
        +    }
        +
             // next see if the fbobject system property has been enabled
             isFBObjectEnabled =
                 JNU_GetStaticFieldByName(env, NULL,
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java
        --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -904,11 +904,12 @@
              */
             public void dispose() {
                 setDisposed(true);
        -        EventQueue.invokeLater(new Runnable() {
        +        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
                     public void run() {
                         doDispose();
                     }
                 });
        +        super.postEvent(ev);
             }
         
             /**
        @@ -933,11 +934,12 @@
              * so events can not be processed using standart means
              */
             void postEvent(final AWTEvent event) {
        -        EventQueue.invokeLater(new Runnable() {
        -                public void run() {
        -                    handleEvent(event);
        -                }
        -            });
        +        InvocationEvent ev = new InvocationEvent(event.getSource(), new Runnable() {
        +            public void run() {
        +                handleEvent(event);
        +            }
        +        });
        +        super.postEvent(ev);
             }
         
             /**
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java
        --- a/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/solaris/classes/sun/awt/X11/XChoicePeer.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -1033,15 +1033,17 @@
                     //fix 6252982: PIT: Keyboard FocusTraversal not working when choice's drop-down is visible, on XToolkit
                     if (e instanceof KeyEvent){
                         // notify XWindow that this event had been already handled and no need to post it again
        -                EventQueue.invokeLater(new Runnable() {
        -                        public void run() {
        -                            if(target.isFocusable() &&
        -                               getParentTopLevel().isFocusableWindow() )
        -                            {
        -                                handleJavaKeyEvent((KeyEvent)e);
        -                            }
        +                InvocationEvent ev = new InvocationEvent(target, new Runnable() {
        +                    public void run() {
        +                        if(target.isFocusable() &&
        +                                getParentTopLevel().isFocusableWindow() )
        +                        {
        +                            handleJavaKeyEvent((KeyEvent)e);
                                 }
        -                    });
        +                    }
        +                });
        +                postEvent(ev);
        +
                         return true;
                     } else {
                         if (e instanceof MouseEvent){
        @@ -1083,11 +1085,13 @@
             //convenient method
             //do not generate this kind of Events
             public boolean handleMouseEventByChoice(final MouseEvent me){
        -        EventQueue.invokeLater(new Runnable() {
        -                public void run() {
        -                    handleJavaMouseEvent(me);
        -                }
        -            });
        +        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
        +            public void run() {
        +                handleJavaMouseEvent(me);
        +            }
        +        });
        +        postEvent(ev);
        +
                 return true;
             }
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/solaris/classes/sun/awt/X11/XListPeer.java
        --- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -1669,11 +1669,12 @@
              * Do handleJavaMouseEvent on EDT
              */
             void handleJavaMouseEventOnEDT(final MouseEvent me){
        -        EventQueue.invokeLater(new Runnable() {
        -                public void run() {
        -                    handleJavaMouseEvent(me);
        -                }
        -            });
        +        InvocationEvent ev = new InvocationEvent(target, new Runnable() {
        +            public void run() {
        +                handleJavaMouseEvent(me);
        +            }
        +        });
        +        postEvent(ev);
             }
         
             /*
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
        --- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c	Thu Jul 11 12:50:20 2013 -0700
        @@ -43,7 +43,14 @@
         #ifndef SO_BSDCOMPAT
         #define SO_BSDCOMPAT  14
         #endif
        +/**
        + * IP_MULTICAST_ALL has been supported since kernel version 2.6.31
        + * but we may be building on a machine that is older than that.
        + */
        +#ifndef IP_MULTICAST_ALL
        +#define IP_MULTICAST_ALL      49
         #endif
        +#endif  //  __linux__
         
         #ifndef IPTOS_TOS_MASK
         #define IPTOS_TOS_MASK 0x1e
        @@ -980,6 +987,18 @@
         
              setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int));
         
        +#if defined(__linux__)
        +     arg = 0;
        +     int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP;
        +     if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) &&
        +         (errno != ENOPROTOOPT)) {
        +         JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
        +                         strerror(errno));
        +         close(fd);
        +         return;
        +     }
        +#endif
        +
         #if defined (__linux__) && defined (AF_INET6)
             /*
              * On Linux for IPv6 sockets we must set the hop limit
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/solaris/native/sun/nio/ch/Net.c
        --- a/jdk/src/solaris/native/sun/nio/ch/Net.c	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/solaris/native/sun/nio/ch/Net.c	Thu Jul 11 12:50:20 2013 -0700
        @@ -40,6 +40,17 @@
         #include "nio.h"
         #include "sun_nio_ch_PollArrayWrapper.h"
         
        +
        +/**
        + * IP_MULTICAST_ALL supported since 2.6.31 but may not be available at
        + * build time.
        + */
        +#ifdef __linux__
        +  #ifndef IP_MULTICAST_ALL
        +  #define IP_MULTICAST_ALL    49
        +  #endif
        +#endif
        +
         #ifdef _ALLBSD_SOURCE
         
         #ifndef IP_BLOCK_SOURCE
        @@ -175,7 +186,7 @@
                                sizeof(int)) < 0) {
                     JNU_ThrowByNameWithLastError(env,
                                                  JNU_JAVANETPKG "SocketException",
        -                                         "sun.nio.ch.Net.setIntOption");
        +                                         "Unable to set IPV6_V6ONLY");
                     close(fd);
                     return -1;
                 }
        @@ -188,11 +199,27 @@
                                sizeof(arg)) < 0) {
                     JNU_ThrowByNameWithLastError(env,
                                                  JNU_JAVANETPKG "SocketException",
        -                                         "sun.nio.ch.Net.setIntOption");
        +                                         "Unable to set SO_REUSEADDR");
                     close(fd);
                     return -1;
                 }
             }
        +
        +#if defined(__linux__)
        +    if (type == SOCK_DGRAM) {
        +        int arg = 0;
        +        int level = (domain == AF_INET6) ? IPPROTO_IPV6 : IPPROTO_IP;
        +        if ((setsockopt(fd, level, IP_MULTICAST_ALL, (char*)&arg, sizeof(arg)) < 0) &&
        +            (errno != ENOPROTOOPT)) {
        +            JNU_ThrowByNameWithLastError(env,
        +                                         JNU_JAVANETPKG "SocketException",
        +                                         "Unable to set IP_MULTICAST_ALL");
        +            close(fd);
        +            return -1;
        +        }
        +    }
        +#endif
        +
         #if defined(__linux__) && defined(AF_INET6)
             /* By default, Linux uses the route default */
             if (domain == AF_INET6 && type == SOCK_DGRAM) {
        @@ -201,7 +228,7 @@
                                sizeof(arg)) < 0) {
                     JNU_ThrowByNameWithLastError(env,
                                                  JNU_JAVANETPKG "SocketException",
        -                                         "sun.nio.ch.Net.setIntOption");
        +                                         "Unable to set IPV6_MULTICAST_HOPS");
                     close(fd);
                     return -1;
                 }
        @@ -646,7 +673,7 @@
                 return pfd.revents;
             } else if (errno == EINTR) {
                 return IOS_INTERRUPTED;
        -    } else if (rv < 0) {
        +    } else {
                 handleSocketError(env, errno);
                 return IOS_THROWN;
             }
        diff -r 0273c023680c -r 6ed8434664ed jdk/src/windows/classes/sun/print/Win32PrintService.java
        --- a/jdk/src/windows/classes/sun/print/Win32PrintService.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -28,11 +28,8 @@
         import java.io.File;
         import java.net.URI;
         import java.net.URISyntaxException;
        -import java.net.URL;
        -
        -import java.util.Vector;
        +import java.util.ArrayList;
         import java.util.HashMap;
        -
         import javax.print.DocFlavor;
         import javax.print.DocPrintJob;
         import javax.print.PrintService;
        @@ -69,22 +66,14 @@
         import javax.print.attribute.standard.Sides;
         import javax.print.attribute.standard.ColorSupported;
         import javax.print.attribute.standard.PrintQuality;
        -import javax.print.attribute.ResolutionSyntax;
         import javax.print.attribute.standard.PrinterResolution;
         import javax.print.attribute.standard.SheetCollate;
         import javax.print.event.PrintServiceAttributeListener;
        -import java.util.ArrayList;
        -
        -import sun.print.SunPrinterJobService;
         
         public class Win32PrintService implements PrintService, AttributeUpdater,
                                                   SunPrinterJobService {
         
        -    public static MediaSize[] predefMedia;
        -
        -    static {
        -        Class c = Win32MediaSize.class;
        -    }
        +    public static MediaSize[] predefMedia = Win32MediaSize.getPredefMedia();
         
             private static final DocFlavor[] supportedFlavors = {
                 DocFlavor.BYTE_ARRAY.GIF,
        @@ -313,7 +302,9 @@
         
             public MediaSizeName findWin32Media(int dmIndex) {
                 if (dmIndex >= 1 && dmIndex <= dmPaperToPrintService.length) {
        -           switch(dmIndex) {
        +            return dmPaperToPrintService[dmIndex - 1];
        +        }
        +        switch(dmIndex) {
                     /* matching media sizes with indices beyond
                        dmPaperToPrintService's length */
                     case DMPAPER_A2:
        @@ -323,11 +314,8 @@
                     case DMPAPER_B6_JIS:
                         return MediaSizeName.JIS_B6;
                     default:
        -                return dmPaperToPrintService[dmIndex - 1];
        -            }
        +                return null;
                 }
        -
        -        return null;
             }
         
             private boolean addToUniqueList(ArrayList msnList, MediaSizeName mediaName) {
        @@ -353,6 +341,7 @@
                 }
         
                 ArrayList msnList = new ArrayList();
        +        ArrayList trailingWmsList = new ArrayList();
                 ArrayList printableList = new ArrayList();
                 MediaSizeName mediaName;
                 boolean added;
        @@ -371,7 +360,8 @@
                     idList.add(Integer.valueOf(media[i]));
                 }
         
        -        mediaSizes = getMediaSizes(idList, media);
        +        ArrayList dmPaperNameList = new ArrayList();
        +        mediaSizes = getMediaSizes(idList, media, dmPaperNameList);
                 for (int i = 0; i < idList.size(); i++) {
         
                     // match Win ID with our predefined ID using table
        @@ -390,6 +380,7 @@
                            mediaName = null;
                         }
                     }
        +            boolean dmPaperIDMatched = (mediaName != null);
         
                     // No match found, then we get the MediaSizeName out of the MediaSize
                     // This requires 1-1 correspondence, lengths must be checked.
        @@ -398,9 +389,32 @@
                     }
         
                     // Add mediaName to the msnList
        +            added = false;
                     if (mediaName != null) {
                         added = addToUniqueList(msnList, mediaName);
                     }
        +            if ((!dmPaperIDMatched || !added) && (idList.size() == dmPaperNameList.size())) {
        +                /* The following block allows to add such media names to the list, whose sizes
        +                 * matched with media sizes predefined in JDK, while whose paper IDs did not,
        +                 * or whose sizes and paper IDs both did not match with any predefined in JDK.
        +                 */
        +                Win32MediaSize wms = Win32MediaSize.findMediaName(dmPaperNameList.get(i));
        +                if ((wms == null) && (idList.size() == mediaSizes.length)) {
        +                    wms = new Win32MediaSize(dmPaperNameList.get(i), (Integer)idList.get(i));
        +                    mediaSizes[i] = new MediaSize(mediaSizes[i].getX(MediaSize.MM),
        +                        mediaSizes[i].getY(MediaSize.MM), MediaSize.MM, wms);
        +                }
        +                if ((wms != null) && (wms != mediaName)) {
        +                    if (!added) {
        +                        added = addToUniqueList(msnList, mediaName = wms);
        +                    } else {
        +                        trailingWmsList.add(wms);
        +                    }
        +                }
        +            }
        +        }
        +        for (Win32MediaSize wms : trailingWmsList) {
        +            added = addToUniqueList(msnList, wms);
                 }
         
                 // init mediaSizeNames
        @@ -591,7 +605,11 @@
             }
         
         
        -    private MediaSize[] getMediaSizes(ArrayList idList, int[] media) {
        +    private MediaSize[] getMediaSizes(ArrayList idList, int[] media, ArrayList dmPaperNameList) {
        +        if (dmPaperNameList == null) {
        +            dmPaperNameList = new ArrayList();
        +        }
        +
                 String prnPort = getPort();
                 int[] mediaSz = getAllMediaSizes(printer, prnPort);
                 String[] winMediaNames = getAllMediaNames(printer, prnPort);
        @@ -610,40 +628,43 @@
                     wid = mediaSz[i*2]/10f;
                     ht = mediaSz[i*2+1]/10f;
         
        -          // Make sure to validate wid & ht.
        -          // HP LJ 4050 (german) causes IAE in Sonderformat paper, wid & ht
        -          // returned is not constant.
        -          if ((wid <= 0) || (ht <= 0)) {
        -            //Remove corresponding ID from list
        -            if (nMedia == media.length) {
        -                Integer remObj = Integer.valueOf(media[i]);
        -              idList.remove(idList.indexOf(remObj));
        +            // Make sure to validate wid & ht.
        +            // HP LJ 4050 (german) causes IAE in Sonderformat paper, wid & ht
        +            // returned is not constant.
        +            if ((wid <= 0) || (ht <= 0)) {
        +                //Remove corresponding ID from list
        +                if (nMedia == media.length) {
        +                    Integer remObj = Integer.valueOf(media[i]);
        +                    idList.remove(idList.indexOf(remObj));
        +                }
        +                continue;
        +            }
        +            // Find matching media using dimensions.
        +            // This call matches only with our own predefined sizes.
        +            msn = findMatchingMediaSizeNameMM(wid, ht);
        +            if (msn != null) {
        +                ms = MediaSize.getMediaSizeForName(msn);
                     }
        -            continue;
        -          }
        -          // Find matching media using dimensions.
        -          // This call matches only with our own predefined sizes.
        -          msn = findMatchingMediaSizeNameMM(wid, ht);
        -          if (msn != null) {
        -            ms = MediaSize.getMediaSizeForName(msn);
        -          }
         
        -          if (ms != null) {
        -            msList.add(ms);
        -          } else {
        -              Win32MediaSize wms =
        -                new Win32MediaSize(winMediaNames[i], media[i]);
        -            try {
        -              ms = new MediaSize(wid, ht, MediaSize.MM, wms);
        -              msList.add(ms);
        -            } catch(IllegalArgumentException e) {
        -              if (nMedia == media.length) {
        -                  Integer remObj = Integer.valueOf(media[i]);
        -                idList.remove(idList.indexOf(remObj));
        -              }
        +            if (ms != null) {
        +                msList.add(ms);
        +                dmPaperNameList.add(winMediaNames[i]);
        +            } else {
        +                Win32MediaSize wms = Win32MediaSize.findMediaName(winMediaNames[i]);
        +                if (wms == null) {
        +                    wms = new Win32MediaSize(winMediaNames[i], media[i]);
        +                }
        +                try {
        +                    ms = new MediaSize(wid, ht, MediaSize.MM, wms);
        +                    msList.add(ms);
        +                    dmPaperNameList.add(winMediaNames[i]);
        +                } catch(IllegalArgumentException e) {
        +                    if (nMedia == media.length) {
        +                        Integer remObj = Integer.valueOf(media[i]);
        +                        idList.remove(idList.indexOf(remObj));
        +                    }
        +                }
                     }
        -          }
        -
                 }
         
                 MediaSize[] arr2 = new MediaSize[msList.size()];
        @@ -1617,6 +1638,7 @@
         class Win32MediaSize extends MediaSizeName {
             private static ArrayList winStringTable = new ArrayList();
             private static ArrayList winEnumTable = new ArrayList();
        +    private static MediaSize[] predefMedia;
         
             private int dmPaperID; // driver ID for this paper.
         
        @@ -1630,6 +1652,18 @@
               return (winStringTable.size()-1);
             }
         
        +    public static synchronized Win32MediaSize findMediaName(String name) {
        +        int nameIndex = winStringTable.indexOf(name);
        +        if (nameIndex != -1) {
        +            return (Win32MediaSize)winEnumTable.get(nameIndex);
        +        }
        +        return null;
        +    }
        +
        +    public static MediaSize[] getPredefMedia() {
        +        return predefMedia;
        +    }
        +
             public Win32MediaSize(String name, int dmPaper) {
                 super(nextValue(name));
                 dmPaperID = dmPaper;
        @@ -1641,18 +1675,17 @@
             }
         
             static {
        -         /* initialize Win32PrintService.predefMedia */
        +         /* initialize predefMedia */
                 {
                     Win32MediaSize winMedia = new Win32MediaSize(-1);
         
                     // cannot call getSuperEnumTable directly because of static context
                     MediaSizeName[] enumMedia = winMedia.getSuperEnumTable();
                     if (enumMedia != null) {
        -                Win32PrintService.predefMedia = new MediaSize[enumMedia.length];
        +                predefMedia = new MediaSize[enumMedia.length];
         
                         for (int i=0; iFindClass(env, "java/net/InetSocketAddress");
        +    CHECK_NULL(cls);
             isa_class = (*env)->NewGlobalRef(env, cls);
             isa_ctorID = (*env)->GetMethodID(env, cls, "",
                                              "(Ljava/net/InetAddress;I)V");
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/ProblemList.txt
        --- a/jdk/test/ProblemList.txt	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/ProblemList.txt	Thu Jul 11 12:50:20 2013 -0700
        @@ -137,6 +137,10 @@
         # 8015780
         java/lang/reflect/Method/GenericStringTest.java			generic-all
         
        +# 8019500
        +java/lang/management/MemoryMXBean/MemoryTestAllGC.sh            generic-all
        +java/lang/management/MemoryMXBean/MemoryTest.java               generic-all
        +
         ############################################################################
         
         # jdk_management
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/TEST.ROOT
        --- a/jdk/test/TEST.ROOT	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/TEST.ROOT	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,6 +1,5 @@
         # This file identifies the root of the test-suite hierarchy.
         # It also contains test-suite configuration information.
        -# DO NOT EDIT without first contacting jdk-regtest@sun.com.
         
         # The list of keywords supported in the entire test suite
         keys=2d dnd i18n
        @@ -9,4 +8,4 @@
         othervm.dirs=java/awt java/beans java/rmi javax/accessibility javax/imageio javax/sound javax/print javax/management com/sun/awt sun/awt sun/java2d sun/pisces sun/rmi
         
         # Tests that cannot run concurrently
        -exclusiveAccess.dirs=java/rmi/Naming java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
        +exclusiveAccess.dirs=java/rmi/Naming java/util/Currency java/util/prefs sun/management/jmxremote sun/tools/jstatd sun/security/mscapi
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java
        --- a/jdk/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/awt/Mouse/EnterExitEvents/FullscreenEnterEventTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        -* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
        +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
         *
         * This code is free software; you can redistribute it and/or modify it
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/beans/XMLEncoder/Test8016545.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/beans/XMLEncoder/Test8016545.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,106 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8016545
        + * @summary Tests beans with predefined fields
        + * @author Sergey Malenkov
        + */
        +
        +public class Test8016545 extends AbstractTest {
        +    public static void main(String[] args) {
        +        new Test8016545().test(true);
        +    }
        +
        +    @Override
        +    protected Object getObject() {
        +        Bean bean = new Bean();
        +        bean.setUndefined(Boolean.FALSE);
        +        Info info = new Info();
        +        info.setEnabled(Boolean.TRUE);
        +        info.setID(1);
        +        bean.setInfo(info);
        +        return bean;
        +    }
        +
        +    @Override
        +    protected Object getAnotherObject() {
        +        Bean bean = new Bean();
        +        bean.setUndefined(Boolean.TRUE);
        +        bean.getInfo().setEnabled(Boolean.FALSE);
        +        bean.getInfo().setID(2);
        +        return bean;
        +    }
        +
        +    public static class Bean {
        +        private Info info = new Info(); // predefined
        +        private Boolean defined = Boolean.TRUE;
        +        private Boolean undefined;
        +
        +        public Info getInfo() {
        +            return this.info;
        +        }
        +
        +        public void setInfo(Info info) {
        +            this.info = info;
        +        }
        +
        +        public Boolean getDefined() {
        +            return this.defined;
        +        }
        +
        +        public void setDefined(Boolean defined) {
        +            this.defined = defined;
        +        }
        +
        +        public Boolean getUndefined() {
        +            return this.undefined;
        +        }
        +
        +        public void setUndefined(Boolean undefined) {
        +            this.undefined = undefined;
        +        }
        +    }
        +
        +    public static class Info {
        +        private Integer id;
        +        private Boolean enabled;
        +
        +        public Integer getID() {
        +            return this.id;
        +        }
        +
        +        public void setID(Integer id) {
        +            this.id = id;
        +        }
        +
        +        public Boolean getEnabled() {
        +            return this.enabled;
        +        }
        +
        +        public void setEnabled(Boolean enabled) {
        +            this.enabled = enabled;
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/lang/Double/ParseDouble.java
        --- a/jdk/test/java/lang/Double/ParseDouble.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/lang/Double/ParseDouble.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,20 +23,106 @@
         
         /*
          * @test
        - * @bug 4160406 4705734 4707389 4826774 4895911 4421494 7021568 7039369
        + * @bug 4160406 4705734 4707389 4826774 4895911 4421494 6358355 7021568 7039369 4396272
          * @summary Test for Double.parseDouble method and acceptance regex
          */
         
        +import java.math.BigDecimal;
        +import java.math.BigInteger;
         import java.util.regex.*;
        -import java.math.BigDecimal;
         
         public class ParseDouble {
         
        +    private static final BigDecimal HALF = BigDecimal.valueOf(0.5);
        +
        +    private static void fail(String val, double n) {
        +        throw new RuntimeException("Double.parseDouble failed. String:" +
        +                                                val + " Result:" + n);
        +    }
        +
        +    private static void check(String val) {
        +        double n = Double.parseDouble(val);
        +        boolean isNegativeN = n < 0 || n == 0 && 1/n < 0;
        +        double na = Math.abs(n);
        +        String s = val.trim().toLowerCase();
        +        switch (s.charAt(s.length() - 1)) {
        +            case 'd':
        +            case 'f':
        +                s = s.substring(0, s.length() - 1);
        +                break;
        +        }
        +        boolean isNegative = false;
        +        if (s.charAt(0) == '+') {
        +            s = s.substring(1);
        +        } else if (s.charAt(0) == '-') {
        +            s = s.substring(1);
        +            isNegative = true;
        +        }
        +        if (s.equals("nan")) {
        +            if (!Double.isNaN(n)) {
        +                fail(val, n);
        +            }
        +            return;
        +        }
        +        if (Double.isNaN(n)) {
        +            fail(val, n);
        +        }
        +        if (isNegativeN != isNegative)
        +            fail(val, n);
        +        if (s.equals("infinity")) {
        +            if (na != Double.POSITIVE_INFINITY) {
        +                fail(val, n);
        +            }
        +            return;
        +        }
        +        BigDecimal bd;
        +        if (s.startsWith("0x")) {
        +            s = s.substring(2);
        +            int indP = s.indexOf('p');
        +            long exp = Long.parseLong(s.substring(indP + 1));
        +            int indD = s.indexOf('.');
        +            String significand;
        +            if (indD >= 0) {
        +                significand = s.substring(0, indD) + s.substring(indD + 1, indP);
        +                exp -= 4*(indP - indD - 1);
        +            } else {
        +                significand = s.substring(0, indP);
        +            }
        +            bd = new BigDecimal(new BigInteger(significand, 16));
        +            if (exp >= 0) {
        +                bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp));
        +            } else {
        +                bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp));
        +            }
        +        } else {
        +            bd = new BigDecimal(s);
        +        }
        +        BigDecimal l, u;
        +        if (Double.isInfinite(na)) {
        +            l = new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(Math.ulp(Double.MAX_VALUE)).multiply(HALF));
        +            u = null;
        +        } else {
        +            l = new BigDecimal(na).subtract(new BigDecimal(Math.ulp(Math.nextUp(-na))).multiply(HALF));
        +            u = new BigDecimal(na).add(new BigDecimal(Math.ulp(n)).multiply(HALF));
        +        }
        +        int cmpL = bd.compareTo(l);
        +        int cmpU = u != null ? bd.compareTo(u) : -1;
        +        if ((Double.doubleToLongBits(n) & 1) != 0) {
        +            if (cmpL <= 0 || cmpU >= 0) {
        +                fail(val, n);
        +            }
        +        } else {
        +            if (cmpL < 0 || cmpU > 0) {
        +                fail(val, n);
        +            }
        +        }
        +    }
        +
             private static void check(String val, double expected) {
                 double n = Double.parseDouble(val);
                 if (n != expected)
        -            throw new RuntimeException("Double.parseDouble failed. String:" +
        -                                                val + " Result:" + n);
        +            fail(val, n);
        +        check(val);
             }
         
             private static void rudimentaryTest() {
        @@ -460,6 +546,7 @@
         
                     try {
                         d = Double.parseDouble(input[i]);
        +                check(input[i]);
                     }
                     catch (NumberFormatException e) {
                         if (! exceptionalInput) {
        @@ -560,12 +647,13 @@
              * region that should convert to that value.
              */
             private static void testSubnormalPowers() {
        +        boolean failed = false;
                 BigDecimal TWO = BigDecimal.valueOf(2);
                 // An ulp is the same for all subnormal values
                 BigDecimal ulp_BD = new BigDecimal(Double.MIN_VALUE);
         
        -        // Test subnormal powers of two
        -        for(int i = -1074; i <= -1022; i++) {
        +        // Test subnormal powers of two (except Double.MIN_VALUE)
        +        for(int i = -1073; i <= -1022; i++) {
                     double d = Math.scalb(1.0, i);
         
                     /*
        @@ -578,17 +666,69 @@
         
                     double convertedLowerBound = Double.parseDouble(lowerBound.toString());
                     double convertedUpperBound = Double.parseDouble(upperBound.toString());
        +            if (convertedLowerBound != d) {
        +                failed = true;
        +                System.out.printf("2^%d lowerBound converts as %a %s%n",
        +                                  i, convertedLowerBound, lowerBound);
        +            }
        +            if (convertedUpperBound != d) {
        +                failed = true;
        +                System.out.printf("2^%d upperBound converts as %a %s%n",
        +                                  i, convertedUpperBound, upperBound);
        +            }
                 }
        +        /*
        +         * Double.MIN_VALUE
        +         * The region ]0.5*Double.MIN_VALUE, 1.5*Double.MIN_VALUE[ should round to Double.MIN_VALUE .
        +         */
        +        BigDecimal minValue = new BigDecimal(Double.MIN_VALUE);
        +        if (Double.parseDouble(minValue.multiply(new BigDecimal(0.5)).toString()) != 0.0) {
        +            failed = true;
        +            System.out.printf("0.5*MIN_VALUE doesn't convert 0%n");
        +        }
        +        if (Double.parseDouble(minValue.multiply(new BigDecimal(0.50000000001)).toString()) != Double.MIN_VALUE) {
        +            failed = true;
        +            System.out.printf("0.50000000001*MIN_VALUE doesn't convert to MIN_VALUE%n");
        +        }
        +        if (Double.parseDouble(minValue.multiply(new BigDecimal(1.49999999999)).toString()) != Double.MIN_VALUE) {
        +            failed = true;
        +            System.out.printf("1.49999999999*MIN_VALUE doesn't convert to MIN_VALUE%n");
        +        }
        +        if (Double.parseDouble(minValue.multiply(new BigDecimal(1.5)).toString()) != 2*Double.MIN_VALUE) {
        +            failed = true;
        +            System.out.printf("1.5*MIN_VALUE doesn't convert to 2*MIN_VALUE%n");
        +        }
        +
        +        if (failed)
        +            throw new RuntimeException("Inconsistent conversion");
             }
         
        +    /**
        +     * For each power of two, test at boundaries of
        +     * region that should convert to that value.
        +     */
        +    private static void testPowers() {
        +        for(int i = -1074; i <= +1023; i++) {
        +            double d = Math.scalb(1.0, i);
        +            BigDecimal d_BD = new BigDecimal(d);
        +
        +            BigDecimal lowerBound = d_BD.subtract(new BigDecimal(Math.ulp(Math.nextUp(-d))).multiply(HALF));
        +            BigDecimal upperBound = d_BD.add(new BigDecimal(Math.ulp(d)).multiply(HALF));
        +
        +            check(lowerBound.toString());
        +            check(upperBound.toString());
        +        }
        +        check(new BigDecimal(Double.MAX_VALUE).add(new BigDecimal(Math.ulp(Double.MAX_VALUE)).multiply(HALF)).toString());
        +    }
         
             private static void testStrictness() {
        -        final double expected = 0x0.0000008000001p-1022;
        +        final double expected = 0x0.0000008000000p-1022;
        +//        final double expected = 0x0.0000008000001p-1022;
                 boolean failed = false;
                 double conversion = 0.0;
                 double sum = 0.0; // Prevent conversion from being optimized away
         
        -        //2^-1047 + 2^-1075
        +        //2^-1047 + 2^-1075 rounds to 2^-1047
                 String decimal = "6.631236871469758276785396630275967243399099947355303144249971758736286630139265439618068200788048744105960420552601852889715006376325666595539603330361800519107591783233358492337208057849499360899425128640718856616503093444922854759159988160304439909868291973931426625698663157749836252274523485312442358651207051292453083278116143932569727918709786004497872322193856150225415211997283078496319412124640111777216148110752815101775295719811974338451936095907419622417538473679495148632480391435931767981122396703443803335529756003353209830071832230689201383015598792184172909927924176339315507402234836120730914783168400715462440053817592702766213559042115986763819482654128770595766806872783349146967171293949598850675682115696218943412532098591327667236328125E-316";
         
                 for(int i = 0; i <= 12_000; i++) {
        @@ -620,6 +760,7 @@
                 testRegex(paddedBadStrings, true);
         
                 testSubnormalPowers();
        +        testPowers();
                 testStrictness();
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/lang/Float/ParseFloat.java
        --- a/jdk/test/java/lang/Float/ParseFloat.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/lang/Float/ParseFloat.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,17 +23,105 @@
         
         /*
          * @test
        - * @bug 4160406 4705734 4707389
        + * @bug 4160406 4705734 4707389 6358355 7032154
          * @summary Tests for Float.parseFloat method
          */
         
        +import java.math.BigDecimal;
        +import java.math.BigInteger;
        +
         public class ParseFloat {
         
        +    private static final BigDecimal HALF = BigDecimal.valueOf(0.5);
        +
        +    private static void fail(String val, float n) {
        +        throw new RuntimeException("Float.parseFloat failed. String:" +
        +                                                val + " Result:" + n);
        +    }
        +
        +    private static void check(String val) {
        +        float n = Float.parseFloat(val);
        +        boolean isNegativeN = n < 0 || n == 0 && 1/n < 0;
        +        float na = Math.abs(n);
        +        String s = val.trim().toLowerCase();
        +        switch (s.charAt(s.length() - 1)) {
        +            case 'd':
        +            case 'f':
        +                s = s.substring(0, s.length() - 1);
        +                break;
        +        }
        +        boolean isNegative = false;
        +        if (s.charAt(0) == '+') {
        +            s = s.substring(1);
        +        } else if (s.charAt(0) == '-') {
        +            s = s.substring(1);
        +            isNegative = true;
        +        }
        +        if (s.equals("nan")) {
        +            if (!Float.isNaN(n)) {
        +                fail(val, n);
        +            }
        +            return;
        +        }
        +        if (Float.isNaN(n)) {
        +            fail(val, n);
        +        }
        +        if (isNegativeN != isNegative)
        +            fail(val, n);
        +        if (s.equals("infinity")) {
        +            if (na != Float.POSITIVE_INFINITY) {
        +                fail(val, n);
        +            }
        +            return;
        +        }
        +        BigDecimal bd;
        +        if (s.startsWith("0x")) {
        +            s = s.substring(2);
        +            int indP = s.indexOf('p');
        +            long exp = Long.parseLong(s.substring(indP + 1));
        +            int indD = s.indexOf('.');
        +            String significand;
        +            if (indD >= 0) {
        +                significand = s.substring(0, indD) + s.substring(indD + 1, indP);
        +                exp -= 4*(indP - indD - 1);
        +            } else {
        +                significand = s.substring(0, indP);
        +            }
        +            bd = new BigDecimal(new BigInteger(significand, 16));
        +            if (exp >= 0) {
        +                bd = bd.multiply(BigDecimal.valueOf(2).pow((int)exp));
        +            } else {
        +                bd = bd.divide(BigDecimal.valueOf(2).pow((int)-exp));
        +            }
        +        } else {
        +            bd = new BigDecimal(s);
        +        }
        +        BigDecimal l, u;
        +        if (Float.isInfinite(na)) {
        +            l = new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF));
        +            u = null;
        +        } else {
        +            l = new BigDecimal(na).subtract(new BigDecimal(Math.ulp(-Math.nextUp(-na))).multiply(HALF));
        +            u = new BigDecimal(na).add(new BigDecimal(Math.ulp(n)).multiply(HALF));
        +        }
        +        int cmpL = bd.compareTo(l);
        +        int cmpU = u != null ? bd.compareTo(u) : -1;
        +        if ((Float.floatToIntBits(n) & 1) != 0) {
        +            if (cmpL <= 0 || cmpU >= 0) {
        +                fail(val, n);
        +            }
        +        } else {
        +            if (cmpL < 0 || cmpU > 0) {
        +                fail(val, n);
        +            }
        +        }
        +    }
        +
             private static void check(String val, float expected) {
                 float n = Float.parseFloat(val);
                 if (n != expected)
        -            throw new RuntimeException("Float.parseFloat failed. String:" +
        -                                                val + " Result:" + n);
        +            fail(val, n);
        +        check(val);
             }
         
             private static void rudimentaryTest() {
        @@ -47,6 +135,17 @@
                 check("-10",    (float) -10.0);
                 check("-10.00", (float) -10.0);
                 check("-10.01", (float) -10.01);
        +
        +        // bug 6358355
        +        check("144115196665790480", 0x1.000002p57f);
        +        check("144115196665790481", 0x1.000002p57f);
        +        check("0.050000002607703203", 0.05f);
        +        check("0.050000002607703204", 0.05f);
        +        check("0.050000002607703205", 0.05f);
        +        check("0.050000002607703206", 0.05f);
        +        check("0.050000002607703207", 0.05f);
        +        check("0.050000002607703208", 0.05f);
        +        check("0.050000002607703209", 0.050000004f);
             }
         
             static  String badStrings[] = {
        @@ -182,6 +281,7 @@
         
                     try {
                         d = Float.parseFloat(input[i]);
        +                check(input[i]);
                     }
                     catch (NumberFormatException e) {
                         if (! exceptionalInput) {
        @@ -199,6 +299,24 @@
                 }
             }
         
        +    /**
        +     * For each power of two, test at boundaries of
        +     * region that should convert to that value.
        +     */
        +    private static void testPowers() {
        +        for(int i = -149; i <= +127; i++) {
        +            float f = Math.scalb(1.0f, i);
        +            BigDecimal f_BD = new BigDecimal(f);
        +
        +            BigDecimal lowerBound = f_BD.subtract(new BigDecimal(Math.ulp(-Math.nextUp(-f))).multiply(HALF));
        +            BigDecimal upperBound = f_BD.add(new BigDecimal(Math.ulp(f)).multiply(HALF));
        +
        +            check(lowerBound.toString());
        +            check(upperBound.toString());
        +        }
        +        check(new BigDecimal(Float.MAX_VALUE).add(new BigDecimal(Math.ulp(Float.MAX_VALUE)).multiply(HALF)).toString());
        +    }
        +
             public static void main(String[] args) throws Exception {
                 rudimentaryTest();
         
        @@ -206,5 +324,7 @@
                 testParsing(paddedGoodStrings, false);
                 testParsing(badStrings, true);
                 testParsing(paddedBadStrings, true);
        +
        +        testPowers();
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/lang/ThreadGroup/Suspend.java
        --- a/jdk/test/java/lang/ThreadGroup/Suspend.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/lang/ThreadGroup/Suspend.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 1999, 2013 Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/lang/invoke/lambda/LambdaConstructorMethodHandleUnbox.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/lang/invoke/lambda/LambdaConstructorMethodHandleUnbox.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,41 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8016761
        + * @summary Lambda metafactory: incorrect type conversion of constructor method handle
        + */
        +
        +public class LambdaConstructorMethodHandleUnbox {
        +    interface IntFunction {
        +        int m(X x);
        +    }
        +
        +    public static void main(String[] args) {
        +       IntFunction s = Integer::new;
        +       if (s.m("2000") + s.m("13") != 2013) {
        +           throw new RuntimeException("Lambda conversion failure");
        +       }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java
        --- a/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/lang/management/PlatformLoggingMXBean/LoggingMXBeanTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -36,12 +36,14 @@
         import java.util.logging.*;
         import java.util.ArrayList;
         import java.util.List;
        +import java.util.Map;
        +import java.util.HashMap;
         
         public class LoggingMXBeanTest
         {
        -    static String LOGGER_NAME_1 = "com.sun.management.Logger";
        -    static String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2";
        -    static String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown";
        +    static final String LOGGER_NAME_1 = "com.sun.management.Logger";
        +    static final String LOGGER_NAME_2 = "com.sun.management.Logger.Logger2";
        +    static final String UNKNOWN_LOGGER_NAME = "com.sun.management.Unknown";
         
             // These instance variables prevent premature logger garbage collection
             // See getLogger() weak reference warnings.
        @@ -213,23 +215,35 @@
                                                 PlatformLoggingMXBean mxbean2) {
                 // verify logger names
                 List loggers1 = mxbean1.getLoggerNames();
        +        System.out.println("Loggers: " + loggers1);
        +
        +        // Retrieve the named loggers to prevent them from being
        +        // spontaneously gc'ed.
        +        Map loggersMap = new HashMap<>();
        +        for (String n : loggers1) {
        +            loggersMap.put(n, Logger.getLogger(n));
        +        }
        +
                 List loggers2 = mxbean2.getLoggerNames();
         
        +        // loggers1 and loggers2 should be identical - no new logger should
        +        // have been created in between (at least no new logger name)
        +        //
                 if (loggers1.size() != loggers2.size())
                     throw new RuntimeException("LoggerNames: unmatched number of entries");
        -        List loggers3 = new ArrayList<>(loggers1);
        -        loggers3.removeAll(loggers2);
        -        if (loggers3.size() != 0)
        +        if (!loggers2.containsAll(loggersMap.keySet()))
                     throw new RuntimeException("LoggerNames: unmatched loggers");
         
        +
                 // verify logger's level  and parent
                 for (String logger : loggers1) {
        -            if (!mxbean1.getLoggerLevel(logger)
        -                    .equals(mxbean2.getLoggerLevel(logger)))
        +            String level1 = mxbean1.getLoggerLevel(logger);
        +            String level2 = mxbean2.getLoggerLevel(logger);
        +            if (!java.util.Objects.equals(level1, level2)) {
                         throw new RuntimeException(
        -                    "LoggerLevel: unmatched level for " + logger
        -                    + ", " + mxbean1.getLoggerLevel(logger)
        -                    + ", " + mxbean2.getLoggerLevel(logger));
        +                        "LoggerLevel: unmatched level for " + logger
        +                        + ", " + level1 + ", " + level2);
        +            }
         
                     if (!mxbean1.getParentLoggerName(logger)
                             .equals(mxbean2.getParentLoggerName(logger)))
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/math/BigInteger/BigIntegerTest.java
        --- a/jdk/test/java/math/BigInteger/BigIntegerTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -61,10 +61,13 @@
             // KARATSUBA_SQUARE_THRESHOLD = 90  ints = 2880 bits
             // TOOM_COOK_SQUARE_THRESHOLD = 140 ints = 4480 bits
             //
        +    // SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8 ints = 256 bits
        +    //
             static final int BITS_KARATSUBA = 1600;
             static final int BITS_TOOM_COOK = 2400;
             static final int BITS_KARATSUBA_SQUARE = 2880;
             static final int BITS_TOOM_COOK_SQUARE = 4480;
        +    static final int BITS_SCHOENHAGE_BASE = 256;
         
             static final int ORDER_SMALL = 60;
             static final int ORDER_MEDIUM = 100;
        @@ -467,12 +470,13 @@
             public static void stringConv() {
                 int failCount = 0;
         
        +        // Generic string conversion.
                 for (int i=0; i<100; i++) {
                     byte xBytes[] = new byte[Math.abs(rnd.nextInt())%100+1];
                     rnd.nextBytes(xBytes);
                     BigInteger x = new BigInteger(xBytes);
         
        -            for (int radix=2; radix < 37; radix++) {
        +            for (int radix=Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
                         String result = x.toString(radix);
                         BigInteger test = new BigInteger(result, radix);
                         if (!test.equals(x)) {
        @@ -483,6 +487,32 @@
                         }
                     }
                 }
        +
        +        // String conversion straddling the Schoenhage algorithm crossover
        +        // threshold, and at twice and four times the threshold.
        +        for (int k = 0; k <= 2; k++) {
        +            int factor = 1 << k;
        +            int upper = factor * BITS_SCHOENHAGE_BASE + 33;
        +            int lower = upper - 35;
        +
        +            for (int bits = upper; bits >= lower; bits--) {
        +                for (int i = 0; i < 50; i++) {
        +                    BigInteger x = BigInteger.ONE.shiftLeft(bits - 1).or(new BigInteger(bits - 2, rnd));
        +
        +                    for (int radix = Character.MIN_RADIX; radix < Character.MAX_RADIX; radix++) {
        +                        String result = x.toString(radix);
        +                        BigInteger test = new BigInteger(result, radix);
        +                        if (!test.equals(x)) {
        +                            failCount++;
        +                            System.err.println("BigInteger toString: " + x);
        +                            System.err.println("Test: " + test);
        +                            System.err.println(radix);
        +                        }
        +                    }
        +                }
        +            }
        +        }
        +
                 report("String Conversion", failCount);
             }
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/math/BigInteger/PrimitiveConversionTests.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/math/BigInteger/PrimitiveConversionTests.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,105 @@
        +/*
        + * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 static java.math.BigInteger.ONE;
        +
        +import java.math.BigInteger;
        +import java.util.ArrayList;
        +import java.util.Arrays;
        +import java.util.Collections;
        +import java.util.List;
        +import java.util.Random;
        +
        +/**
        + * @test
        + * @bug 7131192
        + * @summary This test ensures that BigInteger.floatValue() and
        + *          BigInteger.doubleValue() behave correctly.
        + * @author Louis Wasserman
        + */
        +public class PrimitiveConversionTests {
        +    static final List ALL_BIGINTEGER_CANDIDATES;
        +
        +    static {
        +        List samples = new ArrayList<>();
        +        // Now add values near 2^N for lots of values of N.
        +        for (int exponent : Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 31, 32, 33,
        +                34, 62, 63, 64, 65, 71, 72, 73, 79, 80, 81, 255, 256, 257, 511,
        +                512, 513, Double.MAX_EXPONENT - 1, Double.MAX_EXPONENT,
        +                Double.MAX_EXPONENT + 1, 2000, 2001, 2002)) {
        +            BigInteger x = ONE.shiftLeft(exponent);
        +            for (BigInteger y : Arrays.asList(x, x.add(ONE), x.subtract(ONE))) {
        +                samples.add(y);
        +                samples.add(y.negate());
        +            }
        +        }
        +
        +        Random rng = new Random(1234567);
        +        for (int i = 0; i < 2000; i++) {
        +            samples.add(new BigInteger(rng.nextInt(2000), rng));
        +        }
        +
        +        ALL_BIGINTEGER_CANDIDATES = Collections.unmodifiableList(samples);
        +    }
        +
        +    public static int testDoubleValue() {
        +        int failures = 0;
        +        for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) {
        +            double expected = Double.parseDouble(big.toString());
        +            double actual = big.doubleValue();
        +
        +            // should be bitwise identical
        +            if (Double.doubleToRawLongBits(expected) != Double
        +                    .doubleToRawLongBits(actual)) {
        +                System.out.println(big);
        +                failures++;
        +            }
        +        }
        +        return failures;
        +    }
        +
        +    public static int testFloatValue() {
        +        int failures = 0;
        +        for (BigInteger big : ALL_BIGINTEGER_CANDIDATES) {
        +            float expected = Float.parseFloat(big.toString());
        +            float actual = big.floatValue();
        +
        +            // should be bitwise identical
        +            if (Float.floatToRawIntBits(expected) != Float
        +                    .floatToRawIntBits(actual)) {
        +                System.out.println(big + " " + expected + " " + actual);
        +                failures++;
        +            }
        +        }
        +        return failures;
        +    }
        +
        +    public static void main(String[] args) {
        +        int failures = testDoubleValue();
        +        failures += testFloatValue();
        +        if (failures > 0) {
        +            throw new RuntimeException("Incurred " + failures
        +                    + " failures while testing primitive conversions.");
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/net/CookieHandler/EmptyCookieHeader.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/net/CookieHandler/EmptyCookieHeader.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,94 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8015799
        + * @summary HttpURLConnection.getHeaderFields() throws IllegalArgumentException
        + */
        +
        +import com.sun.net.httpserver.*;
        +import java.io.IOException;
        +import java.io.OutputStream;
        +import java.net.*;
        +import java.util.*;
        +
        +public class EmptyCookieHeader {
        +
        +    public static void main(String[] args) throws Exception {
        +        new EmptyCookieHeader().runTest();
        +    }
        +
        +    public void runTest() throws Exception {
        +        final CookieHandler oldHandler = CookieHandler.getDefault();
        +        CookieHandler.setDefault(new TestCookieHandler());
        +        HttpServer s = HttpServer.create(new InetSocketAddress(0), 0);
        +        try {
        +            startServer(s);
        +            URL url = new URL("http://localhost:" + s.getAddress().getPort() + "/");
        +            HttpURLConnection c = (HttpURLConnection)url.openConnection();
        +            c.getHeaderFields();
        +        } finally {
        +            CookieHandler.setDefault(oldHandler);
        +            s.stop(0);
        +        }
        +    }
        +
        +    static void startServer(HttpServer server) throws IOException {
        +        server.createContext("/", new EmptyCookieHandler());
        +        server.start();
        +    }
        +
        +    static class EmptyCookieHandler implements HttpHandler {
        +
        +        @Override
        +        public void handle(HttpExchange exchange) throws IOException {
        +            String requestMethod = exchange.getRequestMethod();
        +            if (requestMethod.equalsIgnoreCase("GET")) {
        +                Headers responseHeaders = exchange.getResponseHeaders();
        +                responseHeaders.set("Content-Type", "text/plain");
        +                responseHeaders.set("Date", "June 13th 2012");
        +
        +                // No domain value set
        +                responseHeaders.set("Set-Cookie2", "name=value");
        +                responseHeaders.set("Set-Cookie2", "");
        +                exchange.sendResponseHeaders(200, 0);
        +                try (OutputStream os = exchange.getResponseBody()) {
        +                    String str = "This is what the server sent!";
        +                    os.write(str.getBytes());
        +                }
        +            }
        +        }
        +    }
        +
        +    class TestCookieHandler extends CookieHandler {
        +        @Override
        +        public Map> get(URI uri,
        +                                            Map> respH) {
        +            return new HashMap<>();
        +        }
        +
        +        @Override
        +        public void put(URI uri, Map> respH) { }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/net/MulticastSocket/Promiscuous.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/net/MulticastSocket/Promiscuous.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,137 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8014499
        + * @summary Test for interference when two sockets are bound to the same
        + *          port but joined to different multicast groups
        + * @run main Promiscuous
        + * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous
        + */
        +
        +import java.io.IOException;
        +import static java.lang.System.out;
        +import java.net.*;
        +
        +public class Promiscuous {
        +
        +    static final int TIMEOUT =  5 * 1000; // 5 secs
        +    static int id = 1000;
        +
        +    static void receive(MulticastSocket mc, boolean datagramExpected, int id)
        +        throws IOException
        +    {
        +        byte[] ba = new byte[100];
        +        DatagramPacket p = new DatagramPacket(ba, ba.length);
        +        try {
        +            mc.receive(p);
        +            int recvId = Integer.parseInt(
        +                    new String(p.getData(), 0, p.getLength(), "UTF-8"));
        +            if (datagramExpected) {
        +                if (recvId != id)
        +                    throw new RuntimeException("Unexpected id, got " + recvId
        +                                               + ", expected: " + id);
        +                out.printf("Received message as expected, %s\n", p.getAddress());
        +            } else {
        +                throw new RuntimeException("Unexpected message received, "
        +                                           + p.getAddress());
        +            }
        +        } catch (SocketTimeoutException e) {
        +            if (datagramExpected)
        +                throw new RuntimeException("Expected message not received, "
        +                                            + e.getMessage());
        +            else
        +                out.printf("Message not received, as expected\n");
        +        }
        +    }
        +
        +    static void test(InetAddress group1, InetAddress group2)
        +        throws IOException
        +    {
        +        try (MulticastSocket mc1 = new MulticastSocket();
        +             MulticastSocket mc2 = new MulticastSocket(mc1.getLocalPort());
        +             DatagramSocket ds = new DatagramSocket()) {
        +            final int port = mc1.getLocalPort();
        +            out.printf("Using port: %d\n", port);
        +
        +            mc1.setSoTimeout(TIMEOUT);
        +            mc2.setSoTimeout(TIMEOUT);
        +            int nextId = id;
        +            byte[] msg = Integer.toString(nextId).getBytes("UTF-8");
        +            DatagramPacket p = new DatagramPacket(msg, msg.length);
        +            p.setAddress(group1);
        +            p.setPort(port);
        +
        +            mc1.joinGroup(group1);
        +            out.printf("mc1 joined the MC group: %s\n", group1);
        +            mc2.joinGroup(group2);
        +            out.printf("mc2 joined the MC group: %s\n", group2);
        +
        +            out.printf("Sending datagram to: %s/%d\n", group1, port);
        +            ds.send(p);
        +
        +            // the packet should be received by mc1 only
        +            receive(mc1, true, nextId);
        +            receive(mc2, false, 0);
        +
        +            nextId = ++id;
        +            msg = Integer.toString(nextId).getBytes("UTF-8");
        +            p = new DatagramPacket(msg, msg.length);
        +            p.setAddress(group2);
        +            p.setPort(port);
        +
        +            out.printf("Sending datagram to: %s/%d\n", group2, port);
        +            ds.send(p);
        +
        +            // the packet should be received by mc2 only
        +            receive(mc2, true, nextId);
        +            receive(mc1, false, 0);
        +
        +            mc1.leaveGroup(group1);
        +            mc2.leaveGroup(group2);
        +        }
        +    }
        +
        +    public static void main(String args[]) throws IOException {
        +        String os = System.getProperty("os.name");
        +
        +        // Requires IP_MULTICAST_ALL on Linux (new since 2.6.31) so skip
        +        // on older kernels. Note that we skip on <= version 3 to keep the
        +        // parsing simple
        +        if (os.equals("Linux")) {
        +            String osversion = System.getProperty("os.version");
        +            String[] vers = osversion.split("\\.", 0);
        +            int major = Integer.parseInt(vers[0]);
        +            if (major < 3) {
        +                System.out.format("Kernel version is %s, test skipped%n", osversion);
        +                return;
        +            }
        +        }
        +
        +        // multicast groups used for the test
        +        InetAddress ip4Group1 = InetAddress.getByName("224.7.8.9");
        +        InetAddress ip4Group2 = InetAddress.getByName("225.4.5.6");
        +
        +        test(ip4Group1, ip4Group2);
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/nio/channels/DatagramChannel/Promiscuous.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,214 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8014377
        + * @summary Test for interference when two sockets are bound to the same
        + *   port but joined to different multicast groups
        + * @build Promiscuous  NetworkConfiguration
        + * @run main Promiscuous
        + * @run main/othervm -Djava.net.preferIPv4Stack=true Promiscuous
        + */
        +
        +import java.nio.ByteBuffer;
        +import java.nio.channels.*;
        +import java.net.*;
        +import static java.net.StandardProtocolFamily.*;
        +import java.util.*;
        +import java.io.IOException;
        +
        +public class Promiscuous {
        +
        +    static final Random rand = new Random();
        +
        +    static final ProtocolFamily UNSPEC = new ProtocolFamily() {
        +        public String name() {
        +            return "UNSPEC";
        +        }
        +    };
        +
        +    /**
        +     * Sends a datagram to the given multicast group
        +     */
        +    static int sendDatagram(NetworkInterface nif,
        +                            InetAddress group,
        +                            int port)
        +        throws IOException
        +    {
        +        ProtocolFamily family = (group instanceof Inet6Address) ?
        +            StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
        +        DatagramChannel dc = DatagramChannel.open(family)
        +            .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
        +        int id = rand.nextInt();
        +        byte[] msg = Integer.toString(id).getBytes("UTF-8");
        +        ByteBuffer buf = ByteBuffer.wrap(msg);
        +        System.out.format("Send message -> group %s (id=0x%x)\n",
        +            group.getHostAddress(), id);
        +        dc.send(buf, new InetSocketAddress(group, port));
        +        dc.close();
        +        return id;
        +    }
        +
        +    /**
        +     * Wait (with timeout) for datagram. The {@code datagramExepcted}
        +     * parameter indicates whether a datagram is expected, and if
        +     * {@true} then {@code id} is the identifier in the payload.
        +     */
        +    static void receiveDatagram(DatagramChannel dc,
        +                                String name,
        +                                boolean datagramExepcted,
        +                                int id)
        +        throws IOException
        +    {
        +        System.out.println("Checking if received by " + name);
        +
        +        Selector sel = Selector.open();
        +        dc.configureBlocking(false);
        +        dc.register(sel, SelectionKey.OP_READ);
        +        ByteBuffer buf = ByteBuffer.allocateDirect(100);
        +
        +        try {
        +            for (;;) {
        +                System.out.println("Waiting to receive message");
        +                sel.select(5*1000);
        +                SocketAddress sa = dc.receive(buf);
        +
        +                // no datagram received
        +                if (sa == null) {
        +                    if (datagramExepcted) {
        +                        throw new RuntimeException("Expected message not recieved");
        +                    }
        +                    System.out.println("No message received (correct)");
        +                    return;
        +                }
        +
        +                // datagram received
        +
        +                InetAddress sender = ((InetSocketAddress)sa).getAddress();
        +                buf.flip();
        +                byte[] bytes = new byte[buf.remaining()];
        +                buf.get(bytes);
        +                int receivedId = Integer.parseInt(new String(bytes));
        +
        +                System.out.format("Received message from %s (id=0x%x)\n",
        +                    sender, receivedId);
        +
        +                if (!datagramExepcted) {
        +                    if (receivedId == id)
        +                        throw new RuntimeException("Message not expected");
        +                    System.out.println("Message ignored (has wrong id)");
        +                } else {
        +                    if (receivedId == id) {
        +                        System.out.println("Message expected");
        +                        return;
        +                    }
        +                    System.out.println("Message ignored (wrong sender)");
        +                }
        +
        +                sel.selectedKeys().clear();
        +                buf.rewind();
        +            }
        +        } finally {
        +            sel.close();
        +        }
        +    }
        +
        +    static void test(ProtocolFamily family,
        +                     NetworkInterface nif,
        +                     InetAddress group1,
        +                     InetAddress group2)
        +        throws IOException
        +    {
        +
        +        System.out.format("%nTest family=%s%n", family.name());
        +
        +        DatagramChannel dc1 = (family == UNSPEC) ?
        +            DatagramChannel.open() : DatagramChannel.open(family);
        +        DatagramChannel dc2 = (family == UNSPEC) ?
        +            DatagramChannel.open() : DatagramChannel.open(family);
        +
        +        try {
        +            dc1.setOption(StandardSocketOptions.SO_REUSEADDR, true);
        +            dc2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
        +
        +            dc1.bind(new InetSocketAddress(0));
        +            int port = dc1.socket().getLocalPort();
        +            dc2.bind(new InetSocketAddress(port));
        +
        +            System.out.format("dc1 joining [%s]:%d @ %s\n",
        +                group1.getHostAddress(), port, nif.getName());
        +            System.out.format("dc2 joining [%s]:%d @ %s\n",
        +                group2.getHostAddress(), port, nif.getName());
        +
        +            dc1.join(group1, nif);
        +            dc2.join(group2, nif);
        +
        +            int id = sendDatagram(nif, group1, port);
        +
        +            receiveDatagram(dc1, "dc1", true, id);
        +            receiveDatagram(dc2, "dc2", false, id);
        +
        +            id = sendDatagram(nif, group2, port);
        +
        +            receiveDatagram(dc1, "dc1", false, id);
        +            receiveDatagram(dc2, "dc2", true, id);
        +
        +        } finally {
        +            dc1.close();
        +            dc2.close();
        +        }
        +    }
        +
        +    public static void main(String[] args) throws IOException {
        +        String os = System.getProperty("os.name");
        +
        +        // Requires IP_MULTICAST_ALL on Linux (new since 2.6.31) so skip
        +        // on older kernels. Note that we skip on <= version 3 to keep the
        +        // parsing simple
        +        if (os.equals("Linux")) {
        +            String osversion = System.getProperty("os.version");
        +            String[] vers = osversion.split("\\.", 0);
        +            int major = Integer.parseInt(vers[0]);
        +            if (major < 3) {
        +                System.out.format("Kernel version is %s, test skipped%n", osversion);
        +                return;
        +            }
        +        }
        +
        +        // get local network configuration to use
        +        NetworkConfiguration config = NetworkConfiguration.probe();
        +
        +        // multicast groups used for the test
        +        InetAddress ip4Group1 = InetAddress.getByName("225.4.5.6");
        +        InetAddress ip4Group2 = InetAddress.getByName("225.4.6.6");
        +
        +        for (NetworkInterface nif: config.ip4Interfaces()) {
        +            InetAddress source = config.ip4Addresses(nif).iterator().next();
        +            test(INET, nif, ip4Group1, ip4Group2);
        +
        +            // Solaris and Linux allow IPv6 sockets join IPv4 multicast groups
        +            if (os.equals("SunOS") || os.equals("Linux"))
        +                test(UNSPEC, nif, ip4Group1, ip4Group2);
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/nio/file/Files/StreamTest.java
        --- a/jdk/test/java/nio/file/Files/StreamTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/nio/file/Files/StreamTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -43,7 +43,7 @@
         import java.nio.file.Paths;
         import java.nio.file.attribute.BasicFileAttributes;
         import java.util.Arrays;
        -import java.util.Comparators;
        +import java.util.Comparator;
         import java.util.Iterator;
         import java.util.List;
         import java.util.Objects;
        @@ -139,7 +139,7 @@
         
             public void testBasic() {
                 try (CloseableStream s = Files.list(testFolder)) {
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     assertEquals(actual, level1);
                 } catch (IOException ioe) {
                     fail("Unexpected IOException");
        @@ -155,7 +155,7 @@
         
             public void testWalk() {
                 try (CloseableStream s = Files.walk(testFolder)) {
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     assertEquals(actual, all);
                 } catch (IOException ioe) {
                     fail("Unexpected IOException");
        @@ -165,7 +165,7 @@
             public void testWalkOneLevel() {
                 try (CloseableStream s = Files.walk(testFolder, 1)) {
                     Object[] actual = s.filter(path -> ! path.equals(testFolder))
        -                               .sorted(Comparators.naturalOrder())
        +                               .sorted(Comparator.naturalOrder())
                                        .toArray();
                     assertEquals(actual, level1);
                 } catch (IOException ioe) {
        @@ -177,7 +177,7 @@
                 // If link is not supported, the directory structure won't have link.
                 // We still want to test the behavior with FOLLOW_LINKS option.
                 try (CloseableStream s = Files.walk(testFolder, FileVisitOption.FOLLOW_LINKS)) {
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     assertEquals(actual, all_folowLinks);
                 } catch (IOException ioe) {
                     fail("Unexpected IOException");
        @@ -637,13 +637,13 @@
             public void testClosedStream() throws IOException {
                 try (CloseableStream s = Files.list(testFolder)) {
                     s.close();
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     assertTrue(actual.length <= level1.length);
                 }
         
                 try (CloseableStream s = Files.walk(testFolder)) {
                     s.close();
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     fail("Operate on closed stream should throw IllegalStateException");
                 } catch (IllegalStateException ex) {
                     // expected
        @@ -652,7 +652,7 @@
                 try (CloseableStream s = Files.find(testFolder, Integer.MAX_VALUE,
                             (p, attr) -> true)) {
                     s.close();
        -            Object[] actual = s.sorted(Comparators.naturalOrder()).toArray();
        +            Object[] actual = s.sorted(Comparator.naturalOrder()).toArray();
                     fail("Operate on closed stream should throw IllegalStateException");
                 } catch (IllegalStateException ex) {
                     // expected
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/security/cert/CertPathValidator/OCSP/FailoverToCRL.java
        --- a/jdk/test/java/security/cert/CertPathValidator/OCSP/FailoverToCRL.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/security/cert/CertPathValidator/OCSP/FailoverToCRL.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,7 +23,7 @@
         
         /**
          * @test
        - * @bug 6383095
        + * @bug 6383095 8019259
          * @summary CRL revoked certificate failures masked by OCSP failures
          *
          * Note that the certificate validity is from Mar 16 14:55:35 2009 GMT to
        @@ -254,12 +254,32 @@
                 CertPathValidator validator = CertPathValidator.getInstance("PKIX");
         
                 try {
        +            System.out.println("Validating cert via OCSP: no responder URL");
                     validator.validate(path, params);
                 } catch (CertPathValidatorException cpve) {
                     if (cpve.getReason() != BasicReason.REVOKED) {
                         throw new Exception(
        -                    "unexpect exception, should be a REVOKED CPVE", cpve);
        +                    "unexpected exception, should be a REVOKED CPVE", cpve);
                     }
        +            System.out.println("  successful failover to using CRLs");
        +        }
        +
        +        java.security.cert.PKIXRevocationChecker revocationChecker =
        +            (java.security.cert.PKIXRevocationChecker)
        +                validator.getRevocationChecker();
        +        revocationChecker.setOCSPResponder(
        +            new java.net.URI("bad_ocsp_responder_url"));
        +        params.addCertPathChecker(revocationChecker);
        +
        +        try {
        +            System.out.println("Validating cert via OCSP: bad responder URL");
        +            validator.validate(path, params);
        +        } catch (CertPathValidatorException cpve) {
        +            if (cpve.getReason() != BasicReason.REVOKED) {
        +                throw new Exception(
        +                    "unexpected exception, should be a REVOKED CPVE", cpve);
        +            }
        +            System.out.println("  successful failover to using CRLs");
                 }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/security/testlibrary/Proc.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/security/testlibrary/Proc.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,325 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.BufferedReader;
        +import java.io.File;
        +import java.io.IOException;
        +import java.io.InputStreamReader;
        +import java.net.URL;
        +import java.net.URLClassLoader;
        +import java.nio.file.Files;
        +import java.nio.file.Path;
        +import java.nio.file.Paths;
        +import java.security.Permission;
        +import java.util.ArrayList;
        +import java.util.Base64;
        +import java.util.HashMap;
        +import java.util.List;
        +import java.util.Map;
        +import java.util.Map.Entry;
        +
        +/**
        + * This is a test library that makes writing a Java test that spawns multiple
        + * Java processes easily.
        + *
        + * Usage:
        + *
        + *    Proc.create("Clazz")      // The class to launch
        + *        .args("x")            // with args
        + *        .env("env", "value")  // and an environment variable
        + *        .prop("key","value")  // and a system property
        + *        .perm(perm)           // with granted permissions
        + *        .start();             // and start
        + *
        + * create/start must be called, args/env/prop/perm can be called zero or
        + * multiple times between create and start.
        + *
        + * The controller can call inheritIO to share its I/O to the process.
        + * Otherwise, it can send data into a proc's stdin with write/println, and
        + * read its stdout with readLine. stderr is always redirected to DFILE
        + * unless nodump() is called. A protocol is designed to make
        + * data exchange among the controller and the processes super easy, in which
        + * useful data are always printed with a special prefix ("PROCISFUN:").
        + * If the data is binary, make it BASE64.
        + *
        + * For example:
        + *
        + * - A producer Proc calls Proc.binOut() or Proc.textOut() to send out data.
        + *   This method would prints to the stdout something like
        + *
        + *      PROCISFUN:[raw text or base64 binary]
        + *
        + * - The controller calls producer.readData() to get the content. This method
        + *   ignores all other output and only reads lines starting with "PROCISFUN:".
        + *
        + * - The controller does not care if the context is text or base64, it simply
        + *   feeds the data to a consumer Proc by calling consumer.println(data).
        + *   This will be printed into System.in of the consumer process.
        + *
        + * - The consumer Proc calls Proc.binIn() or Proc.textIn() to read the data.
        + *   The first method de-base64 the input and return a byte[] block.
        + *
        + * Please note only plain ASCII is supported in raw text at the moment.
        + *
        + * As the Proc objects are hidden so deeply, two static methods, d(String) and
        + * d(Throwable) are provided to output info into stderr, where they will
        + * normally be appended messages to DFILE (unless nodump() is called).
        + * Developers can view the messages in real time by calling
        + *
        + *    tail -f proc.debug
        + *
        + * TODO:
        + *
        + * . launch java tools, say, keytool
        + * . launch another version of java
        + * . start in another directory
        + * . start and finish using one method
        + *
        + * This is not a test, but is the core of
        + * JDK-8009977: A test library to launch multiple Java processes
        + */
        +public class Proc {
        +    private Process p;
        +    private BufferedReader br;      // the stdout of a process
        +    private String launcher;        // Optional: the java program
        +
        +    private List perms = new ArrayList<>();
        +    private List args = new ArrayList<>();
        +    private Map env = new HashMap<>();
        +    private Map prop = new HashMap();
        +    private boolean inheritIO = false;
        +    private boolean noDump = false;
        +
        +    private String clazz;           // Class to launch
        +    private String debug;           // debug flag, controller will show data
        +                                    // transfer between procs
        +
        +    final private static String PREFIX = "PROCISFUN:";
        +    final private static String DFILE = "proc.debug";
        +
        +    // The following methods are called by controllers
        +
        +    // Creates a Proc by the Java class name, launcher is an optional
        +    // argument to specify the java program
        +    public static Proc create(String clazz, String... launcher) {
        +        Proc pc = new Proc();
        +        pc.clazz = clazz;
        +        if (launcher.length > 0) {
        +            pc.launcher = launcher[0];
        +        }
        +        return pc;
        +    }
        +    // Sets inheritIO flag to proc. If set, proc will same I/O channels as
        +    // teh controller. Otherwise, its stdin/stdout is untouched, and its
        +    // stderr is redirected to DFILE.
        +    public Proc inheritIO() {
        +        inheritIO = true;
        +        return this;
        +    }
        +    // When called, stderr inherits parent stderr, otherwise, append to a file
        +    public Proc nodump() {
        +        noDump = true;
        +        return this;
        +    }
        +    // Specifies some args. Can be called multiple times.
        +    public Proc args(String... args) {
        +        for (String c: args) {
        +            this.args.add(c);
        +        }
        +        return this;
        +    }
        +    // Returns debug prefix
        +    public String debug() {
        +        return debug;
        +    }
        +    // Enables debug with prefix
        +    public Proc debug(String title) {
        +        debug = title;
        +        return this;
        +    }
        +    // Specifies an env var. Can be called multiple times.
        +    public Proc env(String a, String b) {
        +        env.put(a, b);
        +        return this;
        +    }
        +    // Specifies a Java system property. Can be called multiple times.
        +    public Proc prop(String a, String b) {
        +        prop.put(a, b);
        +        return this;
        +    }
        +    // Adds a perm to policy. Can be called multiple times. In order to make it
        +    // effective, please also call prop("java.security.manager", "").
        +    public Proc perm(Permission p) {
        +        perms.add(p);
        +        return this;
        +    }
        +    // Starts the proc
        +    public Proc start() throws IOException {
        +        List cmd = new ArrayList<>();
        +        if (launcher != null) {
        +            cmd.add(launcher);
        +        } else {
        +            cmd.add(new File(new File(System.getProperty("java.home"), "bin"),
        +                        "java").getPath());
        +        }
        +        cmd.add("-cp");
        +        StringBuilder cp = new StringBuilder();
        +        for (URL url: ((URLClassLoader)Proc.class.getClassLoader()).getURLs()) {
        +            if (cp.length() != 0) {
        +                cp.append(File.pathSeparatorChar);
        +            }
        +            cp.append(url.getFile());
        +        }
        +        cmd.add(cp.toString());
        +        for (Entry e: prop.entrySet()) {
        +            cmd.add("-D" + e.getKey() + "=" + e.getValue());
        +        }
        +        if (!perms.isEmpty()) {
        +            Path p = Files.createTempFile(
        +                    Paths.get(".").toAbsolutePath(), "policy", null);
        +            StringBuilder sb = new StringBuilder();
        +            sb.append("grant {\n");
        +            for (Permission perm: perms) {
        +                // Sometimes a permission has no name or actions.
        +                // but it's safe to use an empty string.
        +                String s = String.format("%s \"%s\", \"%s\"",
        +                        perm.getClass().getCanonicalName(),
        +                        perm.getName()
        +                                .replace("\\", "\\\\").replace("\"", "\\\""),
        +                        perm.getActions());
        +                sb.append("    permission ").append(s).append(";\n");
        +            }
        +            sb.append("};\n");
        +            Files.write(p, sb.toString().getBytes());
        +            cmd.add("-Djava.security.policy=" + p.toString());
        +        }
        +        cmd.add(clazz);
        +        for (String s: args) {
        +            cmd.add(s);
        +        }
        +        if (debug != null) {
        +            System.out.println("PROC: " + debug + " cmdline: " + cmd);
        +        }
        +        ProcessBuilder pb = new ProcessBuilder(cmd);
        +        for (Entry e: env.entrySet()) {
        +            pb.environment().put(e.getKey(), e.getValue());
        +        }
        +        if (inheritIO) {
        +            pb.inheritIO();
        +        } else if (noDump) {
        +            pb.redirectError(ProcessBuilder.Redirect.INHERIT);
        +        } else {
        +            pb.redirectError(ProcessBuilder.Redirect.appendTo(new File(DFILE)));
        +        }
        +        p = pb.start();
        +        br = new BufferedReader(new InputStreamReader(p.getInputStream()));
        +        return this;
        +    }
        +    // Reads a line from stdout of proc
        +    public String readLine() throws IOException {
        +        String s = br.readLine();
        +        if (debug != null) {
        +            System.out.println("PROC: " + debug + " readline: " +
        +                    (s == null ? "" : s));
        +        }
        +        return s;
        +    }
        +    // Reads a special line from stdout of proc
        +    public String readData() throws Exception {
        +        while (true) {
        +            String s = readLine();
        +            if (s == null) {
        +                if (p.waitFor() != 0) {
        +                    throw new Exception("Proc abnormal end");
        +                } else {
        +                    return s;
        +                }
        +            }
        +            if (s.startsWith(PREFIX)) {
        +                return s.substring(PREFIX.length());
        +            }
        +        }
        +    }
        +    // Writes text into stdin of proc
        +    public void println(String s) throws IOException {
        +        if (debug != null) {
        +            System.out.println("PROC: " + debug + " println: " + s);
        +        }
        +        write((s + "\n").getBytes());
        +    }
        +    // Writes data into stdin of proc
        +    public void write(byte[] b) throws IOException {
        +        p.getOutputStream().write(b);
        +        p.getOutputStream().flush();
        +    }
        +    // Reads all output and wait for process end
        +    public int waitFor() throws Exception {
        +        while (true) {
        +            String s = readLine();
        +            if (s == null) {
        +                break;
        +            }
        +        }
        +        return p.waitFor();
        +    }
        +
        +    // The following methods are used inside a proc
        +
        +    // Writes out a BASE64 binary with a prefix
        +    public static void binOut(byte[] data) {
        +        System.out.println(PREFIX + Base64.getEncoder().encodeToString(data));
        +    }
        +    // Reads in a line of BASE64 binary
        +    public static byte[] binIn() throws Exception {
        +        return Base64.getDecoder().decode(textIn());
        +    }
        +    // Writes out a text with a prefix
        +    public static void textOut(String data) {
        +        System.out.println(PREFIX + data);
        +    }
        +    // Reads in a line of text
        +    public static String textIn() throws Exception {
        +        StringBuilder sb = new StringBuilder();
        +        boolean isEmpty = true;
        +        while (true) {
        +            int i = System.in.read();
        +            if (i == -1) break;
        +            isEmpty = false;
        +            if (i == '\n') break;
        +            if (i != 13) {
        +                // Force it to a char, so only simple ASCII works.
        +                sb.append((char)i);
        +            }
        +        }
        +        return isEmpty ? null : sb.toString();
        +    }
        +    // Sends string to stderr. If inheritIO is not called, they will
        +    // be collected into DFILE
        +    public static void d(String s) throws IOException {
        +        System.err.println(s);
        +    }
        +    // Sends an exception to stderr
        +    public static void d(Throwable e) throws IOException {
        +        e.printStackTrace();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Arrays/ParallelPrefix.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Arrays/ParallelPrefix.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,165 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/**
        + * @test
        + * @summary unit test for Arrays.ParallelPrefix().
        + * @author Tristan Yan
        + * @run testng ParallelPrefix
        + */
        +
        +import java.util.Arrays;
        +import java.util.function.BinaryOperator;
        +import java.util.function.DoubleBinaryOperator;
        +import java.util.function.Function;
        +import java.util.function.IntBinaryOperator;
        +import java.util.function.LongBinaryOperator;
        +import java.util.stream.IntStream;
        +import java.util.stream.LongStream;
        +import static org.testng.Assert.*;
        +import org.testng.annotations.DataProvider;
        +import org.testng.annotations.Test;
        +
        +public class ParallelPrefix {
        +    //Array size less than MIN_PARTITION
        +    private final static int SMALL_ARRAY_SIZE = 1 << 3;
        +
        +    //Array size equals MIN_PARTITION
        +    private final static int THRESHOLD_ARRAY_SIZE = 1 << 4;
        +
        +    //Array size greater than MIN_PARTITION
        +    private final static int MEDIUM_ARRAY_SIZE = 1 << 8;
        +
        +    //Array size much greater than MIN_PARTITION
        +    private final static int LARGE_ARRAY_SIZE = 1 << 12;
        +
        +    private final static int[] ARRAY_SIZE_COLLECTION  = new int[]{
        +        SMALL_ARRAY_SIZE, THRESHOLD_ARRAY_SIZE,MEDIUM_ARRAY_SIZE, LARGE_ARRAY_SIZE};
        +
        +    @DataProvider
        +    public static Object[][] intSet(){
        +        return genericData(size -> IntStream.range(0, size).toArray(), new IntBinaryOperator[]{Integer::sum, Integer::min});
        +    }
        +
        +    @DataProvider
        +    public static Object[][] longSet(){
        +        return genericData(size -> LongStream.range(0, size).toArray(), new LongBinaryOperator[]{Long::sum, Long::min});
        +    }
        +
        +    @DataProvider
        +    public static Object[][] doubleSet(){
        +        return genericData(size -> IntStream.range(0, size).mapToDouble(i -> (double)i).toArray(),
        +                new DoubleBinaryOperator[]{Double::sum, Double::min});
        +    }
        +
        +    @DataProvider
        +    public static Object[][] stringSet(){
        +        Function stringsFunc = size ->
        +                IntStream.range(0, size).mapToObj(Integer::toString).toArray(String[]::new);
        +        BinaryOperator cancatBop = String::concat;
        +        return genericData(stringsFunc,  new BinaryOperator[]{cancatBop});
        +    }
        +
        +    private static  Object[][] genericData(Function generateFunc, OPS[] ops) {
        +        //test arrays which size is equals n-1, n, n+1, test random data
        +        Object[][] data = new Object[ARRAY_SIZE_COLLECTION.length * 3 * ops.length][4];
        +        for(int n = 0; n < ARRAY_SIZE_COLLECTION.length; n++ ) {
        +            for(int testValue = -1 ; testValue <= 1; testValue++) {
        +                int array_size = ARRAY_SIZE_COLLECTION[n] + testValue;
        +                for(int opsN = 0; opsN < ops.length; opsN++) {
        +                    int index = n * 3 * ops.length + (testValue + 1) * ops.length + opsN;
        +                    data[index][0] = generateFunc.apply(array_size);
        +                    data[index][1] = array_size / 3;
        +                    data[index][2] = 2 * array_size / 3;
        +                    data[index][3] = ops[opsN];
        +                }
        +            }
        +        }
        +        return data;
        +    }
        +
        +    @Test(dataProvider="intSet")
        +    public void testParallelPrefixForInt(int[] data, int fromIndex, int toIndex, IntBinaryOperator op) {
        +        int[] sequentialResult = data.clone();
        +        for (int index = fromIndex + 1; index < toIndex; index++) {
        +            sequentialResult[index ] = op.applyAsInt(sequentialResult[index  - 1], sequentialResult[index]);
        +        }
        +
        +        int[] parallelResult = data.clone();
        +        Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
        +        assertEquals(parallelResult, sequentialResult);
        +
        +        int[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
        +        Arrays.parallelPrefix(parallelRangeResult, op);
        +        assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
        +    }
        +
        +    @Test(dataProvider="longSet")
        +    public void testParallelPrefixForLong(long[] data, int fromIndex, int toIndex, LongBinaryOperator op) {
        +        long[] sequentialResult = data.clone();
        +        for (int index = fromIndex + 1; index < toIndex; index++) {
        +            sequentialResult[index ] = op.applyAsLong(sequentialResult[index  - 1], sequentialResult[index]);
        +        }
        +
        +        long[] parallelResult = data.clone();
        +        Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
        +        assertEquals(parallelResult, sequentialResult);
        +
        +        long[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
        +        Arrays.parallelPrefix(parallelRangeResult, op);
        +        assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
        +    }
        +
        +    @Test(dataProvider="doubleSet")
        +    public void testParallelPrefixForDouble(double[] data, int fromIndex, int toIndex, DoubleBinaryOperator op) {
        +        double[] sequentialResult = data.clone();
        +        for (int index = fromIndex + 1; index < toIndex; index++) {
        +            sequentialResult[index ] = op.applyAsDouble(sequentialResult[index  - 1], sequentialResult[index]);
        +        }
        +
        +        double[] parallelResult = data.clone();
        +        Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
        +        assertEquals(parallelResult, sequentialResult);
        +
        +        double[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
        +        Arrays.parallelPrefix(parallelRangeResult, op);
        +        assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
        +    }
        +
        +    @Test(dataProvider="stringSet")
        +    public void testParallelPrefixForStringr(String[] data , int fromIndex, int toIndex, BinaryOperator op) {
        +        String[] sequentialResult = data.clone();
        +        for (int index = fromIndex + 1; index < toIndex; index++) {
        +            sequentialResult[index ] = op.apply(sequentialResult[index  - 1], sequentialResult[index]);
        +        }
        +
        +        String[] parallelResult = data.clone();
        +        Arrays.parallelPrefix(parallelResult, fromIndex, toIndex, op);
        +        assertEquals(parallelResult, sequentialResult);
        +
        +        String[] parallelRangeResult = Arrays.copyOfRange(data, fromIndex, toIndex);
        +        Arrays.parallelPrefix(parallelRangeResult, op);
        +        assertEquals(parallelRangeResult, Arrays.copyOfRange(sequentialResult, fromIndex, toIndex));
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Collection/ListDefaults.java
        --- a/jdk/test/java/util/Collection/ListDefaults.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Collection/ListDefaults.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,7 +25,6 @@
         import java.util.Arrays;
         import java.util.Collections;
         import java.util.Comparator;
        -import java.util.Comparators;
         import java.util.List;
         import java.util.LinkedList;
         import java.util.Stack;
        @@ -337,23 +336,23 @@
         
                     CollectionSupplier.shuffle(list);
                     list.sort(null);
        -            CollectionAsserts.assertSorted(list, Comparators.naturalOrder());
        +            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
                     if (test.name.startsWith("reverse")) {
                         Collections.reverse(list);
                     }
                     CollectionAsserts.assertContents(list, original);
         
                     CollectionSupplier.shuffle(list);
        -            list.sort(Comparators.naturalOrder());
        -            CollectionAsserts.assertSorted(list, Comparators.naturalOrder());
        +            list.sort(Comparator.naturalOrder());
        +            CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
                     if (test.name.startsWith("reverse")) {
                         Collections.reverse(list);
                     }
                     CollectionAsserts.assertContents(list, original);
         
                     CollectionSupplier.shuffle(list);
        -            list.sort(Comparators.reverseOrder());
        -            CollectionAsserts.assertSorted(list, Comparators.reverseOrder());
        +            list.sort(Comparator.reverseOrder());
        +            CollectionAsserts.assertSorted(list, Comparator.reverseOrder());
                     if (!test.name.startsWith("reverse")) {
                         Collections.reverse(list);
                     }
        @@ -390,8 +389,8 @@
                         final List copy = new ArrayList<>(list);
                         final List subList = list.subList(SUBLIST_FROM, SUBLIST_TO);
                         CollectionSupplier.shuffle(subList);
        -                subList.sort(Comparators.naturalOrder());
        -                CollectionAsserts.assertSorted(subList, Comparators.naturalOrder());
        +                subList.sort(Comparator.naturalOrder());
        +                CollectionAsserts.assertSorted(subList, Comparator.naturalOrder());
                         // verify that elements [0, from) remain unmodified
                         for (int i = 0; i < SUBLIST_FROM; i++) {
                             assertTrue(list.get(i) == copy.get(i),
        @@ -412,8 +411,8 @@
                         public void call(final List list) {
                             final List copy = new ArrayList<>(list);
                             CollectionSupplier.shuffle(list);
        -                    list.sort(Comparators.naturalOrder());
        -                    CollectionAsserts.assertSorted(list, Comparators.naturalOrder());
        +                    list.sort(Comparator.naturalOrder());
        +                    CollectionAsserts.assertSorted(list, Comparator.naturalOrder());
                         }
                     });
                 }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Comparator/BasicTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Comparator/BasicTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,369 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/**
        + * @test
        + * @summary Comparator default method tests
        + * @run testng BasicTest
        + */
        +
        +import java.util.TreeMap;
        +import java.util.Comparator;
        +import org.testng.annotations.Test;
        +
        +import java.util.function.Function;
        +import java.util.function.ToIntFunction;
        +import java.util.function.ToLongFunction;
        +import java.util.function.ToDoubleFunction;
        +
        +import static org.testng.Assert.assertEquals;
        +import static org.testng.Assert.assertTrue;
        +import static org.testng.Assert.fail;
        +
        +@Test(groups = "unit")
        +public class BasicTest {
        +    private static class Thing {
        +        public final int intField;
        +        public final long longField;
        +        public final double doubleField;
        +        public final String stringField;
        +
        +        private Thing(int intField, long longField, double doubleField, String stringField) {
        +            this.intField = intField;
        +            this.longField = longField;
        +            this.doubleField = doubleField;
        +            this.stringField = stringField;
        +        }
        +
        +        public int getIntField() {
        +            return intField;
        +        }
        +
        +        public long getLongField() {
        +            return longField;
        +        }
        +
        +        public double getDoubleField() {
        +            return doubleField;
        +        }
        +
        +        public String getStringField() {
        +            return stringField;
        +        }
        +    }
        +
        +    private final int[] intValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        +    private final long[] longValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        +    private final double[] doubleValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        +    private final String[] stringValues = { "a", "a", "b", "b", "c", "c", "d", "d", "e", "e" };
        +    private final int[] comparisons = { 0, -1, 0, -1, 0, -1, 0, -1, 0 };
        +
        +    private void assertComparisons(T[] things, Comparator comp, int[] comparisons) {
        +        for (int i=0; i comp = Comparator.comparing(new ToIntFunction() {
        +            @Override
        +            public int applyAsInt(Thing thing) {
        +                return thing.getIntField();
        +            }
        +        });
        +
        +        assertComparisons(things, comp, comparisons);
        +    }
        +
        +    public void testLongComparator() {
        +        Thing[] things = new Thing[longValues.length];
        +        for (int i=0; i comp = Comparator.comparing(new ToLongFunction() {
        +            @Override
        +            public long applyAsLong(Thing thing) {
        +                return thing.getLongField();
        +            }
        +        });
        +
        +        assertComparisons(things, comp, comparisons);
        +    }
        +
        +    public void testDoubleComparator() {
        +        Thing[] things = new Thing[doubleValues.length];
        +        for (int i=0; i comp = Comparator.comparing(new ToDoubleFunction() {
        +            @Override
        +            public double applyAsDouble(Thing thing) {
        +                return thing.getDoubleField();
        +            }
        +        });
        +
        +        assertComparisons(things, comp, comparisons);
        +    }
        +
        +    public void testComparing() {
        +        Thing[] things = new Thing[doubleValues.length];
        +        for (int i=0; i comp = Comparator.comparing(new Function() {
        +            @Override
        +            public String apply(Thing thing) {
        +                return thing.getStringField();
        +            }
        +        });
        +
        +        assertComparisons(things, comp, comparisons);
        +    }
        +
        +    public void testNaturalOrderComparator() {
        +        Comparator comp = Comparator.naturalOrder();
        +
        +        assertComparisons(stringValues, comp, comparisons);
        +    }
        +
        +    public void testReverseComparator() {
        +        Comparator cmpr = Comparator.reverseOrder();
        +        Comparator cmp = cmpr.reversed();
        +
        +        assertEquals(cmp.reversed(), cmpr);
        +        assertEquals(0, cmp.compare("a", "a"));
        +        assertEquals(0, cmpr.compare("a", "a"));
        +        assertTrue(cmp.compare("a", "b") < 0);
        +        assertTrue(cmpr.compare("a", "b") > 0);
        +        assertTrue(cmp.compare("b", "a") > 0);
        +        assertTrue(cmpr.compare("b", "a") < 0);
        +    }
        +
        +    public void testReverseComparator2() {
        +        Comparator cmp = (s1, s2) -> s1.length() - s2.length();
        +        Comparator cmpr = cmp.reversed();
        +
        +        assertEquals(cmpr.reversed(), cmp);
        +        assertEquals(0, cmp.compare("abc", "def"));
        +        assertEquals(0, cmpr.compare("abc", "def"));
        +        assertTrue(cmp.compare("abcd", "def") > 0);
        +        assertTrue(cmpr.compare("abcd", "def") < 0);
        +        assertTrue(cmp.compare("abc", "defg") < 0);
        +        assertTrue(cmpr.compare("abc", "defg") > 0);
        +    }
        +
        +    private  void assertComparison(Comparator cmp, T less, T greater) {
        +        assertTrue(cmp.compare(less, greater) < 0, "less");
        +        assertTrue(cmp.compare(less, less) == 0, "equal");
        +        assertTrue(cmp.compare(greater, greater) == 0, "equal");
        +        assertTrue(cmp.compare(greater, less) > 0, "greater");
        +    }
        +
        +    private static class People {
        +        final String firstName;
        +        final String lastName;
        +        final int age;
        +
        +        People(String first, String last, int age) {
        +            firstName = first;
        +            lastName = last;
        +            this.age = age;
        +        }
        +
        +        String getFirstName() { return firstName; }
        +        String getLastName() { return lastName; }
        +        int getAge() { return age; }
        +        long getAgeAsLong() { return (long) age; };
        +        double getAgeAsDouble() { return (double) age; };
        +    }
        +
        +    private final People people[] = {
        +        new People("John", "Doe", 34),
        +        new People("Mary", "Doe", 30),
        +        new People("Maria", "Doe", 14),
        +        new People("Jonah", "Doe", 10),
        +        new People("John", "Cook", 54),
        +        new People("Mary", "Cook", 50),
        +        new People("Mary", null, 25),
        +        new People("John", null, 27)
        +    };
        +
        +    public void testComparatorDefaultMethods() {
        +        Comparator cmp = Comparator.comparing((Function) People::getFirstName);
        +        Comparator cmp2 = Comparator.comparing((Function) People::getLastName);
        +        // reverseOrder
        +        assertComparison(cmp.reversed(), people[1], people[0]);
        +        // thenComparing(Comparator)
        +        assertComparison(cmp.thenComparing(cmp2), people[0], people[1]);
        +        assertComparison(cmp.thenComparing(cmp2), people[4], people[0]);
        +        // thenComparing(Function)
        +        assertComparison(cmp.thenComparing(People::getLastName), people[0], people[1]);
        +        assertComparison(cmp.thenComparing(People::getLastName), people[4], people[0]);
        +        // thenComparing(ToIntFunction)
        +        assertComparison(cmp.thenComparing(People::getAge), people[0], people[1]);
        +        assertComparison(cmp.thenComparing(People::getAge), people[1], people[5]);
        +        // thenComparing(ToLongFunction)
        +        assertComparison(cmp.thenComparing(People::getAgeAsLong), people[0], people[1]);
        +        assertComparison(cmp.thenComparing(People::getAgeAsLong), people[1], people[5]);
        +        // thenComparing(ToDoubleFunction)
        +        assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[0], people[1]);
        +        assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[1], people[5]);
        +    }
        +
        +
        +    public void testNullsFirst() {
        +        Comparator strcmp = Comparator.nullsFirst(Comparator.naturalOrder());
        +        Comparator cmp = Comparator.comparing(People::getLastName, strcmp)
        +                                           .thenComparing(People::getFirstName, strcmp);
        +        // Mary.null vs Mary.Cook - solve by last name
        +        assertComparison(cmp, people[6], people[5]);
        +        // John.null vs Mary.null - solve by first name
        +        assertComparison(cmp, people[7], people[6]);
        +
        +        // More than one thenComparing
        +        strcmp = Comparator.nullsFirst(Comparator.comparing((ToIntFunction) String::length)
        +                                                 .thenComparing(String.CASE_INSENSITIVE_ORDER));
        +        assertComparison(strcmp, null, "abc");
        +        assertComparison(strcmp, "ab", "abc");
        +        assertComparison(strcmp, "abc", "def");
        +        assertEquals(0, strcmp.compare("abc", "ABC"));
        +
        +        // Ensure reverse still handle null properly
        +        Comparator strcmp2 = strcmp.reversed().thenComparing(Comparator.naturalOrder());
        +        assertComparison(strcmp2, "abc", null);
        +        assertComparison(strcmp2, "abc", "ab");
        +        assertComparison(strcmp2, "def", "abc");
        +        assertComparison(strcmp2, "ABC", "abc");
        +
        +        // Considering non-null values to be equal
        +        Comparator blind = Comparator.nullsFirst(null);
        +        assertComparison(blind, null, "abc");
        +        assertEquals(0, blind.compare("abc", "def"));
        +        // reverse still consider non-null values to be equal
        +        strcmp = blind.reversed();
        +        assertComparison(strcmp, "abc", null);
        +        assertEquals(0, strcmp.compare("abc", "def"));
        +        // chain with another comparator to compare non-nulls
        +        strcmp = blind.thenComparing(Comparator.naturalOrder());
        +        assertComparison(strcmp, null, "abc");
        +        assertComparison(strcmp, "abc", "def");
        +    }
        +
        +    public void testNullsLast() {
        +        Comparator strcmp = Comparator.nullsLast(Comparator.naturalOrder());
        +        Comparator cmp = Comparator.comparing(People::getLastName, strcmp)
        +                                           .thenComparing(People::getFirstName, strcmp);
        +        // Mary.null vs Mary.Cook - solve by last name
        +        assertComparison(cmp, people[5], people[6]);
        +        // John.null vs Mary.null - solve by first name
        +        assertComparison(cmp, people[7], people[6]);
        +
        +        // More than one thenComparing
        +        strcmp = Comparator.nullsLast(Comparator.comparing((ToIntFunction) String::length)
        +                                                .thenComparing(String.CASE_INSENSITIVE_ORDER));
        +        assertComparison(strcmp, "abc", null);
        +        assertComparison(strcmp, "ab", "abc");
        +        assertComparison(strcmp, "abc", "def");
        +
        +        // Ensure reverse still handle null properly
        +        Comparator strcmp2 = strcmp.reversed().thenComparing(Comparator.naturalOrder());
        +        assertComparison(strcmp2, null, "abc");
        +        assertComparison(strcmp2, "abc", "ab");
        +        assertComparison(strcmp2, "def", "abc");
        +        assertComparison(strcmp2, "ABC", "abc");
        +
        +        // Considering non-null values to be equal
        +        Comparator blind = Comparator.nullsLast(null);
        +        assertComparison(blind, "abc", null);
        +        assertEquals(0, blind.compare("abc", "def"));
        +        // reverse still consider non-null values to be equal
        +        strcmp = blind.reversed();
        +        assertComparison(strcmp, null, "abc");
        +        assertEquals(0, strcmp.compare("abc", "def"));
        +        // chain with another comparator to compare non-nulls
        +        strcmp = blind.thenComparing(Comparator.naturalOrder());
        +        assertComparison(strcmp, "abc", null);
        +        assertComparison(strcmp, "abc", "def");
        +    }
        +
        +    public void testComposeComparator() {
        +        // Longer string in front
        +        Comparator first = (s1, s2) -> s2.length() - s1.length();
        +        Comparator second = Comparator.naturalOrder();
        +        Comparator composed = first.thenComparing(second);
        +
        +        assertTrue(composed.compare("abcdefg", "abcdef") < 0);
        +        assertTrue(composed.compare("abcdef", "abcdefg") > 0);
        +        assertTrue(composed.compare("abcdef", "abcdef") == 0);
        +        assertTrue(composed.compare("abcdef", "ghijkl") < 0);
        +        assertTrue(composed.compare("ghijkl", "abcdefg") > 0);
        +    }
        +
        +    public void testNulls() {
        +        try {
        +            Comparator.naturalOrder().compare("abc", (String) null);
        +            fail("expected NPE with naturalOrder");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator.naturalOrder().compare((String) null, "abc");
        +            fail("expected NPE with naturalOrder");
        +        } catch (NullPointerException npe) {}
        +
        +        try {
        +            Comparator.reverseOrder().compare("abc", (String) null);
        +            fail("expected NPE with naturalOrder");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator.reverseOrder().compare((String) null, "abc");
        +            fail("expected NPE with naturalOrder");
        +        } catch (NullPointerException npe) {}
        +
        +        try {
        +            Comparator cmp = Comparator.comparing((Function) null, Comparator.naturalOrder());
        +            fail("comparing(null, cmp) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator cmp = Comparator.comparing((Function) People::getFirstName, null);
        +            fail("comparing(f, null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +
        +        try {
        +            Comparator cmp = Comparator.comparing((Function) null);
        +            fail("comparing(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator cmp = Comparator.comparing((ToIntFunction) null);
        +            fail("comparing(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator cmp = Comparator.comparing((ToLongFunction) null);
        +            fail("comparing(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +        try {
        +            Comparator cmp = Comparator.comparing((ToDoubleFunction) null);
        +            fail("comparing(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Comparator/TypeTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Comparator/TypeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,96 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +/**
        + * @test
        + * @summary Comparator API narrowing type test
        + * @run testng TypeTest
        + */
        +
        +import java.util.function.Function;
        +import java.util.Map;
        +import java.util.TreeMap;
        +import java.util.Comparator;
        +import org.testng.annotations.Test;
        +
        +@Test(groups = "unit")
        +public class TypeTest {
        +    static class Person {
        +        String name;
        +        static Comparator C = (p1, p2) -> p1.name.compareTo(p2.name);
        +
        +        Person(String name) {
        +            this.name = name;
        +        }
        +
        +        String getName() { return name; }
        +    }
        +
        +    static class Employee extends Person {
        +        int id;
        +        static Comparator C = (e1, e2) -> e1.id - e2.id;
        +
        +        Employee(int id, String name) {
        +            super(name);
        +            this.id = id;
        +        }
        +    }
        +
        +    static class Manager extends Employee {
        +        long reports;
        +        static Comparator C = (e1, e2) -> (int) (e1.reports - e2.reports);
        +
        +        Manager(String name, int id, long reports) {
        +            super(id, name);
        +            this.reports = reports;
        +        }
        +    }
        +
        +    static  void assertOrder(T o1, T o2, Comparator cmp) {
        +        if (cmp.compare(o1, o2) > 0) {
        +            System.out.println("Fail!!");
        +        }
        +        if (cmp.compare(o1, o2) == 0) {
        +            System.out.println("Equal!!");
        +        }
        +    }
        +
        +    public static void main(String[] args) {
        +        Manager m1 = new Manager("Manager", 2, 2000);
        +        Manager m2 = new Manager("Manager", 4, 1300);
        +
        +        // Comparator tmp = Person.C;
        +
        +        // Comparator cmp = Employee.C.thenComparing(Person.C);
        +        Comparator cmp = Employee.C.thenComparing(Person.C);
        +        assertOrder(m1, m2, Employee.C.thenComparing(Person.C));
        +        assertOrder(m1, m2, cmp);
        +        assertOrder(m1, new Employee(1, "Z"), Person.C);
        +        assertOrder(new Employee(1, "Z"), m2, Employee.C);
        +
        +        assertOrder(m1, m2, Comparator.comparing(Employee::getName, String.CASE_INSENSITIVE_ORDER));
        +
        +        Map map = new TreeMap<>();
        +        map.entrySet().stream().sorted(Map.Entry.comparingByKey(String.CASE_INSENSITIVE_ORDER));
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Comparators/BasicTest.java
        --- a/jdk/test/java/util/Comparators/BasicTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,412 +0,0 @@
        -/*
        - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
        - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        - *
        - * This code is free software; you can redistribute it and/or modify it
        - * under the terms of the GNU General Public License version 2 only, as
        - * published by the Free Software Foundation.
        - *
        - * 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 8001667 8010279
        - * @run testng BasicTest
        - */
        -
        -import java.util.Comparator;
        -import java.util.Comparators;
        -import java.util.AbstractMap;
        -import java.util.Map;
        -import org.testng.annotations.Test;
        -
        -import java.util.function.BinaryOperator;
        -import java.util.function.Function;
        -import java.util.function.ToIntFunction;
        -import java.util.function.ToLongFunction;
        -import java.util.function.ToDoubleFunction;
        -
        -import static org.testng.Assert.assertEquals;
        -import static org.testng.Assert.assertTrue;
        -import static org.testng.Assert.assertSame;
        -import static org.testng.Assert.fail;
        -
        -/**
        - * Unit tests for helper methods in Comparators
        - */
        -@Test(groups = "unit")
        -public class BasicTest {
        -    private static class Thing {
        -        public final int intField;
        -        public final long longField;
        -        public final double doubleField;
        -        public final String stringField;
        -
        -        private Thing(int intField, long longField, double doubleField, String stringField) {
        -            this.intField = intField;
        -            this.longField = longField;
        -            this.doubleField = doubleField;
        -            this.stringField = stringField;
        -        }
        -
        -        public int getIntField() {
        -            return intField;
        -        }
        -
        -        public long getLongField() {
        -            return longField;
        -        }
        -
        -        public double getDoubleField() {
        -            return doubleField;
        -        }
        -
        -        public String getStringField() {
        -            return stringField;
        -        }
        -    }
        -
        -    private final int[] intValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        -    private final long[] longValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        -    private final double[] doubleValues = { -2, -2, -1, -1, 0, 0, 1, 1, 2, 2 };
        -    private final String[] stringValues = { "a", "a", "b", "b", "c", "c", "d", "d", "e", "e" };
        -    private final int[] comparisons = { 0, -1, 0, -1, 0, -1, 0, -1, 0 };
        -
        -    private void assertComparisons(T[] things, Comparator comp, int[] comparisons) {
        -        for (int i=0; i comp = Comparators.comparing(new ToIntFunction() {
        -            @Override
        -            public int applyAsInt(Thing thing) {
        -                return thing.getIntField();
        -            }
        -        });
        -
        -        assertComparisons(things, comp, comparisons);
        -    }
        -
        -    public void testLongComparator() {
        -        Thing[] things = new Thing[longValues.length];
        -        for (int i=0; i comp = Comparators.comparing(new ToLongFunction() {
        -            @Override
        -            public long applyAsLong(Thing thing) {
        -                return thing.getLongField();
        -            }
        -        });
        -
        -        assertComparisons(things, comp, comparisons);
        -    }
        -
        -    public void testDoubleComparator() {
        -        Thing[] things = new Thing[doubleValues.length];
        -        for (int i=0; i comp = Comparators.comparing(new ToDoubleFunction() {
        -            @Override
        -            public double applyAsDouble(Thing thing) {
        -                return thing.getDoubleField();
        -            }
        -        });
        -
        -        assertComparisons(things, comp, comparisons);
        -    }
        -
        -    public void testComparing() {
        -        Thing[] things = new Thing[doubleValues.length];
        -        for (int i=0; i comp = Comparators.comparing(new Function() {
        -            @Override
        -            public String apply(Thing thing) {
        -                return thing.getStringField();
        -            }
        -        });
        -
        -        assertComparisons(things, comp, comparisons);
        -    }
        -
        -    public void testNaturalOrderComparator() {
        -        Comparator comp = Comparators.naturalOrder();
        -
        -        assertComparisons(stringValues, comp, comparisons);
        -    }
        -
        -    public void testReverseComparator() {
        -        Comparator cmpr = Comparators.reverseOrder();
        -        Comparator cmp = cmpr.reverseOrder();
        -
        -        assertEquals(cmp.reverseOrder(), cmpr);
        -        assertEquals(0, cmp.compare("a", "a"));
        -        assertEquals(0, cmpr.compare("a", "a"));
        -        assertTrue(cmp.compare("a", "b") < 0);
        -        assertTrue(cmpr.compare("a", "b") > 0);
        -        assertTrue(cmp.compare("b", "a") > 0);
        -        assertTrue(cmpr.compare("b", "a") < 0);
        -    }
        -
        -    public void testReverseComparator2() {
        -        Comparator cmp = (s1, s2) -> s1.length() - s2.length();
        -        Comparator cmpr = cmp.reverseOrder();
        -
        -        assertEquals(cmpr.reverseOrder(), cmp);
        -        assertEquals(0, cmp.compare("abc", "def"));
        -        assertEquals(0, cmpr.compare("abc", "def"));
        -        assertTrue(cmp.compare("abcd", "def") > 0);
        -        assertTrue(cmpr.compare("abcd", "def") < 0);
        -        assertTrue(cmp.compare("abc", "defg") < 0);
        -        assertTrue(cmpr.compare("abc", "defg") > 0);
        -    }
        -
        -    @Test(expectedExceptions=NullPointerException.class)
        -    public void testReverseComparatorNPE() {
        -        Comparator cmp = Comparators.reverseOrder(null);
        -    }
        -
        -    public void testComposeComparator() {
        -        // Longer string in front
        -        Comparator first = (s1, s2) -> s2.length() - s1.length();
        -        Comparator second = Comparators.naturalOrder();
        -        Comparator composed = Comparators.compose(first, second);
        -
        -        assertTrue(composed.compare("abcdefg", "abcdef") < 0);
        -        assertTrue(composed.compare("abcdef", "abcdefg") > 0);
        -        assertTrue(composed.compare("abcdef", "abcdef") == 0);
        -        assertTrue(composed.compare("abcdef", "ghijkl") < 0);
        -        assertTrue(composed.compare("ghijkl", "abcdefg") > 0);
        -    }
        -
        -    private  void assertPairComparison(K k1, V v1, K k2, V v2,
        -                                        Comparator> ck,
        -                                        Comparator> cv) {
        -        final Map.Entry p11 = new AbstractMap.SimpleImmutableEntry<>(k1, v1);
        -        final Map.Entry p12 = new AbstractMap.SimpleImmutableEntry<>(k1, v2);
        -        final Map.Entry p21 = new AbstractMap.SimpleImmutableEntry<>(k2, v1);
        -        final Map.Entry p22 = new AbstractMap.SimpleImmutableEntry<>(k2, v2);
        -
        -        assertTrue(ck.compare(p11, p11) == 0);
        -        assertTrue(ck.compare(p12, p11) == 0);
        -        assertTrue(ck.compare(p11, p12) == 0);
        -        assertTrue(ck.compare(p12, p22) < 0);
        -        assertTrue(ck.compare(p12, p21) < 0);
        -        assertTrue(ck.compare(p21, p11) > 0);
        -        assertTrue(ck.compare(p21, p12) > 0);
        -
        -        assertTrue(cv.compare(p11, p11) == 0);
        -        assertTrue(cv.compare(p12, p11) > 0);
        -        assertTrue(cv.compare(p11, p12) < 0);
        -        assertTrue(cv.compare(p12, p22) == 0);
        -        assertTrue(cv.compare(p12, p21) > 0);
        -        assertTrue(cv.compare(p21, p11) == 0);
        -        assertTrue(cv.compare(p21, p12) < 0);
        -
        -        Comparator> cmp = Comparators.compose(ck, cv);
        -        assertTrue(cmp.compare(p11, p11) == 0);
        -        assertTrue(cmp.compare(p12, p11) > 0);
        -        assertTrue(cmp.compare(p11, p12) < 0);
        -        assertTrue(cmp.compare(p12, p22) < 0);
        -        assertTrue(cmp.compare(p12, p21) < 0);
        -        assertTrue(cmp.compare(p21, p11) > 0);
        -        assertTrue(cmp.compare(p21, p12) > 0);
        -
        -        cmp = Comparators.compose(cv, ck);
        -        assertTrue(cmp.compare(p11, p11) == 0);
        -        assertTrue(cmp.compare(p12, p11) > 0);
        -        assertTrue(cmp.compare(p11, p12) < 0);
        -        assertTrue(cmp.compare(p12, p22) < 0);
        -        assertTrue(cmp.compare(p12, p21) > 0);
        -        assertTrue(cmp.compare(p21, p11) > 0);
        -        assertTrue(cmp.compare(p21, p12) < 0);
        -    }
        -
        -    public void testKVComparatorable() {
        -        assertPairComparison(1, "ABC", 2, "XYZ",
        -                         Comparators.naturalOrderKeys(),
        -                         Comparators.naturalOrderValues());
        -    }
        -
        -    private static class People {
        -        final String firstName;
        -        final String lastName;
        -        final int age;
        -
        -        People(String first, String last, int age) {
        -            firstName = first;
        -            lastName = last;
        -            this.age = age;
        -        }
        -
        -        String getFirstName() { return firstName; }
        -        String getLastName() { return lastName; }
        -        int getAge() { return age; }
        -        long getAgeAsLong() { return (long) age; };
        -        double getAgeAsDouble() { return (double) age; };
        -    }
        -
        -    private final People people[] = {
        -        new People("John", "Doe", 34),
        -        new People("Mary", "Doe", 30),
        -        new People("Maria", "Doe", 14),
        -        new People("Jonah", "Doe", 10),
        -        new People("John", "Cook", 54),
        -        new People("Mary", "Cook", 50),
        -    };
        -
        -    public void testKVComparators() {
        -        // Comparator cmp = Comparators.naturalOrder(); // Should fail to compiler as People is not comparable
        -        // We can use simple comparator, but those have been tested above.
        -        // Thus choose to do compose for some level of interation.
        -        Comparator cmp1 = Comparators.comparing((Function) People::getFirstName);
        -        Comparator cmp2 = Comparators.comparing((Function) People::getLastName);
        -        Comparator cmp = Comparators.compose(cmp1, cmp2);
        -
        -        assertPairComparison(people[0], people[0], people[1], people[1],
        -                         Comparators.byKey(cmp),
        -                         Comparators.byValue(cmp));
        -
        -    }
        -
        -    private  void assertComparison(Comparator cmp, T less, T greater) {
        -        assertTrue(cmp.compare(less, greater) < 0, "less");
        -        assertTrue(cmp.compare(less, less) == 0, "equal");
        -        assertTrue(cmp.compare(greater, less) > 0, "greater");
        -    }
        -
        -    public void testComparatorDefaultMethods() {
        -        Comparator cmp = Comparators.comparing((Function) People::getFirstName);
        -        Comparator cmp2 = Comparators.comparing((Function) People::getLastName);
        -        // reverseOrder
        -        assertComparison(cmp.reverseOrder(), people[1], people[0]);
        -        // thenComparing(Comparator)
        -        assertComparison(cmp.thenComparing(cmp2), people[0], people[1]);
        -        assertComparison(cmp.thenComparing(cmp2), people[4], people[0]);
        -        // thenComparing(Function)
        -        assertComparison(cmp.thenComparing(People::getLastName), people[0], people[1]);
        -        assertComparison(cmp.thenComparing(People::getLastName), people[4], people[0]);
        -        // thenComparing(ToIntFunction)
        -        assertComparison(cmp.thenComparing(People::getAge), people[0], people[1]);
        -        assertComparison(cmp.thenComparing(People::getAge), people[1], people[5]);
        -        // thenComparing(ToLongFunction)
        -        assertComparison(cmp.thenComparing(People::getAgeAsLong), people[0], people[1]);
        -        assertComparison(cmp.thenComparing(People::getAgeAsLong), people[1], people[5]);
        -        // thenComparing(ToDoubleFunction)
        -        assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[0], people[1]);
        -        assertComparison(cmp.thenComparing(People::getAgeAsDouble), people[1], people[5]);
        -    }
        -
        -    public void testGreaterOf() {
        -        // lesser
        -        assertSame(Comparators.greaterOf(Comparators.comparing(
        -                                    (Function) People::getFirstName))
        -                              .apply(people[0], people[1]),
        -                   people[1]);
        -        // euqal
        -        assertSame(Comparators.greaterOf(Comparators.comparing(
        -                                    (Function) People::getLastName))
        -                              .apply(people[0], people[1]),
        -                   people[0]);
        -        // greater
        -        assertSame(Comparators.greaterOf(Comparators.comparing(
        -                                    (ToIntFunction) People::getAge))
        -                              .apply(people[0], people[1]),
        -                   people[0]);
        -    }
        -
        -    public void testLesserOf() {
        -        // lesser
        -        assertSame(Comparators.lesserOf(Comparators.comparing(
        -                                    (Function) People::getFirstName))
        -                              .apply(people[0], people[1]),
        -                   people[0]);
        -        // euqal
        -        assertSame(Comparators.lesserOf(Comparators.comparing(
        -                                    (Function) People::getLastName))
        -                              .apply(people[0], people[1]),
        -                   people[0]);
        -        // greater
        -        assertSame(Comparators.lesserOf(Comparators.comparing(
        -                                    (ToIntFunction) People::getAge))
        -                              .apply(people[0], people[1]),
        -                   people[1]);
        -    }
        -
        -    public void testNulls() {
        -        try {
        -            Comparators.naturalOrder().compare("abc", (String) null);
        -            fail("expected NPE with naturalOrder");
        -        } catch (NullPointerException npe) {}
        -        try {
        -            Comparators.naturalOrder().compare((String) null, "abc");
        -            fail("expected NPE with naturalOrder");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            Comparators.reverseOrder().compare("abc", (String) null);
        -            fail("expected NPE with naturalOrder");
        -        } catch (NullPointerException npe) {}
        -        try {
        -            Comparators.reverseOrder().compare((String) null, "abc");
        -            fail("expected NPE with naturalOrder");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            Comparator> cmp = Comparators.byKey(null);
        -            fail("byKey(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            Comparator> cmp = Comparators.byValue(null);
        -            fail("byValue(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            Comparator cmp = Comparators.comparing((Function) null);
        -            fail("comparing(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -        try {
        -            Comparator cmp = Comparators.comparing((ToIntFunction) null);
        -            fail("comparing(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -        try {
        -            Comparator cmp = Comparators.comparing((ToLongFunction) null);
        -            fail("comparing(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -        try {
        -            Comparator cmp = Comparators.comparing((ToDoubleFunction) null);
        -            fail("comparing(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            BinaryOperator op = Comparators.lesserOf(null);
        -            fail("lesserOf(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -
        -        try {
        -            BinaryOperator op = Comparators.greaterOf(null);
        -            fail("lesserOf(null) should throw NPE");
        -        } catch (NullPointerException npe) {}
        -    }
        -}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Currency/PropertiesTest.sh
        --- a/jdk/test/java/util/Currency/PropertiesTest.sh	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Currency/PropertiesTest.sh	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,7 +23,7 @@
         #
         
         # @test
        -# @bug 6332666 7180362 8003846
        +# @bug 6332666 6863624 7180362 8003846
         # @summary tests the capability of replacing the currency data with user
         #     specified currency properties file
         # @build PropertiesTest
        @@ -56,10 +56,15 @@
             PS=":"
             FS="/"
             ;;
        -  Windows* | CYGWIN* )
        +  Windows* )
             PS=";"
             FS="/"
             ;;
        +  CYGWIN* )
        +    PS=";"
        +    FS="/"
        +    TESTJAVA=`cygpath -u ${TESTJAVA}`
        +    ;;
           * )
             echo "Unrecognized system!"
             exit 1;
        @@ -92,24 +97,27 @@
         # Dump built-in currency data + overrides in properties file copied into
         # JRE image.
         
        -# copy the test properties file
        +# Copy the test properties file. If testjava is not a typical jdk-image
        +# or testjava is not writable, make a private copy of it.
         COPIED=0
        -if [ -w $TESTJAVA ]
        +if [ -w ${TESTJAVA}${FS}jre${FS}lib ]
         then
           WRITABLEJDK=$TESTJAVA
        +  PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
         else
           WRITABLEJDK=.${FS}testjava
        +  if [ -d ${TESTJAVA}${FS}jre ]
        +  then
        +    PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
        +  else
        +    PROPLOCATION=${WRITABLEJDK}${FS}lib
        +  fi
           cp -r $TESTJAVA $WRITABLEJDK
        +  chmod -R +w $WRITABLEJDK
           COPIED=1
         fi
        -
        -if [ -d ${WRITABLEJDK}${FS}jre ]
        -then
        -  PROPLOCATION=${WRITABLEJDK}${FS}jre${FS}lib
        -else
        -  PROPLOCATION=${WRITABLEJDK}${FS}lib
        -fi
         cp ${PROPS} $PROPLOCATION
        +echo "Properties location: ${PROPLOCATION}"
         
         # run
         echo ''
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/Basic-X.java.template
        --- a/jdk/test/java/util/Formatter/Basic-X.java.template	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/Basic-X.java.template	Thu Jul 11 12:50:20 2013 -0700
        @@ -1177,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/Basic.java
        --- a/jdk/test/java/util/Formatter/Basic.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/Basic.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,7 +25,7 @@
          * @summary Unit test for formatter
          * @bug 4906370 4962433 4973103 4989961 5005818 5031150 4970931 4989491 5002937
          *      5005104 5007745 5061412 5055180 5066788 5088703 6317248 6318369 6320122
        - *      6344623 6369500 6534606 6282094 6286592 6476425 5063507
        + *      6344623 6369500 6534606 6282094 6286592 6476425 5063507 6469160
          *
          * @run shell/timeout=240 Basic.sh
          */
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/BasicBigDecimal.java
        --- a/jdk/test/java/util/Formatter/BasicBigDecimal.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/BasicBigDecimal.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1177,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/BasicDouble.java
        --- a/jdk/test/java/util/Formatter/BasicDouble.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/BasicDouble.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1123,6 +1123,15 @@
         
         
         
        +
        +
        +
        +
        +
        +
        +
        +
        +
                 //---------------------------------------------------------------------
                 // %f - float, double, Double, BigDecimal
                 //---------------------------------------------------------------------
        @@ -1168,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/BasicDoubleObject.java
        --- a/jdk/test/java/util/Formatter/BasicDoubleObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/BasicDoubleObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1123,6 +1123,15 @@
         
         
         
        +
        +
        +
        +
        +
        +
        +
        +
        +
                 //---------------------------------------------------------------------
                 // %f - float, double, Double, BigDecimal
                 //---------------------------------------------------------------------
        @@ -1168,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/BasicFloat.java
        --- a/jdk/test/java/util/Formatter/BasicFloat.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/BasicFloat.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1106,6 +1106,15 @@
         
         
         
        +
        +
        +
        +
        +
        +
        +
        +
        +
                 //---------------------------------------------------------------------
                 // %f - float
                 //---------------------------------------------------------------------
        @@ -1168,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Formatter/BasicFloatObject.java
        --- a/jdk/test/java/util/Formatter/BasicFloatObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Formatter/BasicFloatObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1139,6 +1139,15 @@
         
         
         
        +
        +
        +
        +
        +
        +
        +
        +
        +
                 //---------------------------------------------------------------------
                 // %g
                 //
        @@ -1168,6 +1177,13 @@
                 test("%.3G", "1.00E-05", recip(create(100000.0)));
                 test("%.3G", "-1.00E-05", recip(create(-100000.0)));
         
        +        test("%.1g", "-0", -0.0);
        +        test("%3.0g", " -0", -0.0);
        +        test("%.1g", "0", 0.0);
        +        test("%3.0g", "  0", 0.0);
        +        test("%.1g", "0", +0.0);
        +        test("%3.0g", "  0", +0.0);
        +
                 test("%3.0g", "1e-06", 0.000001);
                 test("%3.0g", "1e-05", 0.00001);
                 test("%3.0g", "1e-05", 0.0000099);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Locale/LocaleProviders.java
        --- a/jdk/test/java/util/Locale/LocaleProviders.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Locale/LocaleProviders.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -207,7 +207,7 @@
                     String jreResult = "\u5e73\u6210 16.11.03 (\u6c34) \u5348\u524d 11:53:47";
                     Locale l = new Locale("ja", "JP", "JP");
                     SimpleDateFormat sdf = new SimpleDateFormat("GGGG yyyy.MMM.dd '('E')' a hh:mm:ss", l);
        -            sdf.setTimeZone(TimeZone.getTimeZone("PST"));
        +            sdf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
                     String result = sdf.format(sampleDate);
                     System.out.println(result);
                     if (LocaleProviderAdapter.getAdapterPreference()
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Locale/LocaleProviders.sh
        --- a/jdk/test/java/util/Locale/LocaleProviders.sh	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Locale/LocaleProviders.sh	Thu Jul 11 12:50:20 2013 -0700
        @@ -24,7 +24,7 @@
         #
         # @test
         # @bug 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8010666
        -#      8013086 8013233 8013903
        +#      8013086 8013233 8013903 8015960
         # @summary tests for "java.locale.providers" system property
         # @compile -XDignore.symbol.file LocaleProviders.java
         # @run shell/timeout=600 LocaleProviders.sh
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Map/Defaults.java
        --- a/jdk/test/java/util/Map/Defaults.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/Map/Defaults.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -271,14 +271,21 @@
         
             @Test(dataProvider = "Map rw=true keys=withNull values=withNull")
             public void testComputeIfPresentNulls(String description, Map map) {
        -        assertTrue(map.containsKey(null));
        -        assertNull(map.get(null));
        +        assertTrue(map.containsKey(null), description + ": null key absent");
        +        assertNull(map.get(null), description + ": value not null");
                 assertSame(map.computeIfPresent(null, (k, v) -> {
        -            fail();
        +            fail(description + ": null value is not deemed present");
                     return EXTRA_VALUE;
                 }), null, description);
                 assertTrue(map.containsKey(null));
        -        assertSame(map.get(null), null, description);
        +        assertNull(map.get(null), description);
        +        assertNull(map.remove(EXTRA_KEY), description + ": unexpected mapping");
        +        assertNull(map.put(EXTRA_KEY, null), description + ": unexpected value");
        +        assertSame(map.computeIfPresent(EXTRA_KEY, (k, v) -> {
        +            fail(description + ": null value is not deemed present");
        +            return EXTRA_VALUE;
        +        }), null, description);
        +        assertNull(map.get(EXTRA_KEY), description + ": null mapping gone");
             }
         
             @Test(dataProvider = "Map rw=true keys=all values=all")
        @@ -307,19 +314,59 @@
                 assertTrue(map.containsKey(null), "null key absent");
                 assertNull(map.get(null), "value not null");
                 assertSame(map.compute(null, (k, v) -> {
        +            assertNull(k);
        +            assertNull(v);
        +            return null;
        +        }), null, description);
        +        assertFalse(map.containsKey(null), description + ": null key present.");
        +        assertSame(map.compute(null, (k, v) -> {
                     assertSame(k, null);
                     assertNull(v);
                     return EXTRA_VALUE;
                 }), EXTRA_VALUE, description);
                 assertTrue(map.containsKey(null));
                 assertSame(map.get(null), EXTRA_VALUE, description);
        -        assertSame(map.remove(null), EXTRA_VALUE, "removed value not expected");
        -        assertFalse(map.containsKey(null), "null key present");
        +        assertSame(map.remove(null), EXTRA_VALUE, description + ": removed value not expected");
        +        // no mapping before and after
        +        assertFalse(map.containsKey(null), description + ": null key present");
                 assertSame(map.compute(null, (k, v) -> {
        -            assertSame(k, null);
        +            assertNull(k);
        +            assertNull(v);
        +            return null;
        +        }), null, description + ": expected null result" );
        +        assertFalse(map.containsKey(null), description + ": null key present");
        +        // compute with map not containing value
        +        assertNull(map.remove(EXTRA_KEY),  description + ": unexpected mapping");
        +        assertFalse(map.containsKey(EXTRA_KEY),  description + ": key present");
        +        assertSame(map.compute(EXTRA_KEY, (k, v) -> {
        +            assertSame(k, EXTRA_KEY);
                     assertNull(v);
                     return null;
                 }), null, description);
        +        assertFalse(map.containsKey(EXTRA_KEY),  description + ": null key present");
        +        // ensure removal.
        +        assertNull(map.put(EXTRA_KEY, EXTRA_VALUE));
        +        assertSame(map.compute(EXTRA_KEY, (k, v) -> {
        +            assertSame(k, EXTRA_KEY);
        +            assertSame(v, EXTRA_VALUE);
        +            return null;
        +        }), null, description + ": null resulted expected");
        +        assertFalse(map.containsKey(EXTRA_KEY),  description + ": null key present");
        +       // compute with map containing null value
        +        assertNull(map.put(EXTRA_KEY, null),  description + ": unexpected value");
        +        assertSame(map.compute(EXTRA_KEY, (k, v) -> {
        +            assertSame(k, EXTRA_KEY);
        +            assertNull(v);
        +            return null;
        +        }), null, description);
        +        assertFalse(map.containsKey(EXTRA_KEY),  description + ": null key present");
        +        assertNull(map.put(EXTRA_KEY, null),  description + ": unexpected value");
        +        assertSame(map.compute(EXTRA_KEY, (k, v) -> {
        +            assertSame(k, EXTRA_KEY);
        +            assertNull(v);
        +            return EXTRA_VALUE;
        +        }), EXTRA_VALUE, description);
        +        assertTrue(map.containsKey(EXTRA_KEY), "null key present");
             }
         
             @Test(dataProvider = "Map rw=true keys=all values=all")
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Map/EntryComparators.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Map/EntryComparators.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,139 @@
        +/*
        + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8009736 8010279
        + * @run testng EntryComparators
        + */
        +import java.util.function.Function;
        +import java.util.Comparator;
        +import java.util.AbstractMap;
        +import java.util.Map;
        +import org.testng.annotations.Test;
        +
        +import static org.testng.Assert.assertTrue;
        +import static org.testng.Assert.fail;
        +
        +/**
        + * Unit tests for Map.Entry.comparing
        + */
        +@Test(groups = "unit")
        +public class EntryComparators {
        +
        +    private  void assertPairComparison(K k1, V v1, K k2, V v2,
        +                                        Comparator> ck,
        +                                        Comparator> cv) {
        +        final Map.Entry p11 = new AbstractMap.SimpleImmutableEntry<>(k1, v1);
        +        final Map.Entry p12 = new AbstractMap.SimpleImmutableEntry<>(k1, v2);
        +        final Map.Entry p21 = new AbstractMap.SimpleImmutableEntry<>(k2, v1);
        +        final Map.Entry p22 = new AbstractMap.SimpleImmutableEntry<>(k2, v2);
        +
        +        assertTrue(ck.compare(p11, p11) == 0);
        +        assertTrue(ck.compare(p12, p11) == 0);
        +        assertTrue(ck.compare(p11, p12) == 0);
        +        assertTrue(ck.compare(p12, p22) < 0);
        +        assertTrue(ck.compare(p12, p21) < 0);
        +        assertTrue(ck.compare(p21, p11) > 0);
        +        assertTrue(ck.compare(p21, p12) > 0);
        +
        +        assertTrue(cv.compare(p11, p11) == 0);
        +        assertTrue(cv.compare(p12, p11) > 0);
        +        assertTrue(cv.compare(p11, p12) < 0);
        +        assertTrue(cv.compare(p12, p22) == 0);
        +        assertTrue(cv.compare(p12, p21) > 0);
        +        assertTrue(cv.compare(p21, p11) == 0);
        +        assertTrue(cv.compare(p21, p12) < 0);
        +
        +        Comparator> cmp = ck.thenComparing(cv);
        +        assertTrue(cmp.compare(p11, p11) == 0);
        +        assertTrue(cmp.compare(p12, p11) > 0);
        +        assertTrue(cmp.compare(p11, p12) < 0);
        +        assertTrue(cmp.compare(p12, p22) < 0);
        +        assertTrue(cmp.compare(p12, p21) < 0);
        +        assertTrue(cmp.compare(p21, p11) > 0);
        +        assertTrue(cmp.compare(p21, p12) > 0);
        +
        +        cmp = cv.thenComparing(ck);
        +        assertTrue(cmp.compare(p11, p11) == 0);
        +        assertTrue(cmp.compare(p12, p11) > 0);
        +        assertTrue(cmp.compare(p11, p12) < 0);
        +        assertTrue(cmp.compare(p12, p22) < 0);
        +        assertTrue(cmp.compare(p12, p21) > 0);
        +        assertTrue(cmp.compare(p21, p11) > 0);
        +        assertTrue(cmp.compare(p21, p12) < 0);
        +    }
        +
        +    public void testKVComparables() {
        +        assertPairComparison(1, "ABC", 2, "XYZ",
        +                         Map.Entry.comparingByKey(),
        +                         Map.Entry.comparingByValue());
        +    }
        +
        +    private static class People {
        +        final String firstName;
        +        final String lastName;
        +        final int age;
        +
        +        People(String first, String last, int age) {
        +            firstName = first;
        +            lastName = last;
        +            this.age = age;
        +        }
        +
        +        String getFirstName() { return firstName; }
        +        String getLastName() { return lastName; }
        +        int getAge() { return age; }
        +    }
        +
        +    private final People people[] = {
        +        new People("John", "Doe", 34),
        +        new People("Mary", "Doe", 30),
        +    };
        +
        +    public void testKVComparators() {
        +        // Comparator cmp = Comparator.naturalOrder(); // Should fail to compiler as People is not comparable
        +        // We can use simple comparator, but those have been tested above.
        +        // Thus choose to do compose for some level of interation.
        +        Comparator cmp1 = Comparator.comparing((Function) People::getFirstName);
        +        Comparator cmp2 = Comparator.comparing((Function) People::getLastName);
        +        Comparator cmp = cmp1.thenComparing(cmp2);
        +
        +        assertPairComparison(people[0], people[0], people[1], people[1],
        +                         Map.Entry.comparingByKey(cmp),
        +                         Map.Entry.comparingByValue(cmp));
        +
        +    }
        +
        +    public void testNulls() {
        +        try {
        +            Comparator> cmp = Map.Entry.comparingByKey(null);
        +            fail("comparingByKey(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +
        +        try {
        +            Comparator> cmp = Map.Entry.comparingByValue(null);
        +            fail("comparingByValue(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Properties/Bug6609431.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Properties/Bug6609431.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,53 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 6609431
        + * @summary Test whether loading of a property value in a file ending with
        + *    a backslash works fine.
        + */
        +
        +import java.io.File;
        +import java.io.FileReader;
        +import java.io.IOException;
        +import java.util.Properties;
        +
        +public class Bug6609431 {
        +    private static final String expected = "backslash";
        +
        +    public static void main(String[] args) throws IOException {
        +        try (FileReader fr =
        +                new FileReader(new File(System.getProperty("test.src", "."),
        +                                        "Bug6609431.properties"))) {
        +            Properties p = new Properties();
        +            p.load(fr);
        +            p.getProperty("a");
        +            String val = p.getProperty("b");
        +            if (!val.equals(expected)) {
        +                throw new RuntimeException("Value returned from the property" +
        +                " list was incorrect. Returned: '" + val +
        +                "', expected: '" + expected + "'");
        +            }
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/Properties/Bug6609431.properties
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/Properties/Bug6609431.properties	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,24 @@
        +# 
        +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        +# 
        +# This code is free software; you can redistribute it and/or modify it
        +# under the terms of the GNU General Public License version 2 only, as
        +# published by the Free Software Foundation.
        +# 
        +# This code is distributed in the hope that it will be useful, but WITHOUT
        +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        +# version 2 for more details (a copy is included in the LICENSE file that
        +# accompanied this code).
        +# 
        +# You should have received a copy of the GNU General Public License version
        +# 2 along with this work; if not, write to the Free Software Foundation,
        +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        +# 
        +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        +# or visit www.oracle.com if you need additional information or have any
        +# questions.
        +#
        +a=backslashbackslash
        +b=backslash\
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/function/BinaryOperator/BasicTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/function/BinaryOperator/BasicTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,104 @@
        +/*
        + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8009736 8010279
        + * @run testng BasicTest
        + */
        +
        +import java.util.Comparator;
        +import java.util.function.BinaryOperator;
        +import java.util.function.Function;
        +import java.util.function.ToIntFunction;
        +import org.testng.annotations.Test;
        +
        +
        +import static java.util.function.BinaryOperator.minBy;
        +import static java.util.function.BinaryOperator.maxBy;
        +import static org.testng.Assert.assertSame;
        +import static org.testng.Assert.fail;
        +
        +/**
        + * Unit tests for helper methods in Comparators
        + */
        +@Test(groups = "unit")
        +public class BasicTest {
        +
        +    private static class People {
        +        final String firstName;
        +        final String lastName;
        +        final int age;
        +
        +        People(String first, String last, int age) {
        +            firstName = first;
        +            lastName = last;
        +            this.age = age;
        +        }
        +
        +        String getFirstName() { return firstName; }
        +        String getLastName() { return lastName; }
        +        int getAge() { return age; }
        +    }
        +
        +    private final People people[] = {
        +        new People("John", "Doe", 34),
        +        new People("Mary", "Doe", 30),
        +    };
        +
        +    public void testMaxBy() {
        +        Comparator cmp = Comparator.comparing((Function) People::getFirstName);
        +        // lesser
        +        assertSame(maxBy(cmp).apply(people[0], people[1]), people[1]);
        +        // euqal
        +        cmp = Comparator.comparing((Function) People::getLastName);
        +        assertSame(maxBy(cmp).apply(people[0], people[1]), people[0]);
        +        // greater
        +        cmp = Comparator.comparing((ToIntFunction) People::getAge);
        +        assertSame(maxBy(cmp).apply(people[0], people[1]), people[0]);
        +    }
        +
        +    public void testLesserOf() {
        +        Comparator cmp = Comparator.comparing((Function) People::getFirstName);
        +        // lesser
        +        assertSame(minBy(cmp).apply(people[0], people[1]), people[0]);
        +        // euqal
        +        cmp = Comparator.comparing((Function) People::getLastName);
        +        assertSame(minBy(cmp).apply(people[0], people[1]), people[0]);
        +        // greater
        +        cmp = Comparator.comparing((ToIntFunction) People::getAge);
        +        assertSame(minBy(cmp).apply(people[0], people[1]), people[1]);
        +    }
        +
        +    public void testNulls() {
        +        try {
        +            BinaryOperator op = minBy(null);
        +            fail("minBy(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +
        +        try {
        +            BinaryOperator op = maxBy(null);
        +            fail("maxBy(null) should throw NPE");
        +        } catch (NullPointerException npe) {}
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/LogManagerInstanceTest.java
        --- a/jdk/test/java/util/logging/LogManagerInstanceTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/logging/LogManagerInstanceTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -63,7 +63,7 @@
                         if (!super.addLogger(root))
                             throw new RuntimeException("Fail to addLogger " + root);
                     } else {
        -                System.out.println("Root logger already exists");
        +                throw new RuntimeException("Root logger already exists");
                     }
                     this.base = root;
                 }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,73 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.util.Arrays;
        +import java.util.List;
        +import java.util.logging.Logger;
        +
        +/**
        + * @test
        + * @bug 7184195
        + * @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration
        + * @build TestGetGlobal testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
        + * @run main/othervm/timeout=10 TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobal
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobal
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobal
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobal
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobal
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobal
        + * @author danielfuchs
        + */
        +public class TestGetGlobal {
        +
        +    final static String[] messages = {
        +        "1. This message should not appear on the console.",
        +        "2. This message should appear on the console.",
        +        "3. This message should now appear on the console too."
        +    };
        +
        +    static {
        +        System.setProperty("java.util.logging.config.file",
        +            System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
        +    }
        +
        +    public static void main(String... args) {
        +
        +        Logger.global.info(messages[0]); // at this point LogManager is not
        +             // initialized yet, so this message should not appear.
        +        Logger.getGlobal().info(messages[1]); // calling getGlobal() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[2]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
        +        if (!testgetglobal.HandlerImpl.received.equals(expected)) {
        +            throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,73 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.util.Arrays;
        +import java.util.List;
        +import java.util.logging.Logger;
        +
        +/**
        + * @test
        + * @bug 7184195
        + * @summary checks that java.util.logging.Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info() logs without configuration
        + * @build TestGetGlobalByName testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
        + * @run main/othervm/timeout=10 TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalByName
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl1 TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalByName
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalByName
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalByName
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalByName
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalByName
        + * @author danielfuchs
        + */
        +public class TestGetGlobalByName {
        +
        +    final static String[] messages = {
        +        "1. This message should not appear on the console.",
        +        "2. This message should appear on the console.",
        +        "3. This message should now appear on the console too."
        +    };
        +
        +    static {
        +        System.setProperty("java.util.logging.config.file",
        +            System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
        +    }
        +
        +    public static void main(String... args) {
        +
        +        Logger.global.info(messages[0]); // at this point LogManager is not
        +             // initialized yet, so this message should not appear.
        +        Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(messages[1]); // calling getLogger() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[2]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, 1, messages.length));
        +        if (!testgetglobal.HandlerImpl.received.equals(expected)) {
        +            throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,184 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.util.Arrays;
        +import java.util.List;
        +import java.util.logging.Logger;
        +
        +/**
        + * @test
        + * @bug 7184195
        + * @summary checks that java.util.logging.Logger.getGlobal().info() logs without configuration
        + * @build TestGetGlobalConcurrent testgetglobal.HandlerImpl testgetglobal.LogManagerImpl1 testgetglobal.LogManagerImpl2 testgetglobal.LogManagerImpl3 testgetglobal.BadLogManagerImpl testgetglobal.DummyLogManagerImpl
        + * @run main/othervm/timeout=10 TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl2 TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.LogManagerImpl3 TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.BadLogManagerImpl TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10 -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent
        + * @run main/othervm/timeout=10/policy=policy -Djava.security.manager -Djava.util.logging.manager=testgetglobal.DummyLogManagerImpl TestGetGlobalConcurrent
        + * @author danielfuchs
        + */
        +public class TestGetGlobalConcurrent {
        +
        +    final static String[] messages = {
        +        "1. This message should not appear on the console.",
        +        "2. This message should appear on the console.",
        +        "3. This message should now appear on the console too.",
        +        "4. This message should appear on the console.",
        +        "5. This message should now appear on the console too.",
        +        "6. This message should appear on the console.",
        +        "7. This message should now appear on the console too.",
        +        "8. This message should appear on the console.",
        +        "9. This message should now appear on the console too."
        +    };
        +
        +    static {
        +        System.setProperty("java.util.logging.config.file",
        +            System.getProperty("test.src", ".") + java.io.File.separator + "logging.properties");
        +    }
        +
        +    public static void test1() {
        +        final int nb = 1;
        +        final int i = 2*nb + 1;
        +        Logger.getGlobal().info(messages[i]); // calling getGlobal() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[i+1]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
        +        if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
        +            fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
        +        }
        +    }
        +    public static void test2() {
        +        final int nb = 2;
        +        final int i = 2*nb + 1;
        +        Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(messages[i]); // calling getGlobal() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[i+1]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
        +        if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
        +            fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
        +        }
        +    }
        +    public static void test3() {
        +        final int nb = 3;
        +        final int i = 2*nb + 1;
        +        java.util.logging.LogManager.getLogManager();
        +        Logger.getGlobal().info(messages[i]); // calling getGlobal() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[i+1]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, i, i+2));
        +        if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
        +            fail(new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected));
        +        }
        +    }
        +    public static void test4() {
        +        log = new MyLogger("foo.bar");
        +        java.util.logging.LogManager.getLogManager().addLogger(log);
        +    }
        +
        +
        +    private static volatile Throwable failed = null;
        +    private static volatile Logger log = null;
        +
        +    public static class MyLogger extends Logger {
        +        public MyLogger(String name) {
        +            super(name, null);
        +        }
        +    }
        +
        +    public static void fail(Throwable failure) {
        +        failure.printStackTrace();
        +        if (failed == null) failed = failure;
        +    }
        +
        +    public static class WaitAndRun implements Runnable {
        +          private final Runnable run;
        +          public WaitAndRun(Runnable run) {
        +              this.run = run;
        +          }
        +          public void run() {
        +              try {
        +                 Thread.sleep(10);
        +                 run.run();
        +              } catch (Exception | Error x) {
        +                 fail(x);
        +              }
        +          }
        +    }
        +
        +    final static class Run1 implements Runnable {
        +        public void run() { test1(); }
        +    }
        +    final static class Run2 implements Runnable {
        +        public void run() { test2(); }
        +    }
        +    final static class Run3 implements Runnable {
        +        public void run() { test3(); }
        +    }
        +    final static class Run4 implements Runnable {
        +        public void run() { test4(); }
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +
        +        final Thread t1 = new Thread(new WaitAndRun(new Run1()), "test1");
        +        final Thread t2 = new Thread(new WaitAndRun(new Run2()), "test2");
        +        final Thread t3 = new Thread(new WaitAndRun(new Run3()), "test3");
        +        final Thread t4 = new Thread(new WaitAndRun(new Run4()), "test4");
        +
        +        t1.setDaemon(true); t2.setDaemon(true); t3.setDaemon(true); t4.setDaemon(true);
        +        t1.start(); t2.start(); t3.start(); t4.start();
        +
        +        Thread.sleep(10);
        +
        +        Logger.getGlobal().info(messages[1]); // calling getGlobal() will
        +             // initialize the LogManager - and thus this message should appear.
        +        Logger.global.info(messages[2]); // Now that the LogManager is
        +             // initialized, this message should appear too.
        +
        +        final List expected = Arrays.asList(Arrays.copyOfRange(messages, 1, 3));
        +        if (!testgetglobal.HandlerImpl.received.containsAll(expected)) {
        +            throw new Error("Unexpected message list: "+testgetglobal.HandlerImpl.received+" vs "+ expected);
        +        }
        +
        +
        +        t1.join(); t2.join(); t3.join(); t4.join();
        +
        +        if (failed != null) {
        +             throw new Error("Test failed.", failed);
        +        }
        +
        +        System.out.println("Test passed");
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/logging.properties
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/logging.properties	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,2 @@
        +.level=INFO
        +handlers=testgetglobal.HandlerImpl
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/policy
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/policy	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,7 @@
        +grant {
        +    permission java.util.PropertyPermission "java.util.logging.config.file", "write";
        +    permission java.util.PropertyPermission "test.src", "read";
        +    permission java.lang.RuntimePermission "setContextClassLoader";
        +    permission java.lang.RuntimePermission "shutdownHooks";
        +    permission java.util.logging.LoggingPermission "control";
        +};
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/BadLogManagerImpl.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/BadLogManagerImpl.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,46 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +
        +/**
        + * This class is used to verify that calling Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
        + * in the constructor of a LogManager subclass installed as default
        + * LogManager does not cause issues beyond throwing the expected NPE.
        + * In that case the default LogManager class will simply be used.
        + * @author danielfuchs
        + */
        +public class BadLogManagerImpl extends LogManager {
        +
        +    final Logger globalLogger;
        +    public BadLogManagerImpl() {
        +        // The call below should generate an NPE, which will be
        +        // catched in LogManager initializer.
        +        globalLogger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +        System.err.println("Global is: " + globalLogger);
        +        throw new Error("Should not have reached here");
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/DummyLogManagerImpl.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/DummyLogManagerImpl.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,35 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +
        +/**
        + * A dummy LogManager subclass that does nothing beyond extending LogManager.
        + * @author danielfuchs
        + */
        +public class DummyLogManagerImpl extends LogManager {
        +
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/HandlerImpl.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/HandlerImpl.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,46 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.concurrent.CopyOnWriteArrayList;
        +import java.util.List;
        +import java.util.logging.ConsoleHandler;
        +import java.util.logging.LogRecord;
        +
        +/**
        + *
        + * @author danielfuchs
        + */
        +public class HandlerImpl extends ConsoleHandler {
        +
        +    public final static List received = new CopyOnWriteArrayList<>();
        +
        +    public HandlerImpl() {
        +    }
        +
        +    @Override
        +    public void publish(LogRecord record) {
        +        received.add(record.getMessage());
        +        super.publish(record);
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl1.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl1.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,42 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +
        +/**
        + * This class is used to verify that calling Logger.getGlobal() in the static
        + * initializer of a LogManager subclass installed as default LogManager
        + * does not cause issues.
        + * @author danielfuchs
        + */
        +public class LogManagerImpl1 extends LogManager {
        +
        +    static final Logger global;
        +    static {
        +        global = Logger.getGlobal();
        +        System.err.println("Global is: " + global);
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl2.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl2.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,42 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +
        +/**
        + * This class is used to verify that calling Logger.getGlobal() in the constructor
        + * initializer of a LogManager subclass installed as default LogManager
        + * does not cause issues.
        + * @author danielfuchs
        + */
        +public class LogManagerImpl2 extends LogManager {
        +
        +    final Logger globalLogger;
        +    public LogManagerImpl2() {
        +        globalLogger = Logger.getGlobal();
        +        System.err.println("Global is: " + globalLogger);
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl3.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/LogManagerImpl3.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,59 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 testgetglobal;
        +
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +
        +/**
        + * This class is used to verify that calling Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
        + * in the static initializer of a LogManager subclass installed as default
        + * LogManager does not cause issues beyond throwing the expected NPE.
        + * @author danielfuchs
        + */
        +public class LogManagerImpl3 extends LogManager {
        +
        +    static final Logger global;
        +    static {
        +        Logger g = null;
        +        try {
        +            g = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            throw new Error("Should not have reached here");
        +        } catch (Exception x) {
        +            // This is to be expected: Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)
        +            // will call LogManager.getLogManager() which will return null, since
        +            // we haven't manage to do new LogManagerImpl3() yet.
        +            //
        +            System.err.println("Got expected exception - you cannot call"
        +                   + " Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)"
        +                   + " in LogManager subclass static initializer: " + x);
        +            x.printStackTrace();
        +        }
        +        if (g == null) {
        +            g = Logger.getGlobal();
        +        }
        +        global = g;
        +        System.err.println("Global is: " + global);
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/logging/TestAppletLoggerContext.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/logging/TestAppletLoggerContext.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,610 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.security.CodeSource;
        +import java.security.Permission;
        +import java.security.PermissionCollection;
        +import java.security.Permissions;
        +import java.security.Policy;
        +import java.security.ProtectionDomain;
        +import java.util.EnumSet;
        +import java.util.HashMap;
        +import java.util.Map;
        +import java.util.logging.LogManager;
        +import java.util.logging.Logger;
        +import java.util.logging.LoggingPermission;
        +import sun.misc.JavaAWTAccess;
        +import sun.misc.SharedSecrets;
        +
        +/*
        + * @test
        + * @bug 8017174 8010727
        + * @summary  NPE when using Logger.getAnonymousLogger or
        + *           LogManager.getLogManager().getLogger
        + *
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingApplet
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  LoadingApplet
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext LoadingMain
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  LoadingMain
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext One
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  One
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Two
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Two
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Three
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Three
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Four
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Four
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Five
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Five
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Six
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Six
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext Seven
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext  Seven
        + * @run main/othervm -Dtest.security=off TestAppletLoggerContext
        + * @run main/othervm -Dtest.security=on TestAppletLoggerContext
        + */
        +
        +// NOTE: We run in other VM in order to 1. switch security manager and 2. cause
        +// LogManager class to be loaded anew.
        +public class TestAppletLoggerContext {
        +
        +    // Avoids the hassle of dealing with files and system props...
        +    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);
        +        }
        +    }
        +
        +    // The bridge class initializes the logging system.
        +    // It stubs the applet context in order to simulate context changes.
        +    //
        +    public static class Bridge {
        +
        +        private static class JavaAWTAccessStub implements JavaAWTAccess {
        +            boolean active = true;
        +
        +            private static class TestExc {
        +                private final Map map = new HashMap<>();
        +                void put(Object key, Object v) { map.put(key, v); }
        +                Object get(Object key) { return map.get(key); }
        +                void remove(Object o) { map.remove(o); }
        +                public static TestExc exc(Object o) {
        +                    return TestExc.class.cast(o);
        +                }
        +            }
        +
        +            TestExc exc;
        +            TestExc global = new TestExc();
        +
        +            @Override
        +            public Object getContext() { return active ? global : null; }
        +            @Override
        +            public Object getExecutionContext() { return active ? exc : null; }
        +            @Override
        +            public Object get(Object o, Object o1) { return TestExc.exc(o).get(o1); }
        +            @Override
        +            public void put(Object o, Object o1, Object o2) { TestExc.exc(o).put(o1, o2); }
        +            @Override
        +            public void remove(Object o, Object o1) { TestExc.exc(o).remove(o1); }
        +            @Override
        +            public Object get(Object o) { return global.get(o); }
        +            @Override
        +            public void put(Object o, Object o1) { global.put(o, o1); }
        +            @Override
        +            public void remove(Object o) { global.remove(o); }
        +            @Override
        +            public boolean isDisposed() { return false; }
        +            @Override
        +            public boolean isMainAppContext() { return exc == null; }
        +        }
        +
        +        final static JavaAWTAccessStub javaAwtAccess = new JavaAWTAccessStub();
        +        public static void init() {
        +            SharedSecrets.setJavaAWTAccess(javaAwtAccess);
        +            if (System.getProperty("test.security", "on").equals("on")) {
        +                Policy p = new SimplePolicy(new LoggingPermission("control", null),
        +                    new RuntimePermission("setContextClassLoader"),
        +                    new RuntimePermission("shutdownHooks"));
        +                Policy.setPolicy(p);
        +                System.setSecurityManager(new SecurityManager());
        +            }
        +        }
        +
        +        public static void changeContext() {
        +            System.out.println("... Switching to a new applet context ...");
        +            javaAwtAccess.active = true;
        +            javaAwtAccess.exc = new JavaAWTAccessStub.TestExc();
        +        }
        +
        +        public static void desactivate() {
        +            System.out.println("... Running with no applet context ...");
        +            javaAwtAccess.exc = null;
        +            javaAwtAccess.active = false;
        +        }
        +
        +        public static class CustomAnonymousLogger extends Logger {
        +            public CustomAnonymousLogger() {
        +                this("");
        +            }
        +            public CustomAnonymousLogger(String name) {
        +                super(null, null);
        +                System.out.println( " LogManager: " +LogManager.getLogManager());
        +                System.out.println( " getLogger: " +LogManager.getLogManager().getLogger(name));
        +                setParent(LogManager.getLogManager().getLogger(name));
        +            }
        +        }
        +
        +        public static class CustomLogger extends Logger {
        +            CustomLogger(String name) {
        +                super(name, null);
        +            }
        +        }
        +    }
        +
        +    public static enum TestCase {
        +        LoadingApplet, LoadingMain, One, Two, Three, Four, Five, Six, Seven;
        +        public void test() {
        +            switch(this) {
        +                // When run - each of these two tests must be
        +                // run before any other tests and before each other.
        +                case LoadingApplet: testLoadingApplet(); break;
        +                case LoadingMain:   testLoadingMain(); break;
        +                case One:   testOne(); break;
        +                case Two:   testTwo(); break;
        +                case Three: testThree(); break;
        +                case Four:  testFour(); break;
        +                case Five:  testFive(); break;
        +                case Six:   testSix(); break;
        +                case Seven: testSeven(); break;
        +            }
        +        }
        +        public String describe() {
        +            switch(this) {
        +                case LoadingApplet:
        +                    return "Test that when the LogManager class is"
        +                        + " loaded in  an applet thread first,"
        +                        + "\n all LoggerContexts are correctly initialized";
        +                case LoadingMain:
        +                    return "Test that when the LogManager class is"
        +                        + " loaded in  the main thread first,"
        +                        + "\n all LoggerContexts are correctly initialized";
        +                case One:
        +                    return "Test that Logger.getAnonymousLogger()"
        +                        + " and new CustomAnonymousLogger() don't throw NPE";
        +                case Two:
        +                    return "Test that Logger.getLogger(\"\")"
        +                            + " does not return null nor throws NPE";
        +                case Three:
        +                    return "Test that LogManager.getLogManager().getLogger(\"\")"
        +                            + " does not return null nor throws NPE";
        +                case Four:
        +                    return "Test that Logger.getLogger(Logger.GLOBAL_LOGGER_NAME)"
        +                            + " does not return null,\n and that"
        +                            + " new CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME)"
        +                            + " does not throw NPE";
        +                case Five:
        +                    return "Test that LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME)"
        +                            + "\n does not return null nor throws NPE";
        +                case Six:
        +                    return "Test that manager.getLogger(Logger.GLOBAL_LOGGER_NAME)"
        +                            + " returns null\n when manager is not the default"
        +                            + " LogManager instance.\n"
        +                            + "Test adding a new logger named \"global\" in that"
        +                            + " non default instance.";
        +                case Seven: return "Test that manager.getLogger(\"\")"
        +                            + " returns null\n when manager is not the default"
        +                            + " LogManager instance.\n"
        +                            + "Test adding a new logger named \"\" in that"
        +                            + " non default instance.";
        +                default: return "Undefined";
        +            }
        +        }
        +    };
        +
        +    /**
        +     * @param args the command line arguments
        +     */
        +    public static void main(String[] args) {
        +        Bridge.init();
        +        EnumSet tests = EnumSet.noneOf(TestCase.class);
        +        for (String arg : args) {
        +            tests.add(TestCase.valueOf(arg));
        +        }
        +        if (args.length == 0) {
        +            tests = EnumSet.complementOf(EnumSet.of(TestCase.LoadingMain));
        +        }
        +        final EnumSet loadingTests =
        +            EnumSet.of(TestCase.LoadingApplet, TestCase.LoadingMain);
        +        int testrun = 0;
        +        for (TestCase test : tests) {
        +            if (loadingTests.contains(test)) {
        +                if (testrun > 0) {
        +                    throw new UnsupportedOperationException("Test case "
        +                          + test + " must be executed first!");
        +                }
        +            }
        +            System.out.println("Testing "+ test+": ");
        +            System.out.println(test.describe());
        +            try {
        +                test.test();
        +            } catch (Exception x) {
        +               throw new Error(String.valueOf(test)
        +                   + (System.getSecurityManager() == null ? " without " : " with ")
        +                   + "security failed: "+x+"\n "+"FAILED: "+test.describe()+"\n", x);
        +            } finally {
        +                testrun++;
        +            }
        +            Bridge.changeContext();
        +            System.out.println("PASSED: "+ test);
        +        }
        +    }
        +
        +    public static void testLoadingApplet() {
        +        Bridge.changeContext();
        +
        +        Logger bar = new Bridge.CustomLogger("com.foo.Bar");
        +        LogManager.getLogManager().addLogger(bar);
        +        assertNotNull(bar.getParent());
        +        testParent(bar);
        +        testParent(LogManager.getLogManager().getLogger("global"));
        +        testParent(LogManager.getLogManager().getLogger(bar.getName()));
        +
        +        Bridge.desactivate();
        +
        +        Logger foo = new Bridge.CustomLogger("com.foo.Foo");
        +        boolean b = LogManager.getLogManager().addLogger(foo);
        +        assertEquals(Boolean.TRUE, Boolean.valueOf(b));
        +        assertNotNull(foo.getParent());
        +        testParent(foo);
        +        testParent(LogManager.getLogManager().getLogger("global"));
        +        testParent(LogManager.getLogManager().getLogger(foo.getName()));
        +    }
        +
        +    public static void testLoadingMain() {
        +        Bridge.desactivate();
        +
        +        Logger bar = new Bridge.CustomLogger("com.foo.Bar");
        +        LogManager.getLogManager().addLogger(bar);
        +        assertNotNull(bar.getParent());
        +        testParent(bar);
        +        testParent(LogManager.getLogManager().getLogger("global"));
        +        testParent(LogManager.getLogManager().getLogger(bar.getName()));
        +
        +        Bridge.changeContext();
        +
        +        Logger foo = new Bridge.CustomLogger("com.foo.Foo");
        +        boolean b = LogManager.getLogManager().addLogger(foo);
        +        assertEquals(Boolean.TRUE, Boolean.valueOf(b));
        +        assertNotNull(foo.getParent());
        +        testParent(foo);
        +        testParent(LogManager.getLogManager().getLogger("global"));
        +        testParent(LogManager.getLogManager().getLogger(foo.getName()));
        +
        +    }
        +
        +    public static void testOne() {
        +        for (int i=0; i<3 ; i++) {
        +            Logger logger1 = Logger.getAnonymousLogger();
        +            Logger logger1b = Logger.getAnonymousLogger();
        +            Bridge.changeContext();
        +            Logger logger2 = Logger.getAnonymousLogger();
        +            Logger logger2b = Logger.getAnonymousLogger();
        +            Bridge.changeContext();
        +            Logger logger3 = new Bridge.CustomAnonymousLogger();
        +            Logger logger3b = new Bridge.CustomAnonymousLogger();
        +            Bridge.changeContext();
        +            Logger logger4 = new Bridge.CustomAnonymousLogger();
        +            Logger logger4b = new Bridge.CustomAnonymousLogger();
        +        }
        +    }
        +
        +
        +    public static void testTwo() {
        +        for (int i=0; i<3 ; i++) {
        +            Logger logger1 = Logger.getLogger("");
        +            Logger logger1b = Logger.getLogger("");
        +            assertNotNull(logger1);
        +            assertNotNull(logger1b);
        +            assertEquals(logger1, logger1b);
        +            Bridge.changeContext();
        +            Logger logger2 = Logger.getLogger("");
        +            Logger logger2b = Logger.getLogger("");
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, logger2b);
        +            assertEquals(logger1, logger2);
        +        }
        +    }
        +
        +    public static void testThree() {
        +        for (int i=0; i<3 ; i++) {
        +            Logger logger1 = LogManager.getLogManager().getLogger("");
        +            Logger logger1b = LogManager.getLogManager().getLogger("");
        +            assertNotNull(logger1);
        +            assertNotNull(logger1b);
        +            assertEquals(logger1, logger1b);
        +            Bridge.changeContext();
        +            Logger logger2 = LogManager.getLogManager().getLogger("");
        +            Logger logger2b = LogManager.getLogManager().getLogger("");
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, logger2b);
        +            assertEquals(logger1, logger2);
        +        }
        +    }
        +
        +    public static void testFour() {
        +        for (int i=0; i<3 ; i++) {
        +            Logger logger1 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger1b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger1);
        +            assertNotNull(logger1b);
        +            assertEquals(logger1, logger1b);
        +            Bridge.changeContext();
        +
        +            Logger logger2 = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger2b = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, logger2b);
        +
        +            assertEquals(logger1, logger2);
        +
        +            Bridge.changeContext();
        +            Logger logger3 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger3b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Bridge.changeContext();
        +            Logger logger4 = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger4b = new Bridge.CustomAnonymousLogger(Logger.GLOBAL_LOGGER_NAME);
        +        }
        +    }
        +
        +    public static void testFive() {
        +        for (int i=0; i<3 ; i++) {
        +            Logger logger1 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger1b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger1);
        +            assertNotNull(logger1b);
        +            assertEquals(logger1, logger1b);
        +
        +            Bridge.changeContext();
        +
        +            Logger logger2 = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger2b = LogManager.getLogManager().getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, logger2b);
        +
        +            assertEquals(logger1, logger2);
        +        }
        +    }
        +
        +    /**
        +     * This test is designed to test the behavior of additional LogManager instances.
        +     * It must be noted that if the security manager is off, then calling
        +     * Bridge.changeContext() has actually no effect - which explains why we have
        +     * some differences between the cases security manager on & security manager
        +     * off.
        +     **/
        +    public static void testSix() {
        +        for (int i=0; i<3 ; i++) {
        +            Bridge.desactivate();
        +            LogManager manager = new LogManager() {};
        +            Logger logger1 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger1b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNull(logger1);
        +            assertNull(logger1b);
        +            Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        +            manager.addLogger(global);
        +            Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, global);
        +            assertEquals(logger2b, global);
        +            assertNull(manager.getLogger(""));
        +            assertNull(manager.getLogger(""));
        +
        +            Bridge.changeContext();
        +
        +            // this is not a supported configuration:
        +            // We are in an applet context with several log managers.
        +            // We however need to check our assumptions...
        +
        +            // Applet context => root logger and global logger are not null.
        +            //   root == LogManager.getLogManager().rootLogger
        +            //   global == Logger.global
        +
        +            Logger logger3 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger3b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger3);
        +            assertNotNull(logger3b);
        +            Logger expected = (System.getSecurityManager() != null
        +                  ? Logger.getGlobal()
        +                  : global);
        +            assertEquals(logger3, expected); // in applet context, we will not see
        +                  // the LogManager's custom global logger added above...
        +            assertEquals(logger3b, expected); // in applet context, we will not see
        +                  // the LogManager's custom global logger added above...
        +            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        +            manager.addLogger(global2); // adding a global logger will not work in applet context
        +               // we will always get back the global logger.
        +               // this could be considered as a bug...
        +            Logger logger4 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger4b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger4);
        +            assertNotNull(logger4b);
        +            assertEquals(logger4,  expected); // adding a global logger will not work in applet context
        +            assertEquals(logger4b, expected); // adding a global logger will not work in applet context
        +
        +            Logger logger5 = manager.getLogger("");
        +            Logger logger5b = manager.getLogger("");
        +            Logger expectedRoot = (System.getSecurityManager() != null
        +                  ? LogManager.getLogManager().getLogger("")
        +                  : null);
        +            assertEquals(logger5, expectedRoot);
        +            assertEquals(logger5b, expectedRoot);
        +
        +        }
        +    }
        +
        +    /**
        +     * This test is designed to test the behavior of additional LogManager instances.
        +     * It must be noted that if the security manager is off, then calling
        +     * Bridge.changeContext() has actually no effect - which explains why we have
        +     * some differences between the cases security manager on & security manager
        +     * off.
        +     **/
        +    public static void testSeven() {
        +        for (int i=0; i<3 ; i++) {
        +            Bridge.desactivate();
        +            LogManager manager = new LogManager() {};
        +            Logger logger1 = manager.getLogger("");
        +            Logger logger1b = manager.getLogger("");
        +            assertNull(logger1);
        +            assertNull(logger1b);
        +            Logger global = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        +            manager.addLogger(global);
        +            Logger logger2 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger2b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            assertNotNull(logger2);
        +            assertNotNull(logger2b);
        +            assertEquals(logger2, global);
        +            assertEquals(logger2b, global);
        +            Logger logger3 = manager.getLogger("");
        +            Logger logger3b = manager.getLogger("");
        +            assertNull(logger3);
        +            assertNull(logger3b);
        +            Logger root = new Bridge.CustomLogger("");
        +            manager.addLogger(root);
        +            Logger logger4 = manager.getLogger("");
        +            Logger logger4b = manager.getLogger("");
        +            assertNotNull(logger4);
        +            assertNotNull(logger4b);
        +            assertEquals(logger4, root);
        +            assertEquals(logger4b, root);
        +
        +            Bridge.changeContext();
        +
        +            // this is not a supported configuration:
        +            // We are in an applet context with several log managers.
        +            // We haowever need to check our assumptions...
        +
        +            // Applet context => root logger and global logger are not null.
        +            //   root == LogManager.getLogManager().rootLogger
        +            //   global == Logger.global
        +
        +            Logger logger5 = manager.getLogger("");
        +            Logger logger5b = manager.getLogger("");
        +            Logger expectedRoot = (System.getSecurityManager() != null
        +                  ? LogManager.getLogManager().getLogger("")
        +                  : root);
        +
        +            assertNotNull(logger5);
        +            assertNotNull(logger5b);
        +            assertEquals(logger5, expectedRoot);
        +            assertEquals(logger5b, expectedRoot);
        +            if (System.getSecurityManager() != null) {
        +                assertNotEquals(logger5, root);
        +                assertNotEquals(logger5b, root);
        +            }
        +
        +            Logger global2 = new Bridge.CustomLogger(Logger.GLOBAL_LOGGER_NAME);
        +            manager.addLogger(global2); // adding a global logger will not work in applet context
        +               // we will always get back the global logger.
        +               // this could be considered as a bug...
        +            Logger logger6 = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger logger6b = manager.getLogger(Logger.GLOBAL_LOGGER_NAME);
        +            Logger expectedGlobal = (System.getSecurityManager() != null
        +                  ? Logger.getGlobal()
        +                  : global);
        +            assertNotNull(logger6);
        +            assertNotNull(logger6b);
        +            assertEquals(logger6, expectedGlobal); // adding a global logger will not work in applet context
        +            assertEquals(logger6b, expectedGlobal); // adding a global logger will not work in applet context
        +
        +            Logger root2 = new Bridge.CustomLogger("");
        +            manager.addLogger(root2); // adding a root logger will not work in applet context
        +               // we will always get back the default manager's root logger.
        +               // this could be considered as a bug...
        +            Logger logger7 = manager.getLogger("");
        +            Logger logger7b = manager.getLogger("");
        +            assertNotNull(logger7);
        +            assertNotNull(logger7b);
        +            assertEquals(logger7, expectedRoot); // adding a global logger will not work in applet context
        +            assertEquals(logger7b, expectedRoot); // adding a global logger will not work in applet context
        +            assertNotEquals(logger7, root2);
        +            assertNotEquals(logger7b, root2);
        +        }
        +    }
        +
        +    public static void testParent(Logger logger) {
        +        Logger l = logger;
        +        while (l.getParent() != null) {
        +            l = l.getParent();
        +        }
        +        assertEquals("", l.getName());
        +    }
        +
        +    public static class TestError extends RuntimeException {
        +        public TestError(String msg) {
        +            super(msg);
        +        }
        +    }
        +
        +    public static void assertNotNull(Object obj) {
        +        if (obj == null) throw new NullPointerException();
        +    }
        +
        +    public static void assertNull(Object obj) {
        +        if (obj != null) throw new TestError("Null expected, got "+obj);
        +    }
        +
        +    public static void assertEquals(Object o1, Object o2) {
        +        if (o1 != o2) {
        +            throw new TestError(o1 + " != " + o2);
        +        }
        +    }
        +
        +    public static void assertNotEquals(Object o1, Object o2) {
        +        if (o1 == o2) {
        +            throw new TestError(o1 + " == " + o2);
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/bootlib/java/util/stream/IntStreamTestDataProvider.java
        --- a/jdk/test/java/util/stream/bootlib/java/util/stream/IntStreamTestDataProvider.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/bootlib/java/util/stream/IntStreamTestDataProvider.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -129,7 +129,6 @@
                                                     () -> IntStream.range(0, ints.length).spliterator()));
                         spliterators.add(splitDescr("IntStream.intRangeClosed(0,l):" + name,
                                                     () -> IntStream.rangeClosed(0, ints.length).spliterator()));
        -
                         // Need more!
                     }
                     spliteratorTestData = spliterators.toArray(new Object[0][]);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/bootlib/java/util/stream/LambdaTestHelpers.java
        --- a/jdk/test/java/util/stream/bootlib/java/util/stream/LambdaTestHelpers.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/bootlib/java/util/stream/LambdaTestHelpers.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -269,7 +269,7 @@
                 Set uniq = new HashSet<>();
                 while(iter.hasNext()) {
                     T each = iter.next();
        -            assertTrue(!uniq.contains(each));
        +            assertTrue(!uniq.contains(each), "Not unique");
                     uniq.add(each);
                 }
             }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/bootlib/java/util/stream/LoggingTestCase.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/stream/bootlib/java/util/stream/LoggingTestCase.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,67 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +package java.util.stream;
        +
        +import java.util.ArrayList;
        +import java.util.Collections;
        +import java.util.HashMap;
        +import java.util.List;
        +import java.util.Map;
        +
        +import org.testng.Assert;
        +import org.testng.ITestResult;
        +import org.testng.annotations.AfterMethod;
        +import org.testng.annotations.BeforeMethod;
        +import org.testng.annotations.Test;
        +
        +/**
        + * LoggingTestCase
        + *
        + */
        +@Test
        +public class LoggingTestCase extends Assert {
        +    private Map context = new HashMap<>();
        +
        +    @BeforeMethod
        +    public void before() {
        +        context.clear();
        +    }
        +
        +    @AfterMethod
        +    public void after(ITestResult result) {
        +        if (!result.isSuccess()) {
        +            List list = new ArrayList<>();
        +            Collections.addAll(list, result.getParameters());
        +            list.add(context.toString());
        +            result.setParameters(list.toArray(new Object[list.size()]));
        +        }
        +    }
        +
        +    protected void setContext(String key, Object value) {
        +        context.put(key, value);
        +    }
        +
        +    protected void clearContext(String key) {
        +        context.remove(key);
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java
        --- a/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/bootlib/java/util/stream/OpTestCase.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -50,7 +50,7 @@
          * ways and asserts that they produce equivalent results.
          */
         @Test
        -public abstract class OpTestCase extends Assert {
        +public abstract class OpTestCase extends LoggingTestCase {
         
             private final Map> testScenarios;
         
        @@ -67,6 +67,25 @@
                 return ((AbstractPipeline) s).getStreamFlags();
             }
         
        +    /**
        +     * An asserter for results produced when exercising of stream or terminal
        +     * tests.
        +     *
        +     * @param  the type of result to assert on
        +     */
        +    public interface ResultAsserter {
        +        /**
        +         * Assert a result produced when exercising of stream or terminal
        +         * test.
        +         *
        +         * @param actual the actual result
        +         * @param expected the expected result
        +         * @param isOrdered true if the pipeline is ordered
        +         * @param isParallel true if the pipeline is parallel
        +         */
        +        void assertResult(R actual, R expected, boolean isOrdered, boolean isParallel);
        +    }
        +
             // Exercise stream operations
         
             public interface BaseStreamTestScenario {
        @@ -190,14 +209,19 @@
                 Set testSet = new HashSet<>();
         
                 Collection refResult;
        -        boolean isOrdered;
         
                 Consumer> before = LambdaTestHelpers.bEmpty;
         
                 Consumer> after = LambdaTestHelpers.bEmpty;
         
        -        BiConsumer, Iterable> sequentialEqualityAsserter = LambdaTestHelpers::assertContentsEqual;
        -        BiConsumer, Iterable> parallelEqualityAsserter = LambdaTestHelpers::assertContentsEqual;
        +        ResultAsserter> resultAsserter = (act, exp, ord, par) -> {
        +            if (par & !ord) {
        +                LambdaTestHelpers.assertContentsUnordered(act, exp);
        +            }
        +            else {
        +                LambdaTestHelpers.assertContentsEqual(act, exp);
        +            }
        +        };
         
                 private ExerciseDataStreamBuilder(TestData data, Function m) {
                     this.data = data;
        @@ -211,10 +235,6 @@
                     testSet.addAll(testScenarios.get(shape));
                 }
         
        -        public BiConsumer, Iterable> getEqualityAsserter(BaseStreamTestScenario t) {
        -            return t.isParallel() ? parallelEqualityAsserter : sequentialEqualityAsserter;
        -        }
        -
                 //
         
                 public > ExerciseDataStreamBuilder expectedResult(I expectedResult) {
        @@ -299,29 +319,15 @@
                     return this;
                 }
         
        -        public ExerciseDataStreamBuilder sequentialEqualityAsserter(BiConsumer, Iterable> equalator) {
        -            this.sequentialEqualityAsserter = equalator;
        -            return this;
        -        }
        -
        -        public ExerciseDataStreamBuilder parallelEqualityAsserter(BiConsumer, Iterable> equalator) {
        -            this.parallelEqualityAsserter = equalator;
        +        public ExerciseDataStreamBuilder resultAsserter(ResultAsserter> resultAsserter) {
        +            this.resultAsserter = resultAsserter;
                     return this;
                 }
         
                 // Build method
         
        -        private long count(StreamShape shape, BaseStream s) {
        -            switch (shape) {
        -                case REFERENCE:    return ((Stream) s).count();
        -                case INT_VALUE:    return ((IntStream) s).count();
        -                case LONG_VALUE:   return ((LongStream) s).count();
        -                case DOUBLE_VALUE: return ((DoubleStream) s).count();
        -                default: throw new IllegalStateException("Unknown shape: " + shape);
        -            }
        -        }
        -
                 public Collection exercise() {
        +            final boolean isOrdered;
                     if (refResult == null) {
                         // Induce the reference result
                         before.accept(data);
        @@ -330,9 +336,10 @@
                         Node refNodeResult = ((AbstractPipeline) sOut).evaluateToArrayNode(size -> (U[]) new Object[size]);
                         refResult = LambdaTestHelpers.toBoxedList(refNodeResult.spliterator());
                         after.accept(data);
        -                S_OUT anotherCopy = m.apply(data.stream());
        -                long count = count(((AbstractPipeline) anotherCopy).getOutputShape(), anotherCopy);
        -                assertEquals(count, refNodeResult.count());
        +            }
        +            else {
        +                S_OUT sOut = m.apply(data.stream());
        +                isOrdered = StreamOpFlag.ORDERED.isKnown(((AbstractPipeline) sOut).getStreamFlags());
                     }
         
                     List errors = new ArrayList<>();
        @@ -343,16 +350,20 @@
                             List result = new ArrayList<>();
                             test.run(data, LambdaTestHelpers.toBoxingConsumer(result::add), m);
         
        -                    Runnable asserter = () -> getEqualityAsserter(test).accept(result, refResult);
        -                    if (test.isParallel() && !isOrdered)
        -                        asserter = () -> LambdaTestHelpers.assertContentsUnordered(result, refResult);
        -                    LambdaTestHelpers.launderAssertion(
        -                            asserter,
        -                            () -> String.format("%n%s: %s != %s", test, refResult, result));
        +                    Runnable asserter = () -> resultAsserter.assertResult(result, refResult, isOrdered, test.isParallel());
        +
        +                    if (refResult.size() > 1000) {
        +                        LambdaTestHelpers.launderAssertion(
        +                                asserter,
        +                                () -> String.format("%n%s: [actual size=%d] != [expected size=%d]", test, result.size(), refResult.size()));
        +                    }
        +                    else {
        +                        LambdaTestHelpers.launderAssertion(
        +                                asserter,
        +                                () -> String.format("%n%s: [actual] %s != [expected] %s", test, result, refResult));
        +                    }
         
                             after.accept(data);
        -//                } catch (AssertionError ae) {
        -//                    errors.add(ae);
                         } catch (Throwable t) {
                             errors.add(new Error(String.format("%s: %s", test, t), t));
                         }
        @@ -406,8 +417,7 @@
         
                 Set testSet = EnumSet.allOf(TerminalTestScenario.class);
         
        -        Function> sequentialEqualityAsserter = s -> LambdaTestHelpers::assertContentsEqual;
        -        Function> parallelEqualityAsserter = s -> LambdaTestHelpers::assertContentsEqual;
        +        ResultAsserter resultAsserter = (act, exp, ord, par) -> LambdaTestHelpers.assertContentsEqual(act, exp);
         
                 private ExerciseDataTerminalBuilder(TestData data, Function streamF, Function terminalF) {
                     this.data = data;
        @@ -423,23 +433,12 @@
                 }
         
                 public ExerciseDataTerminalBuilder equalator(BiConsumer equalityAsserter) {
        -            this.sequentialEqualityAsserter = s -> equalityAsserter;
        -            this.parallelEqualityAsserter = s -> equalityAsserter;
        +            resultAsserter = (act, exp, ord, par) -> equalityAsserter.accept(act, exp);
                     return this;
                 }
         
        -        public ExerciseDataTerminalBuilder sequentialEqualityAsserter(BiConsumer equalityAsserter) {
        -            this.sequentialEqualityAsserter = s -> equalityAsserter;
        -            return this;
        -        }
        -
        -        public ExerciseDataTerminalBuilder parallelEqualityAsserter(BiConsumer equalityAsserter) {
        -            this.parallelEqualityAsserter = s -> equalityAsserter;
        -            return this;
        -        }
        -
        -        public ExerciseDataTerminalBuilder parallelEqualityAsserter(Function> equalatorProvider) {
        -            this.parallelEqualityAsserter = equalatorProvider;
        +        public ExerciseDataTerminalBuilder resultAsserter(ResultAsserter resultAsserter) {
        +            this.resultAsserter = resultAsserter;
                     return this;
                 }
         
        @@ -467,8 +466,9 @@
                 // Build method
         
                 public R exercise() {
        -            S_OUT out = streamF.apply(data.stream());
        +            S_OUT out = streamF.apply(data.stream()).sequential();
                     AbstractPipeline ap = (AbstractPipeline) out;
        +            boolean isOrdered = StreamOpFlag.ORDERED.isKnown(ap.getStreamFlags());
                     StreamShape shape = ap.getOutputShape();
         
                     Node node = ap.evaluateToArrayNode(size -> (U[]) new Object[size]);
        @@ -481,9 +481,8 @@
                         S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
                                                               StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
                                                               false);
        -                BiConsumer asserter = sequentialEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
                                                            () -> String.format("Single sequential: %s != %s", refResult, result));
                     }
         
        @@ -491,11 +490,10 @@
                         S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
                                                               StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
                                                               false);
        -                // Force short-curcuit
        +                // Force short-circuit
                         source = (S_OUT) chain(source, new ShortCircuitOp(shape));
        -                BiConsumer asserter = sequentialEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
                                                            () -> String.format("Single sequential pull: %s != %s", refResult, result));
                     }
         
        @@ -503,44 +501,39 @@
                         S_OUT source = (S_OUT) createPipeline(shape, node.spliterator(),
                                                               StreamOpFlag.IS_ORDERED | StreamOpFlag.IS_SIZED,
                                                               true);
        -                BiConsumer asserter = parallelEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
                                                            () -> String.format("Single parallel: %s != %s", refResult, result));
                     }
         
                     if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL)) {
                         // This may forEach or tryAdvance depending on the terminal op implementation
                         S_OUT source = streamF.apply(data.stream());
        -                BiConsumer asserter = sequentialEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
                                                            () -> String.format("All sequential: %s != %s", refResult, result));
                     }
         
                     if (testSet.contains(TerminalTestScenario.ALL_SEQUENTIAL_SHORT_CIRCUIT)) {
                         S_OUT source = streamF.apply(data.stream());
        -                // Force short-curcuit
        +                // Force short-circuit
                         source = (S_OUT) chain(source, new ShortCircuitOp(shape));
        -                BiConsumer asserter = sequentialEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
                                                            () -> String.format("All sequential pull: %s != %s", refResult, result));
                     }
         
                     if (testSet.contains(TerminalTestScenario.ALL_PARALLEL)) {
                         S_OUT source = streamF.apply(data.parallelStream());
        -                BiConsumer asserter = parallelEqualityAsserter.apply(source);
                         R result = terminalF.apply(source);
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, true),
                                                            () -> String.format("All parallel: %s != %s", refResult, result));
                     }
         
                     if (testSet.contains(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL)) {
                         S_OUT source = streamF.apply(data.parallelStream());
        -                BiConsumer asserter = parallelEqualityAsserter.apply(source);
                         R result = terminalF.apply(source.sequential());
        -                LambdaTestHelpers.launderAssertion(() -> asserter.accept(refResult, result),
        +                LambdaTestHelpers.launderAssertion(() -> resultAsserter.assertResult(result, refResult, isOrdered, false),
                                                            () -> String.format("All parallel then sequential: %s != %s", refResult, result));
                     }
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/bootlib/java/util/stream/SpliteratorTestHelper.java
        --- a/jdk/test/java/util/stream/bootlib/java/util/stream/SpliteratorTestHelper.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/bootlib/java/util/stream/SpliteratorTestHelper.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,11 +42,33 @@
          */
         public class SpliteratorTestHelper {
         
        +    public interface ContentAsserter {
        +        void assertContents(Collection actual, Collection expected, boolean isOrdered);
        +    }
        +
        +    private static ContentAsserter DEFAULT_CONTENT_ASSERTER
        +            = SpliteratorTestHelper::assertContents;
        +
        +    @SuppressWarnings("unchecked")
        +    private static  ContentAsserter defaultContentAsserter() {
        +        return (ContentAsserter) DEFAULT_CONTENT_ASSERTER;
        +    }
        +
             public static void testSpliterator(Supplier> supplier) {
        -        testSpliterator(supplier, (Consumer b) -> b);
        +        testSpliterator(supplier, defaultContentAsserter());
        +    }
        +
        +    public static void testSpliterator(Supplier> supplier,
        +                                       ContentAsserter asserter) {
        +        testSpliterator(supplier, (Consumer b) -> b, asserter);
             }
         
             public static void testIntSpliterator(Supplier supplier) {
        +        testIntSpliterator(supplier, defaultContentAsserter());
        +    }
        +
        +    public static void testIntSpliterator(Supplier supplier,
        +                                          ContentAsserter asserter) {
                 class BoxingAdapter implements Consumer, IntConsumer {
                     private final Consumer b;
         
        @@ -65,10 +87,15 @@
                     }
                 }
         
        -        testSpliterator(supplier, c -> new BoxingAdapter(c));
        +        testSpliterator(supplier, BoxingAdapter::new, asserter);
             }
         
             public static void testLongSpliterator(Supplier supplier) {
        +        testLongSpliterator(supplier, defaultContentAsserter());
        +    }
        +
        +    public static void testLongSpliterator(Supplier supplier,
        +                                           ContentAsserter asserter) {
                 class BoxingAdapter implements Consumer, LongConsumer {
                     private final Consumer b;
         
        @@ -87,10 +114,15 @@
                     }
                 }
         
        -        testSpliterator(supplier, c -> new BoxingAdapter(c));
        +        testSpliterator(supplier, BoxingAdapter::new, asserter);
             }
         
             public static void testDoubleSpliterator(Supplier supplier) {
        +        testDoubleSpliterator(supplier, defaultContentAsserter());
        +    }
        +
        +    public static void testDoubleSpliterator(Supplier supplier,
        +                                             ContentAsserter asserter) {
                 class BoxingAdapter implements Consumer, DoubleConsumer {
                     private final Consumer b;
         
        @@ -109,11 +141,12 @@
                     }
                 }
         
        -        testSpliterator(supplier, c -> new BoxingAdapter(c));
        +        testSpliterator(supplier, BoxingAdapter::new, asserter);
             }
         
             static > void testSpliterator(Supplier supplier,
        -                                                              UnaryOperator> boxingAdapter) {
        +                                                              UnaryOperator> boxingAdapter,
        +                                                              ContentAsserter asserter) {
                 ArrayList fromForEach = new ArrayList<>();
                 Spliterator spliterator = supplier.get();
                 Consumer addToFromForEach = boxingAdapter.apply(fromForEach::add);
        @@ -121,14 +154,14 @@
         
                 Collection exp = Collections.unmodifiableList(fromForEach);
         
        -        testForEach(exp, supplier, boxingAdapter);
        -        testTryAdvance(exp, supplier, boxingAdapter);
        -        testMixedTryAdvanceForEach(exp, supplier, boxingAdapter);
        -        testMixedTraverseAndSplit(exp, supplier, boxingAdapter);
        +        testForEach(exp, supplier, boxingAdapter, asserter);
        +        testTryAdvance(exp, supplier, boxingAdapter, asserter);
        +        testMixedTryAdvanceForEach(exp, supplier, boxingAdapter, asserter);
        +        testMixedTraverseAndSplit(exp, supplier, boxingAdapter, asserter);
                 testSplitAfterFullTraversal(supplier, boxingAdapter);
        -        testSplitOnce(exp, supplier, boxingAdapter);
        -        testSplitSixDeep(exp, supplier, boxingAdapter);
        -        testSplitUntilNull(exp, supplier, boxingAdapter);
        +        testSplitOnce(exp, supplier, boxingAdapter, asserter);
        +        testSplitSixDeep(exp, supplier, boxingAdapter, asserter);
        +        testSplitUntilNull(exp, supplier, boxingAdapter, asserter);
             }
         
             //
        @@ -136,7 +169,8 @@
             private static > void testForEach(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 long sizeIfKnown = spliterator.getExactSizeIfKnown();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
        @@ -159,13 +193,14 @@
                 }
                 assertEquals(fromForEach.size(), exp.size());
         
        -        assertContents(fromForEach, exp, isOrdered);
        +        asserter.assertContents(fromForEach, exp, isOrdered);
             }
         
             private static > void testTryAdvance(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 long sizeIfKnown = spliterator.getExactSizeIfKnown();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
        @@ -188,13 +223,14 @@
                 }
                 assertEquals(fromTryAdvance.size(), exp.size());
         
        -        assertContents(fromTryAdvance, exp, isOrdered);
        +        asserter.assertContents(fromTryAdvance, exp, isOrdered);
             }
         
             private static > void testMixedTryAdvanceForEach(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 long sizeIfKnown = spliterator.getExactSizeIfKnown();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
        @@ -218,18 +254,14 @@
                 }
                 assertEquals(dest.size(), exp.size());
         
        -        if (isOrdered) {
        -            assertEquals(dest, exp);
        -        }
        -        else {
        -            assertContentsUnordered(dest, exp);
        -        }
        +        asserter.assertContents(dest, exp, isOrdered);
             }
         
             private static > void testMixedTraverseAndSplit(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 long sizeIfKnown = spliterator.getExactSizeIfKnown();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
        @@ -266,12 +298,7 @@
                 }
                 assertEquals(dest.size(), exp.size());
         
        -        if (isOrdered) {
        -            assertEquals(dest, exp);
        -        }
        -        else {
        -            assertContentsUnordered(dest, exp);
        -        }
        +        asserter.assertContents(dest, exp, isOrdered);
             }
         
             private static > void testSplitAfterFullTraversal(
        @@ -285,16 +312,14 @@
         
                 // Full traversal using forEach
                 spliterator = supplier.get();
        -        spliterator.forEachRemaining(boxingAdapter.apply(e -> {
        -        }));
        +        spliterator.forEachRemaining(boxingAdapter.apply(e -> { }));
                 split = spliterator.trySplit();
                 assertNull(split);
         
                 // Full traversal using tryAdvance then forEach
                 spliterator = supplier.get();
                 spliterator.tryAdvance(boxingAdapter.apply(e -> { }));
        -        spliterator.forEachRemaining(boxingAdapter.apply(e -> {
        -        }));
        +        spliterator.forEachRemaining(boxingAdapter.apply(e -> { }));
                 split = spliterator.trySplit();
                 assertNull(split);
             }
        @@ -302,7 +327,8 @@
             private static > void testSplitOnce(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 long sizeIfKnown = spliterator.getExactSizeIfKnown();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
        @@ -322,13 +348,15 @@
                     if (s1Size >= 0 && s2Size >= 0)
                         assertEquals(sizeIfKnown, s1Size + s2Size);
                 }
        -        assertContents(fromSplit, exp, isOrdered);
        +
        +        asserter.assertContents(fromSplit, exp, isOrdered);
             }
         
             private static > void testSplitSixDeep(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 S spliterator = supplier.get();
                 boolean isOrdered = spliterator.hasCharacteristics(Spliterator.ORDERED);
         
        @@ -340,13 +368,13 @@
         
                     // verify splitting with forEach
                     splitSixDeepVisitor(depth, 0, dest, spliterator, boxingAdapter, spliterator.characteristics(), false);
        -            assertContents(dest, exp, isOrdered);
        +            asserter.assertContents(dest, exp, isOrdered);
         
                     // verify splitting with tryAdvance
                     dest.clear();
                     spliterator = supplier.get();
                     splitSixDeepVisitor(depth, 0, dest, spliterator, boxingAdapter, spliterator.characteristics(), true);
        -            assertContents(dest, exp, isOrdered);
        +            asserter.assertContents(dest, exp, isOrdered);
                 }
             }
         
        @@ -411,7 +439,8 @@
             private static > void testSplitUntilNull(
                     Collection exp,
                     Supplier supplier,
        -            UnaryOperator> boxingAdapter) {
        +            UnaryOperator> boxingAdapter,
        +            ContentAsserter asserter) {
                 Spliterator s = supplier.get();
                 boolean isOrdered = s.hasCharacteristics(Spliterator.ORDERED);
                 assertSpliterator(s);
        @@ -420,7 +449,7 @@
                 Consumer c = boxingAdapter.apply(splits::add);
         
                 testSplitUntilNull(new SplitNode(c, s));
        -        assertContents(splits, exp, isOrdered);
        +        asserter.assertContents(splits, exp, isOrdered);
             }
         
             private static class SplitNode {
        @@ -540,23 +569,10 @@
                     assertEquals(actual, expected);
                 }
                 else {
        -            assertContentsUnordered(actual, expected);
        +            LambdaTestHelpers.assertContentsUnordered(actual, expected);
                 }
             }
         
        -    private static void assertContentsUnordered(Iterable actual, Iterable expected) {
        -        assertEquals(toBoxedMultiset(actual), toBoxedMultiset(expected));
        -    }
        -
        -    private static  Map toBoxedMultiset(Iterable c) {
        -        Map result = new HashMap<>();
        -        c.forEach(e -> {
        -            if (result.containsKey(e)) result.put(e, result.get(e) + 1);
        -            else result.put(e, 1);
        -        });
        -        return result;
        -    }
        -
             static void mixedTraverseAndSplit(Consumer b, Spliterator splTop) {
                 Spliterator spl1, spl2, spl3;
                 splTop.tryAdvance(b);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/DoubleNodeTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/DoubleNodeTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/DoubleNodeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -102,7 +102,7 @@
         
                 double i = it.nextDouble();
                 if (it.hasNext()) {
        -            return new Nodes.DoubleConcNode(Nodes.node(new double[] {i}), degenerateTree(it));
        +            return new Nodes.ConcNode.OfDouble(Nodes.node(new double[] {i}), degenerateTree(it));
                 }
                 else {
                     return Nodes.node(new double[] {i});
        @@ -114,7 +114,7 @@
                     return m.apply(l);
                 }
                 else {
        -            return new Nodes.DoubleConcNode(
        +            return new Nodes.ConcNode.OfDouble(
                             tree(l.subList(0, l.size() / 2), m),
                             tree(l.subList(l.size() / 2, l.size()), m));
                 }
        @@ -162,4 +162,18 @@
             public void testSpliterator(double[] array, Node.OfDouble n) {
                 SpliteratorTestHelper.testDoubleSpliterator(n::spliterator);
             }
        +
        +    @Test(dataProvider = "nodes")
        +    public void testTruncate(double[] array, Node.OfDouble n) {
        +        int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
        +        for (int start : nums)
        +            for (int end : nums) {
        +                if (start < 0 || end < 0 || end < start || end > array.length)
        +                    continue;
        +                Node.OfDouble slice = n.truncate(start, end, Double[]::new);
        +                double[] asArray = slice.asPrimitiveArray();
        +                for (int k = start; k < end; k++)
        +                    assertEquals(array[k], asArray[k - start]);
        +            }
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/IntNodeTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/IntNodeTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/IntNodeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -102,7 +102,7 @@
         
                 int i = it.nextInt();
                 if (it.hasNext()) {
        -            return new Nodes.IntConcNode(Nodes.node(new int[] {i}), degenerateTree(it));
        +            return new Nodes.ConcNode.OfInt(Nodes.node(new int[] {i}), degenerateTree(it));
                 }
                 else {
                     return Nodes.node(new int[] {i});
        @@ -114,7 +114,7 @@
                     return m.apply(l);
                 }
                 else {
        -            return new Nodes.IntConcNode(
        +            return new Nodes.ConcNode.OfInt(
                             tree(l.subList(0, l.size() / 2), m),
                             tree(l.subList(l.size() / 2, l.size()), m));
                 }
        @@ -160,4 +160,18 @@
             public void testSpliterator(int[] array, Node.OfInt n) {
                 SpliteratorTestHelper.testIntSpliterator(n::spliterator);
             }
        +
        +    @Test(dataProvider = "nodes")
        +    public void testTruncate(int[] array, Node.OfInt n) {
        +        int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
        +        for (int start : nums)
        +            for (int end : nums) {
        +                if (start < 0 || end < 0 || end < start || end > array.length)
        +                    continue;
        +                Node.OfInt slice = n.truncate(start, end, Integer[]::new);
        +                int[] asArray = slice.asPrimitiveArray();
        +                for (int k = start; k < end; k++)
        +                    assertEquals(array[k], asArray[k - start]);
        +            }
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/LongNodeTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/LongNodeTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/LongNodeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -102,7 +102,7 @@
         
                 long i = it.nextLong();
                 if (it.hasNext()) {
        -            return new Nodes.LongConcNode(Nodes.node(new long[] {i}), degenerateTree(it));
        +            return new Nodes.ConcNode.OfLong(Nodes.node(new long[] {i}), degenerateTree(it));
                 }
                 else {
                     return Nodes.node(new long[] {i});
        @@ -114,7 +114,7 @@
                     return m.apply(l);
                 }
                 else {
        -            return new Nodes.LongConcNode(
        +            return new Nodes.ConcNode.OfLong(
                             tree(l.subList(0, l.size() / 2), m),
                             tree(l.subList(l.size() / 2, l.size()), m));
                 }
        @@ -161,4 +161,18 @@
             public void testSpliterator(long[] array, Node.OfLong n) {
                 SpliteratorTestHelper.testLongSpliterator(n::spliterator);
             }
        +
        +    @Test(dataProvider = "nodes")
        +    public void testTruncate(long[] array, Node.OfLong n) {
        +        int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
        +        for (int start : nums)
        +            for (int end : nums) {
        +                if (start < 0 || end < 0 || end < start || end > array.length)
        +                    continue;
        +                Node.OfLong slice = n.truncate(start, end, Long[]::new);
        +                long[] asArray = slice.asPrimitiveArray();
        +                for (int k = start; k < end; k++)
        +                    assertEquals(array[k], asArray[k - start]);
        +            }
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/NodeTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/NodeTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/NodeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -137,4 +137,18 @@
             public void testSpliterator(Integer[] array, Node n) {
                 SpliteratorTestHelper.testSpliterator(n::spliterator);
             }
        +
        +    @Test(dataProvider = "nodes")
        +    public void testTruncate(Integer[] array, Node n) {
        +        int[] nums = new int[] { 0, 1, array.length / 2, array.length - 1, array.length };
        +        for (int start : nums)
        +            for (int end : nums) {
        +                if (start < 0 || end < 0 || end < start || end > array.length)
        +                    continue;
        +                Node slice = n.truncate(start, end, Integer[]::new);
        +                Integer[] asArray = slice.asArray(Integer[]::new);
        +                for (int k = start; k < end; k++)
        +                    assertEquals(array[k], asArray[k - start]);
        +            }
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/SliceSpliteratorTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/SliceSpliteratorTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,201 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +package java.util.stream;
        +
        +import org.testng.annotations.DataProvider;
        +import org.testng.annotations.Test;
        +
        +import java.util.ArrayList;
        +import java.util.Arrays;
        +import java.util.Collection;
        +import java.util.List;
        +import java.util.Spliterator;
        +
        +import static java.util.stream.Collectors.toList;
        +import static org.testng.Assert.assertEquals;
        +
        +/**
        + * @bug 8012987
        + */
        +@Test
        +public class SliceSpliteratorTest extends LoggingTestCase {
        +
        +    static class UnorderedContentAsserter implements SpliteratorTestHelper.ContentAsserter {
        +        Collection source;
        +
        +        UnorderedContentAsserter(Collection source) {
        +            this.source = source;
        +        }
        +
        +        @Override
        +        public void assertContents(Collection actual, Collection expected, boolean isOrdered) {
        +            if (isOrdered) {
        +                assertEquals(actual, expected);
        +            }
        +            else {
        +                assertEquals(actual.size(), expected.size());
        +                assertTrue(source.containsAll(actual));
        +            }
        +        }
        +    }
        +
        +    interface SliceTester {
        +        void test(int size, int skip, int limit);
        +    }
        +
        +    @DataProvider(name = "sliceSpliteratorDataProvider")
        +    public static Object[][] sliceSpliteratorDataProvider() {
        +        List data = new ArrayList<>();
        +
        +        // SIZED/SUBSIZED slice spliterator
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  IntStream.range(0, size).boxed().collect(toList());
        +
        +                SpliteratorTestHelper.testSpliterator(() -> {
        +                    Spliterator s = Arrays.spliterator(source.stream().toArray(Integer[]::new));
        +
        +                    return new StreamSpliterators.SliceSpliterator.OfRef<>(s, skip, limit);
        +                });
        +            };
        +            data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfRef", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  IntStream.range(0, size).boxed().collect(toList());
        +
        +                SpliteratorTestHelper.testIntSpliterator(() -> {
        +                    Spliterator.OfInt s = Arrays.spliterator(source.stream().mapToInt(i->i).toArray());
        +
        +                    return new StreamSpliterators.SliceSpliterator.OfInt(s, skip, limit);
        +                });
        +            };
        +            data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfInt", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  LongStream.range(0, size).boxed().collect(toList());
        +
        +                SpliteratorTestHelper.testLongSpliterator(() -> {
        +                    Spliterator.OfLong s = Arrays.spliterator(source.stream().mapToLong(i->i).toArray());
        +
        +                    return new StreamSpliterators.SliceSpliterator.OfLong(s, skip, limit);
        +                });
        +            };
        +            data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfLong", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  LongStream.range(0, size).asDoubleStream().boxed().collect(toList());
        +
        +                SpliteratorTestHelper.testDoubleSpliterator(() -> {
        +                    Spliterator.OfDouble s = Arrays.spliterator(source.stream().mapToDouble(i->i).toArray());
        +
        +                    return new StreamSpliterators.SliceSpliterator.OfDouble(s, skip, limit);
        +                });
        +            };
        +            data.add(new Object[]{"StreamSpliterators.SliceSpliterator.OfLong", r});
        +        }
        +
        +
        +        // Unordered slice spliterator
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  IntStream.range(0, size).boxed().collect(toList());
        +                final UnorderedContentAsserter uca = new UnorderedContentAsserter<>(source);
        +
        +                SpliteratorTestHelper.testSpliterator(() -> {
        +                    Spliterator s = Arrays.spliterator(source.stream().toArray(Integer[]::new));
        +
        +                    return new StreamSpliterators.UnorderedSliceSpliterator.OfRef<>(s, skip, limit);
        +                }, uca);
        +            };
        +            data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfRef", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  IntStream.range(0, size).boxed().collect(toList());
        +                final UnorderedContentAsserter uca = new UnorderedContentAsserter<>(source);
        +
        +                SpliteratorTestHelper.testIntSpliterator(() -> {
        +                    Spliterator.OfInt s = Arrays.spliterator(source.stream().mapToInt(i->i).toArray());
        +
        +                    return new StreamSpliterators.UnorderedSliceSpliterator.OfInt(s, skip, limit);
        +                }, uca);
        +            };
        +            data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfInt", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  LongStream.range(0, size).boxed().collect(toList());
        +                final UnorderedContentAsserter uca = new UnorderedContentAsserter<>(source);
        +
        +                SpliteratorTestHelper.testLongSpliterator(() -> {
        +                    Spliterator.OfLong s = Arrays.spliterator(source.stream().mapToLong(i->i).toArray());
        +
        +                    return new StreamSpliterators.UnorderedSliceSpliterator.OfLong(s, skip, limit);
        +                }, uca);
        +            };
        +            data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfLong", r});
        +        }
        +
        +        {
        +            SliceTester r = (size, skip, limit) -> {
        +                final Collection source =  LongStream.range(0, size).asDoubleStream().boxed().collect(toList());
        +                final UnorderedContentAsserter uca = new UnorderedContentAsserter<>(source);
        +
        +                SpliteratorTestHelper.testDoubleSpliterator(() -> {
        +                    Spliterator.OfDouble s = Arrays.spliterator(LongStream.range(0, SIZE).asDoubleStream().toArray());
        +
        +                    return new StreamSpliterators.UnorderedSliceSpliterator.OfDouble(s, skip, limit);
        +                }, uca);
        +            };
        +            data.add(new Object[]{"StreamSpliterators.UnorderedSliceSpliterator.OfLong", r});
        +        }
        +
        +        return data.toArray(new Object[0][]);
        +    }
        +
        +    static final int SIZE = 256;
        +
        +    static final int STEP = 32;
        +
        +    @Test(dataProvider = "sliceSpliteratorDataProvider")
        +    public void testSliceSpliterator(String description, SliceTester r) {
        +        setContext("size", SIZE);
        +        for (int skip = 0; skip < SIZE; skip += STEP) {
        +            setContext("skip", skip);
        +            for (int limit = 0; limit < SIZE; limit += STEP) {
        +                setContext("limit", skip);
        +                r.test(SIZE, skip, limit);
        +            }
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/StreamFlagsTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/StreamFlagsTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/StreamFlagsTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -80,8 +80,8 @@
                             EnumSet.of(ORDERED, DISTINCT, SIZED),
                             EnumSet.of(SORTED, SHORT_CIRCUIT));
                 assertFlags(OpTestCase.getStreamFlags(repeat),
        -                    EnumSet.of(ORDERED),
        -                    EnumSet.of(SIZED, DISTINCT, SORTED, SHORT_CIRCUIT));
        +                    EnumSet.noneOf(StreamOpFlag.class),
        +                    EnumSet.of(DISTINCT, SORTED, SHORT_CIRCUIT));
             }
         
             public void testFilter() {
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/boottest/java/util/stream/UnorderedTest.java
        --- a/jdk/test/java/util/stream/boottest/java/util/stream/UnorderedTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/boottest/java/util/stream/UnorderedTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -184,7 +184,6 @@
                     UnaryOperator fi = interpose(f, (S s) -> (S) chain(s, checkClearOrderedOp));
                     withData(data).
                             terminal(fi, terminalF).
        -                    without(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL).
                             equalator(equalityAsserter).
                             exercise();
                 }
        @@ -195,7 +194,6 @@
                     UnaryOperator fi = interpose(f, (S s) -> (S) chain(s, checkSetOrderedOp));
                     withData(data).
                             terminal(fi, s -> terminalF.apply(s.sequential())).
        -                    without(TerminalTestScenario.ALL_PARALLEL_SEQUENTIAL).
                             equalator(equalityAsserter).
                             exercise();
                 }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/DistinctOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -64,7 +64,6 @@
         
                 node = withData(data).
                         stream(s -> s.unordered().distinct()).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
                         exercise();
                 assertUnique(node);
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ForEachOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -58,6 +58,17 @@
                                     55);
             }
         
        +    private  ResultAsserter> resultAsserter() {
        +        return (act, exp, ord, par) -> {
        +            if (par) {
        +                LambdaTestHelpers.assertContentsUnordered(act, exp);
        +            }
        +            else {
        +                LambdaTestHelpers.assertContents(act, exp);
        +            }
        +        };
        +    }
        +
             @Test
             public void testForEachOrdered() {
                 List input = countTo(10000);
        @@ -93,13 +104,13 @@
                 // Test head
                 withData(data).
                         terminal(terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
         
                 // Test multiple stages
                 withData(data).
                         terminal(s -> s.map(LambdaTestHelpers.identity()), terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
             }
         
        @@ -141,13 +152,13 @@
                 // Test head
                 withData(data).
                         terminal(terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
         
                 // Test multiple stages
                 withData(data).
                         terminal(s -> s.map(i -> i), terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
             }
         
        @@ -189,13 +200,13 @@
                 // Test head
                 withData(data).
                         terminal(terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
         
                 // Test multiple stages
                 withData(data).
                         terminal(s -> s.map(i -> i), terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
             }
         
        @@ -237,13 +248,13 @@
                 // Test head
                 withData(data).
                         terminal(terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
         
                 // Test multiple stages
                 withData(data).
                         terminal(s -> s.map(i -> i), terminalFunc).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
        +                resultAsserter(resultAsserter()).
                         exercise();
             }
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/GroupByOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/GroupByOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/GroupByOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -133,9 +133,16 @@
                     Collector>> tab = Collectors.groupingBy(md.m);
                     Map> result =
                             withData(data)
        -                            .terminal(s -> s, s -> s.collect(tab))
        -                            .parallelEqualityAsserter(s -> StreamOpFlagTestHelper.isStreamOrdered(s) ? GroupByOpTest::assertObjectEquals : GroupByOpTest::assertMultiMapEquals)
        -                            .exercise();
        +                    .terminal(s -> s, s -> s.collect(tab))
        +                    .resultAsserter((act, exp, ord, par) -> {
        +                        if (par & !ord) {
        +                            GroupByOpTest.assertMultiMapEquals(act, exp);
        +                        }
        +                        else {
        +                            GroupByOpTest.assertObjectEquals(act, exp);
        +                        }
        +                    })
        +                    .exercise();
                     assertEquals(result.keySet().size(), md.expectedSize);
                 }
             }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -22,45 +22,440 @@
          */
         package org.openjdk.tests.java.util.stream;
         
        -import java.util.stream.OpTestCase;
        +import org.testng.annotations.DataProvider;
         import org.testng.annotations.Test;
         
        -import java.util.Arrays;
        +import java.lang.reflect.InvocationHandler;
        +import java.lang.reflect.Method;
        +import java.lang.reflect.Proxy;
        +import java.util.ArrayList;
         import java.util.List;
        -import java.util.stream.Collectors;
        +import java.util.Spliterator;
        +import java.util.function.Function;
        +import java.util.function.UnaryOperator;
        +import java.util.stream.DoubleStream;
        +import java.util.stream.DoubleStreamTestScenario;
        +import java.util.stream.IntStream;
        +import java.util.stream.IntStreamTestScenario;
        +import java.util.stream.LambdaTestHelpers;
        +import java.util.stream.LongStream;
        +import java.util.stream.LongStreamTestScenario;
        +import java.util.stream.OpTestCase;
         import java.util.stream.Stream;
        +import java.util.stream.StreamSupport;
        +import java.util.stream.StreamTestScenario;
        +import java.util.stream.TestData;
         
        -import static java.util.stream.LambdaTestHelpers.assertContents;
        +import static java.util.stream.LambdaTestHelpers.assertUnique;
         
         
         @Test
         public class InfiniteStreamWithLimitOpTest extends OpTestCase {
         
        -    private static final List tenAs = Arrays.asList("A", "A", "A", "A", "A", "A", "A", "A", "A", "A");
        +    private static final long SKIP_LIMIT_SIZE = 1 << 16;
        +
        +    @DataProvider(name = "Stream.limit")
        +    @SuppressWarnings("rawtypes")
        +    public static Object[][] sliceFunctionsDataProvider() {
        +        Function f = s -> String.format(s, SKIP_LIMIT_SIZE);
        +
        +        List data = new ArrayList<>();
        +
        +        data.add(new Object[]{f.apply("Stream.limit(%d)"),
        +                (UnaryOperator) s -> s.limit(SKIP_LIMIT_SIZE)});
        +        data.add(new Object[]{f.apply("Stream.substream(%d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
        +        data.add(new Object[]{f.apply("Stream.substream(%1$d).limit(%1$d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
        +
        +        return data.toArray(new Object[0][]);
        +    }
        +
        +    @DataProvider(name = "IntStream.limit")
        +    public static Object[][] intSliceFunctionsDataProvider() {
        +        Function f = s -> String.format(s, SKIP_LIMIT_SIZE);
        +
        +        List data = new ArrayList<>();
        +
        +        data.add(new Object[]{f.apply("IntStream.limit(%d)"),
        +                (UnaryOperator) s -> s.limit(SKIP_LIMIT_SIZE)});
        +        data.add(new Object[]{f.apply("IntStream.substream(%d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
        +        data.add(new Object[]{f.apply("IntStream.substream(%1$d).limit(%1$d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
        +
        +        return data.toArray(new Object[0][]);
        +    }
        +
        +    @DataProvider(name = "LongStream.limit")
        +    public static Object[][] longSliceFunctionsDataProvider() {
        +        Function f = s -> String.format(s, SKIP_LIMIT_SIZE);
        +
        +        List data = new ArrayList<>();
        +
        +        data.add(new Object[]{f.apply("LongStream.limit(%d)"),
        +                (UnaryOperator) s -> s.limit(SKIP_LIMIT_SIZE)});
        +        data.add(new Object[]{f.apply("LongStream.substream(%d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
        +        data.add(new Object[]{f.apply("LongStream.substream(%1$d).limit(%1$d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
         
        -    public void testRepeatLimit() {
        -        assertContents(Stream.generate(() -> "A").limit(10).iterator(), tenAs.iterator());
        +        return data.toArray(new Object[0][]);
        +    }
        +
        +    @DataProvider(name = "DoubleStream.limit")
        +    public static Object[][] doubleSliceFunctionsDataProvider() {
        +        Function f = s -> String.format(s, SKIP_LIMIT_SIZE);
        +
        +        List data = new ArrayList<>();
        +
        +        data.add(new Object[]{f.apply("DoubleStream.limit(%d)"),
        +                (UnaryOperator) s -> s.limit(SKIP_LIMIT_SIZE)});
        +        data.add(new Object[]{f.apply("DoubleStream.substream(%d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE, SKIP_LIMIT_SIZE * 2)});
        +        data.add(new Object[]{f.apply("DoubleStream.substream(%1$d).limit(%1$d)"),
        +                (UnaryOperator) s -> s.substream(SKIP_LIMIT_SIZE).limit(SKIP_LIMIT_SIZE)});
        +
        +        return data.toArray(new Object[0][]);
        +    }
        +
        +    private  ResultAsserter> unorderedAsserter() {
        +        return (act, exp, ord, par) -> {
        +            if (par & !ord) {
        +                // Can only assert that all elements of the actual result
        +                // are distinct and that the count is the limit size
        +                // any element within the range [0, Long.MAX_VALUE) may be
        +                // present
        +                assertUnique(act);
        +                long count = 0;
        +                for (T l : act) {
        +                    count++;
        +                }
        +                assertEquals(count, SKIP_LIMIT_SIZE, "size not equal");
        +            }
        +            else {
        +                LambdaTestHelpers.assertContents(act, exp);
        +            }
        +        };
        +    }
        +
        +    private TestData.OfRef refLongs() {
        +        return refLongRange(0, Long.MAX_VALUE);
        +    }
        +
        +    private TestData.OfRef refLongRange(long l, long u) {
        +        return TestData.Factory.ofSupplier(
        +                String.format("[%d, %d)", l, u),
        +                () -> LongStream.range(l, u).boxed());
             }
         
        -    public void testIterateLimit() {
        -        assertContents(Stream.iterate("A", s -> s).limit(10).iterator(), tenAs.iterator());
        +    private TestData.OfInt ints() {
        +        return intRange(0, Integer.MAX_VALUE);
        +    }
        +
        +    private TestData.OfInt intRange(int l, int u) {
        +        return TestData.Factory.ofIntSupplier(
        +                String.format("[%d, %d)", l, u),
        +                () -> IntStream.range(l, u));
        +    }
        +
        +    private TestData.OfLong longs() {
        +        return longRange(0, Long.MAX_VALUE);
        +    }
        +
        +    private TestData.OfLong longRange(long l, long u) {
        +        return TestData.Factory.ofLongSupplier(
        +                String.format("[%d, %d)", l, u),
        +                () -> LongStream.range(l, u));
        +    }
        +
        +    private TestData.OfDouble doubles() {
        +        return doubleRange(0, 1L << 53);
        +    }
        +
        +    private TestData.OfDouble doubleRange(long l, long u) {
        +        return TestData.Factory.ofDoubleSupplier(
        +                String.format("[%d, %d)", l, u),
        +                () -> LongStream.range(l, u).mapToDouble(i -> (double) i));
        +    }
        +
        +
        +    // Sized/subsized range
        +
        +    @Test(dataProvider = "Stream.limit")
        +    public void testSubsizedWithRange(String description, UnaryOperator> fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(refLongs()).
        +                stream(s -> fs.apply(s)).
        +                without(StreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "IntStream.limit")
        +    public void testIntSubsizedWithRange(String description, UnaryOperator fs) {
        +        // Range is [0, Integer.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(ints()).
        +                stream(s -> fs.apply(s)).
        +                without(IntStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "LongStream.limit")
        +    public void testLongSubsizedWithRange(String description, UnaryOperator fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(longs()).
        +                stream(s -> fs.apply(s)).
        +                without(LongStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "DoubleStream.limit")
        +    public void testDoubleSubsizedWithRange(String description, UnaryOperator fs) {
        +        // Range is [0, 2^53), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(doubles()).
        +                stream(s -> fs.apply(s)).
        +                without(DoubleStreamTestScenario.PAR_STREAM_TO_ARRAY_CLEAR_SIZED).
        +                exercise();
        +    }
        +
        +
        +    // Unordered finite not SIZED/SUBSIZED
        +
        +    @Test(dataProvider = "Stream.limit")
        +    public void testUnorderedFinite(String description, UnaryOperator> fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(longs()).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered().boxed())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "IntStream.limit")
        +    public void testIntUnorderedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, Integer.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(ints()).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
             }
         
        -    public void testIterateFibLimit() {
        -        Stream fib = Stream.iterate(new int[] {0, 1}, pair -> new int[] {pair[1], pair[0] + pair[1]})
        -                                    .map(pair -> pair[0]);
        +    @Test(dataProvider = "LongStream.limit")
        +    public void testLongUnorderedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(longs()).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "DoubleStream.limit")
        +    public void testDoubleUnorderedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, 1L << 53), splits are SUBSIZED
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        // Upper bound ensures values mapped to doubles will be unique
        +        withData(doubles()).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +
        +    // Unordered finite not SUBSIZED
         
        -        assertContents(
        -                fib.limit(10).iterator(),
        -                Arrays.asList(0, 1, 1, 2, 3, 5, 8, 13, 21, 34).iterator());
        +    @SuppressWarnings({"rawtypes", "unchecked"})
        +    private Spliterator.OfLong proxyNotSubsized(Spliterator.OfLong s) {
        +        InvocationHandler ih = new InvocationHandler() {
        +            @Override
        +            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        +                switch (method.getName()) {
        +                    case "characteristics": {
        +                        int c = (Integer) method.invoke(s, args);
        +                        return c & ~Spliterator.SUBSIZED;
        +                    }
        +                    case "hasCharacteristics": {
        +                        int c = (Integer) args[0];
        +                        boolean b = (Boolean) method.invoke(s, args);
        +                        return b & ((c & Spliterator.SUBSIZED) == 0);
        +                    }
        +                    default:
        +                        return method.invoke(s, args);
        +                }
        +            }
        +        };
        +
        +        return (Spliterator.OfLong) Proxy.newProxyInstance(this.getClass().getClassLoader(),
        +                                                           new Class[]{Spliterator.OfLong.class},
        +                                                           ih);
        +    }
        +
        +    private TestData.OfLong proxiedLongRange(long l, long u) {
        +        return TestData.Factory.ofLongSupplier(
        +                String.format("[%d, %d)", l, u),
        +                () -> StreamSupport.longStream(proxyNotSubsized(LongStream.range(l, u).spliterator())));
        +    }
        +
        +    @Test(dataProvider = "Stream.limit")
        +    public void testUnorderedSizedNotSubsizedFinite(String description, UnaryOperator> fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are not SUBSIZED (proxy clears
        +        // the SUBSIZED characteristic)
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(proxiedLongRange(0, Long.MAX_VALUE)).
        +                stream(s -> fs.apply(s.unordered().boxed())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "IntStream.limit")
        +    public void testIntUnorderedSizedNotSubsizedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, Integer.MAX_VALUE), splits are not SUBSIZED (proxy clears
        +        // the SUBSIZED characteristic)
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(proxiedLongRange(0, Integer.MAX_VALUE)).
        +                stream(s -> fs.apply(s.unordered().mapToInt(i -> (int) i))).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "LongStream.limit")
        +    public void testLongUnorderedSizedNotSubsizedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, Long.MAX_VALUE), splits are not SUBSIZED (proxy clears
        +        // the SUBSIZED characteristic)
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(proxiedLongRange(0, Long.MAX_VALUE)).
        +                stream(s -> fs.apply(s.unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
             }
         
        -    public void testInfiniteWithLimitToShortCircuitTerminal() {
        -        Object[] array = Stream.generate(() -> 1).limit(4).toArray();
        -        assertEquals(4, array.length);
        -        array = Stream.generate(() -> 1).limit(4).filter(i -> true).toArray();
        -        assertEquals(4, array.length);
        -        List result = Stream.generate(() -> 1).limit(4).collect(Collectors.toList());
        -        assertEquals(result, Arrays.asList(1, 1, 1, 1));
        +    @Test(dataProvider = "DoubleStream.limit")
        +    public void testDoubleUnorderedSizedNotSubsizedFinite(String description, UnaryOperator fs) {
        +        // Range is [0, Double.MAX_VALUE), splits are not SUBSIZED (proxy clears
        +        // the SUBSIZED characteristic)
        +        // Such a size will induce out of memory errors for incorrect
        +        // slice implementations
        +        withData(proxiedLongRange(0, 1L << 53)).
        +                stream(s -> fs.apply(s.unordered().mapToDouble(i -> (double) i))).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +
        +    // Unordered generation
        +
        +    @Test(dataProvider = "Stream.limit")
        +    public void testUnorderedGenerator(String description, UnaryOperator> fs) {
        +        // Source is spliterator of infinite size
        +        TestData.OfRef generator = TestData.Factory.ofSupplier(
        +                "[1L, 1L, ...]", () -> Stream.generate(() -> 1L));
        +
        +        withData(generator).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "IntStream.limit")
        +    public void testIntUnorderedGenerator(String description, UnaryOperator fs) {
        +        // Source is spliterator of infinite size
        +        TestData.OfInt generator = TestData.Factory.ofIntSupplier(
        +                "[1, 1, ...]", () -> IntStream.generate(() -> 1));
        +
        +        withData(generator).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "LongStream.limit")
        +    public void testLongUnorderedGenerator(String description, UnaryOperator fs) {
        +        // Source is spliterator of infinite size
        +        TestData.OfLong generator = TestData.Factory.ofLongSupplier(
        +                "[1L, 1L, ...]", () -> LongStream.generate(() -> 1));
        +
        +        withData(generator).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "DoubleStream.limit")
        +    public void testDoubleUnorderedGenerator(String description, UnaryOperator fs) {
        +        // Source is spliterator of infinite size
        +        TestData.OfDouble generator = TestData.Factory.ofDoubleSupplier(
        +                "[1.0, 1.0, ...]", () -> DoubleStream.generate(() -> 1.0));
        +
        +        withData(generator).
        +                stream(s -> fs.apply(s.filter(i -> true).unordered())).
        +                exercise();
        +    }
        +
        +
        +    // Unordered iteration
        +
        +    @Test(dataProvider = "Stream.limit")
        +    public void testUnorderedIteration(String description, UnaryOperator> fs) {
        +        // Source is a right-balanced tree of infinite size
        +        TestData.OfRef iterator = TestData.Factory.ofSupplier(
        +                "[1L, 2L, 3L, ...]", () -> Stream.iterate(1L, i -> i + 1L));
        +
        +        // Ref
        +        withData(iterator).
        +                stream(s -> fs.apply(s.unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "IntStream.limit")
        +    public void testIntUnorderedIteration(String description, UnaryOperator fs) {
        +        // Source is a right-balanced tree of infinite size
        +        TestData.OfInt iterator = TestData.Factory.ofIntSupplier(
        +                "[1, 2, 3, ...]", () -> IntStream.iterate(1, i -> i + 1));
        +
        +        // Ref
        +        withData(iterator).
        +                stream(s -> fs.apply(s.unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "LongStream.limit")
        +    public void testLongUnorderedIteration(String description, UnaryOperator fs) {
        +        // Source is a right-balanced tree of infinite size
        +        TestData.OfLong iterator = TestData.Factory.ofLongSupplier(
        +                "[1L, 2L, 3L, ...]", () -> LongStream.iterate(1, i -> i + 1));
        +
        +        // Ref
        +        withData(iterator).
        +                stream(s -> fs.apply(s.unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
        +    }
        +
        +    @Test(dataProvider = "DoubleStream.limit")
        +    public void testDoubleUnorderedIteration(String description, UnaryOperator fs) {
        +        // Source is a right-balanced tree of infinite size
        +        TestData.OfDouble iterator = TestData.Factory.ofDoubleSupplier(
        +                "[1.0, 2.0, 3.0, ...]", () -> DoubleStream.iterate(1, i -> i + 1));
        +
        +        // Ref
        +        withData(iterator).
        +                stream(s -> fs.apply(s.unordered())).
        +                resultAsserter(unorderedAsserter()).
        +                exercise();
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntSliceOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -145,6 +145,7 @@
                 List skips = sizes(data.size());
         
                 for (int s : skips) {
        +            setContext("skip", s);
                     Collection sr = exerciseOps(data, st -> st.substream(s));
                     assertEquals(sr.size(), sliceSize(data.size(), s));
         
        @@ -159,7 +160,9 @@
                 List limits = skips;
         
                 for (int s : skips) {
        +            setContext("skip", s);
                     for (int limit : limits) {
        +                setContext("limit", limit);
                         Collection sr = exerciseOps(data, st -> st.substream(s).limit(limit));
                         assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), 0, limit));
         
        @@ -174,6 +177,7 @@
                 List limits = sizes(data.size());
         
                 for (int limit : limits) {
        +            setContext("limit", limit);
                     Collection sr = exerciseOps(data, st -> st.limit(limit));
                     assertEquals(sr.size(), sliceSize(data.size(), 0, limit));
         
        @@ -189,6 +193,7 @@
             @Test(groups = { "serialization-hostile" })
             public void testLimitShortCircuit() {
                 for (int l : Arrays.asList(0, 10)) {
        +            setContext("limit", l);
                     AtomicInteger ai = new AtomicInteger();
                     IntStream.range(1, 101)
                             .peek(i -> ai.getAndIncrement())
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntUniqOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntUniqOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/IntUniqOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -60,7 +60,6 @@
             public void testOpSorted(String name, TestData.OfInt data) {
                 Collection result = withData(data).
                         stream(s -> s.sorted().distinct().boxed()).
        -                parallelEqualityAsserter(LambdaTestHelpers::assertContentsUnordered).
                         exercise();
         
                 assertUnique(result);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/MatchOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,19 +23,16 @@
         package org.openjdk.tests.java.util.stream;
         
         import java.util.Arrays;
        -import java.util.Collections;
         import java.util.HashMap;
         import java.util.Iterator;
         import java.util.List;
         import java.util.Map;
         import java.util.PrimitiveIterator;
        +import java.util.Spliterators;
         import java.util.function.DoublePredicate;
        -import java.util.function.DoubleSupplier;
         import java.util.function.Function;
         import java.util.function.IntPredicate;
        -import java.util.function.IntSupplier;
         import java.util.function.LongPredicate;
        -import java.util.function.LongSupplier;
         import java.util.function.Predicate;
         import java.util.function.Supplier;
         import java.util.stream.DoubleStream;
        @@ -46,6 +43,7 @@
         import java.util.stream.LongStreamTestDataProvider;
         import java.util.stream.OpTestCase;
         import java.util.stream.Stream;
        +import java.util.stream.StreamSupport;
         import java.util.stream.StreamTestDataProvider;
         import java.util.stream.TestData;
         
        @@ -97,6 +95,7 @@
         
             private  void assertPredicates(List source, Kind kind, Predicate[] predicates, boolean... answers) {
                 for (int i = 0; i < predicates.length; i++) {
        +            setContext("i", i);
                     boolean match = this.kinds().get(kind).apply(predicates[i]).apply(source.stream());
                     assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
                 }
        @@ -119,7 +118,9 @@
             @Test(dataProvider = "StreamTestData", dataProviderClass = StreamTestDataProvider.class)
             public void testStream(String name, TestData.OfRef data) {
                 for (Predicate p : INTEGER_PREDICATES) {
        +            setContext("p", p);
                     for (Kind kind : Kind.values()) {
        +                setContext("kind", kind);
                         exerciseTerminalOps(data, this.kinds().get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(pFalse), this.kinds().get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(pEven), this.kinds().get(kind).apply(p));
        @@ -128,29 +129,40 @@
             }
         
             public void testInfinite() {
        -        class CycleSupplier implements Supplier {
        -            final Iterable source;
        -            Iterator i = Collections.emptyIterator();
        +        class CycleIterator implements Iterator {
        +            final Supplier> source;
        +            Iterator i = null;
         
        -            CycleSupplier(Iterable source) {
        +            CycleIterator(Supplier> source) {
                         this.source = source;
                     }
         
                     @Override
        -            public T get() {
        -                if (!i.hasNext()) {
        -                    i = source.iterator();
        +            public Integer next() {
        +                if (i == null || !i.hasNext()) {
        +                    i = source.get();
                         }
                         return i.next();
                     }
        +
        +            @Override
        +            public boolean hasNext() {
        +                if (i == null || !i.hasNext()) {
        +                    i = source.get();
        +                }
        +                return i.hasNext();
        +            }
                 }
         
        -        assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).allMatch(i -> i > 3));
        -        assertTrue(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).anyMatch(i -> i > 3));
        -        assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).noneMatch(i -> i > 3));
        -        assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().allMatch(i -> i > 3));
        -        assertTrue(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().anyMatch(i -> i > 3));
        -        assertFalse(Stream.generate(new CycleSupplier<>(Arrays.asList(1, 2, 3, 4))).parallel().noneMatch(i -> i > 3));
        +        Supplier> source = () -> Arrays.asList(1, 2, 3, 4).iterator();
        +        Supplier> s = () -> StreamSupport.stream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
        +
        +        assertFalse(s.get().allMatch(i -> i > 3));
        +        assertTrue(s.get().anyMatch(i -> i > 3));
        +        assertFalse(s.get().noneMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().allMatch(i -> i > 3));
        +        assertTrue(s.get().parallel().anyMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().noneMatch(i -> i > 3));
             }
         
             //
        @@ -168,6 +180,7 @@
         
             private void assertIntPredicates(Supplier source, Kind kind, IntPredicate[] predicates, boolean... answers) {
                 for (int i = 0; i < predicates.length; i++) {
        +            setContext("i", i);
                     boolean match = intKinds.get(kind).apply(predicates[i]).apply(source.get());
                     assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
                 }
        @@ -189,40 +202,52 @@
         
             @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
             public void testIntStream(String name, TestData.OfInt data) {
        -        for (IntPredicate p : INT_PREDICATES)
        +        for (IntPredicate p : INT_PREDICATES) {
        +            setContext("p", p);
                     for (Kind kind : Kind.values()) {
        +                setContext("kind", kind);
                         exerciseTerminalOps(data, intKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
                     }
        +        }
             }
         
             public void testIntInfinite() {
        -        class CycleSupplier implements IntSupplier {
        +        class CycleIterator implements PrimitiveIterator.OfInt {
                     final Supplier source;
                     PrimitiveIterator.OfInt i = null;
         
        -            CycleSupplier(Supplier source) {
        +            CycleIterator(Supplier source) {
                         this.source = source;
                     }
         
                     @Override
        -            public int getAsInt() {
        +            public int nextInt() {
                         if (i == null || !i.hasNext()) {
                             i = source.get();
                         }
                         return i.nextInt();
                     }
        +
        +            @Override
        +            public boolean hasNext() {
        +                if (i == null || !i.hasNext()) {
        +                    i = source.get();
        +                }
        +                return i.hasNext();
        +            }
                 }
         
                 Supplier source = () -> Arrays.stream(new int[]{1, 2, 3, 4}).iterator();
        +        Supplier s = () -> StreamSupport.intStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
         
        -        assertFalse(IntStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
        -        assertTrue(IntStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
        -        assertFalse(IntStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
        -        assertFalse(IntStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
        -        assertTrue(IntStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
        -        assertFalse(IntStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
        +        assertFalse(s.get().allMatch(i -> i > 3));
        +        assertTrue(s.get().anyMatch(i -> i > 3));
        +        assertFalse(s.get().noneMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().allMatch(i -> i > 3));
        +        assertTrue(s.get().parallel().anyMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().noneMatch(i -> i > 3));
             }
         
             //
        @@ -240,6 +265,7 @@
         
             private void assertLongPredicates(Supplier source, Kind kind, LongPredicate[] predicates, boolean... answers) {
                 for (int i = 0; i < predicates.length; i++) {
        +            setContext("i", i);
                     boolean match = longKinds.get(kind).apply(predicates[i]).apply(source.get());
                     assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
                 }
        @@ -261,40 +287,52 @@
         
             @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
             public void testLongStream(String name, TestData.OfLong data) {
        -        for (LongPredicate p : LONG_PREDICATES)
        +        for (LongPredicate p : LONG_PREDICATES) {
        +            setContext("p", p);
                     for (Kind kind : Kind.values()) {
        +                setContext("kind", kind);
                         exerciseTerminalOps(data, longKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(lpFalse), longKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(lpEven), longKinds.get(kind).apply(p));
                     }
        +        }
             }
         
             public void testLongInfinite() {
        -        class CycleSupplier implements LongSupplier {
        +        class CycleIterator implements PrimitiveIterator.OfLong {
                     final Supplier source;
                     PrimitiveIterator.OfLong i = null;
         
        -            CycleSupplier(Supplier source) {
        +            CycleIterator(Supplier source) {
                         this.source = source;
                     }
         
                     @Override
        -            public long getAsLong() {
        +            public long nextLong() {
                         if (i == null || !i.hasNext()) {
                             i = source.get();
                         }
                         return i.nextLong();
                     }
        +
        +            @Override
        +            public boolean hasNext() {
        +                if (i == null || !i.hasNext()) {
        +                    i = source.get();
        +                }
        +                return i.hasNext();
        +            }
                 }
         
                 Supplier source = () -> Arrays.stream(new long[]{1, 2, 3, 4}).iterator();
        +        Supplier s = () -> StreamSupport.longStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
         
        -        assertFalse(LongStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
        -        assertTrue(LongStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
        -        assertFalse(LongStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
        -        assertFalse(LongStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
        -        assertTrue(LongStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
        -        assertFalse(LongStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
        +        assertFalse(s.get().allMatch(i -> i > 3));
        +        assertTrue(s.get().anyMatch(i -> i > 3));
        +        assertFalse(s.get().noneMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().allMatch(i -> i > 3));
        +        assertTrue(s.get().parallel().anyMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().noneMatch(i -> i > 3));
             }
         
             //
        @@ -312,6 +350,7 @@
         
             private void assertDoublePredicates(Supplier source, Kind kind, DoublePredicate[] predicates, boolean... answers) {
                 for (int i = 0; i < predicates.length; i++) {
        +            setContext("i", i);
                     boolean match = doubleKinds.get(kind).apply(predicates[i]).apply(source.get());
                     assertEquals(answers[i], match, kind.toString() + predicates[i].toString());
                 }
        @@ -333,39 +372,51 @@
         
             @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
             public void testDoubleStream(String name, TestData.OfDouble data) {
        -        for (DoublePredicate p : DOUBLE_PREDICATES)
        +        for (DoublePredicate p : DOUBLE_PREDICATES) {
        +            setContext("p", p);
                     for (Kind kind : Kind.values()) {
        +                setContext("kind", kind);
                         exerciseTerminalOps(data, doubleKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(dpFalse), doubleKinds.get(kind).apply(p));
                         exerciseTerminalOps(data, s -> s.filter(dpEven), doubleKinds.get(kind).apply(p));
                     }
        +        }
             }
         
             public void testDoubleInfinite() {
        -        class CycleSupplier implements DoubleSupplier {
        +        class CycleIterator implements PrimitiveIterator.OfDouble {
                     final Supplier source;
                     PrimitiveIterator.OfDouble i = null;
         
        -            CycleSupplier(Supplier source) {
        +            CycleIterator(Supplier source) {
                         this.source = source;
                     }
         
                     @Override
        -            public double getAsDouble() {
        +            public double nextDouble() {
                         if (i == null || !i.hasNext()) {
                             i = source.get();
                         }
                         return i.nextDouble();
                     }
        +
        +            @Override
        +            public boolean hasNext() {
        +                if (i == null || !i.hasNext()) {
        +                    i = source.get();
        +                }
        +                return i.hasNext();
        +            }
                 }
         
                 Supplier source = () -> Arrays.stream(new double[]{1, 2, 3, 4}).iterator();
        +        Supplier s = () -> StreamSupport.doubleStream(Spliterators.spliteratorUnknownSize(new CycleIterator(source), 0));
         
        -        assertFalse(DoubleStream.generate(new CycleSupplier(source)).allMatch(i -> i > 3));
        -        assertTrue(DoubleStream.generate(new CycleSupplier(source)).anyMatch(i -> i > 3));
        -        assertFalse(DoubleStream.generate(new CycleSupplier(source)).noneMatch(i -> i > 3));
        -        assertFalse(DoubleStream.generate(new CycleSupplier(source)).parallel().allMatch(i -> i > 3));
        -        assertTrue(DoubleStream.generate(new CycleSupplier(source)).parallel().anyMatch(i -> i > 3));
        -        assertFalse(DoubleStream.generate(new CycleSupplier(source)).parallel().noneMatch(i -> i > 3));
        +        assertFalse(s.get().allMatch(i -> i > 3));
        +        assertTrue(s.get().anyMatch(i -> i > 3));
        +        assertFalse(s.get().noneMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().allMatch(i -> i > 3));
        +        assertTrue(s.get().parallel().anyMatch(i -> i > 3));
        +        assertFalse(s.get().parallel().noneMatch(i -> i > 3));
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/RangeTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/RangeTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/RangeTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -58,7 +58,9 @@
             public void testIntRange() {
                 // Half-open
                 for (int start : Arrays.asList(1, 10, -1, -10)) {
        +            setContext("start", start);
                     for (int end : Arrays.asList(1, 10, -1, -10)) {
        +                setContext("end", end);
                         int size = (start < end) ? end - start : 0;
                         int[] exp = new int[size];
                         for (int i = start, p = 0; i < end; i++, p++) {
        @@ -76,7 +78,9 @@
         
                 // Closed
                 for (int start : Arrays.asList(1, 10, -1, -10)) {
        +            setContext("start", start);
                     for (int end : Arrays.asList(1, 10, -1, -10)) {
        +                setContext("end", end);
                         int size = (start <= end) ? end - start + 1 : 0;
                         int[] exp = new int[size];
                         for (int i = start, p = 0; i <= end; i++, p++) {
        @@ -144,7 +148,9 @@
             public void testLongRange() {
                 // Half-open
                 for (long start : Arrays.asList(1, 1000, -1, -1000)) {
        +            setContext("start", start);
                     for (long end : Arrays.asList(1, 1000, -1, -1000)) {
        +                setContext("end", end);
                         long size = start < end ? end - start : 0;
                         long[] exp = new long[(int) size];
                         for (long i = start, p = 0; i < end; i++, p++) {
        @@ -162,7 +168,9 @@
         
                 // Closed
                 for (long start : Arrays.asList(1, 1000, -1, -1000)) {
        +            setContext("start", start);
                     for (long end : Arrays.asList(1, 1000, -1, -1000)) {
        +                setContext("end", end);
                         long size = start <= end ? end - start + 1: 0;
                         long[] exp = new long[(int) size];
                         for (long i = start, p = 0; i <= end; i++, p++) {
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ReduceByOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ReduceByOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ReduceByOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -51,6 +51,7 @@
                 Map result = data.stream().collect(groupingBy(LambdaTestHelpers.forPredicate(pEven, true, false), reducing(0, rPlus)));
                 assertEquals(result.size(), gbResult.size());
                 for (Map.Entry entry : result.entrySet()) {
        +            setContext("entry", entry);
                     Boolean key = entry.getKey();
                     assertEquals(entry.getValue(), data.stream().filter(e -> pEven.test(e) == key).reduce(0, rPlus));
                 }
        @@ -59,7 +60,9 @@
                 Map> mgResult = exerciseTerminalOps(data, s -> s.collect(groupingBy(mId)));
                 Map miResult = exerciseTerminalOps(data, s -> s.collect(groupingBy(mId, reducing(0, e -> 1, Integer::sum))));
                 assertEquals(miResult.keySet().size(), uniqueSize);
        -        for (Map.Entry entry : miResult.entrySet())
        +        for (Map.Entry entry : miResult.entrySet()) {
        +            setContext("entry", entry);
                     assertEquals((int) entry.getValue(), mgResult.get(entry.getKey()).size());
        +        }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SequentialOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -27,8 +27,8 @@
         import java.util.stream.StreamTestDataProvider;
         import org.testng.annotations.Test;
         
        -import java.util.Comparators;
         import java.util.Iterator;
        +import java.util.Comparator;
         import java.util.concurrent.atomic.AtomicInteger;
         import java.util.function.Function;
         import java.util.function.Supplier;
        @@ -64,8 +64,12 @@
                             (UnaryOperator>) s -> s.parallel().map(id).peek(e -> { counter.incrementAndGet(); }).map(id)
                 };
         
        -        for (Supplier> supp : suppliers)
        -            for (UnaryOperator> config : configs) {
        +        for (int i = 0; i < suppliers.length; i++) {
        +            setContext("supplierIndex", i);
        +            Supplier> supp = suppliers[i];
        +            for (int j = 0; j < configs.length; j++) {
        +                setContext("configIndex", j);
        +                UnaryOperator> config = configs[j];
                         counter.set(0);
                         Stream stream = config.apply(supp.get());
                         assertEquals(0, counter.get());
        @@ -86,6 +90,7 @@
                         });
                         assertTrue(data.size() == 0 || counter.get() > 0);
                     }
        +        }
             }
         
             @SuppressWarnings({"rawtypes", "unchecked"})
        @@ -96,23 +101,35 @@
                         = new UnaryOperator[] {
                         (UnaryOperator>) s -> s,
                         (UnaryOperator>) s -> s.sequential(),
        -                (UnaryOperator>) s -> s.parallel()
        +                (UnaryOperator>) s -> s.parallel(),
        +                (UnaryOperator>) s -> s.unordered()
                 };
                 UnaryOperator>[] stuff
                         = new UnaryOperator[] {
                         (UnaryOperator>) s -> s,
                         (UnaryOperator>) s -> s.map(id),
        -                (UnaryOperator>) s -> s.sorted(Comparators.naturalOrder()),
        -                (UnaryOperator>) s -> s.map(id).sorted(Comparators.naturalOrder()).map(id),
        -                (UnaryOperator>) s -> s.filter(LambdaTestHelpers.pEven).sorted(Comparators.naturalOrder()).map(id),
        +                (UnaryOperator>) s -> s.sorted(Comparator.naturalOrder()),
        +                (UnaryOperator>) s -> s.map(id).sorted(Comparator.naturalOrder()).map(id),
        +                (UnaryOperator>) s -> s.filter(LambdaTestHelpers.pEven).sorted(Comparator.naturalOrder()).map(id),
                 };
         
        -        for (UnaryOperator> c1 : changers)
        -            for (UnaryOperator> s1 : stuff)
        -                for (UnaryOperator> c2 : changers)
        -                    for (UnaryOperator> s2 : stuff) {
        +        for (int c1Index = 0; c1Index < changers.length; c1Index++) {
        +            setContext("c1Index", c1Index);
        +            UnaryOperator> c1 = changers[c1Index];
        +            for (int s1Index = 0; s1Index < stuff.length; s1Index++) {
        +                setContext("s1Index", s1Index);
        +                UnaryOperator> s1 = stuff[s1Index];
        +                for (int c2Index = 0; c2Index < changers.length; c2Index++) {
        +                    setContext("c2Index", c2Index);
        +                    UnaryOperator> c2 = changers[c2Index];
        +                    for (int s2Index = 0; s2Index < stuff.length; s2Index++) {
        +                        setContext("s2Index", s2Index);
        +                        UnaryOperator> s2 = stuff[s2Index];
                                 UnaryOperator> composed = s -> s2.apply(c2.apply(s1.apply(c1.apply(s))));
                                 exerciseOps(data, composed);
                             }
        +                }
        +            }
        +        }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SliceOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -26,7 +26,11 @@
         
         import java.util.*;
         import java.util.concurrent.atomic.AtomicInteger;
        -import java.util.stream.Collectors;
        +import java.util.function.Function;
        +import java.util.stream.DoubleStream;
        +import java.util.stream.IntStream;
        +import java.util.stream.LambdaTestHelpers;
        +import java.util.stream.LongStream;
         import java.util.stream.OpTestCase;
         import java.util.stream.Stream;
         import java.util.stream.StreamTestDataProvider;
        @@ -145,19 +149,20 @@
                 List skips = sizes(data.size());
         
                 for (int s : skips) {
        -            Collection sr = exerciseOpsInt(data,
        -                                                      st -> st.substream(s),
        -                                                      st -> st.substream(s),
        -                                                      st -> st.substream(s),
        -                                                      st -> st.substream(s));
        -            assertEquals(sr.size(), sliceSize(data.size(), s));
        +            setContext("skip", s);
        +            testSliceMulti(data,
        +                           sliceSize(data.size(), s),
        +                           st -> st.substream(s),
        +                           st -> st.substream(s),
        +                           st -> st.substream(s),
        +                           st -> st.substream(s));
         
        -            sr = exerciseOpsInt(data,
        -                                  st -> st.substream(s).substream(s / 2),
        -                                  st -> st.substream(s).substream(s / 2),
        -                                  st -> st.substream(s).substream(s / 2),
        -                                  st -> st.substream(s).substream(s / 2));
        -            assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), s/2));
        +            testSliceMulti(data,
        +                           sliceSize(sliceSize(data.size(), s), s/2),
        +                           st -> st.substream(s).substream(s / 2),
        +                           st -> st.substream(s).substream(s / 2),
        +                           st -> st.substream(s).substream(s / 2),
        +                           st -> st.substream(s).substream(s / 2));
                 }
             }
         
        @@ -167,20 +172,22 @@
                 List limits = skips;
         
                 for (int s : skips) {
        -            for (int limit : limits) {
        -                Collection sr = exerciseOpsInt(data,
        -                                                        st -> st.substream(s).limit(limit),
        -                                                        st -> st.substream(s).limit(limit),
        -                                                        st -> st.substream(s).limit(limit),
        -                                                        st -> st.substream(s).limit(limit));
        -                assertEquals(sr.size(), sliceSize(sliceSize(data.size(), s), 0, limit));
        +            setContext("skip", s);
        +            for (int l : limits) {
        +                setContext("limit", l);
        +                testSliceMulti(data,
        +                               sliceSize(sliceSize(data.size(), s), 0, l),
        +                               st -> st.substream(s).limit(l),
        +                               st -> st.substream(s).limit(l),
        +                               st -> st.substream(s).limit(l),
        +                               st -> st.substream(s).limit(l));
         
        -                sr = exerciseOpsInt(data,
        -                                    st -> st.substream(s, limit+s),
        -                                    st -> st.substream(s, limit+s),
        -                                    st -> st.substream(s, limit+s),
        -                                    st -> st.substream(s, limit+s));
        -                assertEquals(sr.size(), sliceSize(data.size(), s, limit));
        +                testSliceMulti(data,
        +                               sliceSize(data.size(), s, l),
        +                                st -> st.substream(s, l+s),
        +                                st -> st.substream(s, l+s),
        +                                st -> st.substream(s, l+s),
        +                                st -> st.substream(s, l+s));
                     }
                 }
             }
        @@ -189,32 +196,87 @@
             public void testLimitOps(String name, TestData.OfRef data) {
                 List limits = sizes(data.size());
         
        -        for (int limit : limits) {
        -            Collection sr = exerciseOpsInt(data,
        -                                                    st -> st.limit(limit),
        -                                                    st -> st.limit(limit),
        -                                                    st -> st.limit(limit),
        -                                                    st -> st.limit(limit));
        -            assertEquals(sr.size(), sliceSize(data.size(), 0, limit));
        +        for (int l : limits) {
        +            setContext("limit", l);
        +            testSliceMulti(data,
        +                           sliceSize(data.size(), 0, l),
        +                           st -> st.limit(l),
        +                           st -> st.limit(l),
        +                           st -> st.limit(l),
        +                           st -> st.limit(l));
        +        }
        +
        +        for (int l : limits) {
        +            setContext("limit", l);
        +            testSliceMulti(data,
        +                           sliceSize(sliceSize(data.size(), 0, l), 0, l / 2),
        +                           st -> st.limit(l).limit(l / 2),
        +                           st -> st.limit(l).limit(l / 2),
        +                           st -> st.limit(l).limit(l / 2),
        +                           st -> st.limit(l).limit(l / 2));
        +        }
        +    }
        +
        +    private ResultAsserter> sliceResultAsserter(Iterable data,
        +                                                                  int expectedSize) {
        +        return (act, exp, ord, par) -> {
        +            if (par & !ord) {
        +                List expected = new ArrayList<>();
        +                data.forEach(expected::add);
        +
        +                List actual = new ArrayList<>();
        +                act.forEach(actual::add);
         
        -            sr = exerciseOpsInt(data,
        -                                st -> st.limit(limit).limit(limit / 2),
        -                                st -> st.limit(limit).limit(limit / 2),
        -                                st -> st.limit(limit).limit(limit / 2),
        -                                st -> st.limit(limit).limit(limit / 2));
        -            assertEquals(sr.size(), sliceSize(sliceSize(data.size(), 0, limit), 0, limit/2));
        +                assertEquals(actual.size(), expectedSize);
        +                assertTrue(expected.containsAll(actual));
        +            }
        +            else {
        +                LambdaTestHelpers.assertContents(act, exp);
        +            }
        +        };
        +    }
        +
        +    private void testSliceMulti(TestData.OfRef data,
        +                                int expectedSize,
        +                                Function, Stream> mRef,
        +                                Function mInt,
        +                                Function mLong,
        +                                Function mDouble) {
        +
        +        @SuppressWarnings({ "rawtypes", "unchecked" })
        +        Function, Stream>[] ms = new Function[4];
        +        ms[0] = mRef;
        +        ms[1] = s -> mInt.apply(s.mapToInt(e -> e)).mapToObj(e -> e);
        +        ms[2] = s -> mLong.apply(s.mapToLong(e -> e)).mapToObj(e -> (int) e);
        +        ms[3] = s -> mDouble.apply(s.mapToDouble(e -> e)).mapToObj(e -> (int) e);
        +        testSliceMulti(data, expectedSize, ms);
        +    }
        +
        +    @SafeVarargs
        +    private final void testSliceMulti(TestData.OfRef data,
        +                                      int expectedSize,
        +                                      Function, Stream>... ms) {
        +        for (int i = 0; i < ms.length; i++) {
        +            setContext("mIndex", i);
        +            Function, Stream> m = ms[i];
        +            Collection sr = withData(data)
        +                    .stream(m)
        +                    .resultAsserter(sliceResultAsserter(data, expectedSize))
        +                    .exercise();
        +            assertEquals(sr.size(), expectedSize);
                 }
             }
         
             public void testLimitSort() {
                 List l = countTo(100);
                 Collections.reverse(l);
        -        exerciseOps(l, s -> s.limit(10).sorted(Comparators.naturalOrder()));
        +        exerciseOps(l, s -> s.limit(10).sorted(Comparator.naturalOrder()));
             }
         
             @Test(groups = { "serialization-hostile" })
             public void testLimitShortCircuit() {
                 for (int l : Arrays.asList(0, 10)) {
        +            setContext("l", l);
                     AtomicInteger ai = new AtomicInteger();
                     countTo(100).stream()
                             .peek(i -> ai.getAndIncrement())
        @@ -224,18 +286,6 @@
                 }
             }
         
        -    public void testSkipParallel() {
        -        List l = countTo(1000).parallelStream().substream(200).limit(200).sequential().collect(Collectors.toList());
        -        assertEquals(l.size(), 200);
        -        assertEquals(l.get(l.size() -1).intValue(), 400);
        -    }
        -
        -    public void testLimitParallel() {
        -        List l = countTo(1000).parallelStream().limit(500).sequential().collect(Collectors.toList());
        -        assertEquals(l.size(), 500);
        -        assertEquals(l.get(l.size() -1).intValue(), 500);
        -    }
        -
             private List sizes(int size) {
                 if (size < 4) {
                     return Arrays.asList(0, 1, 2, 3, 4, 6);
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/SortedOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -40,10 +40,10 @@
             public void testSorted() {
                 assertCountSum(countTo(0).stream().sorted(), 0, 0);
                 assertCountSum(countTo(10).stream().sorted(), 10, 55);
        -        assertCountSum(countTo(10).stream().sorted(cInteger.reverseOrder()), 10, 55);
        +        assertCountSum(countTo(10).stream().sorted(cInteger.reversed()), 10, 55);
         
                 List to10 = countTo(10);
        -        assertSorted(to10.stream().sorted(cInteger.reverseOrder()).iterator(), cInteger.reverseOrder());
        +        assertSorted(to10.stream().sorted(cInteger.reversed()).iterator(), cInteger.reversed());
         
                 Collections.reverse(to10);
                 assertSorted(to10.stream().sorted().iterator());
        @@ -51,7 +51,7 @@
                 Spliterator s = to10.stream().sorted().spliterator();
                 assertTrue(s.hasCharacteristics(Spliterator.SORTED));
         
        -        s = to10.stream().sorted(cInteger.reverseOrder()).spliterator();
        +        s = to10.stream().sorted(cInteger.reversed()).spliterator();
                 assertFalse(s.hasCharacteristics(Spliterator.SORTED));
             }
         
        @@ -87,8 +87,8 @@
                 assertSorted(result.iterator());
                 assertContentsUnordered(data, result);
         
        -        result = exerciseOps(data, s -> s.sorted(cInteger.reverseOrder()));
        -        assertSorted(result.iterator(), cInteger.reverseOrder());
        +        result = exerciseOps(data, s -> s.sorted(cInteger.reversed()));
        +        assertSorted(result.iterator(), cInteger.reversed());
                 assertContentsUnordered(data, result);
             }
         
        @@ -104,23 +104,23 @@
                 assertContentsUnordered(data, result);
         
                 result = withData(data)
        -                .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(cInteger.reverseOrder()),
        +                .stream(s -> s.sorted(cInteger.reversed()).sorted(cInteger.reversed()),
                                 new CollectorOps.TestParallelSizedOp())
                         .exercise();
         
        -        assertSorted(result, cInteger.reverseOrder());
        +        assertSorted(result, cInteger.reversed());
                 assertContentsUnordered(data, result);
         
                 result = withData(data)
        -                .stream(s -> s.sorted().sorted(cInteger.reverseOrder()),
        +                .stream(s -> s.sorted().sorted(cInteger.reversed()),
                                 new CollectorOps.TestParallelSizedOp())
                         .exercise();
         
        -        assertSorted(result, cInteger.reverseOrder());
        +        assertSorted(result, cInteger.reversed());
                 assertContentsUnordered(data, result);
         
                 result = withData(data)
        -                .stream(s -> s.sorted(cInteger.reverseOrder()).sorted(),
        +                .stream(s -> s.sorted(cInteger.reversed()).sorted(),
                                 new CollectorOps.TestParallelSizedOp())
                         .exercise();
         
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamLinkTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -47,6 +47,7 @@
             @Test(dataProvider = "StreamTestData", dataProviderClass = StreamTestDataProvider.class)
             public void testManyStreams(String name, TestData.OfRef data) {
                 for (int n : sizes) {
        +            setContext("n", n);
                     List expected = data.stream().map(e -> (Integer) (e + n)).collect(Collectors.toList());
         
                     withData(data).
        @@ -59,6 +60,7 @@
             @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
             public void testIntManyStreams(String name, TestData.OfInt data) {
                 for (int n : sizes) {
        +            setContext("n", n);
                     int[] expected = data.stream().map(e -> e + n).toArray();
         
                     withData(data).
        @@ -71,6 +73,7 @@
             @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
             public void testLongManyStreams(String name, TestData.OfLong data) {
                 for (int n : sizes) {
        +            setContext("n", n);
                     long[] expected = data.stream().map(e -> e + n).toArray();
         
                     withData(data).
        @@ -83,6 +86,7 @@
             @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
             public void testDoubleManyStreams(String name, TestData.OfDouble data) {
                 for (int n : sizes) {
        +            setContext("n", n);
                     double[] expected = data.stream().map(e -> accumulate(e, n)).toArray();
         
                     withData(data).
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/StreamSpliteratorTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -256,9 +256,14 @@
                         s -> s.map(LambdaTestHelpers.identity()).parallel()
                 );
         
        -        for (Consumer> terminalOp : terminalOps) {
        -            for (UnaryOperator> intermediateOp : intermediateOps) {
        -                for (boolean proxyEstimateSize : new boolean[]{false, true}) {
        +        for (int i = 0; i < terminalOps.size(); i++) {
        +            setContext("termOpIndex", i);
        +            Consumer> terminalOp = terminalOps.get(i);
        +            for (int j = 0; j < intermediateOps.size(); j++) {
        +                setContext("intOpIndex", j);
        +                UnaryOperator> intermediateOp = intermediateOps.get(j);
        +                for (boolean proxyEstimateSize : new boolean[] {false, true}) {
        +                    setContext("proxyEstimateSize", proxyEstimateSize);
                             Spliterator sp = intermediateOp.apply(l.stream()).spliterator();
                             ProxyNoExactSizeSpliterator psp = new ProxyNoExactSizeSpliterator<>(sp, proxyEstimateSize);
                             Stream s = StreamSupport.parallelStream(psp);
        @@ -345,9 +350,14 @@
                         s -> s.map(i -> i).parallel()
                 );
         
        -        for (Consumer terminalOp : terminalOps) {
        -            for (UnaryOperator intermediateOp : intermediateOps) {
        -                for (boolean proxyEstimateSize : new boolean[]{false, true}) {
        +        for (int i = 0; i < terminalOps.size(); i++) {
        +            setContext("termOpIndex", i);
        +            Consumer terminalOp = terminalOps.get(i);
        +            for (int j = 0; j < intermediateOps.size(); j++) {
        +                setContext("intOpIndex", j);
        +                UnaryOperator intermediateOp = intermediateOps.get(j);
        +                for (boolean proxyEstimateSize : new boolean[] {false, true}) {
        +                    setContext("proxyEstimateSize", proxyEstimateSize);
                             // Size is assumed to be larger than the target size for no splitting
                             // @@@ Need way to obtain the target size
                             Spliterator.OfInt sp = intermediateOp.apply(IntStream.range(0, 1000)).spliterator();
        @@ -433,9 +443,14 @@
                         s -> s.map(i -> i).parallel()
                 );
         
        -        for (Consumer terminalOp : terminalOps) {
        -            for (UnaryOperator intermediateOp : intermediateOps) {
        -                for (boolean proxyEstimateSize : new boolean[]{false, true}) {
        +        for (int i = 0; i < terminalOps.size(); i++) {
        +            Consumer terminalOp = terminalOps.get(i);
        +            setContext("termOpIndex", i);
        +            for (int j = 0; j < intermediateOps.size(); j++) {
        +                setContext("intOpIndex", j);
        +                UnaryOperator intermediateOp = intermediateOps.get(j);
        +                for (boolean proxyEstimateSize : new boolean[] {false, true}) {
        +                    setContext("proxyEstimateSize", proxyEstimateSize);
                             // Size is assumed to be larger than the target size for no splitting
                             // @@@ Need way to obtain the target size
                             Spliterator.OfLong sp = intermediateOp.apply(LongStream.range(0, 1000)).spliterator();
        @@ -521,9 +536,14 @@
                         s -> s.map(i -> i).parallel()
                 );
         
        -        for (Consumer terminalOp : terminalOps) {
        -            for (UnaryOperator intermediateOp : intermediateOps) {
        -                for (boolean proxyEstimateSize : new boolean[]{false, true}) {
        +        for (int i = 0; i < terminalOps.size(); i++) {
        +            Consumer terminalOp = terminalOps.get(i);
        +            setContext("termOpIndex", i);
        +            for (int j = 0; j < intermediateOps.size(); j++) {
        +                UnaryOperator intermediateOp = intermediateOps.get(j);
        +                setContext("intOpIndex", j);
        +                for (boolean proxyEstimateSize : new boolean[] {false, true}) {
        +                    setContext("proxyEstimateSize", proxyEstimateSize);
                             // Size is assumed to be larger than the target size for no splitting
                             // @@@ Need way to obtain the target size
                             Spliterator.OfDouble sp = intermediateOp.apply(IntStream.range(0, 1000).asDoubleStream()).spliterator();
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/TabulatorsTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -202,26 +202,38 @@
                 }
             }
         
        +    private  ResultAsserter mapTabulationAsserter(boolean ordered) {
        +        return (act, exp, ord, par) -> {
        +            if (par & (!ordered || !ord)) {
        +                TabulatorsTest.nestedMapEqualityAssertion(act, exp);
        +            }
        +            else {
        +                LambdaTestHelpers.assertContentsEqual(act, exp);
        +            }
        +        };
        +    }
        +
             private
             void exerciseMapTabulation(TestData> data,
                                        Collector collector,
                                        TabulationAssertion assertion)
                     throws ReflectiveOperationException {
        -        boolean ordered = data.isOrdered()
        -                          && !collector.characteristics().contains(Collector.Characteristics.UNORDERED);
        +        boolean ordered = !collector.characteristics().contains(Collector.Characteristics.UNORDERED);
        +
                 M m = withData(data)
                         .terminal(s -> s.collect(collector))
        -                .parallelEqualityAsserter(ordered ? LambdaTestHelpers::assertContentsEqual : this::nestedMapEqualityAssertion)
        +                .resultAsserter(mapTabulationAsserter(ordered))
                         .exercise();
                 assertion.assertValue(m, () -> data.stream(), ordered);
        +
                 m = withData(data)
                         .terminal(s -> s.unordered().collect(collector))
        -                .parallelEqualityAsserter(this::nestedMapEqualityAssertion)
        +                .resultAsserter(mapTabulationAsserter(ordered))
                         .exercise();
                 assertion.assertValue(m, () -> data.stream(), false);
             }
         
        -    private void nestedMapEqualityAssertion(Object o1, Object o2) {
        +    private static void nestedMapEqualityAssertion(Object o1, Object o2) {
                 if (o1 instanceof Map) {
                     Map m1 = (Map) o1;
                     Map m2 = (Map) o2;
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java
        --- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ToArrayOpTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -29,6 +29,7 @@
         import java.util.stream.*;
         
         import static java.util.stream.LambdaTestHelpers.*;
        +import static org.testng.Assert.assertEquals;
         
         
         /**
        @@ -134,15 +135,51 @@
                             s -> s.sorted()
                     ));
         
        +    private  ResultAsserter statefulOpResultAsserter(TestData.OfRef data) {
        +        return (act, exp, ord, par) -> {
        +            if (par) {
        +                if (!data.isOrdered()) {
        +                    // Relax the checking if the data source is unordered
        +                    // It is not exactly possible to determine if the limit
        +                    // operation is present and if it is before or after
        +                    // the sorted operation
        +                    // If the limit operation is present and before the sorted
        +                    // operation then the sub-set output after limit is a
        +                    // non-deterministic sub-set of the source
        +                    List expected = new ArrayList<>();
        +                    data.forEach(expected::add);
        +
        +                    List actual = Arrays.asList(act);
        +
        +                    assertEquals(actual.size(), exp.length);
        +                    assertTrue(expected.containsAll(actual));
        +                    return;
        +                }
        +                else if (!ord) {
        +                    LambdaTestHelpers.assertContentsUnordered(Arrays.asList(act),
        +                                                              Arrays.asList(exp));
        +                    return;
        +                }
        +            }
        +            assertEquals(act, exp);
        +        };
        +    }
        +
             @Test(dataProvider = "StreamTestData", dataProviderClass = StreamTestDataProvider.class)
             public void testStatefulOpPermutations(String name, TestData.OfRef data) {
                 for (Function, Stream> f : statefulOpPermutations) {
        -            exerciseTerminalOps(data, f, s -> s.toArray());
        +            withData(data).terminal(f, s -> s.toArray())
        +                    .resultAsserter(statefulOpResultAsserter(data))
        +                    .exercise();
         
        -            Integer[] is = exerciseTerminalOps(data, f, s -> s.toArray(Integer[]::new));
        +            Integer[] is = withData(data).terminal(f, s -> s.toArray(Integer[]::new))
        +                    .resultAsserter(statefulOpResultAsserter(data))
        +                    .exercise();
                     assertEquals(is.getClass(), Integer[].class);
         
        -            Number[] ns = exerciseTerminalOps(data, f, s -> s.toArray(Number[]::new));
        +            Number[] ns = withData(data).terminal(f, s -> s.toArray(Number[]::new))
        +                    .resultAsserter(statefulOpResultAsserter(data))
        +                    .exercise();
                     assertEquals(ns.getClass(), Number[].class);
         
                     if (data.size() > 0) {
        diff -r 0273c023680c -r 6ed8434664ed jdk/test/javax/swing/text/View/8014863/bug8014863.java
        --- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -136,9 +136,12 @@
                                 "qqqq pp qqqq pp qqqq pp qqqq pp" +
                                 " qqqq pp qqqq pp qqqq pp qqqq

        "); editorPane.setCaretPosition(1); - + // An actual font size depends on OS and might be differnet on various OSs. + // It is necessary to calculate the width to meet the expected number of lines. + int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()), + "qqqq pp qqqq pp qqqq pp qqqqqqqq"); frame.add(editorPane); - frame.setSize(200, 200); + frame.setSize(width, 200); frame.setVisible(true); } }); diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java --- a/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/misc/FloatingDecimal/TestFDBigInteger.java Thu Jul 11 12:50:20 2013 -0700 @@ -351,6 +351,10 @@ if (!isImmutable && diff != left) { throw new Exception("leftInplaceSub of doesn't reuse its argument"); } + if (isImmutable) { + check(biLeft, left, "leftInplaceSub corrupts its left immutable argument"); + } + check(biRight, right, "leftInplaceSub corrupts its right argument"); check(biLeft.subtract(biRight), diff, "leftInplaceSub returns wrong result"); } @@ -381,6 +385,10 @@ if (!isImmutable && diff != right) { throw new Exception("rightInplaceSub of doesn't reuse its argument"); } + check(biLeft, left, "leftInplaceSub corrupts its left argument"); + if (isImmutable) { + check(biRight, right, "leftInplaceSub corrupts its right immutable argument"); + } try { check(biLeft.subtract(biRight), diff, "rightInplaceSub returns wrong result"); } catch (Exception e) { diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java --- a/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/misc/JavaLangAccess/NewUnsafeString.java Thu Jul 11 12:50:20 2013 -0700 @@ -22,7 +22,7 @@ */ import java.util.Objects; -import java.util.Comparators; +import java.util.Comparator; import sun.misc.JavaLangAccess; import sun.misc.SharedSecrets; @@ -48,7 +48,7 @@ if (!benchmark.equals(constructorCopy)) { throw new Error("Copy not equal"); } - if (0 != Objects.compare(benchmark, constructorCopy, Comparators.naturalOrder())) { + if (0 != Objects.compare(benchmark, constructorCopy, Comparator.naturalOrder())) { throw new Error("Copy not equal"); } @@ -58,7 +58,7 @@ if (!benchmark.equals(jlaCopy)) { throw new Error("Copy not equal"); } - if (0 != Objects.compare(benchmark, jlaCopy, Comparators.naturalOrder())) { + if (0 != Objects.compare(benchmark, jlaCopy, Comparator.naturalOrder())) { throw new Error("Copy not equal"); } @@ -68,7 +68,7 @@ if (!constructorCopy.equals(jlaCopy)) { throw new Error("Copy not equal"); } - if (0 != Objects.compare(constructorCopy, jlaCopy, Comparators.naturalOrder())) { + if (0 != Objects.compare(constructorCopy, jlaCopy, Comparator.naturalOrder())) { throw new Error("Copy not equal"); } diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/net/www/http/HttpURLConnection/PostOnDelete.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.net.httpserver.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.*; + +/* + * @test + * @bug 7157360 + * @summary HttpURLConnection: HTTP method DELETE doesn't support output + */ +public class PostOnDelete { + + /* string to send */ + private static String msg = "Hello Server"; + /* length of the string to verify */ + private int len = msg.length(); + + public static void main(String[] args) throws Exception { + new PostOnDelete().runTest(); + } + + public void runTest() throws Exception { + Server s = null; + try { + s = new Server(); + s.startServer(); + URL url = new URL("http://localhost:" + s.getPort()); + HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); + urlConnection.setRequestMethod("DELETE"); + urlConnection.setDoOutput(true); + OutputStream os = urlConnection.getOutputStream(); + os.write(msg.getBytes()); + os.close(); + int code = urlConnection.getResponseCode(); + + if (code != 200) { + throw new RuntimeException("Request entity for DELETE failed!"); + } + } finally { + s.stopServer(); + } + } + + class Server { + HttpServer server; + + public void startServer() { + InetSocketAddress addr = new InetSocketAddress(0); + try { + server = HttpServer.create(addr, 0); + } catch (IOException ioe) { + throw new RuntimeException("Server could not be created"); + } + + server.createContext("/", new EmptyPathHandler()); + server.start(); + } + + public int getPort() { + return server.getAddress().getPort(); + } + + public void stopServer() { + server.stop(0); + } + } + + class EmptyPathHandler implements HttpHandler { + + @Override + public void handle(HttpExchange exchange) throws IOException { + String requestMethod = exchange.getRequestMethod(); + + if (requestMethod.equalsIgnoreCase("DELETE")) { + InputStream is = exchange.getRequestBody(); + + int count = 0; + while (is.read() != -1) { + count++; + } + is.close(); + + Headers responseHeaders = exchange.getResponseHeaders(); + responseHeaders.set("Content-Type", "text/plain"); + exchange.sendResponseHeaders((count == len) ? 200 : 400, 0); + OutputStream os = exchange.getResponseBody(); + String str = "Hello from server!"; + os.write(str.getBytes()); + os.flush(); + os.close(); + } + } + } +} diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/AcceptorSubKey.java --- a/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/krb5/auto/AcceptorSubKey.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,10 +26,10 @@ * @bug 7077646 * @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY * @compile -XDignore.symbol.file AcceptorSubKey.java - * @run main/othervm AcceptorSubKey + * @run main/othervm AcceptorSubKey 0 + * @run main/othervm AcceptorSubKey 4 */ -import java.util.Arrays; import sun.security.jgss.GSSUtil; // The basic krb5 test skeleton you can copy from @@ -37,8 +37,14 @@ public static void main(String[] args) throws Exception { + int expected = Integer.parseInt(args[0]); + new OneKDC(null).writeJAASConf(); + if (expected != 0) { + System.setProperty("sun.security.krb5.acceptor.subkey", "true"); + } + Context c, s; c = Context.fromJAAS("client"); s = Context.fromJAAS("server"); @@ -53,8 +59,8 @@ // FLAG_ACCEPTOR_SUBKEY is 4 int flagOn = wrapped[2] & 4; - if (flagOn != 0) { - throw new Exception("Java GSS should not have set acceptor subkey"); + if (flagOn != expected) { + throw new Exception("not expected"); } s.dispose(); diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/BasicProc.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/auto/BasicProc.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8009977 + * @summary A test library to launch multiple Java processes + * @library ../../../../java/security/testlibrary/ + * @compile -XDignore.symbol.file BasicProc.java + * @run main/othervm BasicProc + */ + +import java.io.File; +import org.ietf.jgss.Oid; + +import javax.security.auth.PrivateCredentialPermission; + +public class BasicProc { + + static String CONF = "krb5.conf"; + static String KTAB = "ktab"; + public static void main(String[] args) throws Exception { + String HOST = "localhost"; + String SERVER = "server/" + HOST; + String BACKEND = "backend/" + HOST; + String USER = "user"; + char[] PASS = "password".toCharArray(); + String REALM = "REALM"; + + Oid oid = new Oid("1.2.840.113554.1.2.2"); + + if (args.length == 0) { + System.setProperty("java.security.krb5.conf", CONF); + KDC kdc = KDC.create(REALM, HOST, 0, true); + kdc.addPrincipal(USER, PASS); + kdc.addPrincipalRandKey("krbtgt/" + REALM); + kdc.addPrincipalRandKey(SERVER); + kdc.addPrincipalRandKey(BACKEND); + + String cwd = System.getProperty("user.dir"); + kdc.writeKtab(KTAB); + KDC.saveConfig(CONF, kdc, "forwardable = true"); + + Proc pc = Proc.create("BasicProc") + .args("client") + .prop("java.security.krb5.conf", CONF) + .prop("java.security.manager", "") + .perm(new java.util.PropertyPermission( + "sun.security.krb5.principal", "read")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrincipals")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrivateCredentials")) + .perm(new javax.security.auth.AuthPermission("doAs")) + .perm(new javax.security.auth.kerberos.ServicePermission( + "krbtgt/" + REALM + "@" + REALM, "initiate")) + .perm(new javax.security.auth.kerberos.ServicePermission( + "server/localhost@" + REALM, "initiate")) + .perm(new javax.security.auth.kerberos.DelegationPermission( + "\"server/localhost@" + REALM + "\" " + + "\"krbtgt/" + REALM + "@" + REALM + "\"")) + .debug("C") + .start(); + Proc ps = Proc.create("BasicProc") + .args("server") + .prop("java.security.krb5.conf", CONF) + .prop("java.security.manager", "") + .perm(new java.util.PropertyPermission( + "sun.security.krb5.principal", "read")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrincipals")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrivateCredentials")) + .perm(new javax.security.auth.AuthPermission("doAs")) + .perm(new PrivateCredentialPermission( + "javax.security.auth.kerberos.KeyTab * \"*\"", + "read")) + .perm(new javax.security.auth.kerberos.ServicePermission( + "server/localhost@" + REALM, "accept")) + .perm(new java.io.FilePermission( + cwd + File.separator + KTAB, "read")) + .perm(new javax.security.auth.kerberos.ServicePermission( + "backend/localhost@" + REALM, "initiate")) + .debug("S") + .start(); + Proc pb = Proc.create("BasicProc") + .args("backend") + .prop("java.security.krb5.conf", CONF) + .prop("java.security.manager", "") + .perm(new java.util.PropertyPermission( + "sun.security.krb5.principal", "read")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrincipals")) + .perm(new javax.security.auth.AuthPermission( + "modifyPrivateCredentials")) + .perm(new javax.security.auth.AuthPermission("doAs")) + .perm(new PrivateCredentialPermission( + "javax.security.auth.kerberos.KeyTab * \"*\"", + "read")) + .perm(new javax.security.auth.kerberos.ServicePermission( + "backend/localhost@" + REALM, "accept")) + .perm(new java.io.FilePermission( + cwd + File.separator + KTAB, "read")) + .debug("B") + .start(); + + // Client and server handshake + String token = pc.readData(); + ps.println(token); + token = ps.readData(); + pc.println(token); + // Server and backend handshake + token = ps.readData(); + pb.println(token); + token = pb.readData(); + ps.println(token); + // wrap/unwrap/getMic/verifyMic and plain text + token = ps.readData(); + pb.println(token); + token = pb.readData(); + ps.println(token); + token = pb.readData(); + ps.println(token); + + if ((pc.waitFor() | ps.waitFor() | pb.waitFor()) != 0) { + throw new Exception(); + } + } else if (args[0].equals("client")) { + Context c = Context.fromUserPass(USER, PASS, false); + c.startAsClient(SERVER, oid); + c.x().requestCredDeleg(true); + Proc.binOut(c.take(new byte[0])); + byte[] token = Proc.binIn(); + c.take(token); + } else if (args[0].equals("server")) { + Context s = Context.fromUserKtab(SERVER, KTAB, true); + s.startAsServer(oid); + byte[] token = Proc.binIn(); + token = s.take(token); + Proc.binOut(token); + Context s2 = s.delegated(); + s2.startAsClient(BACKEND, oid); + Proc.binOut(s2.take(new byte[0])); + token = Proc.binIn(); + s2.take(token); + byte[] msg = "Hello".getBytes(); + Proc.binOut(s2.wrap(msg, true)); + s2.verifyMic(Proc.binIn(), msg); + String in = Proc.textIn(); + if (!in.equals("Hello")) { + throw new Exception(); + } + } else if (args[0].equals("backend")) { + Context b = Context.fromUserKtab(BACKEND, KTAB, true); + b.startAsServer(oid); + byte[] token = Proc.binIn(); + Proc.binOut(b.take(token)); + byte[] msg = b.unwrap(Proc.binIn(), true); + Proc.binOut(b.getMic(msg)); + Proc.textOut(new String(msg)); + } + } + // create a native server + private static Proc ns(Proc p) throws Exception { + return p + .env("KRB5_CONFIG", CONF) + .env("KRB5_KTNAME", KTAB) + .prop("sun.security.jgss.native", "true") + .prop("javax.security.auth.useSubjectCredsOnly", "false") + .prop("sun.security.nativegss.debug", "true"); + } +} diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/Context.java --- a/jdk/test/sun/security/krb5/auto/Context.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/krb5/auto/Context.java Thu Jul 11 12:50:20 2013 -0700 @@ -195,6 +195,7 @@ Krb5LoginModule krb5 = new Krb5LoginModule(); Map map = new HashMap<>(); + map.put("isInitiator", "false"); map.put("doNotPrompt", "true"); map.put("useTicketCache", "false"); map.put("useKeyTab", "true"); @@ -616,9 +617,10 @@ */ static public void handshake(final Context c, final Context s) throws Exception { byte[] t = new byte[0]; - while (!c.x.isEstablished() || !s.x.isEstablished()) { - t = c.take(t); - t = s.take(t); + while (true) { + if (t != null || !c.x.isEstablished()) t = c.take(t); + if (t != null || !s.x.isEstablished()) t = s.take(t); + if (c.x.isEstablished() && s.x.isEstablished()) break; } } } diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/KDC.java --- a/jdk/test/sun/security/krb5/auto/KDC.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/krb5/auto/KDC.java Thu Jul 11 12:50:20 2013 -0700 @@ -1137,7 +1137,7 @@ * @return REALM.NAME = { kdc = host:port } */ private static String realmLineForKDC(KDC kdc) { - return String.format(" %s = {\n kdc = %s:%d\n }\n", + return String.format("%s = {\n kdc = %s:%d\n}\n", kdc.realm, kdc.kdc, kdc.port); diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/NoneReplayCacheTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/auto/NoneReplayCacheTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8001326 + * @run main/othervm NoneReplayCacheTest + * @summary the replaycache type none cannot stop an authenticator replay, + * but it can stop a message replay when s.s.k.acceptor.subkey is true. + * You should not really use none in production environment. This test merely + * shows there can be other protections when replay cache is not working fine. + */ + +import org.ietf.jgss.GSSException; +import sun.security.jgss.GSSUtil; + +public class NoneReplayCacheTest { + + public static void main(String[] args) + throws Exception { + + new OneKDC(null); + + System.setProperty("sun.security.krb5.rcache", "none"); + System.setProperty("sun.security.krb5.acceptor.subkey", "true"); + + Context c, s; + c = Context.fromUserPass(OneKDC.USER, OneKDC.PASS, false); + s = Context.fromUserKtab(OneKDC.SERVER, OneKDC.KTAB, true); + + c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + + byte[] first = c.take(new byte[0]); + + c.take(s.take(first)); + + byte[] msg = c.wrap("hello".getBytes(), true); + s.unwrap(msg, true); + + s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); + s.take(first); // apreq replay not detectable + try { + s.unwrap(msg, true); // msg replay detectable + throw new Exception("This method should fail"); + } catch (GSSException gsse) { + gsse.printStackTrace(); + } + } +} diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/ReplayCache.java --- a/jdk/test/sun/security/krb5/auto/ReplayCache.java Tue Jul 02 17:38:10 2013 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * 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 7118809 - * @run main/othervm ReplayCache - * @summary rcache deadlock - */ - -import org.ietf.jgss.GSSException; -import sun.security.jgss.GSSUtil; -import sun.security.krb5.KrbException; -import sun.security.krb5.internal.Krb5; - -public class ReplayCache { - - public static void main(String[] args) - throws Exception { - - new OneKDC(null).writeJAASConf(); - - Context c, s; - c = Context.fromJAAS("client"); - s = Context.fromJAAS("server"); - - c.startAsClient(OneKDC.SERVER, GSSUtil.GSS_KRB5_MECH_OID); - s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); - - byte[] first = c.take(new byte[0]); - s.take(first); - - s.startAsServer(GSSUtil.GSS_KRB5_MECH_OID); - try { - s.take(first); // Replay the last token sent - throw new Exception("This method should fail"); - } catch (GSSException gsse) { - KrbException ke = (KrbException)gsse.getCause(); - if (ke.returnCode() != Krb5.KRB_AP_ERR_REPEAT) { - throw gsse; - } - } - } -} diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/auto/ReplayCacheExpunge.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/sun/security/krb5/auto/ReplayCacheExpunge.java Thu Jul 11 12:50:20 2013 -0700 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8001326 + * @run main/othervm ReplayCacheExpunge 16 + * @run main/othervm/fail ReplayCacheExpunge 15 + * @summary when number of expired entries minus number of good entries + * is more than 30, expunge occurs, and expired entries are forgotten. +*/ + +import java.util.Random; +import sun.security.krb5.internal.KerberosTime; +import sun.security.krb5.internal.ReplayCache; +import sun.security.krb5.internal.rcache.AuthTimeWithHash; + +public class ReplayCacheExpunge { + static final String client = "dummy@REALM"; + static final String server = "server/localhost@REALM"; + static final Random rand = new Random(); + + public static void main(String[] args) throws Exception { + // Make sure clockskew is default value + System.setProperty("java.security.krb5.conf", "nothing"); + + int count = Integer.parseInt(args[0]); + ReplayCache cache = ReplayCache.getInstance("dfl:./"); + AuthTimeWithHash a1 = + new AuthTimeWithHash(client, server, time(-400), 0, hash("1")); + AuthTimeWithHash a2 = + new AuthTimeWithHash(client, server, time(0), 0, hash("4")); + KerberosTime now = new KerberosTime(time(0)*1000L); + KerberosTime then = new KerberosTime(time(-300)*1000L); + + // Once upon a time, we added a lot of events + for (int i=0; i reqs = new ArrayList<>(); + private static String HOST = "localhost"; + + // Where should the rcache be saved. It seems KRB5RCACHEDIR is not + // recognized on Solaris. Maybe version too low? I see 1.6. + private static String cwd = + System.getProperty("os.name").startsWith("SunOS") ? + "/var/krb5/rcache/" : + System.getProperty("user.dir"); + + + private static int uid; + + public static void main0(String[] args) throws Exception { + System.setProperty("java.security.krb5.conf", OneKDC.KRB5_CONF); + if (args.length == 0) { // The controller + int ns = 5; // number of servers + int nu = 5; // number of users + int nx = 50; // number of experiments + int np = 5; // number of peers (services) + int mode = 0; // native(1), random(0), java(-1) + boolean random = true; // random experiments choreograph + + // Do not test interop with native GSS on some platforms + String os = System.getProperty("os.name", "???"); + if (!os.startsWith("SunOS") && !os.startsWith("Linux")) { + mode = -1; + } + + try { + Class clazz = Class.forName( + "com.sun.security.auth.module.UnixSystem"); + uid = (int)(long)(Long) + clazz.getMethod("getUid").invoke(clazz.newInstance()); + } catch (Exception e) { + uid = -1; + } + + KDC kdc = KDC.create(OneKDC.REALM, HOST, 0, true); + for (int i=0; i>4]; + h[2*i+1] = hexConst[hash[i]&0xf]; + } + return new String(h); + } + // return size of dfl file, excluding the null hash ones + private static int csize(int p) throws Exception { + try (SeekableByteChannel chan = Files.newByteChannel( + Paths.get(dfl(p)), StandardOpenOption.READ)) { + chan.position(6); + int cc = 0; + while (true) { + try { + if (AuthTime.readFrom(chan) != null) cc++; + } catch (BufferUnderflowException e) { + break; + } + } + return cc; + } catch (IOException ioe) { + return 0; + } + } + // models an experiement + private static class Ex { + int i; // # + boolean expected; // expected result + boolean actual; // actual output + int old; // which ap-req to send + String server; // which server to send to + String hash; // the hash of req + int user; // which initiator + int peer; // which acceptor + int csize; // size of rcache after test + } + // models a saved ap-req msg + private static class Req { + String msg; // based64-ed req + int user; // which initiator + int peer; // which accceptor + Req(int user, int peer, String msg) { + this.msg = msg; + this.user= user; + this.peer = peer; + } + } +} diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/krb5/ccache/EmptyCC.java --- a/jdk/test/sun/security/krb5/ccache/EmptyCC.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/krb5/ccache/EmptyCC.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,15 +26,12 @@ * @bug 7158329 * @bug 8001208 * @summary NPE in sun.security.krb5.Credentials.acquireDefaultCreds() + * @library ../../../../java/security/testlibrary/ * @compile -XDignore.symbol.file EmptyCC.java * @run main EmptyCC tmpcc * @run main EmptyCC FILE:tmpcc */ import java.io.File; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; import sun.security.krb5.Credentials; import sun.security.krb5.PrincipalName; import sun.security.krb5.internal.ccache.CredentialsCache; @@ -48,32 +45,9 @@ // Main process, write the ccache and launch sub process CredentialsCache cache = CredentialsCache.create(pn, ccache); cache.save(); - - // java -cp $test.classes EmptyCC readcc - ProcessBuilder pb = new ProcessBuilder( - new File(new File(System.getProperty("java.home"), "bin"), - "java").getPath(), - "-cp", - System.getProperty("test.classes"), - "EmptyCC", - ccache, - "readcc" - ); - - pb.environment().put("KRB5CCNAME", ccache); - pb.redirectErrorStream(true); - - Process p = pb.start(); - try (InputStream ins = p.getInputStream()) { - byte[] buf = new byte[8192]; - int n; - while ((n = ins.read(buf)) > 0) { - System.out.write(buf, 0, n); - } - } - if (p.waitFor() != 0) { - throw new Exception("Test failed"); - } + Proc p = Proc.create("EmptyCC").args(ccache, "readcc") + .env("KRB5CCNAME", ccache).start(); + p.waitFor(); } else { // Sub process, read the ccache String cc = System.getenv("KRB5CCNAME"); diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NoImpactServerRenego.java --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NoImpactServerRenego.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NoImpactServerRenego.java Thu Jul 11 12:50:20 2013 -0700 @@ -29,7 +29,7 @@ * @bug 7188658 * @summary Add possibility to disable client initiated renegotiation * @run main/othervm - * -Djdk.tls.rejectClientInitializedRenego=true NoImpactServerRenego + * -Djdk.tls.rejectClientInitiatedRenegotiation=true NoImpactServerRenego */ import java.io.*; diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/RejectClientRenego.java --- a/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/RejectClientRenego.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/RejectClientRenego.java Thu Jul 11 12:50:20 2013 -0700 @@ -131,7 +131,7 @@ sslOS.flush(); } throw new Exception("Not reject client initialized renegotiation"); - } catch (SSLHandshakeException she) { + } catch (IOException ioe) { System.out.println("Got the expected exception"); } finally { sslSocket.close(); @@ -181,7 +181,7 @@ sslIS.read(); } throw new Exception("Not reject client initialized renegotiation"); - } catch (SSLHandshakeException she) { + } catch (IOException ioe) { System.out.println("Got the expected exception"); } finally { sslSocket.close(); @@ -216,7 +216,8 @@ System.setProperty("javax.net.ssl.trustStorePassword", passwd); // reject client initialized SSL renegotiation. - System.setProperty("jdk.tls.rejectClientInitializedRenego", "true"); + System.setProperty( + "jdk.tls.rejectClientInitiatedRenegotiation", "true"); if (debug) System.setProperty("javax.net.debug", "all"); diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/text/resources/LocaleData --- a/jdk/test/sun/text/resources/LocaleData Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/text/resources/LocaleData Thu Jul 11 12:50:20 2013 -0700 @@ -11,7 +11,7 @@ # bug #4052679 LocaleNames/fr/fr=fran\u00e7ais -# bug #4055602, 4290801 +# bug #4055602, 4290801, 8013836 CurrencyNames/pt_BR/BRL=R$ FormatData/pt_BR/NumberPatterns/0=#,##0.###;-#,##0.### # FormatData/pt_BR/NumberPatterns/1=R$ #,##0.##;-R$ #,##0.## # Changed; see bug 4122840 @@ -34,7 +34,7 @@ FormatData/pt_BR/DayNames/0=Domingo FormatData/pt_BR/DayNames/1=Segunda-feira FormatData/pt_BR/DayNames/2=Ter\u00e7a-feira -CalendarData/pt_BR/firstDayOfWeek=2 +CalendarData/pt_BR/firstDayOfWeek=1 CalendarData/pt_BR/minimalDaysInFirstWeek=1 FormatData/pt_BR/MonthNames/0=Janeiro FormatData/pt_BR/MonthNames/1=Fevereiro diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/text/resources/LocaleDataTest.java --- a/jdk/test/sun/text/resources/LocaleDataTest.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/text/resources/LocaleDataTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -35,7 +35,7 @@ * 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787 * 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495 * 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509 - * 7114053 7074882 7040556 + * 7114053 7074882 7040556 8013836 * @summary Verify locale data * */ diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/tools/jcmd/jcmd_Output1.awk --- a/jdk/test/sun/tools/jcmd/jcmd_Output1.awk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/tools/jcmd/jcmd_Output1.awk Thu Jul 11 12:50:20 2013 -0700 @@ -8,10 +8,10 @@ current=1; } -# or match on a path name to a jar file followed by arbitraty arguments +# or match on a path name to a jar or war file followed by arbitraty arguments # - note, jar files ending with ".jar" is only a convention, not a requirement. #Theoretically, any valid file name could occur here. -/^[0-9]+ .*\.jar($| .*$)/ { +/^[0-9]+ .*\.(jar|war)($| .*$)/ { current=1; } diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/tools/jps/jps-l_Output1.awk --- a/jdk/test/sun/tools/jps/jps-l_Output1.awk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/tools/jps/jps-l_Output1.awk Thu Jul 11 12:50:20 2013 -0700 @@ -8,10 +8,10 @@ matched++; } -# or match on a jar file name - note, jar files ending with +# or match on a jar or war file name - note, jar files ending with # ".jar" is only a convention , not a requirement. Theoretically, # any valid file name could occur here. -/^[0-9]+ .*\.jar$/ { +/^[0-9]+ .*\.(jar|war)$/ { matched++; } diff -r 0273c023680c -r 6ed8434664ed jdk/test/sun/tools/jps/jps_Output1.awk --- a/jdk/test/sun/tools/jps/jps_Output1.awk Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/sun/tools/jps/jps_Output1.awk Thu Jul 11 12:50:20 2013 -0700 @@ -8,10 +8,10 @@ matched++; } -# or match on a path name to a jar file - note, jar files ending with +# or match on a path name to a jar or war file - note, jar files ending with # ".jar" is only a convention, not a requirement. Theoretically, # any valid file name could occur here. -/^[0-9]+ .*\.jar$/ { +/^[0-9]+ .*\.(jar|war)$/ { matched++; } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/AttributeTests.java --- a/jdk/test/tools/pack200/AttributeTests.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/AttributeTests.java Thu Jul 11 12:50:20 2013 -0700 @@ -37,6 +37,7 @@ public static void main(String... args) throws Exception { test6746111(); testMethodParameters(); + Utils.cleanup(); } /* diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/BandIntegrity.java --- a/jdk/test/tools/pack200/BandIntegrity.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/BandIntegrity.java Thu Jul 11 12:50:20 2013 -0700 @@ -40,7 +40,7 @@ * the java packer and unpacker must be called in the same java instance. */ public class BandIntegrity { - public static void main(String... args) throws IOException { + public static void main(String... args) throws IOException { File testFile = new File("test.jar"); Utils.jar("cvf", testFile.getName(), "-C", Utils.TEST_CLS_DIR.getAbsolutePath(), @@ -56,6 +56,7 @@ Utils.createFile(configFile, scratch); File outFile = new File("out.jar"); Utils.repack(testFile, outFile, true, - "-v", "--config-file=" + configFile.getName()); + "-v", "--config-file=" + configFile.getName()); + Utils.cleanup(); } } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/CommandLineTests.java --- a/jdk/test/tools/pack200/CommandLineTests.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/CommandLineTests.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -83,6 +83,11 @@ Utils.recursiveCopy(Utils.JavaSDK, EXP_SDK); creatConfigFile(); } + // cleanup the test area + static void cleanup() throws IOException { + Utils.recursiveDelete(EXP_SDK); + Utils.cleanup(); + } // Hopefully, this should be kept in sync with what the installer does. static void creatConfigFile() throws IOException { @@ -172,6 +177,7 @@ init(); testJRE(); testJDK(); + cleanup(); // cleanup only if we pass successfully } catch (IOException ioe) { throw new RuntimeException(ioe); } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/InstructionTests.java --- a/jdk/test/tools/pack200/InstructionTests.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/InstructionTests.java Thu Jul 11 12:50:20 2013 -0700 @@ -35,6 +35,7 @@ public class InstructionTests { public static void main(String... args) throws Exception { testInvokeOpCodes(); + Utils.cleanup(); } /* * the following should produce invokestatic and invokespecial diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/Pack200Props.java --- a/jdk/test/tools/pack200/Pack200Props.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/Pack200Props.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,7 @@ */ import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -45,11 +46,12 @@ public class Pack200Props { - public static void main(String... args) { + public static void main(String... args) throws IOException { verifyDefaults(); File out = new File("test" + Utils.PACK_FILE_EXT); out.delete(); verifySegmentLimit(out); + Utils.cleanup(); } static void verifySegmentLimit(File outFile) { diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/Pack200Test.java --- a/jdk/test/tools/pack200/Pack200Test.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/Pack200Test.java Thu Jul 11 12:50:20 2013 -0700 @@ -66,7 +66,7 @@ } } - private static void doPackUnpack() { + private static void doPackUnpack() throws IOException { for (File in : jarList) { JarOutputStream javaUnpackerStream = null; JarOutputStream nativeUnpackerStream = null; @@ -117,12 +117,13 @@ Utils.close((Closeable) jarFile); } } + Utils.cleanup(); // cleanup artifacts, if successful run } /** * @param args the command line arguments */ - public static void main(String[] args) { + public static void main(String[] args) throws IOException { // select the jars carefully, adding more jars will increase the // testing time, especially for jprt. jarList.add(Utils.locateJar("tools.jar")); diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/PackageVersionTest.java --- a/jdk/test/tools/pack200/PackageVersionTest.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/PackageVersionTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,6 +1,5 @@ - /* - * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +53,7 @@ public final static int JAVA7_PACKAGE_MAJOR_VERSION = 170; public final static int JAVA7_PACKAGE_MINOR_VERSION = 1; - public static void main(String... args) { + public static void main(String... args) throws IOException { if (!javaHome.getName().endsWith("jre")) { throw new RuntimeException("Error: requires an SDK to run"); } @@ -78,6 +77,7 @@ // test for resource file, ie. no class files verifyPack("Test6.java", JAVA5_PACKAGE_MAJOR_VERSION, JAVA5_PACKAGE_MINOR_VERSION); + Utils.cleanup(); } static void verify6991164() { diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/RepackTest.java --- a/jdk/test/tools/pack200/RepackTest.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/RepackTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,7 @@ public static void main(String... args) throws Exception { testRepack(); + Utils.cleanup(); } /* diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/T7007157.java --- a/jdk/test/tools/pack200/T7007157.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/T7007157.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,5 +63,6 @@ Utils.close(fos); Utils.close(jarFile); } + Utils.cleanup(); } } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/TestExceptions.java --- a/jdk/test/tools/pack200/TestExceptions.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/TestExceptions.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,12 +219,13 @@ } } - public static void main(String... args) { + public static void main(String... args) throws IOException { init(); pack200Test1(); pack200Test2(); pack200Test3(); unpack200Test1(); + Utils.cleanup(); } // containers for test inputs and management diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/TimeStamp.java --- a/jdk/test/tools/pack200/TimeStamp.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/TimeStamp.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -149,6 +149,7 @@ Utils.close(jf1); Utils.close(jf2); } + Utils.cleanup(); if (errors > 0) { throw new RuntimeException("FAIL:" + errors + " error(s) encounted"); } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/UnpackerMemoryTest.java --- a/jdk/test/tools/pack200/UnpackerMemoryTest.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/UnpackerMemoryTest.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,6 +81,7 @@ Utils.close(fos); } } + Utils.cleanup(); } } diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/Utils.java --- a/jdk/test/tools/pack200/Utils.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/Utils.java Thu Jul 11 12:50:20 2013 -0700 @@ -75,6 +75,7 @@ static final File TEST_CLS_DIR = new File(System.getProperty("test.classes")); static final String VERIFIER_DIR_NAME = "pack200-verifier"; static final File VerifierJar = new File(VERIFIER_DIR_NAME + JAR_FILE_EXT); + static final File XCLASSES = new File("xclasses"); private Utils() {} // all static @@ -95,8 +96,7 @@ } List javaFileList = findFiles(srcDir, createFilter(JAVA_FILE_EXT)); File tmpFile = File.createTempFile("javac", ".tmp"); - File classesDir = new File("xclasses"); - classesDir.mkdirs(); + XCLASSES.mkdirs(); FileOutputStream fos = null; PrintStream ps = null; try { @@ -111,14 +111,14 @@ } compiler("-d", - "xclasses", + XCLASSES.getName(), "@" + tmpFile.getAbsolutePath()); jar("cvfe", VerifierJar.getName(), "sun.tools.pack.verify.Main", "-C", - "xclasses", + XCLASSES.getName(), "."); } @@ -175,6 +175,33 @@ }; } + /* + * clean up all the usual suspects + */ + static void cleanup() throws IOException { + recursiveDelete(XCLASSES); + List toDelete = new ArrayList<>(); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".out"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".bak"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".jar"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".pack"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".bnd"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".txt"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".idx"))); + toDelete.addAll(Utils.findFiles(new File("."), + Utils.createFilter(".gidx"))); + for (File f : toDelete) { + f.delete(); + } + } + static final FileFilter DIR_FILTER = new FileFilter() { public boolean accept(File pathname) { if (pathname.isDirectory()) { @@ -199,6 +226,9 @@ Files.createDirectories(parent); } Files.copy(src.toPath(), dst.toPath(), COPY_ATTRIBUTES, REPLACE_EXISTING); + if (dst.isDirectory() && !dst.canWrite()) { + dst.setWritable(true); + } } static String baseName(File file, String extension) { diff -r 0273c023680c -r 6ed8434664ed jdk/test/tools/pack200/typeannos/TestTypeAnnotations.java --- a/jdk/test/tools/pack200/typeannos/TestTypeAnnotations.java Tue Jul 02 17:38:10 2013 -0700 +++ b/jdk/test/tools/pack200/typeannos/TestTypeAnnotations.java Thu Jul 11 12:50:20 2013 -0700 @@ -41,5 +41,6 @@ "-C", Utils.TEST_CLS_DIR.getAbsolutePath(), "."); Utils.testWithRepack(testFile, "--unknown-attribute=error"); + Utils.cleanup(); } } diff -r 0273c023680c -r 6ed8434664ed langtools/.hgtags --- a/langtools/.hgtags Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/.hgtags Thu Jul 11 12:50:20 2013 -0700 @@ -217,3 +217,6 @@ 2c5a568ee36eb2d9471483b7a310c49ed545db55 jdk8-b93 48c6e6ab7c815fd41d747f0218f8041c22f3a460 jdk8-b94 4cb1136231275a1f8af53f5bfdef0b488e4b5bab jdk8-b95 +988aef3a8c3adac482363293f65e77ec4c5ce98d jdk8-b96 +6a11a81a8824c17f6cd2ec8f8492e1229b694e96 jdk8-b97 +ce5a90df517bdceb2739d7dd3e6764b070def802 jdk8-b98 diff -r 0273c023680c -r 6ed8434664ed langtools/make/build.properties --- a/langtools/make/build.properties Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/make/build.properties Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ # -# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ target.java = ${target.java.home}/bin/java # Version info -- override as needed -jdk.version = 1.7.0 +jdk.version = 1.8.0 build.number = b00 milestone = internal @@ -60,8 +60,8 @@ bootstrap.full.version = ${bootstrap.release}-${build.number} # options for the tasks used to compile the tools -javac.source = 7 -javac.target = 7 +javac.source = 8 +javac.target = 8 javac.debug = true javac.debuglevel = source,lines javac.no.jdk.warnings = -XDignore.symbol.file=true diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/source/util/TreePath.java --- a/langtools/src/share/classes/com/sun/source/util/TreePath.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/source/util/TreePath.java Thu Jul 11 12:50:20 2013 -0700 @@ -125,18 +125,25 @@ return parent; } + /** + * Iterates from leaves to root. + */ + @Override public Iterator iterator() { return new Iterator() { + @Override public boolean hasNext() { return next != null; } + @Override public Tree next() { Tree t = next.leaf; next = next.parent; return t; } + @Override public void remove() { throw new UnsupportedOperationException(); } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/classfile/Attribute.java --- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java Thu Jul 11 12:50:20 2013 -0700 @@ -77,10 +77,12 @@ public Attribute createAttribute(ClassReader cr, int name_index, byte[] data) throws IOException { - if (standardAttributes == null) + if (standardAttributes == null) { init(); + } ConstantPool cp = cr.getConstantPool(); + String reasonForDefaultAttr; try { String name = cp.getUTF8Value(name_index); Class attrClass = standardAttributes.get(name); @@ -90,14 +92,18 @@ Constructor constr = attrClass.getDeclaredConstructor(constrArgTypes); return constr.newInstance(new Object[] { cr, name_index, data.length }); } catch (Throwable t) { + reasonForDefaultAttr = t.toString(); // fall through and use DefaultAttribute // t.printStackTrace(); } + } else { + reasonForDefaultAttr = "unknown attribute"; } } catch (ConstantPoolException e) { + reasonForDefaultAttr = e.toString(); // fall through and use DefaultAttribute } - return new DefaultAttribute(cr, name_index, data); + return new DefaultAttribute(cr, name_index, data, reasonForDefaultAttr); } protected void init() { diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java --- a/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassFile.java Thu Jul 11 12:50:20 2013 -0700 @@ -26,9 +26,9 @@ package com.sun.tools.classfile; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; import java.nio.file.Path; import static com.sun.tools.classfile.AccessFlags.*; @@ -44,26 +44,24 @@ public class ClassFile { public static ClassFile read(File file) throws IOException, ConstantPoolException { - return read(file, new Attribute.Factory()); + return read(file.toPath(), new Attribute.Factory()); } - public static ClassFile read(Path path) + public static ClassFile read(Path input) throws IOException, ConstantPoolException { - return read(path.toFile(), new Attribute.Factory()); + return read(input, new Attribute.Factory()); + } + + public static ClassFile read(Path input, Attribute.Factory attributeFactory) + throws IOException, ConstantPoolException { + try (InputStream in = Files.newInputStream(input)) { + return new ClassFile(in, attributeFactory); + } } public static ClassFile read(File file, Attribute.Factory attributeFactory) throws IOException, ConstantPoolException { - FileInputStream in = new FileInputStream(file); - try { - return new ClassFile(in, attributeFactory); - } finally { - try { - in.close(); - } catch (IOException e) { - // ignore - } - } + return read(file.toPath(), attributeFactory); } public static ClassFile read(InputStream in) diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java --- a/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/classfile/DefaultAttribute.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,13 +33,24 @@ */ public class DefaultAttribute extends Attribute { DefaultAttribute(ClassReader cr, int name_index, byte[] data) { + this(cr, name_index, data, null); + } + + DefaultAttribute(ClassReader cr, int name_index, byte[] data, String reason) { super(name_index, data.length); info = data; + this.reason = reason; } public DefaultAttribute(ConstantPool constant_pool, int name_index, byte[] info) { + this(constant_pool, name_index, info, null); + } + + public DefaultAttribute(ConstantPool constant_pool, int name_index, + byte[] info, String reason) { super(name_index, info.length); this.info = info; + this.reason = reason; } public R accept(Visitor visitor, P p) { @@ -47,4 +58,7 @@ } public final byte[] info; + /** Why did we need to generate a DefaultAttribute + */ + public final String reason; } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java --- a/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/classfile/SourceDebugExtension_attribute.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.IOException; +import java.nio.charset.Charset; /** * See JVMS, section 4.8.15. @@ -38,6 +39,8 @@ * deletion without notice. */ public class SourceDebugExtension_attribute extends Attribute { + private static final Charset UTF8 = Charset.forName("UTF-8"); + SourceDebugExtension_attribute(ClassReader cr, int name_index, int length) throws IOException { super(name_index, length); debug_extension = new byte[attribute_length]; @@ -55,12 +58,7 @@ } public String getValue() { - DataInputStream d = new DataInputStream(new ByteArrayInputStream(debug_extension)); - try { - return d.readUTF(); - } catch (IOException e) { - return null; - } + return new String(debug_extension, UTF8); } public R accept(Visitor visitor, D data) { diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Thu Jul 11 12:50:20 2013 -0700 @@ -289,7 +289,8 @@ * @param classInfoTree the content tree to which the documentation will be added */ public void buildClassSignature(XMLNode node, Content classInfoTree) { - StringBuilder modifiers = new StringBuilder(classDoc.modifiers() + " "); + StringBuilder modifiers = new StringBuilder(classDoc.modifiers()); + modifiers.append(modifiers.length() == 0 ? "" : " "); if (isEnum) { modifiers.append("enum "); int index; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java Thu Jul 11 12:50:20 2013 -0700 @@ -385,15 +385,21 @@ } commentTextBuilder.append(propertyDoc.commentText()); - Tag[] tags = propertyDoc.tags("@defaultValue"); - if (tags != null) { - for (Tag tag: tags) { - commentTextBuilder.append("\n") - .append(tag.name()) - .append(" ") - .append(tag.text()); + // copy certain tags + List allTags = new LinkedList(); + String[] tagNames = {"@defaultValue", "@since"}; + for (String tagName: tagNames) { + Tag[] tags = propertyDoc.tags(tagName); + if (tags != null) { + allTags.addAll(Arrays.asList(tags)); } } + for (Tag tag: allTags) { + commentTextBuilder.append("\n") + .append(tag.name()) + .append(" ") + .append(tag.text()); + } //add @see tags if (!isGetter && !isSetter) { diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Thu Jul 11 12:50:20 2013 -0700 @@ -371,6 +371,7 @@ overflow:hidden; padding:0px; margin:0px; + white-space:pre; } caption a:link, caption a:hover, caption a:active, caption a:visited { color:#FFFFFF; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java --- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java Thu Jul 11 12:50:20 2013 -0700 @@ -631,6 +631,10 @@ * Initialize standard Javadoc tags for ordering purposes. */ private void initStandardTaglets() { + if (javafx) { + initJavaFXTaglets(); + } + Taglet temp; addStandardTaglet(new ParamTaglet()); addStandardTaglet(new ReturnTaglet()); @@ -664,10 +668,6 @@ standardTags.add("serial"); standardTags.add("serialField"); standardTags.add("Text"); - - if (javafx) { - initJavaFXTaglets(); - } } /** diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java --- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu Jul 11 12:50:20 2013 -0700 @@ -69,6 +69,7 @@ import com.sun.tools.javac.code.Type.ErrorType; import com.sun.tools.javac.code.Type.UnionClassType; import com.sun.tools.javac.code.Types; +import com.sun.tools.javac.code.TypeTag; import com.sun.tools.javac.code.Types.TypeRelation; import com.sun.tools.javac.comp.Attr; import com.sun.tools.javac.comp.AttrContext; @@ -653,8 +654,7 @@ switch (t.getTag()) { case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID: case BOT: case NONE: - return t.getTag() == s.getTag(); - + return t.hasTag(s.getTag()); default: throw new AssertionError("fuzzyMatcher " + t.getTag()); } @@ -668,7 +668,7 @@ if (s.isPartial()) return visit(s, t); - return s.getTag() == ARRAY + return s.hasTag(ARRAY) && visit(t.elemtype, types.elemtype(s)); } @@ -685,7 +685,7 @@ @Override public Boolean visitErrorType(ErrorType t, Type s) { - return s.getTag() == CLASS + return s.hasTag(CLASS) && t.tsym.name == ((ClassType) s).tsym.name; } }; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Thu Jul 11 12:50:20 2013 -0700 @@ -83,7 +83,7 @@ return v.visitString((String) value, p); if (value instanceof Integer) { int i = (Integer) value; - switch (type.tag) { + switch (type.getTag()) { case BOOLEAN: return v.visitBoolean(i != 0, p); case CHAR: return v.visitChar((char) i, p); case BYTE: return v.visitByte((byte) i, p); @@ -91,7 +91,7 @@ case INT: return v.visitInt(i, p); } } - switch (type.tag) { + switch (type.getTag()) { case LONG: return v.visitLong((Long) value, p); case FLOAT: return v.visitFloat((Float) value, p); case DOUBLE: return v.visitDouble((Double) value, p); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Kinds.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -73,9 +73,13 @@ */ public final static int MTH = 1 << 4; + /** Poly kind, for deferred types. + */ + public final static int POLY = 1 << 5; + /** The error kind, which includes all other kinds. */ - public final static int ERR = (1 << 5) - 1; + public final static int ERR = (1 << 6) - 1; /** The set of all kinds. */ @@ -83,7 +87,7 @@ /** Kinds for erroneous symbols that complement the above */ - public static final int ERRONEOUS = 1 << 6; + public static final int ERRONEOUS = 1 << 7; public static final int AMBIGUOUS = ERRONEOUS+1; // ambiguous reference public static final int HIDDEN = ERRONEOUS+2; // hidden method or field public static final int STATICERR = ERRONEOUS+3; // nonstatic member from static context @@ -214,10 +218,10 @@ /** A KindName representing the kind of a given class/interface type. */ public static KindName typeKindName(Type t) { - if (t.tag == TYPEVAR || - t.tag == CLASS && (t.tsym.flags() & COMPOUND) != 0) + if (t.hasTag(TYPEVAR) || + t.hasTag(CLASS) && (t.tsym.flags() & COMPOUND) != 0) return KindName.BOUND; - else if (t.tag == PACKAGE) + else if (t.hasTag(PACKAGE)) return KindName.PACKAGE; else if ((t.tsym.flags_field & ANNOTATION) != 0) return KindName.ANNOTATION; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Printer.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Thu Jul 11 12:50:20 2013 -0700 @@ -215,7 +215,7 @@ @Override public String visitClassType(ClassType t, Locale locale) { StringBuilder buf = new StringBuilder(); - if (t.getEnclosingType().tag == CLASS && t.tsym.owner.kind == Kinds.TYP) { + if (t.getEnclosingType().hasTag(CLASS) && t.tsym.owner.kind == Kinds.TYP) { buf.append(visit(t.getEnclosingType(), locale)); buf.append('.'); buf.append(className(t, false, locale)); @@ -379,7 +379,7 @@ ? s.owner.name.toString() : s.name.toString(); if (s.type != null) { - if (s.type.tag == FORALL) { + if (s.type.hasTag(FORALL)) { ms = "<" + visitTypes(s.type.getTypeArguments(), locale) + ">" + ms; } ms += "(" + printMethodArgs( diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Thu Jul 11 12:50:20 2013 -0700 @@ -699,17 +699,17 @@ public final boolean precedes(TypeSymbol that, Types types) { if (this == that) return false; - if (this.type.tag == that.type.tag) { - if (this.type.hasTag(CLASS)) { + if (type.hasTag(that.type.getTag())) { + if (type.hasTag(CLASS)) { return types.rank(that.type) < types.rank(this.type) || types.rank(that.type) == types.rank(this.type) && that.getQualifiedName().compareTo(this.getQualifiedName()) < 0; - } else if (this.type.hasTag(TYPEVAR)) { + } else if (type.hasTag(TYPEVAR)) { return types.isSubtype(this.type, that.type); } } - return this.type.hasTag(TYPEVAR); + return type.hasTag(TYPEVAR); } @Override diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symtab.java Thu Jul 11 12:50:20 2013 -0700 @@ -28,7 +28,6 @@ import java.util.*; import javax.lang.model.element.ElementVisitor; -import javax.lang.model.type.TypeVisitor; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.code.Type.*; @@ -65,16 +64,16 @@ /** Builtin types. */ - public final Type byteType = new Type(BYTE, null); - public final Type charType = new Type(CHAR, null); - public final Type shortType = new Type(SHORT, null); - public final Type intType = new Type(INT, null); - public final Type longType = new Type(LONG, null); - public final Type floatType = new Type(FLOAT, null); - public final Type doubleType = new Type(DOUBLE, null); - public final Type booleanType = new Type(BOOLEAN, null); + public final JCPrimitiveType byteType = new JCPrimitiveType(BYTE, null); + public final JCPrimitiveType charType = new JCPrimitiveType(CHAR, null); + public final JCPrimitiveType shortType = new JCPrimitiveType(SHORT, null); + public final JCPrimitiveType intType = new JCPrimitiveType(INT, null); + public final JCPrimitiveType longType = new JCPrimitiveType(LONG, null); + public final JCPrimitiveType floatType = new JCPrimitiveType(FLOAT, null); + public final JCPrimitiveType doubleType = new JCPrimitiveType(DOUBLE, null); + public final JCPrimitiveType booleanType = new JCPrimitiveType(BOOLEAN, null); public final Type botType = new BottomType(); - public final JCNoType voidType = new JCNoType(VOID); + public final JCVoidType voidType = new JCVoidType(); private final Names names; private final ClassReader reader; @@ -208,7 +207,7 @@ public void initType(Type type, ClassSymbol c) { type.tsym = c; - typeOfTag[type.tag.ordinal()] = type; + typeOfTag[type.getTag().ordinal()] = type; } public void initType(Type type, String name) { @@ -220,7 +219,7 @@ public void initType(Type type, String name, String bname) { initType(type, name); - boxedName[type.tag.ordinal()] = names.fromString("java.lang." + bname); + boxedName[type.getTag().ordinal()] = names.fromString("java.lang." + bname); } /** The class symbol that owns all predefined symbols. @@ -330,7 +329,7 @@ } public void synthesizeBoxTypeIfMissing(final Type type) { - ClassSymbol sym = reader.enterClass(boxedName[type.tag.ordinal()]); + ClassSymbol sym = reader.enterClass(boxedName[type.getTag().ordinal()]); final Completer completer = sym.completer; if (completer != null) { sym.completer = new Completer() { @@ -388,12 +387,7 @@ target = Target.instance(context); // Create the unknown type - unknownType = new Type(UNKNOWN, null) { - @Override - public R accept(TypeVisitor v, P p) { - return v.visitUnknown(this, p); - } - }; + unknownType = new UnknownType(); // create the basic builtin symbols rootPackage = new PackageSymbol(names.empty, null); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Type.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Thu Jul 11 12:50:20 2013 -0700 @@ -70,25 +70,19 @@ * * @see TypeTag */ -public class Type implements PrimitiveType { +public abstract class Type implements TypeMirror { /** Constant type: no type at all. */ - public static final JCNoType noType = new JCNoType(NONE); + public static final JCNoType noType = new JCNoType(); /** Constant type: special type to be used during recovery of deferred expressions. */ - public static final JCNoType recoveryType = new JCNoType(NONE); + public static final JCNoType recoveryType = new JCNoType(); /** If this switch is turned on, the names of type variables * and anonymous classes are printed with hashcodes appended. */ public static boolean moreInfo = false; - /** The tag of this type. - * - * @see TypeTag - */ - protected TypeTag tag; - /** The defining class / interface / package / type variable. */ public TypeSymbol tsym; @@ -98,39 +92,37 @@ * @return true if tag is equal to the current type tag. */ public boolean hasTag(TypeTag tag) { - return this.tag == tag; + return tag == getTag(); } /** * Returns the current type tag. * @return the value of the current type tag. */ - public TypeTag getTag() { - return tag; - } + public abstract TypeTag getTag(); public boolean isNumeric() { - return tag.isNumeric; + return false; } public boolean isPrimitive() { - return tag.isPrimitive; + return false; } public boolean isPrimitiveOrVoid() { - return tag.isPrimitiveOrVoid; + return false; } public boolean isReference() { - return tag.isReference; + return false; } public boolean isNullOrReference() { - return (tag.isReference || tag == BOT); + return false; } public boolean isPartial() { - return tag.isPartial; + return false; } /** @@ -143,6 +135,18 @@ return null; } + /** Is this a constant type whose value is false? + */ + public boolean isFalse() { + return false; + } + + /** Is this a constant type whose value is true? + */ + public boolean isTrue() { + return false; + } + /** * Get the representation of this type used for modelling purposes. * By default, this is itself. For ErrorType, a different value @@ -153,7 +157,7 @@ } public static List getModelTypes(List ts) { - ListBuffer lb = new ListBuffer(); + ListBuffer lb = new ListBuffer<>(); for (Type t: ts) lb.append(t.getModelType()); return lb.toList(); @@ -163,8 +167,7 @@ /** Define a type given its tag and type symbol */ - public Type(TypeTag tag, TypeSymbol tsym) { - this.tag = tag; + public Type(TypeSymbol tsym) { this.tsym = tsym; } @@ -203,18 +206,7 @@ * and with given constant value */ public Type constType(Object constValue) { - final Object value = constValue; - Assert.check(isPrimitive()); - return new Type(tag, tsym) { - @Override - public Object constValue() { - return value; - } - @Override - public Type baseType() { - return tsym.type; - } - }; + throw new AssertionError(); } /** @@ -272,7 +264,9 @@ String s = (tsym == null || tsym.name == null) ? "" : tsym.name.toString(); - if (moreInfo && tag == TYPEVAR) s = s + hashCode(); + if (moreInfo && hasTag(TYPEVAR)) { + s = s + hashCode(); + } return s; } @@ -298,12 +292,7 @@ */ public String stringValue() { Object cv = Assert.checkNonNull(constValue()); - if (tag == BOOLEAN) - return ((Integer) cv).intValue() == 0 ? "false" : "true"; - else if (tag == CHAR) - return String.valueOf((char) ((Integer) cv).intValue()); - else - return cv.toString(); + return cv.toString(); } /** @@ -321,24 +310,6 @@ return super.hashCode(); } - /** Is this a constant type whose value is false? - */ - public boolean isFalse() { - return - tag == BOOLEAN && - constValue() != null && - ((Integer)constValue()).intValue() == 0; - } - - /** Is this a constant type whose value is true? - */ - public boolean isTrue() { - return - tag == BOOLEAN && - constValue() != null && - ((Integer)constValue()).intValue() != 0; - } - public String argtypes(boolean varargs) { List args = getParameterTypes(); if (!varargs) return args.toString(); @@ -348,7 +319,7 @@ args = args.tail; buf.append(','); } - if (args.head.unannotatedType().tag == ARRAY) { + if (args.head.unannotatedType().hasTag(ARRAY)) { buf.append(((ArrayType)args.head.unannotatedType()).elemtype); if (args.head.getAnnotationMirrors().nonEmpty()) { buf.append(args.head.getAnnotationMirrors()); @@ -485,28 +456,122 @@ return tsym; } + @Override public TypeKind getKind() { - switch (tag) { - case BYTE: return TypeKind.BYTE; - case CHAR: return TypeKind.CHAR; - case SHORT: return TypeKind.SHORT; - case INT: return TypeKind.INT; - case LONG: return TypeKind.LONG; - case FLOAT: return TypeKind.FLOAT; - case DOUBLE: return TypeKind.DOUBLE; - case BOOLEAN: return TypeKind.BOOLEAN; - case VOID: return TypeKind.VOID; - case BOT: return TypeKind.NULL; - case NONE: return TypeKind.NONE; - default: return TypeKind.OTHER; - } + return TypeKind.OTHER; + } + + @Override + public R accept(TypeVisitor v, P p) { + throw new AssertionError(); } - public R accept(TypeVisitor v, P p) { - if (isPrimitive()) + public static class JCPrimitiveType extends Type + implements javax.lang.model.type.PrimitiveType { + + TypeTag tag; + + public JCPrimitiveType(TypeTag tag, TypeSymbol tsym) { + super(tsym); + this.tag = tag; + Assert.check(tag.isPrimitive); + } + + @Override + public boolean isNumeric() { + return tag != BOOLEAN; + } + + @Override + public boolean isPrimitive() { + return true; + } + + @Override + public TypeTag getTag() { + return tag; + } + + @Override + public boolean isPrimitiveOrVoid() { + return true; + } + + /** Define a constant type, of the same kind as this type + * and with given constant value + */ + @Override + public Type constType(Object constValue) { + final Object value = constValue; + return new JCPrimitiveType(tag, tsym) { + @Override + public Object constValue() { + return value; + } + @Override + public Type baseType() { + return tsym.type; + } + }; + } + + /** + * The constant value of this type, converted to String + */ + @Override + public String stringValue() { + Object cv = Assert.checkNonNull(constValue()); + if (tag == BOOLEAN) { + return ((Integer) cv).intValue() == 0 ? "false" : "true"; + } + else if (tag == CHAR) { + return String.valueOf((char) ((Integer) cv).intValue()); + } + else { + return cv.toString(); + } + } + + /** Is this a constant type whose value is false? + */ + @Override + public boolean isFalse() { + return + tag == BOOLEAN && + constValue() != null && + ((Integer)constValue()).intValue() == 0; + } + + /** Is this a constant type whose value is true? + */ + @Override + public boolean isTrue() { + return + tag == BOOLEAN && + constValue() != null && + ((Integer)constValue()).intValue() != 0; + } + + @Override + public R accept(TypeVisitor v, P p) { return v.visitPrimitive(this, p); - else + } + + @Override + public TypeKind getKind() { + switch (tag) { + case BYTE: return TypeKind.BYTE; + case CHAR: return TypeKind.CHAR; + case SHORT: return TypeKind.SHORT; + case INT: return TypeKind.INT; + case LONG: return TypeKind.LONG; + case FLOAT: return TypeKind.FLOAT; + case DOUBLE: return TypeKind.DOUBLE; + case BOOLEAN: return TypeKind.BOOLEAN; + } throw new AssertionError(); + } + } public static class WildcardType extends Type @@ -522,7 +587,7 @@ } public WildcardType(Type type, BoundKind kind, TypeSymbol tsym) { - super(WILDCARD, tsym); + super(tsym); this.type = Assert.checkNonNull(type); this.kind = kind; } @@ -535,6 +600,12 @@ this.bound = bound; } + @Override + public TypeTag getTag() { + return WILDCARD; + } + + @Override public boolean contains(Type t) { return kind != UNBOUND && type.contains(t); } @@ -551,6 +622,17 @@ return kind == UNBOUND; } + @Override + public boolean isReference() { + return true; + } + + @Override + public boolean isNullOrReference() { + return true; + } + + @Override public Type withTypeVar(Type t) { //-System.err.println(this+".withTypeVar("+t+");");//DEBUG if (bound == t) @@ -640,7 +722,7 @@ public List all_interfaces_field; public ClassType(Type outer, List typarams, TypeSymbol tsym) { - super(CLASS, tsym); + super(tsym); this.outer_field = outer; this.typarams_field = typarams; this.allparams_field = null; @@ -658,6 +740,11 @@ } @Override + public TypeTag getTag() { + return CLASS; + } + + @Override public R accept(Type.Visitor v, S s) { return v.visitClassType(this, s); } @@ -680,7 +767,7 @@ */ public String toString() { StringBuilder buf = new StringBuilder(); - if (getEnclosingType().tag == CLASS && tsym.owner.kind == TYP) { + if (getEnclosingType().hasTag(CLASS) && tsym.owner.kind == TYP) { buf.append(getEnclosingType().toString()); buf.append("."); buf.append(className(tsym, false)); @@ -765,6 +852,16 @@ // optimization, was: allparams().nonEmpty(); } + @Override + public boolean isReference() { + return true; + } + + @Override + public boolean isNullOrReference() { + return true; + } + /** A cache for the rank. */ int rank_field = -1; @@ -909,11 +1006,15 @@ public Type elemtype; public ArrayType(Type elemtype, TypeSymbol arrayClass) { - super(ARRAY, arrayClass); + super(arrayClass); this.elemtype = elemtype; } @Override + public TypeTag getTag() { + return ARRAY; + } + public R accept(Type.Visitor v, S s) { return v.visitArrayType(this, s); } @@ -947,6 +1048,16 @@ return elemtype.isParameterized(); } + @Override + public boolean isReference() { + return true; + } + + @Override + public boolean isNullOrReference() { + return true; + } + public boolean isRaw() { return elemtype.isRaw(); } @@ -1001,13 +1112,17 @@ Type restype, List thrown, TypeSymbol methodClass) { - super(METHOD, methodClass); + super(methodClass); this.argtypes = argtypes; this.restype = restype; this.thrown = thrown; } @Override + public TypeTag getTag() { + return METHOD; + } + public R accept(Type.Visitor v, S s) { return v.visitMethodType(this, s); } @@ -1077,7 +1192,12 @@ public static class PackageType extends Type implements NoType { PackageType(TypeSymbol tsym) { - super(PACKAGE, tsym); + super(tsym); + } + + @Override + public TypeTag getTag() { + return PACKAGE; } @Override @@ -1120,26 +1240,32 @@ public Type lower; public TypeVar(Name name, Symbol owner, Type lower) { - super(TYPEVAR, null); + super(null); tsym = new TypeVariableSymbol(0, name, this, owner); this.lower = lower; } public TypeVar(TypeSymbol tsym, Type bound, Type lower) { - super(TYPEVAR, tsym); + super(tsym); this.bound = bound; this.lower = lower; } @Override + public TypeTag getTag() { + return TYPEVAR; + } + + @Override public R accept(Type.Visitor v, S s) { return v.visitTypeVar(this, s); } @Override public Type getUpperBound() { - if ((bound == null || bound.tag == NONE) && this != tsym.type) + if ((bound == null || bound.hasTag(NONE)) && this != tsym.type) { bound = tsym.type.getUpperBound(); + } return bound; } @@ -1158,6 +1284,17 @@ return false; } + @Override + public boolean isReference() { + return true; + } + + @Override + public boolean isNullOrReference() { + return true; + } + + @Override public R accept(TypeVisitor v, P p) { return v.visitTypeVariable(this, p); } @@ -1203,10 +1340,13 @@ public static abstract class DelegatedType extends Type { public Type qtype; + public TypeTag tag; public DelegatedType(TypeTag tag, Type qtype) { - super(tag, qtype.tsym); + super(qtype.tsym); + this.tag = tag; this.qtype = qtype; } + public TypeTag getTag() { return tag; } public String toString() { return qtype.toString(); } public List getTypeArguments() { return qtype.getTypeArguments(); } public Type getEnclosingType() { return qtype.getEnclosingType(); } @@ -1340,6 +1480,12 @@ else return qtype + "?"; } + @Override + public boolean isPartial() { + return true; + } + + @Override public Type baseType() { if (inst != null) return inst.baseType(); else return this; @@ -1439,21 +1585,21 @@ } } - /** Represents VOID or NONE. + /** Represents NONE. */ - static class JCNoType extends Type implements NoType { - public JCNoType(TypeTag tag) { - super(tag, null); + public static class JCNoType extends Type implements NoType { + public JCNoType() { + super(null); + } + + @Override + public TypeTag getTag() { + return NONE; } @Override public TypeKind getKind() { - switch (tag) { - case VOID: return TypeKind.VOID; - case NONE: return TypeKind.NONE; - default: - throw new AssertionError("Unexpected tag: " + tag); - } + return TypeKind.NONE; } @Override @@ -1462,9 +1608,43 @@ } } + /** Represents VOID. + */ + public static class JCVoidType extends Type implements NoType { + + public JCVoidType() { + super(null); + } + + @Override + public TypeTag getTag() { + return VOID; + } + + @Override + public TypeKind getKind() { + return TypeKind.VOID; + } + + @Override + public R accept(TypeVisitor v, P p) { + return v.visitNoType(this, p); + } + + @Override + public boolean isPrimitiveOrVoid() { + return true; + } + } + static class BottomType extends Type implements NullType { public BottomType() { - super(BOT, null); + super(null); + } + + @Override + public TypeTag getTag() { + return BOT; } @Override @@ -1486,6 +1666,12 @@ public String stringValue() { return "null"; } + + @Override + public boolean isNullOrReference() { + return true; + } + } public static class ErrorType extends ClassType @@ -1495,7 +1681,6 @@ public ErrorType(Type originalType, TypeSymbol tsym) { super(noType, List.nil(), null); - tag = ERROR; this.tsym = tsym; this.originalType = (originalType == null ? noType : originalType); } @@ -1507,6 +1692,26 @@ c.members_field = new Scope.ErrorScope(c); } + @Override + public TypeTag getTag() { + return ERROR; + } + + @Override + public boolean isPartial() { + return true; + } + + @Override + public boolean isReference() { + return true; + } + + @Override + public boolean isNullOrReference() { + return true; + } + public ErrorType(Name name, TypeSymbol container, Type originalType) { this(new ClassSymbol(PUBLIC|STATIC|ACYCLIC, name, null, container), originalType); } @@ -1559,7 +1764,7 @@ public Type underlyingType; public AnnotatedType(Type underlyingType) { - super(underlyingType.tag, underlyingType.tsym); + super(underlyingType.tsym); this.typeAnnotations = List.nil(); this.underlyingType = underlyingType; Assert.check(!underlyingType.isAnnotated(), @@ -1568,7 +1773,7 @@ public AnnotatedType(List typeAnnotations, Type underlyingType) { - super(underlyingType.tag, underlyingType.tsym); + super(underlyingType.tsym); this.typeAnnotations = typeAnnotations; this.underlyingType = underlyingType; Assert.check(!underlyingType.isAnnotated(), @@ -1577,6 +1782,11 @@ } @Override + public TypeTag getTag() { + return underlyingType.getTag(); + } + + @Override public boolean isAnnotated() { return true; } @@ -1651,10 +1861,18 @@ @Override public List allparams() { return underlyingType.allparams(); } @Override + public boolean isPrimitive() { return underlyingType.isPrimitive(); } + @Override + public boolean isPrimitiveOrVoid() { return underlyingType.isPrimitiveOrVoid(); } + @Override public boolean isNumeric() { return underlyingType.isNumeric(); } @Override public boolean isReference() { return underlyingType.isReference(); } @Override + public boolean isNullOrReference() { return underlyingType.isNullOrReference(); } + @Override + public boolean isPartial() { return underlyingType.isPartial(); } + @Override public boolean isParameterized() { return underlyingType.isParameterized(); } @Override public boolean isRaw() { return underlyingType.isRaw(); } @@ -1719,6 +1937,28 @@ public TypeMirror getSuperBound() { return ((WildcardType)underlyingType).getSuperBound(); } } + public static class UnknownType extends Type { + + public UnknownType() { + super(null); + } + + @Override + public TypeTag getTag() { + return UNKNOWN; + } + + @Override + public R accept(TypeVisitor v, P p) { + return v.visitUnknown(this, p); + } + + @Override + public boolean isPartial() { + return true; + } + } + /** * A visitor for types. A visitor is used to implement operations * (or relations) on types. Most common operations on types are diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeTag.java Thu Jul 11 12:50:20 2013 -0700 @@ -42,132 +42,107 @@ public enum TypeTag { /** The tag of the basic type `byte'. */ - BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, - TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), + BYTE(BYTE_CLASS, BYTE_SUPERCLASSES, true), /** The tag of the basic type `char'. */ - CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, - TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), + CHAR(CHAR_CLASS, CHAR_SUPERCLASSES, true), /** The tag of the basic type `short'. */ - SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, - TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), - - /** The tag of the basic type `int'. - */ - INT(INT_CLASS, INT_SUPERCLASSES, - TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), + SHORT(SHORT_CLASS, SHORT_SUPERCLASSES, true), /** The tag of the basic type `long'. */ - LONG(LONG_CLASS, LONG_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), + LONG(LONG_CLASS, LONG_SUPERCLASSES, true), /** The tag of the basic type `float'. */ - FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), - + FLOAT(FLOAT_CLASS, FLOAT_SUPERCLASSES, true), + /** The tag of the basic type `int'. + */ + INT(INT_CLASS, INT_SUPERCLASSES, true), /** The tag of the basic type `double'. */ - DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, TypeTagKind.PRIMITIVE | TypeTagKind.NUMERIC), - + DOUBLE(DOUBLE_CLASS, DOUBLE_CLASS, true), /** The tag of the basic type `boolean'. */ - BOOLEAN(TypeTagKind.PRIMITIVE), + BOOLEAN(0, 0, true), /** The tag of the type `void'. */ - VOID(TypeTagKind.VOID), + VOID, /** The tag of all class and interface types. */ - CLASS(TypeTagKind.REFERENCE), + CLASS, /** The tag of all array types. */ - ARRAY(TypeTagKind.REFERENCE), + ARRAY, /** The tag of all (monomorphic) method types. */ - METHOD(TypeTagKind.OTHER), + METHOD, /** The tag of all package "types". */ - PACKAGE(TypeTagKind.OTHER), + PACKAGE, /** The tag of all (source-level) type variables. */ - TYPEVAR(TypeTagKind.REFERENCE), + TYPEVAR, /** The tag of all type arguments. */ - WILDCARD(TypeTagKind.REFERENCE), + WILDCARD, /** The tag of all polymorphic (method-) types. */ - FORALL(TypeTagKind.OTHER), + FORALL, /** The tag of deferred expression types in method context */ - DEFERRED(TypeTagKind.OTHER), + DEFERRED, /** The tag of the bottom type {@code }. */ - BOT(TypeTagKind.OTHER), + BOT, /** The tag of a missing type. */ - NONE(TypeTagKind.OTHER), + NONE, /** The tag of the error type. */ - ERROR(TypeTagKind.REFERENCE | TypeTagKind.PARTIAL), + ERROR, /** The tag of an unknown type */ - UNKNOWN(TypeTagKind.PARTIAL), + UNKNOWN, /** The tag of all instantiatable type variables. */ - UNDETVAR(TypeTagKind.PARTIAL), + UNDETVAR, /** Pseudo-types, these are special tags */ - UNINITIALIZED_THIS(TypeTagKind.OTHER), - - UNINITIALIZED_OBJECT(TypeTagKind.OTHER); + UNINITIALIZED_THIS, - final boolean isPrimitive; - final boolean isNumeric; - final boolean isPartial; - final boolean isReference; - final boolean isPrimitiveOrVoid; + UNINITIALIZED_OBJECT; + final int superClasses; final int numericClass; + final boolean isPrimitive; - private TypeTag(int kind) { - this(0, 0, kind); + private TypeTag() { + this(0, 0, false); } - private TypeTag(int numericClass, int superClasses, int kind) { - isPrimitive = (kind & TypeTagKind.PRIMITIVE) != 0; - isNumeric = (kind & TypeTagKind.NUMERIC) != 0; - isPartial = (kind & TypeTagKind.PARTIAL) != 0; - isReference = (kind & TypeTagKind.REFERENCE) != 0; - isPrimitiveOrVoid = ((kind & TypeTagKind.PRIMITIVE) != 0) || - ((kind & TypeTagKind.VOID) != 0); - this.superClasses = superClasses; - this.numericClass = numericClass; - } - - static class TypeTagKind { - static final int PRIMITIVE = 1; - static final int NUMERIC = 2; - static final int REFERENCE = 4; - static final int PARTIAL = 8; - static final int OTHER = 16; - static final int VOID = 32; + private TypeTag(int numericClass, int superClasses, boolean isPrimitive) { + this.superClasses = superClasses; + this.numericClass = numericClass; + this.isPrimitive = isPrimitive; } public static class NumericClasses { @@ -261,4 +236,5 @@ throw new AssertionError("unknown primitive type " + this); } } + } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/code/Types.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Thu Jul 11 12:50:20 2013 -0700 @@ -33,10 +33,15 @@ import java.util.Set; import java.util.WeakHashMap; +import javax.tools.JavaFileObject; + import com.sun.tools.javac.code.Attribute.RetentionPolicy; import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Type.UndetVar.InferenceBound; +import com.sun.tools.javac.comp.AttrContext; import com.sun.tools.javac.comp.Check; +import com.sun.tools.javac.comp.Enter; +import com.sun.tools.javac.comp.Env; import com.sun.tools.javac.jvm.ClassReader; import com.sun.tools.javac.util.*; import static com.sun.tools.javac.code.BoundKind.*; @@ -83,6 +88,7 @@ final boolean allowDefaultMethods; final ClassReader reader; final Check chk; + final Enter enter; JCDiagnostic.Factory diags; List warnStack = List.nil(); final Name capturedName; @@ -109,6 +115,7 @@ allowDefaultMethods = source.allowDefaultMethods(); reader = ClassReader.instance(context); chk = Check.instance(context); + enter = Enter.instance(context); capturedName = names.fromString(""); messages = JavacMessages.instance(context); diags = JCDiagnostic.Factory.instance(context); @@ -286,8 +293,9 @@ * conversion to s? */ public boolean isConvertible(Type t, Type s, Warner warn) { - if (t.tag == ERROR) + if (t.hasTag(ERROR)) { return true; + } boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (tPrimitive == sPrimitive) { @@ -396,7 +404,8 @@ /** * Compute the function descriptor associated with a given functional interface */ - public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, CompoundScope membersCache) throws FunctionDescriptorLookupError { + public FunctionDescriptor findDescriptorInternal(TypeSymbol origin, + CompoundScope membersCache) throws FunctionDescriptorLookupError { if (!origin.isInterface() || (origin.flags() & ANNOTATION) != 0) { //t must be an interface throw failure("not.a.functional.intf", origin); @@ -603,6 +612,84 @@ return site; } } + + /** + * Create a symbol for a class that implements a given functional interface + * and overrides its functional descriptor. This routine is used for two + * main purposes: (i) checking well-formedness of a functional interface; + * (ii) perform functional interface bridge calculation. + */ + public ClassSymbol makeFunctionalInterfaceClass(Env env, Name name, List targets, long cflags) { + Assert.check(targets.nonEmpty() && isFunctionalInterface(targets.head)); + Symbol descSym = findDescriptorSymbol(targets.head.tsym); + Type descType = findDescriptorType(targets.head); + ClassSymbol csym = new ClassSymbol(cflags, name, env.enclClass.sym.outermostClass()); + csym.completer = null; + csym.members_field = new Scope(csym); + MethodSymbol instDescSym = new MethodSymbol(descSym.flags(), descSym.name, descType, csym); + csym.members_field.enter(instDescSym); + Type.ClassType ctype = new Type.ClassType(Type.noType, List.nil(), csym); + ctype.supertype_field = syms.objectType; + ctype.interfaces_field = targets; + csym.type = ctype; + csym.sourcefile = ((ClassSymbol)csym.owner).sourcefile; + return csym; + } + + /** + * Find the minimal set of methods that are overridden by the functional + * descriptor in 'origin'. All returned methods are assumed to have different + * erased signatures. + */ + public List functionalInterfaceBridges(TypeSymbol origin) { + Assert.check(isFunctionalInterface(origin)); + Symbol descSym = findDescriptorSymbol(origin); + CompoundScope members = membersClosure(origin.type, false); + ListBuffer overridden = ListBuffer.lb(); + outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { + if (m2 == descSym) continue; + else if (descSym.overrides(m2, origin, Types.this, false)) { + for (Symbol m3 : overridden) { + if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || + (m3.overrides(m2, origin, Types.this, false) && + (pendingBridges((ClassSymbol)origin, m3.enclClass()) || + (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { + continue outer; + } + } + overridden.add(m2); + } + } + return overridden.toList(); + } + //where + private Filter bridgeFilter = new Filter() { + public boolean accepts(Symbol t) { + return t.kind == Kinds.MTH && + t.name != names.init && + t.name != names.clinit && + (t.flags() & SYNTHETIC) == 0; + } + }; + private boolean pendingBridges(ClassSymbol origin, TypeSymbol s) { + //a symbol will be completed from a classfile if (a) symbol has + //an associated file object with CLASS kind and (b) the symbol has + //not been entered + if (origin.classfile != null && + origin.classfile.getKind() == JavaFileObject.Kind.CLASS && + enter.getEnv(origin) == null) { + return false; + } + if (origin == s) { + return true; + } + for (Type t : interfaces(origin.type)) { + if (pendingBridges((ClassSymbol)t.tsym, s)) { + return true; + } + } + return false; + } // /** @@ -655,17 +742,16 @@ } } else if (isSubtype(t, s)) { return true; - } - else if (t.tag == TYPEVAR) { + } else if (t.hasTag(TYPEVAR)) { return isSubtypeUnchecked(t.getUpperBound(), s, warn); - } - else if (!s.isRaw()) { + } else if (!s.isRaw()) { Type t2 = asSuper(t, s.tsym); if (t2 != null && t2.isRaw()) { - if (isReifiable(s)) + if (isReifiable(s)) { warn.silentWarn(LintCategory.UNCHECKED); - else + } else { warn.warn(LintCategory.UNCHECKED); + } return true; } } @@ -673,13 +759,14 @@ } private void checkUnsafeVarargsConversion(Type t, Type s, Warner warn) { - if (t.tag != ARRAY || isReifiable(t)) + if (!t.hasTag(ARRAY) || isReifiable(t)) { return; + } t = t.unannotatedType(); s = s.unannotatedType(); ArrayType from = (ArrayType)t; boolean shouldWarn = false; - switch (s.tag) { + switch (s.getTag()) { case ARRAY: ArrayType to = (ArrayType)s; shouldWarn = from.isVarargs() && @@ -735,8 +822,9 @@ // where private TypeRelation isSubtype = new TypeRelation() { + @Override public Boolean visitType(Type t, Type s) { - switch (t.tag) { + switch (t.getTag()) { case BYTE: return (!s.hasTag(CHAR) && t.getTag().isSubRangeOf(s.getTag())); case CHAR: @@ -756,7 +844,7 @@ case NONE: return false; default: - throw new AssertionError("isSubtype " + t.tag); + throw new AssertionError("isSubtype " + t.getTag()); } } @@ -826,14 +914,14 @@ @Override public Boolean visitArrayType(ArrayType t, Type s) { - if (s.tag == ARRAY) { + if (s.hasTag(ARRAY)) { if (t.elemtype.isPrimitive()) return isSameType(t.elemtype, elemtype(s)); else return isSubtypeNoCapture(t.elemtype, elemtype(s)); } - if (s.tag == CLASS) { + if (s.hasTag(CLASS)) { Name sname = s.tsym.getQualifiedName(); return sname == names.java_lang_Object || sname == names.java_lang_Cloneable @@ -846,9 +934,9 @@ @Override public Boolean visitUndetVar(UndetVar t, Type s) { //todo: test against origin needed? or replace with substitution? - if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN) { + if (t == s || t.qtype == s || s.hasTag(ERROR) || s.hasTag(UNKNOWN)) { return true; - } else if (s.tag == BOT) { + } else if (s.hasTag(BOT)) { //if 's' is 'null' there's no instantiated type U for which //U <: s (but 'null' itself, which is not a valid type) return false; @@ -913,15 +1001,17 @@ * Is t a supertype of s? */ public boolean isSuperType(Type t, Type s) { - switch (t.tag) { + switch (t.getTag()) { case ERROR: return true; case UNDETVAR: { UndetVar undet = (UndetVar)t; if (t == s || undet.qtype == s || - s.tag == ERROR || - s.tag == BOT) return true; + s.hasTag(ERROR) || + s.hasTag(BOT)) { + return true; + } undet.addBound(InferenceBound.LOWER, s, this); return true; } @@ -990,12 +1080,12 @@ if (s.isPartial()) return visit(s, t); - switch (t.tag) { + switch (t.getTag()) { case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID: case BOT: case NONE: - return t.tag == s.tag; + return t.hasTag(s.getTag()); case TYPEVAR: { - if (s.tag == TYPEVAR) { + if (s.hasTag(TYPEVAR)) { //type-substitution does not preserve type-var types //check that type var symbols and bounds are indeed the same return sameTypeVars((TypeVar)t.unannotatedType(), (TypeVar)s.unannotatedType()); @@ -1009,7 +1099,7 @@ } } default: - throw new AssertionError("isSameType " + t.tag); + throw new AssertionError("isSameType " + t.getTag()); } } @@ -1080,8 +1170,9 @@ @Override public Boolean visitForAll(ForAll t, Type s) { - if (s.tag != FORALL) + if (!s.hasTag(FORALL)) { return false; + } ForAll forAll = (ForAll)s; return hasSameBounds(t, forAll) @@ -1090,12 +1181,14 @@ @Override public Boolean visitUndetVar(UndetVar t, Type s) { - if (s.tag == WILDCARD) + if (s.hasTag(WILDCARD)) { // FIXME, this might be leftovers from before capture conversion return false; - - if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN) + } + + if (t == s || t.qtype == s || s.hasTag(ERROR) || s.hasTag(UNKNOWN)) { return true; + } t.addBound(InferenceBound.EQ, s, Types.this); @@ -1171,9 +1264,9 @@ // public boolean containedBy(Type t, Type s) { - switch (t.tag) { + switch (t.getTag()) { case UNDETVAR: - if (s.tag == WILDCARD) { + if (s.hasTag(WILDCARD)) { UndetVar undetvar = (UndetVar)t; WildcardType wt = (WildcardType)s.unannotatedType(); switch(wt.kind) { @@ -1241,7 +1334,7 @@ private TypeRelation containsType = new TypeRelation() { private Type U(Type t) { - while (t.tag == WILDCARD) { + while (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType)t.unannotatedType(); if (w.isSuperBound()) return w.bound == null ? syms.objectType : w.bound.bound; @@ -1252,7 +1345,7 @@ } private Type L(Type t) { - while (t.tag == WILDCARD) { + while (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType)t.unannotatedType(); if (w.isExtendsBound()) return syms.botType; @@ -1298,10 +1391,11 @@ @Override public Boolean visitUndetVar(UndetVar t, Type s) { - if (s.tag != WILDCARD) + if (!s.hasTag(WILDCARD)) { return isSameType(t, s); - else + } else { return false; + } } @Override @@ -1311,13 +1405,13 @@ }; public boolean isCaptureOf(Type s, WildcardType t) { - if (s.tag != TYPEVAR || !((TypeVar)s.unannotatedType()).isCaptured()) + if (!s.hasTag(TYPEVAR) || !((TypeVar)s.unannotatedType()).isCaptured()) return false; return isSameWildcard(t, ((CapturedType)s.unannotatedType()).wildcard); } public boolean isSameWildcard(WildcardType t, Type s) { - if (s.tag != WILDCARD) + if (!s.hasTag(WILDCARD)) return false; WildcardType w = (WildcardType)s.unannotatedType(); return w.kind == t.kind && w.type == t.type; @@ -1333,6 +1427,26 @@ } // + /** + * Can t and s be compared for equality? Any primitive == + * primitive or primitive == object comparisons here are an error. + * Unboxing and correct primitive == primitive comparisons are + * already dealt with in Attr.visitBinary. + * + */ + public boolean isEqualityComparable(Type s, Type t, Warner warn) { + if (t.isNumeric() && s.isNumeric()) + return true; + + boolean tPrimitive = t.isPrimitive(); + boolean sPrimitive = s.isPrimitive(); + if (!tPrimitive && !sPrimitive) { + return isCastable(s, t, warn) || isCastable(t, s, warn); + } else { + return false; + } + } + // public boolean isCastable(Type t, Type s) { return isCastable(t, s, noWarnings); @@ -1369,15 +1483,15 @@ private TypeRelation isCastable = new TypeRelation() { public Boolean visitType(Type t, Type s) { - if (s.tag == ERROR) + if (s.hasTag(ERROR)) return true; - switch (t.tag) { + switch (t.getTag()) { case BYTE: case CHAR: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: return s.isNumeric(); case BOOLEAN: - return s.tag == BOOLEAN; + return s.hasTag(BOOLEAN); case VOID: return false; case BOT: @@ -1394,10 +1508,10 @@ @Override public Boolean visitClassType(ClassType t, Type s) { - if (s.tag == ERROR || s.tag == BOT) + if (s.hasTag(ERROR) || s.hasTag(BOT)) return true; - if (s.tag == TYPEVAR) { + if (s.hasTag(TYPEVAR)) { if (isCastable(t, s.getUpperBound(), noWarnings)) { warnStack.head.warn(LintCategory.UNCHECKED); return true; @@ -1412,11 +1526,11 @@ visitIntersectionType((IntersectionClassType)t.unannotatedType(), s, false); } - if (s.tag == CLASS || s.tag == ARRAY) { + if (s.hasTag(CLASS) || s.hasTag(ARRAY)) { boolean upcast; if ((upcast = isSubtype(erasure(t), erasure(s))) || isSubtype(erasure(s), erasure(t))) { - if (!upcast && s.tag == ARRAY) { + if (!upcast && s.hasTag(ARRAY)) { if (!isReifiable(s)) warnStack.head.warn(LintCategory.UNCHECKED); return true; @@ -1469,7 +1583,7 @@ } // Sidecast - if (s.tag == CLASS) { + if (s.hasTag(CLASS)) { if ((s.tsym.flags() & INTERFACE) != 0) { return ((t.tsym.flags() & FINAL) == 0) ? sideCast(t, s, warnStack.head) @@ -1501,7 +1615,7 @@ @Override public Boolean visitArrayType(ArrayType t, Type s) { - switch (s.tag) { + switch (s.getTag()) { case ERROR: case BOT: return true; @@ -1516,7 +1630,7 @@ return isSubtype(t, s); case ARRAY: if (elemtype(t).isPrimitive() || elemtype(s).isPrimitive()) { - return elemtype(t).tag == elemtype(s).tag; + return elemtype(t).hasTag(elemtype(s).getTag()); } else { return visit(elemtype(t), elemtype(s)); } @@ -1527,7 +1641,7 @@ @Override public Boolean visitTypeVar(TypeVar t, Type s) { - switch (s.tag) { + switch (s.getTag()) { case ERROR: case BOT: return true; @@ -1579,8 +1693,9 @@ private Set cache = new HashSet(); + @Override public Boolean visitType(Type t, Type s) { - if (s.tag == WILDCARD) + if (s.hasTag(WILDCARD)) return visit(s, t); else return notSoftSubtypeRecursive(t, s) || notSoftSubtypeRecursive(s, t); @@ -1617,10 +1732,10 @@ if (t.isUnbound()) return false; - if (s.tag != WILDCARD) { + if (!s.hasTag(WILDCARD)) { if (t.isExtendsBound()) return notSoftSubtypeRecursive(s, t.type); - else // isSuperBound() + else return notSoftSubtypeRecursive(t.type, s); } @@ -1669,21 +1784,21 @@ */ public boolean notSoftSubtype(Type t, Type s) { if (t == s) return false; - if (t.tag == TYPEVAR) { + if (t.hasTag(TYPEVAR)) { TypeVar tv = (TypeVar) t; return !isCastable(tv.bound, relaxBound(s), noWarnings); } - if (s.tag != WILDCARD) + if (!s.hasTag(WILDCARD)) s = upperBound(s); return !isSubtype(t, relaxBound(s)); } private Type relaxBound(Type t) { - if (t.tag == TYPEVAR) { - while (t.tag == TYPEVAR) + if (t.hasTag(TYPEVAR)) { + while (t.hasTag(TYPEVAR)) t = t.getUpperBound(); t = rewriteQuantifiers(t, true, true); } @@ -1732,16 +1847,16 @@ // public boolean isArray(Type t) { - while (t.tag == WILDCARD) + while (t.hasTag(WILDCARD)) t = upperBound(t); - return t.tag == ARRAY; + return t.hasTag(ARRAY); } /** * The element type of an array. */ public Type elemtype(Type t) { - switch (t.tag) { + switch (t.getTag()) { case WILDCARD: return elemtype(upperBound(t)); case ARRAY: @@ -1775,7 +1890,7 @@ */ public int dimensions(Type t) { int result = 0; - while (t.tag == ARRAY) { + while (t.hasTag(ARRAY)) { result++; t = elemtype(t); } @@ -1789,8 +1904,7 @@ * @return the ArrayType for the given component */ public ArrayType makeArrayType(Type t) { - if (t.tag == VOID || - t.tag == PACKAGE) { + if (t.hasTag(VOID) || t.hasTag(PACKAGE)) { Assert.error("Type t must not be a VOID or PACKAGE type, " + t.toString()); } return new ArrayType(t, syms.arrayClass); @@ -1821,7 +1935,7 @@ return t; Type st = supertype(t); - if (st.tag == CLASS || st.tag == TYPEVAR || st.tag == ERROR) { + if (st.hasTag(CLASS) || st.hasTag(TYPEVAR) || st.hasTag(ERROR)) { Type x = asSuper(st, sym); if (x != null) return x; @@ -1863,13 +1977,13 @@ * @param sym a symbol */ public Type asOuterSuper(Type t, Symbol sym) { - switch (t.tag) { + switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; t = t.getEnclosingType(); - } while (t.tag == CLASS); + } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; @@ -1890,16 +2004,16 @@ * @param sym a symbol */ public Type asEnclosingSuper(Type t, Symbol sym) { - switch (t.tag) { + switch (t.getTag()) { case CLASS: do { Type s = asSuper(t, sym); if (s != null) return s; Type outer = t.getEnclosingType(); - t = (outer.tag == CLASS) ? outer : + t = (outer.hasTag(CLASS)) ? outer : (t.tsym.owner.enclClass() != null) ? t.tsym.owner.enclClass().type : Type.noType; - } while (t.tag == CLASS); + } while (t.hasTag(CLASS)); return null; case ARRAY: return isSubtype(t, sym.type) ? sym.type : null; @@ -1987,11 +2101,11 @@ * (not defined for Method and ForAll types) */ public boolean isAssignable(Type t, Type s, Warner warn) { - if (t.tag == ERROR) + if (t.hasTag(ERROR)) return true; - if (t.tag.isSubRangeOf(INT) && t.constValue() != null) { + if (t.getTag().isSubRangeOf(INT) && t.constValue() != null) { int value = ((Number)t.constValue()).intValue(); - switch (s.tag) { + switch (s.getTag()) { case BYTE: if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) return true; @@ -2007,7 +2121,7 @@ case INT: return true; case CLASS: - switch (unboxedType(s).tag) { + switch (unboxedType(s).getTag()) { case BYTE: case CHAR: case SHORT: @@ -2135,7 +2249,7 @@ null, syms.noSymbol); bc.type = new IntersectionClassType(bounds, bc, allInterfaces); - bc.erasure_field = (bounds.head.tag == TYPEVAR) ? + bc.erasure_field = (bounds.head.hasTag(TYPEVAR)) ? syms.objectType : // error condition, recover erasure(firstExplicitBound); bc.members_field = new Scope(bc); @@ -2198,7 +2312,7 @@ */ @Override public Type visitTypeVar(TypeVar t, Void ignored) { - if (t.bound.tag == TYPEVAR || + if (t.bound.hasTag(TYPEVAR) || (!t.bound.isCompound() && !t.bound.isInterface())) { return t.bound; } else { @@ -2502,8 +2616,8 @@ } private MethodSymbol implementationInternal(MethodSymbol ms, TypeSymbol origin, boolean checkResult, Filter implFilter) { - for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = supertype(t)) { - while (t.tag == TYPEVAR) + for (Type t = origin.type; t.hasTag(CLASS) || t.hasTag(TYPEVAR); t = supertype(t)) { + while (t.hasTag(TYPEVAR)) t = t.getUpperBound(); TypeSymbol c = t.tsym; for (Scope.Entry e = c.members().lookup(ms.name, implFilter); @@ -2643,6 +2757,7 @@ public boolean accepts(Symbol s) { return s.kind == Kinds.MTH && s.name == msym.name && + (s.flags() & SYNTHETIC) == 0 && s.isInheritedIn(site.tsym, Types.this) && overrideEquivalent(memberType(site, s), memberType(site, msym)); } @@ -2684,13 +2799,13 @@ @Override public Boolean visitMethodType(MethodType t, Type s) { - return s.tag == METHOD + return s.hasTag(METHOD) && containsTypeEquivalent(t.argtypes, s.getParameterTypes()); } @Override public Boolean visitForAll(ForAll t, Type s) { - if (s.tag != FORALL) + if (!s.hasTag(FORALL)) return strict ? false : visitMethodType(t.asMethodType(), s); ForAll forAll = (ForAll)s; @@ -3025,7 +3140,7 @@ */ public int rank(Type t) { t = t.unannotatedType(); - switch(t.tag) { + switch(t.getTag()) { case CLASS: { ClassType cls = (ClassType)t; if (cls.rank_field < 0) { @@ -3091,7 +3206,7 @@ */ @Deprecated public String toString(Type t) { - if (t.tag == FORALL) { + if (t.hasTag(FORALL)) { ForAll forAll = (ForAll)t; return typaramsString(forAll.tvars) + forAll.qtype; } @@ -3157,9 +3272,9 @@ if (cl == null) { Type st = supertype(t); if (!t.isCompound()) { - if (st.tag == CLASS) { + if (st.hasTag(CLASS)) { cl = insert(closure(st), t); - } else if (st.tag == TYPEVAR) { + } else if (st.hasTag(TYPEVAR)) { cl = closure(st).prepend(t); } else { cl = List.of(t); @@ -3219,7 +3334,7 @@ if (isSameType(cl1.head, cl2.head)) return intersect(cl1.tail, cl2.tail).prepend(cl1.head); if (cl1.head.tsym == cl2.head.tsym && - cl1.head.tag == CLASS && cl2.head.tag == CLASS) { + cl1.head.hasTag(CLASS) && cl2.head.hasTag(CLASS)) { if (cl1.head.isParameterized() && cl2.head.isParameterized()) { Type merge = merge(cl1.head,cl2.head); return intersect(cl1.tail, cl2.tail).prepend(merge); @@ -3343,7 +3458,7 @@ final int CLASS_BOUND = 2; int boundkind = 0; for (Type t : ts) { - switch (t.tag) { + switch (t.getTag()) { case CLASS: boundkind |= CLASS_BOUND; break; @@ -3353,8 +3468,8 @@ case TYPEVAR: do { t = t.getUpperBound(); - } while (t.tag == TYPEVAR); - if (t.tag == ARRAY) { + } while (t.hasTag(TYPEVAR)); + if (t.hasTag(ARRAY)) { boundkind |= ARRAY_BOUND; } else { boundkind |= CLASS_BOUND; @@ -3394,13 +3509,14 @@ case CLASS_BOUND: // calculate lub(A, B) - while (ts.head.tag != CLASS && ts.head.tag != TYPEVAR) + while (!ts.head.hasTag(CLASS) && !ts.head.hasTag(TYPEVAR)) { ts = ts.tail; + } Assert.check(!ts.isEmpty()); //step 1 - compute erased candidate set (EC) List cl = erasedSupertypes(ts.head); for (Type t : ts.tail) { - if (t.tag == CLASS || t.tag == TYPEVAR) + if (t.hasTag(CLASS) || t.hasTag(TYPEVAR)) cl = intersect(cl, erasedSupertypes(t)); } //step 2 - compute minimal erased candidate set (MEC) @@ -3422,7 +3538,7 @@ // calculate lub(A, B[]) List classes = List.of(arraySuperType()); for (Type t : ts) { - if (t.tag != ARRAY) // Filter out any arrays + if (!t.hasTag(ARRAY)) // Filter out any arrays classes = classes.prepend(t); } // lub(A, B[]) is lub(A, arraySuperType) @@ -3433,7 +3549,7 @@ List erasedSupertypes(Type t) { ListBuffer buf = lb(); for (Type sup : closure(t)) { - if (sup.tag == TYPEVAR) { + if (sup.hasTag(TYPEVAR)) { buf.append(sup); } else { buf.append(erasure(sup)); @@ -3509,7 +3625,7 @@ private static final UnaryVisitor hashCode = new UnaryVisitor() { public Integer visitType(Type t, Void ignored) { - return t.tag.ordinal(); + return t.getTag().ordinal(); } @Override @@ -3635,7 +3751,7 @@ * Return the class that boxes the given primitive. */ public ClassSymbol boxedClass(Type t) { - return reader.enterClass(syms.boxedName[t.tag.ordinal()]); + return reader.enterClass(syms.boxedName[t.getTag().ordinal()]); } /** @@ -3667,7 +3783,7 @@ */ public Type unboxedTypeOrType(Type t) { Type unboxedType = unboxedType(t); - return unboxedType.tag == NONE ? t : unboxedType; + return unboxedType.hasTag(NONE) ? t : unboxedType; } // @@ -3717,7 +3833,7 @@ return buf.reverse(); } public Type capture(Type t) { - if (t.tag != CLASS) + if (!t.hasTag(CLASS)) return t; if (t.getEnclosingType() != Type.noType) { Type capturedEncl = capture(t.getEnclosingType()); @@ -3783,7 +3899,7 @@ public List freshTypeVariables(List types) { ListBuffer result = lb(); for (Type t : types) { - if (t.tag == WILDCARD) { + if (t.hasTag(WILDCARD)) { t = t.unannotatedType(); Type bound = ((WildcardType)t).getExtendsBound(); if (bound == null) @@ -3953,14 +4069,14 @@ @Override public Void visitClassType(ClassType source, Type target) throws AdaptFailure { - if (target.tag == CLASS) + if (target.hasTag(CLASS)) adaptRecursive(source.allparams(), target.allparams()); return null; } @Override public Void visitArrayType(ArrayType source, Type target) throws AdaptFailure { - if (target.tag == ARRAY) + if (target.hasTag(ARRAY)) adaptRecursive(elemtype(source), elemtype(target)); return null; } @@ -4142,7 +4258,7 @@ } Type B(Type t) { - while (t.tag == WILDCARD) { + while (t.hasTag(WILDCARD)) { WildcardType w = (WildcardType)t.unannotatedType(); t = high ? w.getExtendsBound() : @@ -4187,7 +4303,7 @@ * substituted by the wildcard */ private WildcardType makeSuperWildcard(Type bound, TypeVar formal) { - if (bound.tag == BOT) { + if (bound.hasTag(BOT)) { return new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Jul 11 12:50:20 2013 -0700 @@ -134,6 +134,7 @@ allowAnonOuterThis = source.allowAnonOuterThis(); allowStringsInSwitch = source.allowStringsInSwitch(); allowPoly = source.allowPoly(); + allowTypeAnnos = source.allowTypeAnnotations(); allowLambda = source.allowLambda(); allowDefaultMethods = source.allowDefaultMethods(); sourceName = source.name; @@ -147,6 +148,7 @@ statInfo = new ResultInfo(NIL, Type.noType); varInfo = new ResultInfo(VAR, Type.noType); unknownExprInfo = new ResultInfo(VAL, Type.noType); + unknownAnyPolyInfo = new ResultInfo(VAL, Infer.anyPoly); unknownTypeInfo = new ResultInfo(TYP, Type.noType); unknownTypeExprInfo = new ResultInfo(Kinds.TYP | Kinds.VAL, Type.noType); recoveryInfo = new RecoveryInfo(deferredAttr.emptyDeferredAttrContext); @@ -160,6 +162,10 @@ */ boolean allowPoly; + /** Switch: support type annotations. + */ + boolean allowTypeAnnos; + /** Switch: support generics? */ boolean allowGenerics; @@ -240,7 +246,7 @@ InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext(); Type owntype = found; if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) { - if (inferenceContext.free(found)) { + if (allowPoly && inferenceContext.free(found)) { inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { @@ -558,6 +564,7 @@ final ResultInfo statInfo; final ResultInfo varInfo; + final ResultInfo unknownAnyPolyInfo; final ResultInfo unknownExprInfo; final ResultInfo unknownTypeInfo; final ResultInfo unknownTypeExprInfo; @@ -664,17 +671,21 @@ attribStat(l.head, env); } - /** Attribute the arguments in a method call, returning a list of types. + /** Attribute the arguments in a method call, returning the method kind. */ - List attribArgs(List trees, Env env) { - ListBuffer argtypes = new ListBuffer(); + int attribArgs(List trees, Env env, ListBuffer argtypes) { + int kind = VAL; for (JCExpression arg : trees) { - Type argtype = allowPoly && deferredAttr.isDeferred(env, arg) ? - deferredAttr.new DeferredType(arg, env) : - chk.checkNonVoid(arg, attribExpr(arg, env, Infer.anyPoly)); + Type argtype; + if (allowPoly && deferredAttr.isDeferred(env, arg)) { + argtype = deferredAttr.new DeferredType(arg, env); + kind |= POLY; + } else { + argtype = chk.checkNonVoid(arg, attribTree(arg, env, unknownAnyPolyInfo)); + } argtypes.append(argtype); } - return argtypes.toList(); + return kind; } /** Attribute a type argument list, returning a list of types. @@ -745,25 +756,15 @@ JCTree.JCExpression initializer, Type type) { - // in case no lint value has been set up for this env, scan up - // env stack looking for smallest enclosing env for which it is set. - Env lintEnv = env; - while (lintEnv.info.lint == null) - lintEnv = lintEnv.next; - - // Having found the enclosing lint value, we can initialize the lint value for this class - // ... but ... - // There's a problem with evaluating annotations in the right order, such that - // env.info.enclVar.attributes_field might not yet have been evaluated, and so might be - // null. In that case, calling augment will throw an NPE. To avoid this, for now we - // revert to the jdk 6 behavior and ignore the (unevaluated) attributes. - if (env.info.enclVar.annotationsPendingCompletion()) { - env.info.lint = lintEnv.info.lint; - } else { - env.info.lint = lintEnv.info.lint.augment(env.info.enclVar); - } - - Lint prevLint = chk.setLint(env.info.lint); + /* When this env was created, it didn't have the correct lint nor had + * annotations has been processed. + * But now at this phase we have already processed annotations and the + * correct lint must have been set in chk, so we should use that one to + * attribute the initializer. + */ + Lint prevLint = env.info.lint; + env.info.lint = chk.getLint(); + JavaFileObject prevSource = log.useSource(env.toplevel.sourcefile); try { @@ -775,10 +776,11 @@ memberEnter.typeAnnotate(initializer, env, null); annotate.flush(); Type itype = attribExpr(initializer, env, type); - if (itype.constValue() != null) + if (itype.constValue() != null) { return coerce(itype, type).constValue(); - else + } else { return null; + } } finally { env.info.lint = prevLint; log.useSource(prevSource); @@ -1739,6 +1741,7 @@ boolean isConstructorCall = methName == names._this || methName == names._super; + ListBuffer argtypesBuf = ListBuffer.lb(); if (isConstructorCall) { // We are seeing a ...this(...) or ...super(...) call. // Check that this is the first statement in a constructor. @@ -1749,7 +1752,8 @@ localEnv.info.isSelfCall = true; // Attribute arguments, yielding list of argument types. - argtypes = attribArgs(tree.args, localEnv); + attribArgs(tree.args, localEnv, argtypesBuf); + argtypes = argtypesBuf.toList(); typeargtypes = attribTypes(tree.typeargs, localEnv); // Variable `site' points to the class in which the called @@ -1821,7 +1825,8 @@ } else { // Otherwise, we are seeing a regular method call. // Attribute the arguments, yielding list of argument types, ... - argtypes = attribArgs(tree.args, localEnv); + int kind = attribArgs(tree.args, localEnv, argtypesBuf); + argtypes = argtypesBuf.toList(); typeargtypes = attribAnyTypes(tree.typeargs, localEnv); // ... and attribute the method using as a prototype a methodtype @@ -1829,7 +1834,7 @@ // arguments (this will also set the method symbol). Type mpt = newMethodTemplate(resultInfo.pt, argtypes, typeargtypes); localEnv.info.pendingResolutionPhase = null; - Type mtype = attribTree(tree.meth, localEnv, new ResultInfo(VAL, mpt, resultInfo.checkContext)); + Type mtype = attribTree(tree.meth, localEnv, new ResultInfo(kind, mpt, resultInfo.checkContext)); // Compute the result type. Type restype = mtype.getReturnType(); @@ -1999,7 +2004,9 @@ } // Attribute constructor arguments. - List argtypes = attribArgs(tree.args, localEnv); + ListBuffer argtypesBuf = ListBuffer.lb(); + int pkind = attribArgs(tree.args, localEnv, argtypesBuf); + List argtypes = argtypesBuf.toList(); List typeargtypes = attribTypes(tree.typeargs, localEnv); // If we have made no mistakes in the class type... @@ -2086,11 +2093,16 @@ clazztype, tree.constructor, rsEnv, - new ResultInfo(MTH, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); + new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); if (rsEnv.info.lastResolveVarargs()) Assert.check(tree.constructorType.isErroneous() || tree.varargsElement != null); } - findDiamondIfNeeded(localEnv, tree, clazztype); + if (cdef == null && + !clazztype.isErroneous() && + clazztype.getTypeArguments().nonEmpty() && + findDiamonds) { + findDiamond(localEnv, tree, clazztype); + } } if (cdef != null) { @@ -2157,7 +2169,7 @@ clazztype, tree.constructor, localEnv, - new ResultInfo(VAL, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); + new ResultInfo(pkind, newMethodTemplate(syms.voidType, argtypes, typeargtypes))); } else { if (tree.clazz.hasTag(ANNOTATED_TYPE)) { checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations, @@ -2172,32 +2184,27 @@ chk.validate(tree.typeargs, localEnv); } //where - void findDiamondIfNeeded(Env env, JCNewClass tree, Type clazztype) { - if (tree.def == null && - !clazztype.isErroneous() && - clazztype.getTypeArguments().nonEmpty() && - findDiamonds) { - JCTypeApply ta = (JCTypeApply)tree.clazz; - List prevTypeargs = ta.arguments; - try { - //create a 'fake' diamond AST node by removing type-argument trees - ta.arguments = List.nil(); - ResultInfo findDiamondResult = new ResultInfo(VAL, - resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt()); - Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type; - Type polyPt = allowPoly ? - syms.objectType : - clazztype; - if (!inferred.isErroneous() && - types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) { - String key = types.isSameType(clazztype, inferred) ? - "diamond.redundant.args" : - "diamond.redundant.args.1"; - log.warning(tree.clazz.pos(), key, clazztype, inferred); - } - } finally { - ta.arguments = prevTypeargs; + void findDiamond(Env env, JCNewClass tree, Type clazztype) { + JCTypeApply ta = (JCTypeApply)tree.clazz; + List prevTypeargs = ta.arguments; + try { + //create a 'fake' diamond AST node by removing type-argument trees + ta.arguments = List.nil(); + ResultInfo findDiamondResult = new ResultInfo(VAL, + resultInfo.checkContext.inferenceContext().free(resultInfo.pt) ? Type.noType : pt()); + Type inferred = deferredAttr.attribSpeculative(tree, env, findDiamondResult).type; + Type polyPt = allowPoly ? + syms.objectType : + clazztype; + if (!inferred.isErroneous() && + types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) { + String key = types.isSameType(clazztype, inferred) ? + "diamond.redundant.args" : + "diamond.redundant.args.1"; + log.warning(tree.clazz.pos(), key, clazztype, inferred); } + } finally { + ta.arguments = prevTypeargs; } } @@ -2327,13 +2334,12 @@ if (pt() != Type.recoveryType) { target = targetChecker.visit(target, that); lambdaType = types.findDescriptorType(target); - chk.checkFunctionalInterface(that, target); } else { target = Type.recoveryType; lambdaType = fallbackDescriptorType(that); } - setFunctionalInfo(that, pt(), lambdaType, target, resultInfo.checkContext.inferenceContext()); + setFunctionalInfo(localEnv, that, pt(), lambdaType, target, resultInfo.checkContext); if (lambdaType.hasTag(FORALL)) { //lambda expression target desc cannot be a generic method @@ -2675,13 +2681,12 @@ if (pt() != Type.recoveryType) { target = targetChecker.visit(pt(), that); desc = types.findDescriptorType(target); - chk.checkFunctionalInterface(that, target); } else { target = Type.recoveryType; desc = fallbackDescriptorType(that); } - setFunctionalInfo(that, pt(), desc, target, resultInfo.checkContext.inferenceContext()); + setFunctionalInfo(localEnv, that, pt(), desc, target, resultInfo.checkContext); List argtypes = desc.getParameterTypes(); Pair refResult = @@ -2883,31 +2888,37 @@ * might contain inference variables, we might need to register an hook in the * current inference context. */ - private void setFunctionalInfo(final JCFunctionalExpression fExpr, final Type pt, - final Type descriptorType, final Type primaryTarget, InferenceContext inferenceContext) { - if (inferenceContext.free(descriptorType)) { - inferenceContext.addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() { + private void setFunctionalInfo(final Env env, final JCFunctionalExpression fExpr, + final Type pt, final Type descriptorType, final Type primaryTarget, final CheckContext checkContext) { + if (checkContext.inferenceContext().free(descriptorType)) { + checkContext.inferenceContext().addFreeTypeListener(List.of(pt, descriptorType), new FreeTypeListener() { public void typesInferred(InferenceContext inferenceContext) { - setFunctionalInfo(fExpr, pt, inferenceContext.asInstType(descriptorType), - inferenceContext.asInstType(primaryTarget), inferenceContext); + setFunctionalInfo(env, fExpr, pt, inferenceContext.asInstType(descriptorType), + inferenceContext.asInstType(primaryTarget), checkContext); } }); } else { - ListBuffer targets = ListBuffer.lb(); + ListBuffer targets = ListBuffer.lb(); if (pt.hasTag(CLASS)) { if (pt.isCompound()) { - targets.append(primaryTarget.tsym); //this goes first + targets.append(types.removeWildcards(primaryTarget)); //this goes first for (Type t : ((IntersectionClassType)pt()).interfaces_field) { if (t != primaryTarget) { - targets.append(t.tsym); + targets.append(types.removeWildcards(t)); } } } else { - targets.append(pt.tsym); + targets.append(types.removeWildcards(primaryTarget)); } } fExpr.targets = targets.toList(); - fExpr.descriptorType = descriptorType; + if (checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK && + pt != Type.recoveryType) { + //check that functional interface class is well-formed + ClassSymbol csym = types.makeFunctionalInterfaceClass(env, + names.empty, List.of(fExpr.targets.head), ABSTRACT); + chk.checkImplementations(env.tree, csym, csym); + } } } @@ -3003,6 +3014,8 @@ !left.isErroneous() && !right.isErroneous()) { owntype = operator.type.getReturnType(); + // This will figure out when unboxing can happen and + // choose the right comparison operator. int opc = chk.checkOperator(tree.lhs.pos(), (OperatorSymbol)operator, tree.getTag(), @@ -3030,9 +3043,11 @@ } // Check that argument types of a reference ==, != are - // castable to each other, (JLS???). + // castable to each other, (JLS 15.21). Note: unboxing + // comparisons will not have an acmp* opc at this point. if ((opc == ByteCodes.if_acmpeq || opc == ByteCodes.if_acmpne)) { - if (!types.isCastable(left, right, new Warner(tree.pos()))) { + if (!types.isEqualityComparable(left, right, + new Warner(tree.pos()))) { log.error(tree.pos(), "incomparable.types", left, right); } } @@ -3051,7 +3066,7 @@ //should we propagate the target type? final ResultInfo castInfo; JCExpression expr = TreeInfo.skipParens(tree.expr); - boolean isPoly = expr.hasTag(LAMBDA) || expr.hasTag(REFERENCE); + boolean isPoly = allowPoly && (expr.hasTag(LAMBDA) || expr.hasTag(REFERENCE)); if (isPoly) { //expression is a poly - we need to propagate target type info castInfo = new ResultInfo(VAL, clazztype, new Check.NestedCheckContext(resultInfo.checkContext) { @@ -3190,7 +3205,7 @@ if (skind == TYP) { Type elt = site; while (elt.hasTag(ARRAY)) - elt = ((ArrayType)elt).elemtype; + elt = ((ArrayType)elt.unannotatedType()).elemtype; if (elt.hasTag(TYPEVAR)) { log.error(tree.pos(), "type.var.cant.be.deref"); result = types.createErrorType(tree.type); @@ -3440,10 +3455,14 @@ Symbol sym, Env env, ResultInfo resultInfo) { - Type pt = resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase)); - Type owntype = checkIdInternal(tree, site, sym, pt, env, resultInfo); - resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase)); - return owntype; + if ((resultInfo.pkind & POLY) != 0) { + Type pt = resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.SPECULATIVE, sym, env.info.pendingResolutionPhase)); + Type owntype = checkIdInternal(tree, site, sym, pt, env, resultInfo); + resultInfo.pt.map(deferredAttr.new RecoveryDeferredTypeMap(AttrMode.CHECK, sym, env.info.pendingResolutionPhase)); + return owntype; + } else { + return checkIdInternal(tree, site, sym, resultInfo.pt, env, resultInfo); + } } Type checkIdInternal(JCTree tree, @@ -3541,7 +3560,7 @@ break; case MTH: { owntype = checkMethod(site, sym, - new ResultInfo(VAL, resultInfo.pt.getReturnType(), resultInfo.checkContext), + new ResultInfo(resultInfo.pkind, resultInfo.pt.getReturnType(), resultInfo.checkContext), env, TreeInfo.args(env.tree), resultInfo.pt.getParameterTypes(), resultInfo.pt.getTypeArguments()); break; @@ -4289,12 +4308,13 @@ (c.flags() & ABSTRACT) == 0) { checkSerialVersionUID(tree, c); } - - // Correctly organize the postions of the type annotations - TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree); - - // Check type annotations applicability rules - validateTypeAnnotations(tree); + if (allowTypeAnnos) { + // Correctly organize the postions of the type annotations + TypeAnnotations.organizeTypeAnnotationsBodies(this.syms, this.names, this.log, tree); + + // Check type annotations applicability rules + validateTypeAnnotations(tree); + } } // where /** get a diagnostic position for an attribute of Type t, or null if attribute missing */ @@ -4563,9 +4583,6 @@ @Override public void visitLambda(JCLambda that) { super.visitLambda(that); - if (that.descriptorType == null) { - that.descriptorType = syms.unknownType; - } if (that.targets == null) { that.targets = List.nil(); } @@ -4577,9 +4594,6 @@ if (that.sym == null) { that.sym = new MethodSymbol(0, names.empty, syms.unknownType, syms.noSymbol); } - if (that.descriptorType == null) { - that.descriptorType = syms.unknownType; - } if (that.targets == null) { that.targets = List.nil(); } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Thu Jul 11 12:50:20 2013 -0700 @@ -218,6 +218,14 @@ return prev; } + /* This idiom should be used only in cases when it is needed to set the lint + * of an environment that has been created in a phase previous to annotations + * processing. + */ + Lint getLint() { + return lint; + } + DeferredLintHandler setDeferredLintHandler(DeferredLintHandler newDeferredLintHandler) { DeferredLintHandler prev = deferredLintHandler; deferredLintHandler = newDeferredLintHandler; @@ -2267,24 +2275,6 @@ c.flags_field |= ACYCLIC; } - /** - * Check that functional interface methods would make sense when seen - * from the perspective of the implementing class - */ - void checkFunctionalInterface(JCTree tree, Type funcInterface) { - ClassType c = new ClassType(Type.noType, List.nil(), null); - ClassSymbol csym = new ClassSymbol(0, names.empty, c, syms.noSymbol); - c.interfaces_field = List.of(types.removeWildcards(funcInterface)); - c.supertype_field = syms.objectType; - c.tsym = csym; - csym.members_field = new Scope(csym); - Symbol descSym = types.findDescriptorSymbol(funcInterface.tsym); - Type descType = types.findDescriptorType(funcInterface); - csym.members_field.enter(new MethodSymbol(PUBLIC, descSym.name, descType, csym)); - csym.completer = null; - checkImplementations(tree, csym, csym); - } - /** Check that all methods which implement some * method conform to the method they implement. * @param tree The class definition whose members are checked. diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Jul 11 12:50:20 2013 -0700 @@ -115,12 +115,17 @@ SpeculativeCache speculativeCache; DeferredType(JCExpression tree, Env env) { - super(DEFERRED, null); + super(null); this.tree = tree; this.env = env.dup(tree, env.info.dup()); this.speculativeCache = new SpeculativeCache(); } + @Override + public TypeTag getTag() { + return DEFERRED; + } + /** * A speculative cache is used to keep track of all overload resolution rounds * that triggered speculative attribution on a given deferred type. Each entry @@ -959,10 +964,8 @@ if (sym.kind == Kinds.AMBIGUOUS) { Resolve.AmbiguityError err = (Resolve.AmbiguityError)sym.baseSymbol(); result = ArgumentExpressionKind.PRIMITIVE; - for (List ambigousSyms = err.ambiguousSyms ; - ambigousSyms.nonEmpty() && !result.isPoly() ; - ambigousSyms = ambigousSyms.tail) { - Symbol s = ambigousSyms.head; + for (Symbol s : err.ambiguousSyms) { + if (result.isPoly()) break; if (s.kind == Kinds.MTH) { result = reduce(ArgumentExpressionKind.methodKind(s, types)); } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java Thu Jul 11 12:50:20 2013 -0700 @@ -1945,10 +1945,17 @@ } } + /* The analysis of each catch should be independent. + * Each one should have the same initial values of inits and + * uninits. + */ + final Bits initsCatchPrev = new Bits(initsTry); + final Bits uninitsCatchPrev = new Bits(uninitsTry); + for (List l = tree.catchers; l.nonEmpty(); l = l.tail) { JCVariableDecl param = l.head.param; - inits.assign(initsTry); - uninits.assign(uninitsTry); + inits.assign(initsCatchPrev); + uninits.assign(uninitsCatchPrev); scan(param); inits.incl(param.sym.adr); uninits.excl(param.sym.adr); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java Thu Jul 11 12:50:20 2013 -0700 @@ -96,7 +96,7 @@ } /** A value for prototypes that admit any type, including polymorphic ones. */ - public static final Type anyPoly = new Type(NONE, null); + public static final Type anyPoly = new JCNoType(); /** * This exception class is design to store a list of diagnostics corresponding diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Jul 11 12:50:20 2013 -0700 @@ -100,6 +100,9 @@ /** Flag for alternate metafactories indicating the lambda object has multiple targets */ public static final int FLAG_MARKERS = 1 << 1; + /** Flag for alternate metafactories indicating the lambda object requires multiple bridges */ + public static final int FLAG_BRIDGES = 1 << 2; + private class KlassInfo { /** @@ -321,7 +324,7 @@ int refKind = referenceKind(sym); //convert to an invokedynamic call - result = makeMetaFactoryIndyCall(tree, context.needsAltMetafactory(), context.isSerializable(), refKind, sym, indy_args); + result = makeMetafactoryIndyCall(context, refKind, sym, indy_args); } private JCIdent makeThis(Type type, Symbol owner) { @@ -382,7 +385,7 @@ //build a sam instance using an indy call to the meta-factory - result = makeMetaFactoryIndyCall(tree, localContext.needsAltMetafactory(), localContext.isSerializable(), localContext.referenceKind(), refSym, indy_args); + result = makeMetafactoryIndyCall(localContext, localContext.referenceKind(), refSym, indy_args); } /** @@ -606,8 +609,8 @@ make.Return(makeIndyCall( pos, syms.lambdaMetafactory, - names.altMetaFactory, - staticArgs, indyType, serArgs.toList())), + names.altMetafactory, + staticArgs, indyType, serArgs.toList(), samSym.name)), null); ListBuffer stmts = kInfo.deserializeCases.get(implMethodName); if (stmts == null) { @@ -905,22 +908,26 @@ kInfo.addMethod(new MemberReferenceBridger(tree, localContext).bridge()); } + private MethodType typeToMethodType(Type mt) { + Type type = types.erasure(mt); + return new MethodType(type.getParameterTypes(), + type.getReturnType(), + type.getThrownTypes(), + syms.methodClass); + } + /** * Generate an indy method call to the meta factory */ - private JCExpression makeMetaFactoryIndyCall(JCFunctionalExpression tree, boolean needsAltMetafactory, - boolean isSerializable, int refKind, Symbol refSym, List indy_args) { + private JCExpression makeMetafactoryIndyCall(TranslationContext context, + int refKind, Symbol refSym, List indy_args) { + JCFunctionalExpression tree = context.tree; //determine the static bsm args - Type mtype = types.erasure(tree.descriptorType); MethodSymbol samSym = (MethodSymbol) types.findDescriptorSymbol(tree.type.tsym); List staticArgs = List.of( - new Pool.MethodHandle(ClassFile.REF_invokeInterface, - types.findDescriptorSymbol(tree.type.tsym), types), + typeToMethodType(samSym.type), new Pool.MethodHandle(refKind, refSym, types), - new MethodType(mtype.getParameterTypes(), - mtype.getReturnType(), - mtype.getThrownTypes(), - syms.methodClass)); + typeToMethodType(tree.getDescriptorType(types))); //computed indy arg types ListBuffer indy_args_types = ListBuffer.lb(); @@ -934,31 +941,46 @@ List.nil(), syms.methodClass); - Name metafactoryName = needsAltMetafactory ? - names.altMetaFactory : names.metaFactory; + Name metafactoryName = context.needsAltMetafactory() ? + names.altMetafactory : names.metafactory; - if (needsAltMetafactory) { + if (context.needsAltMetafactory()) { ListBuffer markers = ListBuffer.lb(); - for (Symbol t : tree.targets.tail) { - if (t != syms.serializableType.tsym) { - markers.append(t); + for (Type t : tree.targets.tail) { + if (t.tsym != syms.serializableType.tsym) { + markers.append(t.tsym); } } - int flags = isSerializable? FLAG_SERIALIZABLE : 0; + int flags = context.isSerializable() ? FLAG_SERIALIZABLE : 0; boolean hasMarkers = markers.nonEmpty(); - flags |= hasMarkers ? FLAG_MARKERS : 0; + boolean hasBridges = context.bridges.nonEmpty(); + if (hasMarkers) { + flags |= FLAG_MARKERS; + } + if (hasBridges) { + flags |= FLAG_BRIDGES; + } staticArgs = staticArgs.append(flags); if (hasMarkers) { staticArgs = staticArgs.append(markers.length()); staticArgs = staticArgs.appendList(markers.toList()); } - if (isSerializable) { + if (hasBridges) { + staticArgs = staticArgs.append(context.bridges.length() - 1); + for (Symbol s : context.bridges) { + Type s_erasure = s.erasure(types); + if (!types.isSameType(s_erasure, samSym.erasure(types))) { + staticArgs = staticArgs.append(s.erasure(types)); + } + } + } + if (context.isSerializable()) { addDeserializationCase(refKind, refSym, tree.type, samSym, tree, staticArgs, indyType); } } - return makeIndyCall(tree, syms.lambdaMetafactory, metafactoryName, staticArgs, indyType, indy_args); + return makeIndyCall(tree, syms.lambdaMetafactory, metafactoryName, staticArgs, indyType, indy_args, samSym.name); } /** @@ -966,7 +988,8 @@ * arguments types */ private JCExpression makeIndyCall(DiagnosticPosition pos, Type site, Name bsmName, - List staticArgs, MethodType indyType, List indyArgs) { + List staticArgs, MethodType indyType, List indyArgs, + Name methName) { int prevPos = make.pos; try { make.at(pos); @@ -978,7 +1001,7 @@ bsmName, bsm_staticArgs, List.nil()); DynamicMethodSymbol dynSym = - new DynamicMethodSymbol(names.lambda, + new DynamicMethodSymbol(methName, syms.noSymbol, bsm.isStatic() ? ClassFile.REF_invokeStatic : @@ -1299,7 +1322,6 @@ // Make lambda holding the new-class call JCLambda slam = make.Lambda(params, nc); - slam.descriptorType = tree.descriptorType; slam.targets = tree.targets; slam.type = tree.type; slam.pos = tree.pos; @@ -1634,23 +1656,30 @@ /** the enclosing translation context (set for nested lambdas/mref) */ TranslationContext prev; + /** list of methods to be bridged by the meta-factory */ + List bridges; + TranslationContext(T tree) { this.tree = tree; this.owner = owner(); this.depth = frameStack.size() - 1; this.prev = context(); + ClassSymbol csym = + types.makeFunctionalInterfaceClass(attrEnv, names.empty, tree.targets, ABSTRACT | INTERFACE); + this.bridges = types.functionalInterfaceBridges(csym); } /** does this functional expression need to be created using alternate metafactory? */ boolean needsAltMetafactory() { - return (tree.targets.length() > 1 || - isSerializable()); + return tree.targets.length() > 1 || + isSerializable() || + bridges.length() > 1; } /** does this functional expression require serialization support? */ boolean isSerializable() { - for (Symbol target : tree.targets) { - if (types.asSuper(target.type, syms.serializableType.tsym) != null) { + for (Type target : tree.targets) { + if (types.asSuper(target, syms.serializableType.tsym) != null) { return true; } } @@ -1833,7 +1862,7 @@ } Type generatedLambdaSig() { - return types.erasure(tree.descriptorType); + return types.erasure(tree.getDescriptorType(types)); } } @@ -1909,7 +1938,7 @@ } Type bridgedRefSig() { - return types.erasure(types.findDescriptorSymbol(tree.targets.head).type); + return types.erasure(types.findDescriptorSymbol(tree.targets.head.tsym).type); } } } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Thu Jul 11 12:50:20 2013 -0700 @@ -109,15 +109,20 @@ source = Source.instance(context); target = Target.instance(context); deferredLintHandler = DeferredLintHandler.instance(context); + allowTypeAnnos = source.allowTypeAnnotations(); } + /** Switch: support type annotations. + */ + boolean allowTypeAnnos; + /** A queue for classes whose members still need to be entered into the * symbol table. */ ListBuffer> halfcompleted = new ListBuffer>(); /** Set to true only when the first of a set of classes is - * processed from the halfcompleted queue. + * processed from the half completed queue. */ boolean isFirst = true; @@ -1072,7 +1077,9 @@ isFirst = true; } } - TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate); + if (allowTypeAnnos) { + TypeAnnotations.organizeTypeAnnotationsSignatures(syms, names, log, tree, annotate); + } } /* @@ -1117,7 +1124,9 @@ } public void typeAnnotate(final JCTree tree, final Env env, final Symbol sym) { - tree.accept(new TypeAnnotate(env, sym)); + if (allowTypeAnnos) { + tree.accept(new TypeAnnotate(env, sym)); + } } /** diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jul 11 12:50:20 2013 -0700 @@ -1573,7 +1573,6 @@ allowBoxing, useVarargs, operator); - reportVerboseResolutionDiagnostic(env.tree.pos(), name, site, argtypes, typeargtypes, bestSoFar); return bestSoFar; } // where @@ -2224,7 +2223,7 @@ return lookupMethod(env, pos, env.enclClass.sym, resolveMethodCheck, new BasicLookupHelper(name, env.enclClass.sym.type, argtypes, typeargtypes) { @Override - Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol doLookup(Env env, MethodResolutionPhase phase) { return findFun(env, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); @@ -2256,7 +2255,7 @@ List typeargtypes) { return lookupMethod(env, pos, location, resolveContext, new BasicLookupHelper(name, site, argtypes, typeargtypes) { @Override - Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol doLookup(Env env, MethodResolutionPhase phase) { return findMethod(env, site, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired(), false); @@ -2355,7 +2354,7 @@ List typeargtypes) { return lookupMethod(env, pos, site.tsym, resolveContext, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) { @Override - Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol doLookup(Env env, MethodResolutionPhase phase) { return findConstructor(pos, env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); @@ -2413,7 +2412,7 @@ return lookupMethod(env, pos, site.tsym, resolveMethodCheck, new BasicLookupHelper(names.init, site, argtypes, typeargtypes) { @Override - Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol doLookup(Env env, MethodResolutionPhase phase) { return findDiamond(env, site, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired()); @@ -2503,7 +2502,7 @@ return lookupMethod(env, pos, syms.predefClass, currentResolutionContext, new BasicLookupHelper(name, syms.predefClass.type, argtypes, null, BOX) { @Override - Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol doLookup(Env env, MethodResolutionPhase phase) { return findMethod(env, site, name, argtypes, typeargtypes, phase.isBoxingRequired(), phase.isVarargsRequired(), true); @@ -2669,6 +2668,13 @@ abstract Symbol lookup(Env env, MethodResolutionPhase phase); /** + * Dump overload resolution info + */ + void debug(DiagnosticPosition pos, Symbol sym) { + //do nothing + } + + /** * Validate the result of the lookup */ abstract Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym); @@ -2685,17 +2691,30 @@ } @Override - Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { + final Symbol lookup(Env env, MethodResolutionPhase phase) { + Symbol sym = doLookup(env, phase); if (sym.kind == AMBIGUOUS) { AmbiguityError a_err = (AmbiguityError)sym; sym = a_err.mergeAbstracts(site); } + return sym; + } + + abstract Symbol doLookup(Env env, MethodResolutionPhase phase); + + @Override + Symbol access(Env env, DiagnosticPosition pos, Symbol location, Symbol sym) { if (sym.kind >= AMBIGUOUS) { //if nothing is found return the 'first' error sym = accessMethod(sym, pos, location, site, name, true, argtypes, typeargtypes); } return sym; } + + @Override + void debug(DiagnosticPosition pos, Symbol sym) { + reportVerboseResolutionDiagnostic(pos, name, site, argtypes, typeargtypes, sym); + } } /** @@ -2843,7 +2862,7 @@ protected Symbol lookup(Env env, MethodResolutionPhase phase) { Scope sc = new Scope(syms.arrayClass); MethodSymbol arrayConstr = new MethodSymbol(PUBLIC, name, null, site.tsym); - arrayConstr.type = new MethodType(List.of(syms.intType), site, List.nil(), syms.methodClass); + arrayConstr.type = new MethodType(List.of(syms.intType), site, List.nil(), syms.methodClass); sc.enter(arrayConstr); return findMethodInScope(env, site, name, argtypes, typeargtypes, sc, methodNotFound, phase.isBoxingRequired(), phase.isVarargsRequired(), false, false); } @@ -2924,7 +2943,9 @@ MethodResolutionPhase prevPhase = currentResolutionContext.step; Symbol prevBest = bestSoFar; currentResolutionContext.step = phase; - bestSoFar = phase.mergeResults(bestSoFar, lookupHelper.lookup(env, phase)); + Symbol sym = lookupHelper.lookup(env, phase); + lookupHelper.debug(pos, sym); + bestSoFar = phase.mergeResults(bestSoFar, sym); env.info.pendingResolutionPhase = (prevBest == bestSoFar) ? prevPhase : phase; } return lookupHelper.access(env, pos, location, bestSoFar); @@ -3630,35 +3651,39 @@ * is more specific than the others, attempt to merge their signatures. */ Symbol mergeAbstracts(Type site) { - Symbol fst = ambiguousSyms.last(); - Symbol res = fst; - for (Symbol s : ambiguousSyms.reverse()) { - Type mt1 = types.memberType(site, res); - Type mt2 = types.memberType(site, s); - if ((s.flags() & ABSTRACT) == 0 || - !types.overrideEquivalent(mt1, mt2) || - !types.isSameTypes(fst.erasure(types).getParameterTypes(), - s.erasure(types).getParameterTypes())) { - //ambiguity cannot be resolved - return this; - } else { - Type mst = mostSpecificReturnType(mt1, mt2); - if (mst == null) { - // Theoretically, this can't happen, but it is possible - // due to error recovery or mixing incompatible class files + List ambiguousInOrder = ambiguousSyms.reverse(); + for (Symbol s : ambiguousInOrder) { + Type mt = types.memberType(site, s); + boolean found = true; + List allThrown = mt.getThrownTypes(); + for (Symbol s2 : ambiguousInOrder) { + Type mt2 = types.memberType(site, s2); + if ((s2.flags() & ABSTRACT) == 0 || + !types.overrideEquivalent(mt, mt2) || + !types.isSameTypes(s.erasure(types).getParameterTypes(), + s2.erasure(types).getParameterTypes())) { + //ambiguity cannot be resolved return this; } - Symbol mostSpecific = mst == mt1 ? res : s; - List allThrown = chk.intersect(mt1.getThrownTypes(), mt2.getThrownTypes()); - Type newSig = types.createMethodTypeWithThrown(mostSpecific.type, allThrown); - res = new MethodSymbol( - mostSpecific.flags(), - mostSpecific.name, - newSig, - mostSpecific.owner); + Type mst = mostSpecificReturnType(mt, mt2); + if (mst == null || mst != mt) { + found = false; + break; + } + allThrown = chk.intersect(allThrown, mt2.getThrownTypes()); + } + if (found) { + //all ambiguous methods were abstract and one method had + //most specific return type then others + return (allThrown == mt.getThrownTypes()) ? + s : new MethodSymbol( + s.flags(), + s.name, + types.createMethodTypeWithThrown(mt, allThrown), + s.owner); } } - return res; + return this; } @Override diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java Thu Jul 11 12:50:20 2013 -0700 @@ -68,6 +68,7 @@ private TreeMaker make; private Enter enter; private boolean allowEnums; + private boolean allowInterfaceBridges; private Types types; private final Resolve resolve; @@ -91,6 +92,7 @@ Source source = Source.instance(context); allowEnums = source.allowEnums(); addBridges = source.addBridges(); + allowInterfaceBridges = source.allowDefaultMethods(); types = Types.instance(context); make = TreeMaker.instance(context); resolve = Resolve.instance(context); @@ -252,7 +254,8 @@ // Create a bridge method symbol and a bridge definition without a body. Type bridgeType = meth.erasure(types); - long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE; + long flags = impl.flags() & AccessFlags | SYNTHETIC | BRIDGE | + (origin.isInterface() ? DEFAULT : 0); if (hypothetical) flags |= HYPOTHETICAL; MethodSymbol bridge = new MethodSymbol(flags, meth.name, @@ -387,11 +390,12 @@ } } // where - Filter overrideBridgeFilter = new Filter() { + private Filter overrideBridgeFilter = new Filter() { public boolean accepts(Symbol s) { return (s.flags() & (SYNTHETIC | OVERRIDE_BRIDGE)) != SYNTHETIC; } }; + /** * @param method The symbol for which a bridge might have to be added * @param impl The implementation of method @@ -999,8 +1003,9 @@ ListBuffer bridges = new ListBuffer(); if (false) //see CR: 6996415 bridges.appendList(addOverrideBridgesIfNeeded(tree, c)); - if ((tree.sym.flags() & INTERFACE) == 0) - addBridges(tree.pos(), tree.sym, bridges); + if (allowInterfaceBridges || (tree.sym.flags() & INTERFACE) == 0) { + addBridges(tree.pos(), c, bridges); + } tree.defs = bridges.toList().prependList(tree.defs); } tree.type = erasure(tree.type); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Code.java Thu Jul 11 12:50:20 2013 -0700 @@ -919,11 +919,15 @@ if (o instanceof Long) return syms.longType; if (o instanceof Double) return syms.doubleType; if (o instanceof ClassSymbol) return syms.classType; - if (o instanceof Type.ArrayType) return syms.classType; - if (o instanceof Type.MethodType) return syms.methodTypeType; + if (o instanceof Pool.MethodHandle) return syms.methodHandleType; if (o instanceof UniqueType) return typeForPool(((UniqueType)o).type); - if (o instanceof Pool.MethodHandle) return syms.methodHandleType; - throw new AssertionError(o); + if (o instanceof Type) { + Type ty = ((Type)o).unannotatedType(); + + if (ty instanceof Type.ArrayType) return syms.classType; + if (ty instanceof Type.MethodType) return syms.methodTypeType; + } + throw new AssertionError("Invalid type of constant pool entry: " + o.getClass()); } /** Emit an opcode with a one-byte operand field; @@ -1855,7 +1859,7 @@ } } - static final Type jsrReturnValue = new Type(INT, null); + static final Type jsrReturnValue = new JCPrimitiveType(INT, null); /* ************************************************************************** diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java --- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Thu Jul 11 12:50:20 2013 -0700 @@ -991,9 +991,19 @@ */ void genMethod(JCMethodDecl tree, Env env, boolean fatcode) { MethodSymbol meth = tree.sym; -// System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG - if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + - (((tree.mods.flags & STATIC) == 0 || meth.isConstructor()) ? 1 : 0) > + int extras = 0; + // Count up extra parameters + if (meth.isConstructor()) { + extras++; + if (meth.enclClass().isInner() && + !meth.enclClass().isStatic()) { + extras++; + } + } else if ((tree.mods.flags & STATIC) == 0) { + extras++; + } + // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG + if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras > ClassFile.MAX_PARAMETERS) { log.error(tree.pos(), "limit.parameters"); nerrs++; @@ -1773,7 +1783,16 @@ r.load(); code.emitop0(ireturn + Code.truncate(Code.typecode(pt))); } else { + /* If we have a statement like: + * + * return; + * + * we need to store the code.pendingStatPos value before generating + * the finalizer. + */ + int tmpPos = code.pendingStatPos; targetEnv = unwind(env.enclMethod, env); + code.pendingStatPos = tmpPos; code.emitop0(return_); } endFinalizerGaps(env, targetEnv); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/main/Main.java --- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Thu Jul 11 12:50:20 2013 -0700 @@ -377,10 +377,10 @@ } public Result compile(String[] args, - String[] classNames, - Context context, - List fileObjects, - Iterable processors) + String[] classNames, + Context context, + List fileObjects, + Iterable processors) { context.put(Log.outKey, out); log = Log.instance(context); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java --- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacTypes.java Thu Jul 11 12:50:20 2013 -0700 @@ -139,7 +139,7 @@ Type unboxed = types.unboxedType((Type) t); if (! unboxed.isPrimitive()) // only true primitives, not void throw new IllegalArgumentException(t.toString()); - return unboxed; + return (PrimitiveType)unboxed; } public TypeMirror capture(TypeMirror t) { diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Thu Jul 11 12:50:20 2013 -0700 @@ -2914,7 +2914,9 @@ pos = token.pos; accept(LBRACE); ListBuffer buf = new ListBuffer(); - if (token.kind != RBRACE) { + if (token.kind == COMMA) { + nextToken(); + } else if (token.kind != RBRACE) { buf.append(annotationValue()); while (token.kind == COMMA) { nextToken(); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Thu Jul 11 12:50:20 2013 -0700 @@ -36,10 +36,7 @@ import javax.annotation.processing.*; import javax.lang.model.SourceVersion; -import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.Element; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; +import javax.lang.model.element.*; import javax.lang.model.util.*; import javax.tools.DiagnosticListener; import javax.tools.JavaFileManager; @@ -762,12 +759,30 @@ } @Override - public Set scan(Element e, Set p) { + public Set visitType(TypeElement e, Set p) { + // Type parameters are not considered to be enclosed by a type + scan(e.getTypeParameters(), p); + return scan(e.getEnclosedElements(), p); + } + + @Override + public Set visitExecutable(ExecutableElement e, Set p) { + // Type parameters are not considered to be enclosed by an executable + scan(e.getTypeParameters(), p); + return scan(e.getEnclosedElements(), p); + } + + void addAnnotations(Element e, Set p) { for (AnnotationMirror annotationMirror : elements.getAllAnnotationMirrors(e) ) { Element e2 = annotationMirror.getAnnotationType().asElement(); p.add((TypeElement) e2); } + } + + @Override + public Set scan(Element e, Set p) { + addAnnotations(e, p); return super.scan(e, p); } } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java --- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacRoundEnvironment.java Thu Jul 11 12:50:20 2013 -0700 @@ -147,6 +147,20 @@ } @Override + public Set visitType(TypeElement e, DeclaredType p) { + // Type parameters are not considered to be enclosed by a type + scan(e.getTypeParameters(), p); + return scan(e.getEnclosedElements(), p); + } + + @Override + public Set visitExecutable(ExecutableElement e, DeclaredType p) { + // Type parameters are not considered to be enclosed by an executable + scan(e.getTypeParameters(), p); + return scan(e.getEnclosedElements(), p); + } + + @Override public Set scan(Element e, DeclaredType p) { java.util.List annotationMirrors = processingEnv.getElementUtils().getAllAnnotationMirrors(e); @@ -157,7 +171,6 @@ e.accept(this, p); return annotatedElements; } - } /** diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Thu Jul 11 12:50:20 2013 -0700 @@ -641,10 +641,12 @@ polyKind = PolyKind.POLY; } - /** target descriptor inferred for this functional expression. */ - public Type descriptorType; /** list of target types inferred for this functional expression. */ - public List targets; + public List targets; + + public Type getDescriptorType(Types types) { + return types.findDescriptorType(targets.head); + } } /** diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javac/util/Names.java --- a/langtools/src/share/classes/com/sun/tools/javac/util/Names.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/Names.java Thu Jul 11 12:50:20 2013 -0700 @@ -174,8 +174,8 @@ //lambda-related public final Name lambda; - public final Name metaFactory; - public final Name altMetaFactory; + public final Name metafactory; + public final Name altMetafactory; public final Name.Table table; @@ -310,8 +310,8 @@ //lambda-related lambda = fromString("lambda$"); - metaFactory = fromString("metaFactory"); - altMetaFactory = fromString("altMetaFactory"); + metafactory = fromString("metafactory"); + altMetafactory = fromString("altMetafactory"); } protected Name.Table createTable(Options options) { diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javah/JavahTask.java --- a/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTask.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -220,12 +220,6 @@ } }, - new HiddenOption(false, "-old") { - void process(JavahTask task, String opt, String arg) { - task.old = true; - } - }, - new HiddenOption(false, "-llni", "-Xllni") { void process(JavahTask task, String opt, String arg) { task.llni = true; @@ -663,7 +657,6 @@ boolean llni; boolean doubleAlign; boolean force; - boolean old; Set javac_extras = new LinkedHashSet(); PrintWriter log; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java --- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java Thu Jul 11 12:50:20 2013 -0700 @@ -114,6 +114,9 @@ } public Void visitDefault(DefaultAttribute attr, Void ignore) { + if (attr.reason != null) { + report(attr.reason); + } byte[] data = attr.info; int i = 0; int j = 0; @@ -365,8 +368,7 @@ indent(+1); println("Start Length Slot Name Signature"); for (LocalVariableTable_attribute.Entry entry : attr.local_variable_table) { - Formatter formatter = new Formatter(); - println(formatter.format("%8d %7d %5d %5s %s", + println(String.format("%5d %7d %5d %5s %s", entry.start_pc, entry.length, entry.index, constantWriter.stringValue(entry.name_index), constantWriter.stringValue(entry.descriptor_index))); @@ -511,7 +513,12 @@ } public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr, Void ignore) { - println("SourceDebugExtension: " + attr.getValue()); + println("SourceDebugExtension:"); + indent(+1); + for (String s: attr.getValue().split("[\r\n]+")) { + println(s); + } + indent(-1); return null; } @@ -609,7 +616,8 @@ public Void visit_append_frame(StackMapTable_attribute.append_frame frame, Void p) { printHeader(frame); println(" /* append */"); - println(" offset_delta = " + frame.offset_delta); + indent(+1); + println("offset_delta = " + frame.offset_delta); printMap("locals", frame.locals); return null; } diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java --- a/langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Thu Jul 11 12:50:20 2013 -0700 @@ -136,7 +136,8 @@ // for each compile..... int kbPerFile = 175; String osarch = System.getProperty("os.arch"); - if (osarch.equals("i386")) { + String dataModel = System.getProperty("sun.arch.data.model"); + if ("32".equals(dataModel)) { // For 32 bit platforms, assume it is slightly smaller // because of smaller object headers and pointers. kbPerFile = 119; diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java --- a/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/javax/annotation/processing/AbstractProcessor.java Thu Jul 11 12:50:20 2013 -0700 @@ -38,7 +38,7 @@ * superclass for most concrete annotation processors. This class * examines annotation values to compute the {@linkplain * #getSupportedOptions options}, {@linkplain - * #getSupportedAnnotationTypes annotations}, and {@linkplain + * #getSupportedAnnotationTypes annotation types}, and {@linkplain * #getSupportedSourceVersion source version} supported by its * subtypes. * diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/javax/annotation/processing/Processor.java --- a/langtools/src/share/classes/javax/annotation/processing/Processor.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/javax/annotation/processing/Processor.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ package javax.annotation.processing; import java.util.Set; +import javax.lang.model.util.Elements; +import javax.lang.model.AnnotatedConstruct; import javax.lang.model.element.*; import javax.lang.model.SourceVersion; @@ -88,23 +90,52 @@ * configuration mechanisms, such as command line options; for * details, refer to the particular tool's documentation. Which * processors the tool asks to {@linkplain #process run} is a function - * of what annotations are present on the {@linkplain + * of the types of the annotations {@linkplain AnnotatedConstruct present} + * on the {@linkplain * RoundEnvironment#getRootElements root elements}, what {@linkplain * #getSupportedAnnotationTypes annotation types a processor - * processes}, and whether or not a processor {@linkplain #process - * claims the annotations it processes}. A processor will be asked to + * supports}, and whether or not a processor {@linkplain #process + * claims the annotation types it processes}. A processor will be asked to * process a subset of the annotation types it supports, possibly an * empty set. * - * For a given round, the tool computes the set of annotation types on - * the root elements. If there is at least one annotation type - * present, as processors claim annotation types, they are removed - * from the set of unmatched annotations. When the set is empty or no - * more processors are available, the round has run to completion. If + * For a given round, the tool computes the set of annotation types + * that are present on the elements enclosed within the root elements. + * If there is at least one annotation type present, then as + * processors claim annotation types, they are removed from the set of + * unmatched annotation types. When the set is empty or no more + * processors are available, the round has run to completion. If * there are no annotation types present, annotation processing still * occurs but only universal processors which support - * processing {@code "*"} can claim the (empty) set of annotation - * types. + * processing all annotation types, {@code "*"}, can claim the (empty) + * set of annotation types. + * + *

        An annotation type is considered present if there is at least + * one annotation of that type present on an element enclosed within + * the root elements of a round. For this purpose, a type parameter is + * considered to be enclosed by its {@linkplain + * TypeParameterElement#getGenericElement generic + * element}. Annotations on {@linkplain + * java.lang.annotation.ElementType#TYPE_USE type uses}, as opposed to + * annotations on elements, are ignored when computing whether or not + * an annotation type is present. + * + *

        An annotation is present if it meets the definition of being + * present given in {@link AnnotatedConstruct}. In brief, an + * annotation is considered present for the purposes of discovery if + * it is directly present or present via inheritance. An annotation is + * not considered present by virtue of being wrapped by a + * container annotation. Operationally, this is equivalent to an + * annotation being present on an element if and only if it would be + * included in the results of {@link + * Elements#getAllAnnotationMirrors(Element)} called on that element. Since + * annotations inside container annotations are not considered + * present, to properly process {@linkplain + * java.lang.annotation.Repeatable repeatable annotation types}, + * processors are advised to include both the repeatable annotation + * type and its containing annotation type in the set of {@linkplain + * #getSupportedAnnotationTypes() supported annotation types} of a + * processor. * *

        Note that if a processor supports {@code "*"} and returns {@code * true}, all annotations are claimed. Therefore, a universal @@ -257,10 +288,10 @@ /** * Processes a set of annotation types on type elements * originating from the prior round and returns whether or not - * these annotations are claimed by this processor. If {@code - * true} is returned, the annotations are claimed and subsequent + * these annotation types are claimed by this processor. If {@code + * true} is returned, the annotation types are claimed and subsequent * processors will not be asked to process them; if {@code false} - * is returned, the annotations are unclaimed and subsequent + * is returned, the annotation types are unclaimed and subsequent * processors may be asked to process them. A processor may * always return the same boolean value or may vary the result * based on chosen criteria. @@ -271,7 +302,7 @@ * * @param annotations the annotation types requested to be processed * @param roundEnv environment for information about the current and prior round - * @return whether or not the set of annotations are claimed by this processor + * @return whether or not the set of annotation types are claimed by this processor */ boolean process(Set annotations, RoundEnvironment roundEnv); diff -r 0273c023680c -r 6ed8434664ed langtools/src/share/classes/javax/lang/model/SourceVersion.java --- a/langtools/src/share/classes/javax/lang/model/SourceVersion.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/src/share/classes/javax/lang/model/SourceVersion.java Thu Jul 11 12:50:20 2013 -0700 @@ -53,6 +53,8 @@ * 1.4: assert * 1.5: annotations, generics, autoboxing, var-args... * 1.6: no changes + * 1.7: diamond syntax, try-with-resources, etc. + * 1.8: lambda expressions and default methods */ /** @@ -122,6 +124,9 @@ * The version recognized by the Java Platform, Standard Edition * 7. * + * Additions in this release include, diamond syntax for + * constructors, {@code try}-with-resources, strings in switch, + * binary literals, and multi-catch. * @since 1.7 */ RELEASE_7, @@ -130,6 +135,7 @@ * The version recognized by the Java Platform, Standard Edition * 8. * + * Additions in this release include lambda expressions and default methods. * @since 1.8 */ RELEASE_8; diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testJavaFX/C.java --- a/langtools/test/com/sun/javadoc/testJavaFX/C.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/test/com/sun/javadoc/testJavaFX/C.java Thu Jul 11 12:50:20 2013 -0700 @@ -57,6 +57,7 @@ * Defines the direction/speed at which the {@code Timeline} is expected to * be played. * @defaultValue 11 + * @since JavaFX 8.0 */ private DoubleProperty rate; diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java --- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Thu Jul 11 12:50:20 2013 -0700 @@ -55,6 +55,8 @@ {"./" + BUG_ID + "/C.html", "Default value:"}, {"./" + BUG_ID + "/C.html", + "Since:" + NL + "

        JavaFX 8.0
        " }, + {"./" + BUG_ID + "/C.html", "

        Sets the value of the property Property"}, {"./" + BUG_ID + "/C.html", "

        Gets the value of the property Property"}, @@ -78,7 +80,7 @@ private static final String[] ARGS = new String[] { - "-d", BUG_ID, "-sourcepath", SRC_DIR, "-private", "-javafx", + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-javafx", SRC_DIR + FS + "C.java", SRC_DIR + FS + "D.java" }; diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java --- a/langtools/test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/test/com/sun/javadoc/testNestedInlineTag/TestNestedInlineTag.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,10 +21,8 @@ * questions. */ -/** - * This should be green, underlined and bold (Class): {@underline {@bold {@green My test}}} . +/* * @test - * @bug 0000000 * @summary Test for nested inline tags. * * @author jamieh * @library ../lib/ @@ -36,6 +34,9 @@ * @run main TestNestedInlineTag */ +/** + * This should be green, underlined and bold (Class): {@underline {@bold {@green My test}}} . + */ public class TestNestedInlineTag extends JavadocTester { /** diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java --- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Tue Jul 02 17:38:10 2013 -0700 +++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Thu Jul 11 12:50:20 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4780441 4874845 4978816 + * @bug 4780441 4874845 4978816 8014017 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * @@ -33,17 +33,19 @@ * * Make sure that when a private interface method with generic parameters * is implemented, the comments can be inherited properly. + * + * Make sure when no modifier appear in the class signature, the + * signature is displayed correctly without extra space at the beginning. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestPrivateClasses + * @build JavadocTester TestPrivateClasses * @run main TestPrivateClasses */ public class TestPrivateClasses extends JavadocTester { //Test information. - private static final String BUG_ID = "4780441-4874845-4978816"; + private static final String BUG_ID = "4780441-4874845-4978816-8014017"; //Javadoc arguments. private static final String[] ARGS1 = new String[] { @@ -234,8 +236,19 @@ " in interface " + "I" + "<java.lang.String>"}, + + //Make sure when no modifier appear in the class signature, the + //signature is displayed correctly without extra space at the beginning. + {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html", + "

        class PrivateParent"},
        +
        +      {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
        +            "
        public class PublicChild"},
             };
        -    private static final String[][] NEGATED_TEST2 = NO_TEST;
        +    private static final String[][] NEGATED_TEST2 = {
        +        {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
        +            "
         class PrivateParent"},
        +    };
         
             /**
              * The entry point of the test.
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java
        --- a/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/com/sun/javadoc/testStylesheet/TestStylesheet.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -23,7 +23,7 @@
         
         /*
          * @test
        - * @bug      4494033 7028815 7052425
        + * @bug      4494033 7028815 7052425 8007338
          * @summary  Run tests on doclet stylesheet.
          * @author   jamieh
          * @library  ../lib/
        @@ -34,7 +34,7 @@
         public class TestStylesheet extends JavadocTester {
         
             //Test information.
        -    private static final String BUG_ID = "4494033-7028815-7052425";
        +    private static final String BUG_ID = "4494033-7028815-7052425-8007338";
         
             //Javadoc arguments.
             private static final String[] ARGS = new String[] {
        @@ -44,29 +44,45 @@
             //Input for string search tests.
             private static final String[][] TEST = {
                 {BUG_ID + FS + "stylesheet.css",
        -                "/* Javadoc style sheet */"},
        +            "/* Javadoc style sheet */"},
        +        {BUG_ID + FS + "stylesheet.css",
        +            "/*" + NL + "Overall document style" + NL + "*/"},
        +        {BUG_ID + FS + "stylesheet.css",
        +            "/*" + NL + "Heading styles" + NL + "*/"},
                 {BUG_ID + FS + "stylesheet.css",
        -                "/*" + NL + "Overall document style" + NL + "*/"},
        +            "/*" + NL + "Navigation bar styles" + NL + "*/"},
                 {BUG_ID + FS + "stylesheet.css",
        -                "/*" + NL + "Heading styles" + NL + "*/"},
        +            "body {" + NL + "    background-color:#ffffff;" + NL +
        +            "    color:#353833;" + NL +
        +            "    font-family:Arial, Helvetica, sans-serif;" + NL +
        +            "    font-size:76%;" + NL + "    margin:0;" + NL + "}"},
        +        {BUG_ID + FS + "stylesheet.css",
        +            "ul {" + NL + "    list-style-type:disc;" + NL + "}"},
                 {BUG_ID + FS + "stylesheet.css",
        -                "/*" + NL + "Navigation bar styles" + NL + "*/"},
        -        {BUG_ID + FS + "stylesheet.css",
        -                "body {" + NL + "    background-color:#ffffff;" + NL +
        -                "    color:#353833;" + NL +
        -                "    font-family:Arial, Helvetica, sans-serif;" + NL +
        -                "    font-size:76%;" + NL + "    margin:0;" + NL + "}"},
        -        {BUG_ID + FS + "stylesheet.css",
        -                "ul {" + NL + "    list-style-type:disc;" + NL + "}"},
        +            ".overviewSummary caption, .packageSummary caption, " +
        +            ".contentContainer ul.blockList li.blockList caption, " +
        +            ".summary caption, .classUseContainer caption, " +
        +            ".constantValuesContainer caption {" + NL +
        +            "    position:relative;" + NL +
        +            "    text-align:left;" + NL +
        +            "    background-repeat:no-repeat;" + NL +
        +            "    color:#FFFFFF;" + NL +
        +            "    font-weight:bold;" + NL +
        +            "    clear:none;" + NL +
        +            "    overflow:hidden;" + NL +
        +            "    padding:0px;" + NL +
        +            "    margin:0px;" + NL +
        +            "    white-space:pre;" + NL +
        +            "}"},
                 // Test whether a link to the stylesheet file is inserted properly
                 // in the class documentation.
                 {BUG_ID + FS + "pkg" + FS + "A.html",
        -                ""}
        +            ""}
             };
             private static final String[][] NEGATED_TEST = {
                 {BUG_ID + FS + "stylesheet.css",
        -                "* {" + NL + "    margin:0;" + NL + "    padding:0;" + NL + "}"}
        +            "* {" + NL + "    margin:0;" + NL + "    padding:0;" + NL + "}"}
             };
         
             /**
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java
        --- a/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/com/sun/javadoc/testTagMisuse/TestTagMisuse.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -21,9 +21,8 @@
          * questions.
          */
         
        -/**
        +/*
          * @test
        - * @bug 0000000
          * @summary Determine if proper warning messages are printed when know.
          * @author jamieh
          * @library ../lib/
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java
        --- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -78,7 +78,7 @@
                     "typeannos\">@ClassParamA java.lang.String>"
                 },
                 {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html",
        -            "
         class ExtendsGeneric<K extends " +
        +            "
        class ExtendsGeneric<K extends " +
                     "@ClassParamA Unannotated< java.lang.String>>"
                 },
                 {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html",
        -            "
         class TwoBounds<K extends class TwoBounds<K extends " +
                     "@ClassParamA java.lang.String,V extends @ClassParamB" +
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,94 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 6356530
        + * @summary -Xlint:serial does not flag abstract classes with concrete methods/members
        + * @compile/fail/ref=FinalVariableAssignedToInCatchBlockTest.out -XDrawDiagnostics FinalVariableAssignedToInCatchBlockTest.java
        + */
        +
        +import java.io.IOException;
        +
        +public class FinalVariableAssignedToInCatchBlockTest {
        +    public void m1(int o)
        +    {
        +        final int i;
        +        try {
        +            if (o == 1) {
        +                throw new IOException();
        +            } else if (o == 2) {
        +                throw new InterruptedException();
        +            } else {
        +                throw new Exception();
        +            }
        +        } catch (IOException e) {
        +            i = 1;
        +        } catch (InterruptedException ie) {
        +            i = 2;
        +        } catch (Exception e) {
        +            i = 3;
        +        } finally {
        +            i = 4;
        +        }
        +    }
        +
        +    public void m2(int o)
        +    {
        +        final int i;
        +        try {
        +            if (o == 1) {
        +                throw new IOException();
        +            } else if (o == 2) {
        +                throw new InterruptedException();
        +            } else {
        +                throw new Exception();
        +            }
        +        } catch (IOException e) {
        +            i = 1;
        +        } catch (InterruptedException ie) {
        +            i = 2;
        +        } catch (Exception e) {
        +            i = 3;
        +        }
        +    }
        +
        +    public void m3(int o) throws Exception
        +    {
        +        final int i;
        +        try {
        +            if (o == 1) {
        +                throw new IOException();
        +            } else if (o == 2) {
        +                throw new InterruptedException();
        +            } else {
        +                throw new Exception();
        +            }
        +        } catch (IOException e) {
        +            i = 1;
        +        } catch (InterruptedException ie) {
        +            i = 2;
        +        }
        +        i = 3;
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/T6326693/FinalVariableAssignedToInCatchBlockTest.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,3 @@
        +FinalVariableAssignedToInCatchBlockTest.java:52:13: compiler.err.var.might.already.be.assigned: i
        +FinalVariableAssignedToInCatchBlockTest.java:92:9: compiler.err.var.might.already.be.assigned: i
        +2 errors
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T6725036.java
        --- a/langtools/test/tools/javac/T6725036.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/T6725036.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -24,6 +24,7 @@
         /*
          * @test
          * @bug 6725036
        + * @ignore 8016760: failure of regression test langtools/tools/javac/T6725036.java
          * @summary javac returns incorrect value for lastModifiedTime() when
          *          source is a zip file archive
          */
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,117 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 7008643
        + * @summary inlined finally clauses confuse debuggers
        + * @library /tools/javac/lib
        + * @build ToolBox
        + * @run main InlinedFinallyConfuseDebuggersTest
        + */
        +
        +import java.io.File;
        +import java.nio.file.Paths;
        +
        +import com.sun.tools.classfile.ClassFile;
        +import com.sun.tools.classfile.Code_attribute;
        +import com.sun.tools.classfile.LineNumberTable_attribute;
        +import com.sun.tools.classfile.Method;
        +import com.sun.tools.javac.util.Assert;
        +
        +public class InlinedFinallyConfuseDebuggersTest {
        +
        +    static final String testSource =
        +    /* 01 */        "public class InlinedFinallyTest {\n" +
        +    /* 02 */        "    void lookForThisMethod(int value) {\n" +
        +    /* 03 */        "        try {\n" +
        +    /* 04 */        "            if (value > 0) {\n" +
        +    /* 05 */        "                System.out.println(\"if\");\n" +
        +    /* 06 */        "                return;\n" +
        +    /* 07 */        "            }\n" +
        +    /* 08 */        "        } finally {\n" +
        +    /* 09 */        "            System.out.println(\"finally\");\n" +
        +    /* 10 */        "        }\n" +
        +    /* 11 */        "    }\n" +
        +    /* 12 */        "}";
        +
        +    static final int[][] expectedLNT = {
        +    //  {line-number, start-pc},
        +        {4,           0},       //if (value > 0) {
        +        {5,           4},       //    System.out.println("if");
        +        {9,           12},      //System.out.println("finally");
        +        {6,           20},      //    return;
        +        {9,           21},      //System.out.println("finally");
        +        {10,          29},
        +        {9,           32},      //System.out.println("finally");
        +        {11,          43},
        +    };
        +
        +    static final String methodToLookFor = "lookForThisMethod";
        +
        +    public static void main(String[] args) throws Exception {
        +        new InlinedFinallyConfuseDebuggersTest().run();
        +    }
        +
        +    void run() throws Exception {
        +        compileTestClass();
        +        checkClassFile(new File(Paths.get(System.getProperty("user.dir"),
        +                "InlinedFinallyTest.class").toUri()), methodToLookFor);
        +    }
        +
        +    void compileTestClass() throws Exception {
        +        ToolBox.JavaToolArgs javacSuccessArgs =
        +                new ToolBox.JavaToolArgs().setSources(testSource);
        +        ToolBox.javac(javacSuccessArgs);
        +    }
        +
        +    void checkClassFile(final File cfile, String methodToFind) throws Exception {
        +        ClassFile classFile = ClassFile.read(cfile);
        +        boolean methodFound = false;
        +        for (Method method : classFile.methods) {
        +            if (method.getName(classFile.constant_pool).equals(methodToFind)) {
        +                methodFound = true;
        +                Code_attribute code = (Code_attribute) method.attributes.get("Code");
        +                LineNumberTable_attribute lnt =
        +                        (LineNumberTable_attribute) code.attributes.get("LineNumberTable");
        +                Assert.check(lnt.line_number_table_length == expectedLNT.length,
        +                        "The LineNumberTable found has a length different to the expected one");
        +                int i = 0;
        +                for (LineNumberTable_attribute.Entry entry: lnt.line_number_table) {
        +                    Assert.check(entry.line_number == expectedLNT[i][0] &&
        +                            entry.start_pc == expectedLNT[i][1],
        +                            "LNT entry at pos " + i + " differ from expected." +
        +                            "Found " + entry.line_number + ":" + entry.start_pc +
        +                            ". Expected " + expectedLNT[i][0] + ":" + expectedLNT[i][1]);
        +                    i++;
        +                }
        +            }
        +        }
        +        Assert.check(methodFound, "The seek method was not found");
        +    }
        +
        +    void error(String msg) {
        +        throw new AssertionError(msg);
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T8016099/UncheckedWarningRegressionTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/T8016099/UncheckedWarningRegressionTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,32 @@
        +/*
        + * @test /nodynamiccopyright/
        + * @bug     8016099
        + * @summary Some SuppressWarnings annotations ignored ( unchecked, rawtypes )
        + * @compile UncheckedWarningRegressionTest.java
        + * @compile/fail/ref=UncheckedWarningRegressionTest.out -XDrawDiagnostics -Werror -Xlint:unchecked UncheckedWarningRegressionTest.java
        + */
        +
        +public class UncheckedWarningRegressionTest {
        +     void suppressedWarningsFinalInitializer() {
        +        @SuppressWarnings("unchecked")
        +        T[] tt = (T[]) FINAL_EMPTY_ARRAY;
        +    }
        +
        +    final Object[] FINAL_EMPTY_ARRAY = {};
        +
        +     void finalInitializer() {
        +        T[] tt = (T[]) FINAL_EMPTY_ARRAY;
        +    }
        +
        +     void suppressedWarningsNonFinalInitializer() {
        +        @SuppressWarnings("unchecked")
        +        T[] tt = (T[]) NON_FINAL_EMPTY_ARRAY;
        +    }
        +
        +    Object[] NON_FINAL_EMPTY_ARRAY = {};
        +
        +     void nonFinalInitializer() {
        +        T[] tt = (T[]) NON_FINAL_EMPTY_ARRAY;
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/T8016099/UncheckedWarningRegressionTest.out
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/T8016099/UncheckedWarningRegressionTest.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,5 @@
        +UncheckedWarningRegressionTest.java:18:24: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Object[], T[]
        +UncheckedWarningRegressionTest.java:29:24: compiler.warn.prob.found.req: (compiler.misc.unchecked.cast.to.type), java.lang.Object[], T[]
        +- compiler.err.warnings.and.werror
        +1 error
        +2 warnings
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/api/6437999/T6437999.java
        --- a/langtools/test/tools/javac/api/6437999/T6437999.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/api/6437999/T6437999.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,11 +33,28 @@
          */
         
         import java.io.File;
        +import java.io.IOException;
         import java.nio.charset.Charset;
        +import java.nio.file.Files;
        +import java.util.ArrayList;
         import java.util.Collections;
        +import java.util.List;
         import javax.tools.*;
        +import static java.nio.file.StandardOpenOption.*;
         
         public class T6437999 extends ToolTester {
        +    final File testFile = new File("Utf8.java");
        +    T6437999() throws IOException {
        +        createTestFile();
        +    }
        +    final void createTestFile() throws IOException {
        +        List scratch = new ArrayList<>();
        +        scratch.add("// @author Peter von der Ah" + (char) 0xe9);
        +        scratch.add("class Utf8{}");
        +        Files.write(testFile.toPath(), scratch, Charset.forName("UTF-8"),
        +                CREATE, TRUNCATE_EXISTING);
        +    }
        +
             static class MyDiagnosticListener implements DiagnosticListener {
                 boolean error = false;
                 public void report(Diagnostic diagnostic) {
        @@ -55,7 +72,7 @@
                 dl.error = false;
                 fm = getFileManager(tool, dl, Charset.forName("ASCII"));
                 fm.handleOption("-source", sourceLevel.iterator());
        -        files = fm.getJavaFileObjects(new File(test_src, "Utf8.java"));
        +        files = fm.getJavaFileObjects(testFile);
                 tool.getTask(null, fm, null, null, null, files).call();
                 if (!dl.error)
                     throw new AssertionError("No error in ASCII mode");
        @@ -63,12 +80,12 @@
                 dl.error = false;
                 fm = getFileManager(tool, dl, Charset.forName("UTF-8"));
                 fm.handleOption("-source", sourceLevel.iterator());
        -        files = fm.getJavaFileObjects(new File(test_src, "Utf8.java"));
        +        files = fm.getJavaFileObjects(testFile);
                 task = tool.getTask(null, fm, null, null, null, files);
                 if (dl.error)
                     throw new AssertionError("Error in UTF-8 mode");
             }
        -    public static void main(String... args) {
        +    public static void main(String... args) throws IOException {
                 new T6437999().test(args);
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/api/6437999/Utf8.java
        --- a/langtools/test/tools/javac/api/6437999/Utf8.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,27 +0,0 @@
        -/*
        - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
        - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        - *
        - * This code is free software; you can redistribute it and/or modify it
        - * under the terms of the GNU General Public License version 2 only, as
        - * published by the Free Software Foundation.
        - *
        - * 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.
        - */
        -
        -/**
        - * @author Peter von der Ah\u00e9
        - */
        -class Utf8 {}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/api/T6306137.java
        --- a/langtools/test/tools/javac/api/T6306137.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/api/T6306137.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,8 +31,14 @@
          */
         
         import java.io.File;
        +import java.io.IOException;
        +import java.nio.charset.Charset;
        +import java.nio.file.Files;
        +import java.util.ArrayList;
         import java.util.Arrays;
        +import java.util.List;
         import javax.tools.*;
        +import static java.nio.file.StandardOpenOption.*;
         
         public class T6306137 {
             boolean error;
        @@ -40,8 +46,9 @@
             final JavaCompiler compiler;
             Iterable files;
             DiagnosticListener dl;
        +    final File testFile = new File("Utf8.java");
         
        -    T6306137() {
        +    T6306137() throws IOException {
                 dl = new DiagnosticListener() {
                         public void report(Diagnostic message) {
                             if (message.getKind() == Diagnostic.Kind.ERROR)
        @@ -56,11 +63,17 @@
                 };
                 compiler = ToolProvider.getSystemJavaCompiler();
                 fm = compiler.getStandardFileManager(dl, null, null);
        -        String srcdir = System.getProperty("test.src");
                 files =
        -            fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6306137.java")));
        +            fm.getJavaFileObjectsFromFiles(Arrays.asList(testFile));
        +        createTestFile();
             }
        -
        +    final void createTestFile() throws IOException {
        +        List scratch = new ArrayList<>();
        +        scratch.add("// @author Peter von der Ah" + (char)0xe9);
        +        scratch.add("class Utf8{}");
        +        Files.write(testFile.toPath(), scratch, Charset.forName("UTF-8"),
        +                CREATE, TRUNCATE_EXISTING);
        +    }
             void test(String encoding, boolean good) {
                 error = false;
                 Iterable args = Arrays.asList("-source", "6", "-encoding", encoding, "-d", ".");
        @@ -74,7 +87,7 @@
                 }
             }
         
        -    public static void main(String[] args) {
        +    public static void main(String[] args) throws IOException {
                 T6306137 self = new T6306137();
                 self.test("utf-8", true);
                 self.test("ascii", false);
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/Bridge.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/Bridge.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,28 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.lang.annotation.Repeatable;
        +
        +@Repeatable(Bridges.class)
        +@interface Bridge {
        +    String value();
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/BridgeHarness.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/BridgeHarness.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,219 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8013789
        + * @summary Compiler should emit bridges in interfaces
        + * @library /tools/javac/lib
        + * @build JavacTestingAbstractProcessor BridgeHarness
        + * @run main BridgeHarness
        + */
        +
        +import com.sun.source.util.JavacTask;
        +import com.sun.tools.classfile.AccessFlags;
        +import com.sun.tools.classfile.ClassFile;
        +import com.sun.tools.classfile.ConstantPool;
        +import com.sun.tools.classfile.ConstantPoolException;
        +import com.sun.tools.classfile.Method;
        +import com.sun.tools.javac.code.Symbol.ClassSymbol;
        +import com.sun.tools.javac.util.List;
        +
        +import java.io.File;
        +import java.io.InputStream;
        +import java.util.Arrays;
        +import java.util.Collections;
        +import java.util.HashMap;
        +import java.util.Map;
        +import java.util.Set;
        +
        +import javax.annotation.processing.RoundEnvironment;
        +import javax.annotation.processing.SupportedAnnotationTypes;
        +import javax.lang.model.element.Element;
        +import javax.lang.model.element.TypeElement;
        +import javax.tools.JavaCompiler;
        +import javax.tools.JavaFileObject;
        +import javax.tools.StandardJavaFileManager;
        +import javax.tools.ToolProvider;
        +
        +import static javax.tools.StandardLocation.*;
        +
        +public class BridgeHarness {
        +
        +    /** number of errors found (must be zero for the test to pass) */
        +    static int nerrors = 0;
        +
        +    /** the (shared) Java compiler used for compiling the tests */
        +    static final JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
        +
        +    /** the (shared) file manager used by the compiler */
        +    static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
        +
        +    public static void main(String[] args) throws Exception {
        +        //set sourcepath
        +        fm.setLocation(SOURCE_PATH,
        +                Arrays.asList(new File(System.getProperty("test.src"), "tests")));
        +        //set output (-d)
        +        fm.setLocation(javax.tools.StandardLocation.CLASS_OUTPUT,
        +                Arrays.asList(new File(System.getProperty("user.dir"))));
        +        for (JavaFileObject jfo : fm.list(SOURCE_PATH, "", Collections.singleton(JavaFileObject.Kind.SOURCE), true)) {
        +            //for each source, compile and check against annotations
        +            new BridgeHarness(jfo).compileAndCheck();
        +        }
        +        //if there were errors, fail
        +        if (nerrors > 0) {
        +            throw new AssertionError("Errors were found");
        +        }
        +    }
        +
        +    /* utility methods */
        +
        +    /**
        +     * Remove an element from a list
        +     */
        +    static  List drop(List lz, Z z) {
        +        if (lz.head == z) {
        +            return drop(lz.tail, z);
        +        } else if (lz.isEmpty()) {
        +            return lz;
        +        } else {
        +            return drop(lz.tail, z).prepend(lz.head);
        +        }
        +    }
        +
        +    /**
        +     * return a string representation of a bytecode method
        +     */
        +    static String descriptor(Method m, ConstantPool cp) throws ConstantPoolException {
        +        return m.getName(cp) + m.descriptor.getValue(cp);
        +    }
        +
        +    /* test harness */
        +
        +    /** Test file to be compiled */
        +    JavaFileObject jfo;
        +
        +    /** Mapping between class name and list of bridges in class with that name */
        +    Map> bridgesMap = new HashMap>();
        +
        +    protected BridgeHarness(JavaFileObject jfo) {
        +        this.jfo = jfo;
        +    }
        +
        +    /**
        +     * Compile a test using a custom annotation processor and check the generated
        +     * bytecode against discovered annotations.
        +     */
        +    protected void compileAndCheck() throws Exception {
        +        JavacTask ct = (JavacTask)comp.getTask(null, fm, null, null, null, Arrays.asList(jfo));
        +        ct.setProcessors(Collections.singleton(new BridgeFinder()));
        +
        +        for (JavaFileObject jfo : ct.generate()) {
        +            checkBridges(jfo);
        +        }
        +    }
        +
        +    /**
        +     * Check that every bridge in the generated classfile has a matching bridge
        +     * annotation in the bridge map
        +     */
        +    protected void checkBridges(JavaFileObject jfo) {
        +        try (InputStream is = jfo.openInputStream()) {
        +            ClassFile cf = ClassFile.read(is);
        +            System.err.println("checking: " + cf.getName());
        +
        +            List bridgeList = bridgesMap.get(cf.getName());
        +            if (bridgeList == null) {
        +                //no bridges - nothing to check;
        +                bridgeList = List.nil();
        +            }
        +
        +            for (Method m : cf.methods) {
        +                if (m.access_flags.is(AccessFlags.ACC_SYNTHETIC | AccessFlags.ACC_BRIDGE)) {
        +                    //this is a bridge - see if there's a match in the bridge list
        +                    Bridge match = null;
        +                    for (Bridge b : bridgeList) {
        +                        if (b.value().equals(descriptor(m, cf.constant_pool))) {
        +                            match = b;
        +                            break;
        +                        }
        +                    }
        +                    if (match == null) {
        +                        error("No annotation for bridge method: " + descriptor(m, cf.constant_pool));
        +                    } else {
        +                        bridgeList = drop(bridgeList, match);
        +                    }
        +                }
        +            }
        +            if (bridgeList.nonEmpty()) {
        +                error("Redundant bridge annotation found: " + bridgeList.head.value());
        +            }
        +        } catch (Exception e) {
        +            e.printStackTrace();
        +            throw new Error("error reading " + jfo.toUri() +": " + e);
        +        }
        +    }
        +
        +    /**
        +     * Log an error
        +     */
        +    protected void error(String msg) {
        +        nerrors++;
        +        System.err.printf("Error occurred while checking file: %s\nreason: %s\n", jfo.getName(), msg);
        +    }
        +
        +    /**
        +     * This annotation processor is used to populate the bridge map with the
        +     * contents of the annotations that are found on the tests being compiled
        +     */
        +    @SupportedAnnotationTypes({"Bridges","Bridge"})
        +    class BridgeFinder extends JavacTestingAbstractProcessor {
        +        @Override
        +        public boolean process(Set annotations, RoundEnvironment roundEnv) {
        +            if (roundEnv.processingOver())
        +                return true;
        +
        +            TypeElement bridgeAnno = elements.getTypeElement("Bridge");
        +            TypeElement bridgesAnno = elements.getTypeElement("Bridges");
        +
        +            //see if there are repeated annos
        +            for (Element elem: roundEnv.getElementsAnnotatedWith(bridgesAnno)) {
        +                List bridgeList = List.nil();
        +                Bridges bridges = elem.getAnnotation(Bridges.class);
        +                for (Bridge bridge : bridges.value()) {
        +                    bridgeList = bridgeList.prepend(bridge);
        +                }
        +                bridgesMap.put(((ClassSymbol)elem).flatname.toString(), bridgeList);
        +            }
        +
        +            //see if there are non-repeated annos
        +            for (Element elem: roundEnv.getElementsAnnotatedWith(bridgeAnno)) {
        +                Bridge bridge = elem.getAnnotation(Bridge.class);
        +                bridgesMap.put(((ClassSymbol)elem).flatname.toString(),
        +                        List.of(bridge));
        +            }
        +
        +            return true;
        +        }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/Bridges.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/Bridges.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,25 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +@interface Bridges {
        +    Bridge[] value();
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestBridgeWithDefault.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestBridgeWithDefault.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,31 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestBridgeWithDefault {
        +    interface A { Object m(int x); }
        +
        +    @Bridge("m(I)Ljava/lang/Object;")
        +    interface B extends A {
        +        String m(int x);
        +        default Integer m(long x) { return null; }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestClassAndInterfaceBridgeIdentical01.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestClassAndInterfaceBridgeIdentical01.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestClassAndInterfaceBridgeIdentical01 {
        +
        +    interface A { Object m(); }
        +    interface B { Number m(); }
        +
        +    @Bridge("m()Ljava/lang/Object;")
        +    @Bridge("m()Ljava/lang/Number;")
        +    interface C extends A, B {
        +        Integer m();
        +    }
        +
        +    @Bridge("m()Ljava/lang/Object;")
        +    @Bridge("m()Ljava/lang/Number;")
        +    static abstract class D implements A, B {
        +        public abstract Integer m();
        +    }
        +
        +    @Bridge("m()Ljava/lang/Object;")
        +    @Bridge("m()Ljava/lang/Number;")
        +    static class E implements A, B {
        +        public Integer m() { return 1; }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestClassAndInterfaceBridgeIdentical02.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestClassAndInterfaceBridgeIdentical02.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestClassAndInterfaceBridgeIdentical02 {
        +
        +    interface A { void m(X x); }
        +    interface B { void m(X x); }
        +
        +    @Bridge("m(Ljava/lang/Object;)V")
        +    @Bridge("m(Ljava/lang/Number;)V")
        +    interface C extends A, B {
        +        void m(Integer i);
        +    }
        +
        +    @Bridge("m(Ljava/lang/Object;)V")
        +    @Bridge("m(Ljava/lang/Number;)V")
        +    static abstract class D implements A, B {
        +        public abstract void m(Integer i);
        +    }
        +
        +    @Bridge("m(Ljava/lang/Object;)V")
        +    @Bridge("m(Ljava/lang/Number;)V")
        +    static class E implements A, B {
        +        public void m(Integer i) { }
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestNoBridgeInSiblingsSuper.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestNoBridgeInSiblingsSuper.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,34 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestNoBridgeInSiblingSuper {
        +    interface A { Object m(); }
        +    interface B { String m(); }
        +    //no bridge here!
        +    interface C extends A, B { }
        +
        +    @Bridge("m()Ljava/lang/Object;")
        +    interface D extends C {
        +        String m();
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestNoDuplicateBridges01.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestNoDuplicateBridges01.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,29 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestNoDuplicateBridges01 {
        +    interface A1 { Object m(); }
        +    interface A2 { Object m(); }
        +
        +    @Bridge("m()Ljava/lang/Object;")
        +    interface B extends A1, A2 { B m(); }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/generics/bridges/tests/TestNoDuplicateBridges02.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/generics/bridges/tests/TestNoDuplicateBridges02.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,38 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +class TestNoDuplicateBridges02 {
        +    interface A {
        +        A get();
        +    }
        +
        +    @Bridge("get()LTestNoDuplicateBridges02$A;")
        +    interface B extends A {
        +        B get();
        +    }
        +
        +    @Bridge("get()LTestNoDuplicateBridges02$A;")
        +    @Bridge("get()LTestNoDuplicateBridges02$B;")
        +    interface C extends A, B {
        +        C get();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/LambdaConv01.java
        --- a/langtools/test/tools/javac/lambda/LambdaConv01.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambda/LambdaConv01.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -67,7 +67,7 @@
                 assertTrue(3 == f1.foo());
                 //Covariant returns:
                 TU f2 = (Integer x) -> x;
        -        assertTrue(3 == f2.foo(3));
        +        assertTrue(3 == f2.foo(3).intValue());
                 //Method resolution with boxing:
                 int res = LambdaConv01.exec((Integer x) -> x, 3);
                 assertTrue(3 == res);
        @@ -86,7 +86,7 @@
                 assertTrue(3 == f1.foo());
                 //Covariant returns:
                 TU f2 = (Integer x) -> x;
        -        assertTrue(3 == f2.foo(3));
        +        assertTrue(3 == f2.foo(3).intValue());
                 //Method resolution with boxing:
                 int res = LambdaConv01.exec((Integer x) -> x, 3);
                 assertTrue(3 == res);
        @@ -105,7 +105,7 @@
                 assertTrue(3 == f1.foo());
                 //Covariant returns:
                 TU f2 = (Integer x) -> x;
        -        assertTrue(3 == f2.foo(3));
        +        assertTrue(3 == f2.foo(3).intValue());
                 //Method resolution with boxing:
                 int res = LambdaConv01.exec((Integer x) -> x, 3);
                 assertTrue(3 == res);
        @@ -124,7 +124,7 @@
                 assertTrue(3 == f1.foo());
                 //Covariant returns:
                 TU f2 = (Integer x) -> x;
        -        assertTrue(3 == f2.foo(3));
        +        assertTrue(3 == f2.foo(3).intValue());
                 //Method resolution with boxing:
                 int res = LambdaConv01.exec((Integer x) -> x, 3);
                 assertTrue(3 == res);
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/LambdaExpr15.java
        --- a/langtools/test/tools/javac/lambda/LambdaExpr15.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambda/LambdaExpr15.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -48,7 +48,7 @@
                     new Object() {
                         String get() { return ""; }
                     };
        -            assertTrue(t == 1);
        +            assertTrue((Integer)t == 1);
                 };
                 ba1.apply(1);
         
        @@ -58,7 +58,7 @@
                         String get() { return ""; }
                     };
                     new A();
        -            assertTrue(t == 2);
        +            assertTrue((Integer)t == 2);
                 };
                 ba2.apply(2);
                 assertTrue(assertionCount == 2);
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/bridge/TestMetafactoryBridges.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/lambda/bridge/TestMetafactoryBridges.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,359 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8013789
        + * @summary Compiler should emit bridges in interfaces
        + */
        +
        +import com.sun.source.util.JavacTask;
        +import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
        +import com.sun.tools.javac.code.Symbol;
        +import com.sun.tools.javac.util.JCDiagnostic;
        +
        +import java.io.File;
        +import java.io.PrintWriter;
        +import java.net.URI;
        +import java.util.ArrayList;
        +import java.util.Arrays;
        +import java.util.EnumSet;
        +import java.util.List;
        +import java.util.Set;
        +
        +import javax.tools.Diagnostic;
        +import javax.tools.Diagnostic.Kind;
        +import javax.tools.JavaCompiler;
        +import javax.tools.JavaFileObject;
        +import javax.tools.SimpleJavaFileObject;
        +import javax.tools.ToolProvider;
        +
        +public class TestMetafactoryBridges {
        +
        +    static int checkCount = 0;
        +
        +    enum ClasspathKind {
        +        NONE(),
        +        B7(7, ClassKind.B),
        +        A7(7, ClassKind.A),
        +        B8(8, ClassKind.B),
        +        A8(8, ClassKind.A);
        +
        +        int version;
        +        ClassKind ck;
        +
        +        ClasspathKind() {
        +            this(-1, null);
        +        }
        +
        +        ClasspathKind(int version, ClassKind ck) {
        +            this.version = version;
        +            this.ck = ck;
        +        }
        +    }
        +
        +    enum PreferPolicy {
        +        SOURCE("-Xprefer:source"),
        +        NEWER("-Xprefer:newer");
        +
        +        String preferOpt;
        +
        +        PreferPolicy(String preferOpt) {
        +            this.preferOpt = preferOpt;
        +        }
        +    }
        +
        +    enum SourcepathKind {
        +        NONE,
        +        A(ClassKind.A),
        +        B(ClassKind.B),
        +        C(ClassKind.C),
        +        AB(ClassKind.A, ClassKind.B),
        +        BC(ClassKind.B, ClassKind.C),
        +        AC(ClassKind.A, ClassKind.C),
        +        ABC(ClassKind.A, ClassKind.B, ClassKind.C);
        +
        +        List sources;
        +
        +        SourcepathKind(ClassKind... sources) {
        +            this.sources = Arrays.asList(sources);
        +        }
        +    }
        +
        +    enum SourceSet {
        +        ALL() {
        +            @Override
        +            List> permutations() {
        +                return Arrays.asList(
        +                    Arrays.asList(ClassKind.A, ClassKind.B, ClassKind.C),
        +                    Arrays.asList(ClassKind.A, ClassKind.B, ClassKind.C),
        +                    Arrays.asList(ClassKind.B, ClassKind.A, ClassKind.C),
        +                    Arrays.asList(ClassKind.B, ClassKind.C, ClassKind.A),
        +                    Arrays.asList(ClassKind.C, ClassKind.A, ClassKind.B),
        +                    Arrays.asList(ClassKind.C, ClassKind.B, ClassKind.A)
        +                );
        +            }
        +        },
        +        AC() {
        +            @Override
        +            List> permutations() {
        +                return Arrays.asList(
        +                    Arrays.asList(ClassKind.A, ClassKind.C),
        +                    Arrays.asList(ClassKind.C, ClassKind.A)
        +                );
        +            }
        +        },
        +        C() {
        +            @Override
        +            List> permutations() {
        +                return Arrays.asList(Arrays.asList(ClassKind.C));
        +            }
        +        };
        +
        +        abstract List> permutations();
        +    }
        +
        +    enum ClassKind {
        +        A("A", "interface A { Object m(); }"),
        +        B("B", "interface B extends A { Integer m(); }", A),
        +        C("C", "class C { B b = ()->42; }", A, B);
        +
        +        String name;
        +        String source;
        +        ClassKind[] deps;
        +
        +        ClassKind(String name, String source, ClassKind... deps) {
        +            this.name = name;
        +            this.source = source;
        +            this.deps = deps;
        +        }
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        String SCRATCH_DIR = System.getProperty("user.dir");
        +        //create default shared JavaCompiler - reused across multiple compilations
        +        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
        +
        +        int n = 0;
        +        for (SourceSet ss : SourceSet.values()) {
        +            for (List sources : ss.permutations()) {
        +                for (SourcepathKind spKind : SourcepathKind.values()) {
        +                    for (ClasspathKind cpKind : ClasspathKind.values()) {
        +                        for (PreferPolicy pp : PreferPolicy.values()) {
        +                            Set deps = EnumSet.noneOf(ClassKind.class);
        +                            if (cpKind.ck != null) {
        +                                deps.add(cpKind.ck);
        +                            }
        +                            deps.addAll(sources);
        +                            if (deps.size() < 3) continue;
        +                            File testDir = new File(SCRATCH_DIR, "test" + n);
        +                            testDir.mkdir();
        +                            try (PrintWriter debugWriter = new PrintWriter(new File(testDir, "debug.txt"))) {
        +                                new TestMetafactoryBridges(testDir, sources, spKind, cpKind, pp, debugWriter).run(comp);
        +                                n++;
        +                            }
        +                        }
        +                    }
        +                }
        +            }
        +        }
        +        System.out.println("Total check executed: " + checkCount);
        +    }
        +
        +    File testDir;
        +    List sources;
        +    SourcepathKind spKind;
        +    ClasspathKind cpKind;
        +    PreferPolicy pp;
        +    PrintWriter debugWriter;
        +    DiagnosticChecker diagChecker;
        +
        +    TestMetafactoryBridges(File testDir, Listsources, SourcepathKind spKind,
        +            ClasspathKind cpKind, PreferPolicy pp, PrintWriter debugWriter) {
        +        this.testDir = testDir;
        +        this.sources = sources;
        +        this.spKind = spKind;
        +        this.cpKind = cpKind;
        +        this.pp = pp;
        +        this.debugWriter = debugWriter;
        +        this.diagChecker = new DiagnosticChecker();
        +    }
        +
        +    class JavaSource extends SimpleJavaFileObject {
        +
        +        final String source;
        +
        +        public JavaSource(ClassKind ck) {
        +            super(URI.create(String.format("myfo:/%s.java", ck.name)), JavaFileObject.Kind.SOURCE);
        +            this.source = ck.source;
        +        }
        +
        +        @Override
        +        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
        +            return source;
        +        }
        +    }
        +
        +    void run(JavaCompiler tool) throws Exception {
        +        File classesDir = new File(testDir, "classes");
        +        File outDir = new File(testDir, "out");
        +        File srcDir = new File(testDir, "src");
        +        classesDir.mkdir();
        +        outDir.mkdir();
        +        srcDir.mkdir();
        +
        +        debugWriter.append(testDir.getName() + "\n");
        +        debugWriter.append("sources = " + sources + "\n");
        +        debugWriter.append("spKind = " + spKind  + "\n");
        +        debugWriter.append("cpKind = " + cpKind + "\n");
        +        debugWriter.append("preferPolicy = " + pp.preferOpt + "\n");
        +
        +        //step 1 - prepare sources (older!!)
        +        debugWriter.append("Preparing sources\n");
        +        for (ClassKind ck : spKind.sources) {
        +            //skip sources explicitly provided on command line
        +            if (!sources.contains(ck)) {
        +                debugWriter.append("Copy " + ck.name + ".java to" + srcDir.getAbsolutePath() + "\n");
        +                File dest = new File(srcDir, ck.name + ".java");
        +                PrintWriter pw = new PrintWriter(dest);
        +                pw.append(ck.source);
        +                pw.close();
        +            }
        +        }
        +
        +        //step 2 - prepare classes
        +        debugWriter.append("Preparing classes\n");
        +        if (cpKind != ClasspathKind.NONE) {
        +            List sources = new ArrayList<>();
        +            ClassKind toRemove = null;
        +            sources.add(new JavaSource(cpKind.ck));
        +            if (cpKind.ck.deps.length != 0) {
        +                //at most only one dependency
        +                toRemove = cpKind.ck.deps[0];
        +                sources.add(new JavaSource(toRemove));
        +            }
        +            JavacTask ct = (JavacTask)tool.getTask(debugWriter, null, null,
        +                    Arrays.asList("-d", classesDir.getAbsolutePath(), "-source", String.valueOf(cpKind.version)), null, sources);
        +            try {
        +                ct.generate();
        +                if (toRemove != null) {
        +                    debugWriter.append("Remove " + toRemove.name + ".class from" + classesDir.getAbsolutePath() + "\n");
        +                    File fileToRemove = new File(classesDir, toRemove.name + ".class");
        +                    fileToRemove.delete();
        +                }
        +            } catch (Throwable ex) {
        +                throw new AssertionError("Error thrown when generating side-classes");
        +            }
        +        }
        +
        +        //step 3 - compile
        +        debugWriter.append("Compiling test\n");
        +        List sourcefiles = new ArrayList<>();
        +        for (ClassKind ck : sources) {
        +            sourcefiles.add(new JavaSource(ck));
        +        }
        +        JavacTask ct = (JavacTask)tool.getTask(debugWriter, null, diagChecker,
        +                    Arrays.asList("-XDdumpLambdaToMethodStats", "-d", outDir.getAbsolutePath(),
        +                                  "-sourcepath", srcDir.getAbsolutePath(),
        +                                  "-classpath", classesDir.getAbsolutePath(),
        +                                  pp.preferOpt), null, sourcefiles);
        +        try {
        +            ct.generate();
        +        } catch (Throwable ex) {
        +            throw new AssertionError("Error thrown when compiling test case");
        +        }
        +        check();
        +    }
        +
        +    void check() {
        +        checkCount++;
        +        if (diagChecker.errorFound) {
        +            throw new AssertionError("Unexpected compilation failure");
        +        }
        +
        +        boolean altMetafactory =
        +                cpKind == ClasspathKind.B7 &&
        +                !sources.contains(ClassKind.B) &&
        +                (pp == PreferPolicy.NEWER || !spKind.sources.contains(ClassKind.B));
        +
        +        if (altMetafactory != diagChecker.altMetafactory) {
        +            throw new AssertionError("Bad metafactory detected - expected altMetafactory: " + altMetafactory +
        +                    "\ntest: " + testDir);
        +        }
        +    }
        +
        +    static class DiagnosticChecker implements javax.tools.DiagnosticListener {
        +
        +        boolean altMetafactory = false;
        +        boolean errorFound = false;
        +
        +        public void report(Diagnostic diagnostic) {
        +            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
        +                errorFound = true;
        +            } else if (statProcessor.matches(diagnostic)) {
        +                statProcessor.process(diagnostic);
        +            }
        +        }
        +
        +        abstract class DiagnosticProcessor {
        +
        +            List codes;
        +            Diagnostic.Kind kind;
        +
        +            public DiagnosticProcessor(Kind kind, String... codes) {
        +                this.codes = Arrays.asList(codes);
        +                this.kind = kind;
        +            }
        +
        +            abstract void process(Diagnostic diagnostic);
        +
        +            boolean matches(Diagnostic diagnostic) {
        +                return (codes.isEmpty() || codes.contains(diagnostic.getCode())) &&
        +                        diagnostic.getKind() == kind;
        +            }
        +
        +            JCDiagnostic asJCDiagnostic(Diagnostic diagnostic) {
        +                if (diagnostic instanceof JCDiagnostic) {
        +                    return (JCDiagnostic)diagnostic;
        +                } else if (diagnostic instanceof DiagnosticSourceUnwrapper) {
        +                    return ((DiagnosticSourceUnwrapper)diagnostic).d;
        +                } else {
        +                    throw new AssertionError("Cannot convert diagnostic to JCDiagnostic: " + diagnostic.getClass().getName());
        +                }
        +            }
        +        }
        +
        +        DiagnosticProcessor statProcessor = new DiagnosticProcessor(Kind.NOTE,
        +                "compiler.note.lambda.stat",
        +                "compiler.note.mref.stat",
        +                "compiler.note.mref.stat.1") {
        +            @Override
        +            void process(Diagnostic diagnostic) {
        +                JCDiagnostic diag = asJCDiagnostic(diagnostic);
        +                if ((Boolean)diag.getArgs()[0]) {
        +                    altMetafactory = true;
        +                }
        +            }
        +        };
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest6.java
        --- a/langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest6.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambda/lambdaExpression/LambdaTest6.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -105,7 +105,7 @@
                     Class returnType = m.getReturnType();
                     assertTrue(types.remove(returnType.getName()));
                 }
        -        assertTrue(types.isEmpty());
        +        assertTrue(types.size() == 1); //there's a bridge
             }
         
         
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/methodReference/BridgeMethod.java
        --- a/langtools/test/tools/javac/lambda/methodReference/BridgeMethod.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambda/methodReference/BridgeMethod.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -112,6 +112,6 @@
                     Class returnType = m.getReturnType();
                     assertTrue(types.remove(returnType.getName()));
                 }
        -        assertTrue(types.isEmpty());
        +        assertTrue(types.size() == 1); //there's a bridge
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java
        --- a/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambda/typeInference/InferenceTest2b.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -64,7 +64,7 @@
         
             void m2(SAM6 s) {
                 System.out.println("m2()");
        -        assertTrue(s.m6(1, 2) == 1);
        +        assertTrue(s.m6(1, 2).equals(Integer.valueOf(1)));
             }
         
             void m3(SAM6 s) {
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java
        --- a/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/lambdaShapes/org/openjdk/tests/vm/DefaultMethodsTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -395,6 +395,7 @@
              * TEST: C c = new C(); c.m() == 88;
              * TEST: I i = new C(); i.m() == 88;
              */
        +    @Test(enabled=false)
             public void testSelfFill() {
                 // This test ensures that a concrete method overrides a default method
                 // that matches at the language-level, but has a different method
        @@ -484,6 +485,7 @@
              * TEST: J j = new C(); j.m("A","B","C") == 88;
              * TEST: K k = new C(); k.m("A","B","C") == 88;
              */
        +    @Test(enabled=false)
             public void testBridges() {
                 DefaultMethod dm = new DefaultMethod("int", stdMethodName, "return 99;",
                     new MethodParameter("T", "t"), new MethodParameter("V", "v"),
        @@ -672,6 +674,7 @@
              * class S { Object foo() { return (new D()).m(); } // link sig: ()LInteger;
              * TEST: S s = new S(); s.foo() == new Integer(99)
              */
        +    @Test(enabled=false)
             public void testCovarBridge() {
                 Interface I = new Interface("I", new DefaultMethod(
                     "Integer", "m", "return new Integer(88);"));
        @@ -754,6 +757,7 @@
              * Test that a erased-signature-matching method does not implement
              * non-language-level matching methods
              */
        +    @Test(enabled=false)
             public void testNonConcreteFill() {
                 AbstractMethod ipm = new AbstractMethod("int", "m",
                     new MethodParameter("T", "t"),
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NestedClassConstructorArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/NestedClassConstructorArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8014230
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main NestedClassConstructorArgs
        + */
        +
        +public class NestedClassConstructorArgs extends NumArgsTest {
        +    private static final NumArgsTest.NestingDef[] nesting = {
        +        classNesting("Inner")
        +    };
        +
        +    private NestedClassConstructorArgs() {
        +        super(253, "NestedClassConstructorArgs", "Inner", nesting);
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new NestedClassConstructorArgs().runTest();
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NestedClassMethodArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/NestedClassMethodArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8014230
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main NestedClassMethodArgs
        + */
        +
        +public class NestedClassMethodArgs extends NumArgsTest {
        +    private static final NumArgsTest.NestingDef[] nesting = {
        +        classNesting("Inner")
        +    };
        +
        +    private NestedClassMethodArgs() {
        +        super(254, "void", "test", "NestedClassMethodArgs", nesting);
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new NestedClassMethodArgs().runTest();
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NumArgs1.java
        --- a/langtools/test/tools/javac/limits/NumArgs1.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,552 +0,0 @@
        -/*
        - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
        - * 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 4309152
        - * @summary Compiler silently generates bytecode that exceeds VM limits
        - * @author gafter
        - *
        - * @compile/fail NumArgs1.java
        - */
        -
        -class NumArgs1 {
        -    void f(
        -           // T1 this,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255,
        -           int x256
        -    ) {}
        -
        -    static
        -    void g(
        -           int x1,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255,
        -           int x256
        -    ) {}
        -}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NumArgs2.java
        --- a/langtools/test/tools/javac/limits/NumArgs2.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,550 +0,0 @@
        -/*
        - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
        - * 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 4309152
        - * @summary Compiler silently generates bytecode that exceeds VM limits
        - * @author gafter
        - *
        - * @compile NumArgs2.java
        - */
        -
        -class NumArgs2 {
        -    void f(
        -           // This this,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255
        -    ) {}
        -
        -    static
        -    void g(
        -           int x1,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255
        -    ) {}
        -}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NumArgs3.java
        --- a/langtools/test/tools/javac/limits/NumArgs3.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,292 +0,0 @@
        -/*
        - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
        - * 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 4309152
        - * @summary Compiler silently generates bytecode that exceeds VM limits
        - * @author gafter
        - *
        - * @compile/fail NumArgs3.java
        - */
        -
        -class NumArgs3 {
        -    void NumArgs3(
        -           // T1 this,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255,
        -           int x256
        -    ) {}
        -}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NumArgs4.java
        --- a/langtools/test/tools/javac/limits/NumArgs4.java	Tue Jul 02 17:38:10 2013 -0700
        +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
        @@ -1,291 +0,0 @@
        -/*
        - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
        - * 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 4309152
        - * @summary Compiler silently generates bytecode that exceeds VM limits
        - * @author gafter
        - *
        - * @compile NumArgs4.java
        - */
        -
        -class NumArgs4 {
        -    void NumArgs4(
        -           // T1 this,
        -           int x2,
        -           int x3,
        -           int x4,
        -           int x5,
        -           int x6,
        -           int x7,
        -           int x8,
        -           int x9,
        -           int x10,
        -           int x11,
        -           int x12,
        -           int x13,
        -           int x14,
        -           int x15,
        -           int x16,
        -           int x17,
        -           int x18,
        -           int x19,
        -           int x20,
        -           int x21,
        -           int x22,
        -           int x23,
        -           int x24,
        -           int x25,
        -           int x26,
        -           int x27,
        -           int x28,
        -           int x29,
        -           int x30,
        -           int x31,
        -           int x32,
        -           int x33,
        -           int x34,
        -           int x35,
        -           int x36,
        -           int x37,
        -           int x38,
        -           int x39,
        -           int x40,
        -           int x41,
        -           int x42,
        -           int x43,
        -           int x44,
        -           int x45,
        -           int x46,
        -           int x47,
        -           int x48,
        -           int x49,
        -           int x50,
        -           int x51,
        -           int x52,
        -           int x53,
        -           int x54,
        -           int x55,
        -           int x56,
        -           int x57,
        -           int x58,
        -           int x59,
        -           int x60,
        -           int x61,
        -           int x62,
        -           int x63,
        -           int x64,
        -           int x65,
        -           int x66,
        -           int x67,
        -           int x68,
        -           int x69,
        -           int x70,
        -           int x71,
        -           int x72,
        -           int x73,
        -           int x74,
        -           int x75,
        -           int x76,
        -           int x77,
        -           int x78,
        -           int x79,
        -           int x80,
        -           int x81,
        -           int x82,
        -           int x83,
        -           int x84,
        -           int x85,
        -           int x86,
        -           int x87,
        -           int x88,
        -           int x89,
        -           int x90,
        -           int x91,
        -           int x92,
        -           int x93,
        -           int x94,
        -           int x95,
        -           int x96,
        -           int x97,
        -           int x98,
        -           int x99,
        -           int x100,
        -           int x101,
        -           int x102,
        -           int x103,
        -           int x104,
        -           int x105,
        -           int x106,
        -           int x107,
        -           int x108,
        -           int x109,
        -           int x110,
        -           int x111,
        -           int x112,
        -           int x113,
        -           int x114,
        -           int x115,
        -           int x116,
        -           int x117,
        -           int x118,
        -           int x119,
        -           int x120,
        -           int x121,
        -           int x122,
        -           int x123,
        -           int x124,
        -           int x125,
        -           int x126,
        -           int x127,
        -           int x128,
        -           int x129,
        -           int x130,
        -           int x131,
        -           int x132,
        -           int x133,
        -           int x134,
        -           int x135,
        -           int x136,
        -           int x137,
        -           int x138,
        -           int x139,
        -           int x140,
        -           int x141,
        -           int x142,
        -           int x143,
        -           int x144,
        -           int x145,
        -           int x146,
        -           int x147,
        -           int x148,
        -           int x149,
        -           int x150,
        -           int x151,
        -           int x152,
        -           int x153,
        -           int x154,
        -           int x155,
        -           int x156,
        -           int x157,
        -           int x158,
        -           int x159,
        -           int x160,
        -           int x161,
        -           int x162,
        -           int x163,
        -           int x164,
        -           int x165,
        -           int x166,
        -           int x167,
        -           int x168,
        -           int x169,
        -           int x170,
        -           int x171,
        -           int x172,
        -           int x173,
        -           int x174,
        -           int x175,
        -           int x176,
        -           int x177,
        -           int x178,
        -           int x179,
        -           int x180,
        -           int x181,
        -           int x182,
        -           int x183,
        -           int x184,
        -           int x185,
        -           int x186,
        -           int x187,
        -           int x188,
        -           int x189,
        -           int x190,
        -           int x191,
        -           int x192,
        -           int x193,
        -           int x194,
        -           int x195,
        -           int x196,
        -           int x197,
        -           int x198,
        -           int x199,
        -           int x200,
        -           int x201,
        -           int x202,
        -           int x203,
        -           int x204,
        -           int x205,
        -           int x206,
        -           int x207,
        -           int x208,
        -           int x209,
        -           int x210,
        -           int x211,
        -           int x212,
        -           int x213,
        -           int x214,
        -           int x215,
        -           int x216,
        -           int x217,
        -           int x218,
        -           int x219,
        -           int x220,
        -           int x221,
        -           int x222,
        -           int x223,
        -           int x224,
        -           int x225,
        -           int x226,
        -           int x227,
        -           int x228,
        -           int x229,
        -           int x230,
        -           int x231,
        -           int x232,
        -           int x233,
        -           int x234,
        -           int x235,
        -           int x236,
        -           int x237,
        -           int x238,
        -           int x239,
        -           int x240,
        -           int x241,
        -           int x242,
        -           int x243,
        -           int x244,
        -           int x245,
        -           int x246,
        -           int x247,
        -           int x248,
        -           int x249,
        -           int x250,
        -           int x251,
        -           int x252,
        -           int x253,
        -           int x254,
        -           int x255
        -    ) {}
        -}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/NumArgsTest.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/NumArgsTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,269 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * This code is distributed in the hope that it will be useful, but WITHOUT
        + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
        + * version 2 for more details (a copy is included in the LICENSE file that
        + * accompanied this code).
        + *
        + * You should have received a copy of the GNU General Public License version
        + * 2 along with this work; if not, write to the Free Software Foundation,
        + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
        + *
        + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
        + * or visit www.oracle.com if you need additional information or have any
        + * questions.
        + */
        +
        +import com.sun.tools.javac.util.*;
        +import com.sun.tools.javac.api.*;
        +import com.sun.tools.javac.file.*;
        +import java.io.*;
        +import java.util.*;
        +import javax.tools.*;
        +
        +// More general parameter limit testing framework, and designed so
        +// that it could be expanded into a general limits-testing framework
        +// in the future.
        +public class NumArgsTest {
        +
        +    private static final NumArgsTest.NestingDef[] NO_NESTING = {};
        +
        +    // threshold is named as such because "threshold" args is expected
        +    // to pass, and "threshold" + 1 args is expected to fail.
        +    private final int threshold;
        +    private final boolean isStaticMethod;
        +    private final String result;
        +    private final String testName;
        +    private final String methodName;
        +    private final NestingDef[] nesting;
        +    private final File testdir;
        +    private final JavacTool tool = JavacTool.create();
        +    private final JavacFileManager fm =
        +        tool.getStandardFileManager(null, null, null);
        +    private int errors = 0;
        +
        +    public NumArgsTest(final int threshold,
        +                       final boolean isStaticMethod,
        +                       final String result,
        +                       final String methodName,
        +                       final String testName,
        +                       final NestingDef[] nesting) {
        +        this.threshold = threshold;
        +        this.isStaticMethod = isStaticMethod;
        +        this.result = result;
        +        this.methodName = methodName;
        +        this.testName = testName;
        +        this.nesting = nesting;
        +        testdir = new File(testName);
        +        testdir.mkdir();
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final boolean isStaticMethod,
        +                       final String result,
        +                       final String methodName,
        +                       final String testName) {
        +        this(threshold, isStaticMethod, result, methodName,
        +             testName, NO_NESTING);
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final String result,
        +                       final String methodName,
        +                       final String testName,
        +                       final NestingDef[] nesting) {
        +        this(threshold, false, result, methodName, testName, nesting);
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final String result,
        +                       final String methodName,
        +                       final String testName) {
        +        this(threshold, false, result, methodName, testName, NO_NESTING);
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final String testName,
        +                       final NestingDef[] nesting) {
        +        this(threshold, null, null, testName, nesting);
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final String testName) {
        +        this(threshold, null, null, testName, NO_NESTING);
        +    }
        +
        +    public NumArgsTest(final int threshold,
        +                       final String testName,
        +                       final String constructorName,
        +                       final NestingDef[] nesting) {
        +        this(threshold, null, constructorName, testName, nesting);
        +    }
        +
        +    protected void writeArgs(final int num, final PrintWriter stream)
        +        throws IOException {
        +        stream.print("int x1");
        +        for(int i = 1; i < num; i++)
        +            stream.print(", int x" + (i + 1));
        +    }
        +
        +    protected void writeMethod(final int num,
        +                               final String name,
        +                               final PrintWriter stream)
        +        throws IOException {
        +        stream.write("public ");
        +        if (isStaticMethod) stream.write("static ");
        +        if (result == null)
        +            stream.write("");
        +        else {
        +            stream.write(result);
        +            stream.write(" ");
        +        }
        +        stream.write(name);
        +        stream.write("(");
        +        writeArgs(num, stream);
        +        stream.write(") {}\n");
        +    }
        +
        +    protected void writeJavaFile(final int num,
        +                                 final boolean pass,
        +                                 final PrintWriter stream)
        +        throws IOException {
        +        final String fullName = testName + (pass ? "Pass" : "Fail");
        +        stream.write("public class ");
        +        stream.write(fullName);
        +        stream.write(" {\n");
        +        for(int i = 0; i < nesting.length; i++)
        +            nesting[i].writeBefore(stream);
        +        if (null == methodName)
        +            writeMethod(num, fullName, stream);
        +        else
        +            writeMethod(num, methodName, stream);
        +        for(int i = nesting.length - 1; i >= 0; i--)
        +            nesting[i].writeAfter(stream);
        +        stream.write("}\n");
        +    }
        +
        +    public void runTest() throws Exception {
        +        // Run the pass test
        +        final String passTestName = testName + "Pass.java";
        +        final StringWriter passBody = new StringWriter();
        +        final PrintWriter passStream = new PrintWriter(passBody);
        +        final File passFile = new File(testdir, passTestName);
        +        final FileWriter passWriter = new FileWriter(passFile);
        +
        +        writeJavaFile(threshold, true, passStream);
        +        passStream.close();
        +        passWriter.write(passBody.toString());
        +        passWriter.close();
        +
        +        final StringWriter passSW = new StringWriter();
        +        final String[] passArgs = { passFile.toString() };
        +        final Iterable passFiles =
        +            fm.getJavaFileObjectsFromFiles(Arrays.asList(passFile));
        +        final JavaCompiler.CompilationTask passTask =
        +            tool.getTask(passSW, fm, null, null, null, passFiles);
        +
        +        if (!passTask.call()) {
        +            errors++;
        +            System.err.println("Compilation unexpectedly failed. Body:\n" +
        +                               passBody);
        +            System.err.println("Output:\n" + passSW.toString());
        +        }
        +
        +        // Run the fail test
        +        final String failTestName = testName + "Fail.java";
        +        final StringWriter failBody = new StringWriter();
        +        final PrintWriter failStream = new PrintWriter(failBody);
        +        final File failFile = new File(testdir, failTestName);
        +        final FileWriter failWriter = new FileWriter(failFile);
        +
        +        writeJavaFile(threshold + 1, false, failStream);
        +        failStream.close();
        +        failWriter.write(failBody.toString());
        +        failWriter.close();
        +
        +        final StringWriter failSW = new StringWriter();
        +        final TestDiagnosticHandler failDiag =
        +            new TestDiagnosticHandler("compiler.err.limit.parameters");
        +        final Iterable failFiles =
        +            fm.getJavaFileObjectsFromFiles(Arrays.asList(failFile));
        +        final JavaCompiler.CompilationTask failTask =
        +            tool.getTask(failSW,
        +                         tool.getStandardFileManager(null, null, null),
        +                         failDiag,
        +                         null,
        +                         null,
        +                         failFiles);
        +
        +        if (failTask.call()) {
        +            errors++;
        +            System.err.println("Compilation unexpectedly succeeded.");
        +            System.err.println("Input:\n" + failBody);
        +        }
        +
        +        if (!failDiag.sawError) {
        +            errors++;
        +            System.err.println("Did not see expected compile error.");
        +        }
        +
        +        if (errors != 0)
        +            throw new RuntimeException("Test failed with " +
        +                                       errors + " errors");
        +    }
        +
        +    public static NestingDef classNesting(final String name) {
        +        return new NestedClassBuilder(name, false);
        +    }
        +
        +    public static NestingDef classNesting(final String name,
        +                                          final boolean isStatic) {
        +        return new NestedClassBuilder(name, isStatic);
        +    }
        +
        +    protected interface NestingDef {
        +        public abstract void writeBefore(final PrintWriter stream);
        +        public abstract void writeAfter(final PrintWriter stream);
        +    }
        +
        +    private static class NestedClassBuilder implements NestingDef {
        +        private final String name;
        +        private final boolean isStatic;
        +        public NestedClassBuilder(final String name, final boolean isStatic) {
        +            this.name = name;
        +            this.isStatic = isStatic;
        +        }
        +        public void writeBefore(final PrintWriter stream) {
        +            stream.write("public ");
        +            if (isStatic) stream.write("static");
        +            stream.write(" class ");
        +            stream.write(name);
        +            stream.write(" {\n");
        +        }
        +        public void writeAfter(final PrintWriter stream) {
        +            stream.write("}\n");
        +        }
        +    }
        +
        +    public class TestDiagnosticHandler implements DiagnosticListener {
        +        public boolean sawError;
        +        public final String target;
        +
        +        public TestDiagnosticHandler(final String target) {
        +            this.target = target;
        +        }
        +
        +        public void report(final Diagnostic diag) {
        +            if (diag.getCode().equals(target))
        +                sawError = true;
        +        }
        +    }
        +
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/StaticNestedClassConstructorArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/StaticNestedClassConstructorArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,45 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8014230
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main StaticNestedClassConstructorArgs
        + */
        +
        +public class StaticNestedClassConstructorArgs extends NumArgsTest {
        +    private static final NumArgsTest.NestingDef[] nesting = {
        +        classNesting("StaticInner", true)
        +    };
        +
        +    private StaticNestedClassConstructorArgs() {
        +        super(254, "StaticNestedClassConstructorArgs", "StaticInner", nesting);
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new StaticNestedClassConstructorArgs().runTest();
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/TopLevelClassConstructorArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/TopLevelClassConstructorArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,40 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 4309152
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main TopLevelClassConstructorArgs
        + */
        +
        +public class TopLevelClassConstructorArgs extends NumArgsTest {
        +    private TopLevelClassConstructorArgs() {
        +        super(254, "TopLevelClassConstructorArgs");
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new TopLevelClassConstructorArgs().runTest();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/TopLevelClassMethodArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/TopLevelClassMethodArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,40 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 4309152
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main TopLevelClassMethodArgs
        + */
        +
        +public class TopLevelClassMethodArgs extends NumArgsTest {
        +    private TopLevelClassMethodArgs() {
        +        super(254, "void", "test", "TopLevelClassMethodArgs");
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new TopLevelClassMethodArgs().runTest();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/limits/TopLevelClassStaticMethodArgs.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/limits/TopLevelClassStaticMethodArgs.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,40 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 4309152
        + * @summary Compiler silently generates bytecode that exceeds VM limits
        + * @compile NumArgsTest.java
        + * @run main TopLevelClassStaticMethodArgs
        + */
        +
        +public class TopLevelClassStaticMethodArgs extends NumArgsTest {
        +    private TopLevelClassStaticMethodArgs() {
        +        super(255, true, "void", "test", "TopLevelClassStaticMethodArgs");
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new TopLevelClassStaticMethodArgs().runTest();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/literals/UnderscoreLiterals.java
        --- a/langtools/test/tools/javac/literals/UnderscoreLiterals.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/literals/UnderscoreLiterals.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,5 +1,5 @@
         /*
        - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
        + * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
          * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
          *
          * This code is free software; you can redistribute it and/or modify it
        @@ -42,6 +42,12 @@
                 test(1_0_0, 100);
                 test(1__0__0, 100);
                 test(123_456_789, 123456789);
        +        test(2_147_483_647, Integer.MAX_VALUE);
        +        test(-2_147_483_648, Integer.MIN_VALUE);
        +        test(32_767, Short.MAX_VALUE);
        +        test(-32_768, Short.MIN_VALUE);
        +        test(1_2_7, Byte.MAX_VALUE);
        +        test(-1_2_8, Byte.MIN_VALUE);
         
                 // long
                 test(1l, 1l);
        @@ -51,6 +57,8 @@
                 test(1_0_0l, 100l);
                 test(1__0__0l, 100l);
                 test(123_456_789l, 123456789l);
        +        test(9_223_372_036_854_775_807l, Long.MAX_VALUE);
        +        test(-9_223_372_036_854_775_808l, Long.MIN_VALUE);
         
                 // float
                 test(.1f, .1f);
        @@ -80,6 +88,8 @@
                 test(1_1.1_0_0f, 1_1.100f);
                 test(1_1.1__0__0f, 1_1.100f);
                 test(1_1.123_456_789f, 1_1.123456789f);
        +        test(3.4_028_235E38f, Float.MAX_VALUE);
        +        test(1.4E-4_5f, Float.MIN_VALUE);
         
                 // double
                 test(.1d, .1d);
        @@ -109,6 +119,8 @@
                 test(1_1.1_0_0d, 1_1.100d);
                 test(1_1.1__0__0d, 1_1.100d);
                 test(1_1.123_456_789d, 1_1.123456789d);
        +        test(1.797_6_9_3_1_348_623_157E3_08, Double.MAX_VALUE);
        +        test(4.9E-3_24, Double.MIN_VALUE);
         
                 // binary
                 test(0b1, 1);
        @@ -118,6 +130,14 @@
                 test(0b1_0_0, 4);
                 test(0b1__0__0, 4);
                 test(0b0001_0010_0011, 0x123);
        +        test(0b111_1111_1111_1111_1111_1111_1111_1111, Integer.MAX_VALUE);
        +        test(0b1000_0000_0000_0000_0000_0000_0000_0000, Integer.MIN_VALUE);
        +        test(0b111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111_1111l, Long.MAX_VALUE);
        +        test(0b1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000l, Long.MIN_VALUE);
        +        test(0b111_1111_1111_1111, Short.MAX_VALUE);
        +        test((short)-0b1000_0000_0000_0000, Short.MIN_VALUE);
        +        test(0b111_1111, Byte.MAX_VALUE);
        +        test((byte)-0b1000_0000, Byte.MIN_VALUE);
         
                 // octal
                 test(01, 1);
        @@ -133,6 +153,14 @@
                 test(0_1_0_0, 64);
                 test(0_1__0__0, 64);
                 test(0_001_002_003, 01002003);
        +        test(0177_7777_7777, Integer.MAX_VALUE);
        +        test(-0200_0000_0000, Integer.MIN_VALUE);
        +        test(077_77_77_77_77_7_77_77_77_77_77l, Long.MAX_VALUE);
        +        test(-010_00_00_00_00_00_00_00_00_00_00l, Long.MIN_VALUE);
        +        test((short)07_77_77, Short.MAX_VALUE);
        +        test((short)-010_00_00, Short.MIN_VALUE);
        +        test(01_77, Byte.MAX_VALUE);
        +        test((byte)-02_00, Byte.MIN_VALUE);
         
                 // hexadecimal
                 test(0x1, 1);
        @@ -142,6 +170,18 @@
                 test(0x1_0_0, 256);
                 test(0x1__0__0, 256);
                 test(0x01_02_03_04, 0x1020304);
        +        test(0x7f_ff_ff_ff, Integer.MAX_VALUE);
        +        test(0x80_00_00_00, Integer.MIN_VALUE);
        +        test(0x1.f_ff_ffep127f, Float.MAX_VALUE);
        +        test(0x0.00_00_02p-126f, Float.MIN_VALUE);
        +        test(0x1.f__ff_ff_ff_ff_ff_ffp1_023, Double.MAX_VALUE);
        +        test(0x0.000_000_000_000_1p-1_022, Double.MIN_VALUE);
        +        test(0x7f_ff_ff_ff_ff_ff_ff_ffl, Long.MAX_VALUE);
        +        test(0x80_00_00_00_00_00_00_00l, Long.MIN_VALUE);
        +        test(0x7f_ff, Short.MAX_VALUE);
        +        test((short)0x80_00, Short.MIN_VALUE);
        +        test(0x7_f, Byte.MAX_VALUE);
        +        test((byte)0x8_0, Byte.MIN_VALUE);
         
                 // misc
                 long creditCardNumber = 1234_5678_9012_3456L;
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/parser/SingleCommaAnnotationValue.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/parser/SingleCommaAnnotationValue.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,39 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8012722
        + * @summary Single comma in array initializer should parse
        + * @compile SingleCommaAnnotationValue.java
        + */
        +
        +public class SingleCommaAnnotationValue {
        +    @Foo({}) void a() { }
        +    @Foo({,}) void b() { }
        +    @Foo({0}) void c() { }
        +    @Foo({0,}) void d() { }
        +    @Foo({0,0}) void e() { }
        +    @Foo({0,0,}) void f() { }
        +}
        +@interface Foo { int[] value(); }
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/parser/SingleCommaAnnotationValueFail.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/parser/SingleCommaAnnotationValueFail.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,36 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8012722
        + * @summary Single comma in array initializer should parse
        + * @compile/fail/ref=SingleCommaAnnotationValueFail.out -XDrawDiagnostics
        + * SingleCommaAnnotationValueFail.java
        + */
        +
        +public class SingleCommaAnnotationValueFail {
        +    // Non-example
        +    @Foo({,0}) void a() { }
        +}
        +@interface Foo { int[] value(); }
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/parser/SingleCommaAnnotationValueFail.out
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/parser/SingleCommaAnnotationValueFail.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,6 @@
        +SingleCommaAnnotationValueFail.java:34:12: compiler.err.expected: '}'
        +SingleCommaAnnotationValueFail.java:34:13: compiler.err.illegal.start.of.type
        +SingleCommaAnnotationValueFail.java:34:14: compiler.err.expected: token.identifier
        +SingleCommaAnnotationValueFail.java:34:15: compiler.err.expected: ';'
        +SingleCommaAnnotationValueFail.java:34:21: compiler.err.invalid.meth.decl.ret.type.req
        +5 errors
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java
        --- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -30,11 +30,13 @@
          * @build   JavacTestingAbstractProcessor
          * @compile TestElementsAnnotatedWith.java
          * @compile InheritedAnnotation.java
        + * @compile TpAnno.java
          * @compile -processor TestElementsAnnotatedWith -proc:only SurfaceAnnotations.java
          * @compile -processor TestElementsAnnotatedWith -proc:only BuriedAnnotations.java
          * @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java
          * @compile -processor TestElementsAnnotatedWith -proc:only C2.java
          * @compile -processor TestElementsAnnotatedWith -proc:only Foo.java
        + * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java
          * @compile Foo.java
          * @compile/process -processor TestElementsAnnotatedWith -proc:only Foo
          */
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/processing/environment/round/TpAnno.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/processing/environment/round/TpAnno.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,29 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.lang.annotation.*;
        +import static java.lang.annotation.RetentionPolicy.*;
        +
        +@Retention(RUNTIME)
        +@Target(ElementType.TYPE_PARAMETER)
        +public @interface TpAnno {}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/processing/environment/round/TypeParameterAnnotations.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,37 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +
        +/**
        + * Class to hold annotations for ElementsAnnotatedWithTest.
        + */
        +
        +@AnnotatedElementInfo(annotationName="TpAnno",
        +                      expectedSize=4,
        +                      names={"T", "A", "B", "C"})
        +public class TypeParameterAnnotations<@TpAnno T>  {
        +    private <@TpAnno A> TypeParameterAnnotations(A a) {;}
        +
        +    public <@TpAnno B> void foo(B b) {return;}
        +
        +    public static <@TpAnno C> void bar(C b) {return;}
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/resolve/ResolveHarness.java
        --- a/langtools/test/tools/javac/resolve/ResolveHarness.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/resolve/ResolveHarness.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,8 @@
         
         import com.sun.source.util.JavacTask;
         import com.sun.tools.javac.api.ClientCodeWrapper.DiagnosticSourceUnwrapper;
        +import com.sun.tools.javac.code.Flags;
        +import com.sun.tools.javac.code.Symbol;
         import com.sun.tools.javac.code.Type.MethodType;
         import com.sun.tools.javac.util.JCDiagnostic;
         
        @@ -154,7 +156,7 @@
                 //check all candidates have been used up
                 for (Map.Entry entry : candidatesMap.entrySet()) {
                     if (!seenCandidates.contains(entry.getKey())) {
        -                error("Redundant @Candidate annotation on method " + entry.getKey().elem);
        +                error("Redundant @Candidate annotation on method " + entry.getKey().elem + " sig = " + entry.getKey().elem.asType());
                     }
                 }
             }
        @@ -250,7 +252,7 @@
                 void process(Diagnostic diagnostic) {
                     Element siteSym = getSiteSym(diagnostic);
                     if (siteSym.getSimpleName().length() != 0 &&
        -                    siteSym.getAnnotation(TraceResolve.class) == null) {
        +                    ((Symbol)siteSym).outermostClass().getAnnotation(TraceResolve.class) == null) {
                         return;
                     }
                     int candidateIdx = 0;
        @@ -308,7 +310,11 @@
         
                 @Override
                 void process(Diagnostic diagnostic) {
        -            Element methodSym = methodSym(diagnostic);
        +            Symbol methodSym = (Symbol)methodSym(diagnostic);
        +            if ((methodSym.flags() & Flags.GENERATEDCONSTR) != 0) {
        +                //skip resolution of default constructor (put there by javac)
        +                return;
        +            }
                     Candidate c = getCandidateAtPos(methodSym,
                             asJCDiagnostic(diagnostic).getLineNumber(),
                             asJCDiagnostic(diagnostic).getColumnNumber());
        @@ -470,23 +476,10 @@
                 }
         
                 String computeKey(Element e) {
        -            StringBuilder buf = new StringBuilder();
        -            if (predefTranslationMap.containsKey(e.getSimpleName().toString())) {
        -                //predef element
        -                buf.append(".");
        -                String replacedName = predefTranslationMap.get(e.getSimpleName().toString());
        -                buf.append(e.toString().replace(e.getSimpleName().toString(), replacedName));
        -            } else if (e.getSimpleName().toString().startsWith("_")) {
        -                buf.append(".");
        -                buf.append(e.toString());
        -            } else {
        -                while (e != null) {
        -                    buf.append(e.toString());
        -                    e = e.getEnclosingElement();
        -                }
        -                buf.append(jfo.getName());
        -            }
        -            return buf.toString();
        +            String simpleName = e.getSimpleName().toString();
        +            String opName = predefTranslationMap.get(simpleName);
        +            String name = opName != null ? opName : simpleName;
        +            return name + e.asType();
                 }
         
                 @Override
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/resolve/tests/AbstractMerge.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/resolve/tests/AbstractMerge.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,107 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +@TraceResolve
        +class AbstractMerge {
        +
        +    interface A {
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m1();
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m2();
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m3();
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m4();
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m5();
        +        @Candidate(applicable=Phase.BASIC)
        +        java.io.Serializable m6();
        +    }
        +
        +    interface B {
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m1();
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m2();
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m3();
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m4();
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m5();
        +        @Candidate(applicable=Phase.BASIC)
        +        Cloneable m6();
        +    }
        +
        +    interface C {
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m1();
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m2();
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m3();
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m4();
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m5();
        +        @Candidate(applicable=Phase.BASIC, mostSpecific=true)
        +        Object[] m6();
        +    }
        +
        +    interface ABC extends A, B, C { }
        +    interface ACB extends A, C, B { }
        +    interface BAC extends B, A, C { }
        +    interface BCA extends B, C, A { }
        +    interface CAB extends C, A, B { }
        +    interface CBA extends C, B, A { }
        +
        +    {
        +        ABC abc = null;
        +        abc.m1();
        +    }
        +
        +    {
        +        ACB acb = null;
        +        acb.m2();
        +    }
        +
        +    {
        +        BAC bac = null;
        +        bac.m3();
        +    }
        +
        +    {
        +        BCA bca = null;
        +        bca.m4();
        +    }
        +
        +    {
        +        CAB cab = null;
        +        cab.m5();
        +    }
        +
        +    {
        +        CBA cba = null;
        +        cba.m6();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/resolve/tests/InnerOverOuter.java
        --- a/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/resolve/tests/InnerOverOuter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -21,7 +21,7 @@
          * questions.
          */
         
        -@TraceResolve
        +@TraceResolve(keys={"compiler.err.cant.apply.symbol"})
         class Test {
         
             //no annotation here - this should NOT even be considered!
        @@ -30,7 +30,6 @@
             //no annotation here - this should NOT even be considered!
             void m(Object... o) { }
         
        -    @TraceResolve(keys={"compiler.err.cant.apply.symbol"})
             class Inner {
                 @Candidate
                 void m(String s) {
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/types/TestComparisons.java
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/langtools/test/tools/javac/types/TestComparisons.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,362 @@
        +/*
        + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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 8013357
        + * @summary javac should correctly enforce binary comparison rules.
        + */
        +import com.sun.tools.javac.code.Type;
        +import com.sun.tools.javac.code.Type.*;
        +import com.sun.tools.javac.code.Symbol.*;
        +import java.io.*;
        +import java.lang.reflect.Array;
        +import java.util.EnumSet;
        +
        +public class TestComparisons {
        +
        +    private int errors = 0;
        +    private int testnum = 0;
        +
        +    static final File testdir = new File("8013357");
        +
        +    private enum CompareType {
        +        BYTE_PRIM("byte"),
        +        SHORT_PRIM("short"),
        +        CHAR_PRIM("char"),
        +        INTEGER_PRIM("int"),
        +        LONG_PRIM("long"),
        +        FLOAT_PRIM("float"),
        +        DOUBLE_PRIM("double"),
        +        BOOLEAN_PRIM("boolean"),
        +
        +        BYTE("Byte"),
        +        SHORT("Short"),
        +        CHAR("Character"),
        +        INTEGER("Integer"),
        +        LONG("Long"),
        +        FLOAT("Float"),
        +        DOUBLE("Double"),
        +        BOOLEAN("Boolean"),
        +
        +        BYTE_SUPER("List", true),
        +        SHORT_SUPER("List", true),
        +        CHAR_SUPER("List", true),
        +        INTEGER_SUPER("List", true),
        +        LONG_SUPER("List", true),
        +        FLOAT_SUPER("List", true),
        +        DOUBLE_SUPER("List", true),
        +        BOOLEAN_SUPER("List", true),
        +
        +        OBJECT("Object"),
        +        NUMBER("Number"),
        +        STRING("String");
        +
        +        public final boolean isList;
        +        public final String name;
        +
        +        private CompareType(final String name, final boolean isList) {
        +            this.isList = isList;
        +            this.name = name;
        +        }
        +
        +        private CompareType(final String name) {
        +            this(name, false);
        +        }
        +    }
        +
        +    // The integers here refer to which subsection of JLS 15.21 is in
        +    // effect.  0 means no comparison is allowed.
        +    private static final int truthtab[][] = {
        +        // byte, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // short, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // char, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // int, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // long, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // float, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // double, comparable to itself, any numeric type, or any boxed
        +        // numeric type.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          1, 1, 1, 1, 1, 1, 1, 0, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // boolean, comparable only to itself and Boolean.
        +        { 0, 0, 0, 0, 0, 0, 0, 2, // Primitives
        +          0, 0, 0, 0, 0, 0, 0, 2, // Boxed primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Captures
        +          0, 0, 0                 // Reference types
        +        },
        +        // Byte, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          3, 0, 0, 0, 0, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Short, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 3, 0, 0, 0, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Character, comparable to itself, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 0, 3, 0, 0, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 0, 0                 // Reference types
        +        },
        +        // Int, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 0, 0, 3, 0, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Long, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 0, 0, 0, 3, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Float, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 0, 0, 0, 0, 3, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Double, comparable to itself, Number, Object, any numeric primitive,
        +        // and any captures.
        +        { 1, 1, 1, 1, 1, 1, 1, 0, // Primitives
        +          0, 0, 0, 0, 0, 0, 3, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // Boolean, to itself, any capture, Object, and boolean.
        +        { 0, 0, 0, 0, 0, 0, 0, 2, // Primitives
        +          0, 0, 0, 0, 0, 0, 0, 2, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 0, 0                 // Reference types
        +        },
        +        // Byte supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Short supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Character supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Integer supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Long supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Float supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Double supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Boolean supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Object, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 3                 // Reference types
        +        },
        +        // Number, comparable to Object, any of its subclasses.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          3, 3, 0, 3, 3, 3, 3, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 3, 0                 // Reference types
        +        },
        +        // String supertype wildcard, comparable to any reference type.
        +        // and any captures.
        +        { 0, 0, 0, 0, 0, 0, 0, 0, // Primitives
        +          0, 0, 0, 0, 0, 0, 0, 0, // Boxed primitives
        +          3, 3, 3, 3, 3, 3, 3, 3, // Captures
        +          3, 0, 3                 // Reference types
        +        }
        +    };
        +
        +    private void assert_compile_fail(final File file, final String body) {
        +        final String filename = file.getPath();
        +        final String[] args = { filename };
        +        final StringWriter sw = new StringWriter();
        +        final PrintWriter pw = new PrintWriter(sw);
        +        final int rc = com.sun.tools.javac.Main.compile(args, pw);
        +        pw.close();
        +        if (rc == 0) {
        +            System.err.println("Compilation of " + file.getName() +
        +                               " didn't fail as expected.\nFile:\n" +
        +                               body + "\nOutput:\n" + sw.toString());
        +            errors++;
        +        }
        +    }
        +
        +    private void assert_compile_succeed(final File file, final String body) {
        +        final String filename = file.getPath();
        +        final String[] args = { filename };
        +        final StringWriter sw = new StringWriter();
        +        final PrintWriter pw = new PrintWriter(sw);
        +        final int rc = com.sun.tools.javac.Main.compile(args, pw);
        +        pw.close();
        +        if (rc != 0) {
        +            System.err.println("Compilation of " + file.getName() +
        +                               " didn't succeed as expected.\nFile:\n" +
        +                               body + "\nOutput:\n" +
        +                               sw.toString());
        +            errors++;
        +        }
        +    }
        +
        +    private String makeBody(final int num,
        +                            final CompareType left,
        +                            final CompareType right) {
        +        return "import java.util.List;\n" +
        +            "public class Test" + num + " {\n" +
        +            "    public boolean test(" + left.name +
        +            " left, " + right.name + " right) {\n" +
        +            "        return left" + (left.isList ? ".get(0)" : "") +
        +            " == right" + (right.isList ? ".get(0)" : "") + ";\n" +
        +            "    }\n" +
        +            "}\n";
        +    }
        +
        +    private File writeFile(final String filename,
        +                           final String body)
        +        throws IOException {
        +        final File f = new File(testdir, filename);
        +        f.getParentFile().mkdirs();
        +        final FileWriter out = new FileWriter(f);
        +        out.write(body);
        +        out.close();
        +        return f;
        +    }
        +
        +    private void test(final CompareType left, final CompareType right)
        +        throws IOException {
        +        final int num = testnum++;
        +        final String filename = "Test" + num + ".java";
        +        final String body = makeBody(num, left, right);
        +        final File file = writeFile(filename, body);
        +        if (truthtab[left.ordinal()][right.ordinal()] != 0)
        +            assert_compile_succeed(file, body);
        +        else
        +            assert_compile_fail(file, body);
        +    }
        +
        +    void run() throws Exception {
        +        testdir.mkdir();
        +
        +        for(CompareType left : CompareType.values())
        +            for(CompareType right : CompareType.values())
        +                test(left, right);
        +
        +        if (errors != 0)
        +            throw new Exception("ObjectZeroCompare test failed with " +
        +                                errors + " errors.");
        +    }
        +
        +    public static void main(String... args) throws Exception {
        +        new TestComparisons().run();
        +    }
        +}
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,6 +23,7 @@
         
         /**
          * @test
        + * @bug 7153951
          * @compile ClassUsingAnotherAuxiliary.java NotAClassName.java
          * @compile -Xlint:auxiliaryclass ClassUsingAnotherAuxiliary.java NotAClassName.java
          * @compile/fail/ref=ClassUsingAnotherAuxiliary.out -XDrawDiagnostics -Werror -Xlint:auxiliaryclass ClassUsingAnotherAuxiliary.java NotAClassName.java
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAnotherAuxiliary.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,4 +1,4 @@
        -ClassUsingAnotherAuxiliary.java:32:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AnAuxiliaryClass, NotAClassName.java
        +ClassUsingAnotherAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AnAuxiliaryClass, NotAClassName.java
         - compiler.err.warnings.and.werror
         1 error
         1 warning
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -23,6 +23,7 @@
         
         /**
          * @test
        + * @bug 7153951
          * @clean ClassUsingAuxiliary ClassWithAuxiliary AuxiliaryClass ClassWithAuxiliary$NotAnAuxiliaryClass ClassWithAuxiliary$NotAnAuxiliaryClassEither
          * @run compile ClassUsingAuxiliary.java ClassWithAuxiliary.java
          * @run compile/fail/ref=ClassUsingAuxiliary1.out -XDrawDiagnostics -Werror -Xlint:auxiliaryclass ClassUsingAuxiliary.java ClassWithAuxiliary.java
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary1.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,4 +1,4 @@
        -ClassUsingAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
        +ClassUsingAuxiliary.java:34:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
         - compiler.err.warnings.and.werror
         1 error
         1 warning
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/ClassUsingAuxiliary2.out	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,4 +1,4 @@
        -ClassUsingAuxiliary.java:33:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
        +ClassUsingAuxiliary.java:34:5: compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file: AuxiliaryClass, ClassWithAuxiliary.java
         - compiler.err.warnings.and.werror
         1 error
         1 warning
        diff -r 0273c023680c -r 6ed8434664ed langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java
        --- a/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/langtools/test/tools/javac/warnings/AuxiliaryClass/SelfClassWithAux.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -29,16 +29,17 @@
         
         /*
          * @test
        + * @bug 7153951
          * @run compile -Werror -Xlint:auxiliaryclass SelfClassWithAux.java ClassWithAuxiliary.java
          * @run compile -Werror -Xlint:auxiliaryclass SelfClassWithAux.java
          */
         
         class SelfClassWithAux {
        -    Aux aux;
        +    AuxClass aux;
             ClassWithAuxiliary.NotAnAuxiliaryClass alfa;
             ClassWithAuxiliary.NotAnAuxiliaryClassEither beta;
         }
         
        -class Aux {
        -    Aux aux;
        +class AuxClass {
        +    AuxClass aux;
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/.hgtags
        --- a/nashorn/.hgtags	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/.hgtags	Thu Jul 11 12:50:20 2013 -0700
        @@ -205,3 +205,6 @@
         ddbf41575a2bdb12ccb9f91e169018bf04073038 jdk8-b93
         d92b756bc73966f1bfd111f44f3216cea3bba129 jdk8-b94
         cbc9926f5b40a24025c1e15d8870157d651a9ff7 jdk8-b95
        +d6bd440ac5b97bb1205b6c3274569c1cfe626723 jdk8-b96
        +1bf1d6ce30427e1f9dc1ada18db409d1f14d99fe jdk8-b97
        +542b7803f0389a91fab58608a0f46fac0e15d759 jdk8-b98
        diff -r 0273c023680c -r 6ed8434664ed nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java
        --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -166,11 +166,11 @@
                 mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
                 mi.loadClass(className);
                 mi.invokeStatic(MAP_TYPE, MAP_NEWMAP, MAP_NEWMAP_DESC);
        -        mi.storeLocal(0);
        +        // stack: PropertyMap
             }
         
             static void emitStaticInitSuffix(final MethodGenerator mi, final String className) {
        -        mi.loadLocal(0);
        +        // stack: PropertyMap
                 mi.putStatic(className, MAP_FIELD_NAME, MAP_DESC);
                 mi.returnVoid();
                 mi.computeMaxs();
        @@ -278,7 +278,7 @@
         
             static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo memInfo) {
                 final String propertyName = memInfo.getName();
        -        mi.loadLocal(0);
        +        // stack: PropertyMap
                 mi.loadLiteral(propertyName);
                 // setup flags
                 mi.push(memInfo.getAttributes());
        @@ -293,12 +293,12 @@
                     mi.visitLdcInsn(new Handle(H_INVOKEVIRTUAL, className, javaName, setterDesc(memInfo)));
                 }
                 mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
        -        mi.storeLocal(0);
        +        // stack: PropertyMap
             }
         
             static void linkerAddGetterSetter(final MethodGenerator mi, final String className, final MemberInfo getter, final MemberInfo setter) {
                 final String propertyName = getter.getName();
        -        mi.loadLocal(0);
        +        // stack: PropertyMap
                 mi.loadLiteral(propertyName);
                 // setup flags
                 mi.push(getter.getAttributes());
        @@ -313,7 +313,7 @@
                             setter.getJavaName(), setter.getJavaDesc()));
                 }
                 mi.invokeStatic(LOOKUP_TYPE, LOOKUP_NEWPROPERTY, LOOKUP_NEWPROPERTY_DESC);
        -        mi.storeLocal(0);
        +        // stack: PropertyMap
             }
         
             static ScriptClassInfo getScriptClassInfo(final String fileName) throws IOException {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java
        --- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ScriptClassInstrumentor.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -159,10 +159,14 @@
                     public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) {
                         if (isConstructor && opcode == INVOKESPECIAL &&
                                 INIT.equals(name) && SCRIPTOBJECT_TYPE.equals(owner)) {
        -                    super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(),
        -                            MAP_FIELD_NAME, MAP_DESC);
        -                    super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT,
        -                            SCRIPTOBJECT_INIT_DESC);
        +
        +                    // replace call to empty super-constructor with one passing PropertyMap argument
        +                    if (DEFAULT_INIT_DESC.equals(desc)) {
        +                        super.visitFieldInsn(GETSTATIC, scriptClassInfo.getJavaName(), MAP_FIELD_NAME, MAP_DESC);
        +                        super.visitMethodInsn(INVOKESPECIAL, SCRIPTOBJECT_TYPE, INIT, SCRIPTOBJECT_INIT_DESC);
        +                    } else {
        +                        super.visitMethodInsn(opcode, owner, name, desc);
        +                    }
         
                             if (memberCount > 0) {
                                 // initialize @Property fields if needed
        @@ -223,7 +227,7 @@
                         ClassGenerator.addSetter(cv, className, memInfo);
                     }
                 }
        -        ClassGenerator.addMapField(this);
        +        // omit addMapField() since instance classes already define a static PropertyMap field
             }
         
             void emitGettersSetters() {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/docs/JavaScriptingProgrammersGuide.html
        --- a/nashorn/docs/JavaScriptingProgrammersGuide.html	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/docs/JavaScriptingProgrammersGuide.html	Thu Jul 11 12:50:20 2013 -0700
        @@ -227,6 +227,16 @@
         it. Note that the syntax to access Java objects, methods and fields
         is dependent on the scripting language. JavaScript supports the
         most "natural" Java-like syntax.

        +

        +Nashorn script engine pre-defines two global variables named "context" +and "engine". The "context" variable is of type javax.script.ScriptContext +and refers to the current ScriptContext instance passed to script engine's +eval method. The "engine" variable is of type javax.script.ScriptEngine and +refers to the current nashorn script engine instance evaluating the script. +Both of these variables are non-writable, non-enumerable and non-configurable +- which implies script code can not write overwrite the value, for..loop iteration +on global object will not iterate these variables and these variables can not be +deleted by script.

        
         // ScriptVars.java
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/make/build.xml
        --- a/nashorn/make/build.xml	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/make/build.xml	Thu Jul 11 12:50:20 2013 -0700
        @@ -124,7 +124,7 @@
             
           
         
        -  
        +  
             
               
               
        @@ -139,7 +139,13 @@
               
             
           
        -  
        +
        +  
        +    
        +    
        +    
        +  
        +
           
             Builds the javafx shell.
             
        @@ -238,7 +244,7 @@
             
             
             
        -    
        +
             
             
             
        @@ -462,24 +468,24 @@
           
           
             
        -     
        +    
         
             
        -        
        +    
             
             
         
             
        -        
        +    
             
         
             
        -     
        +    
             
             
         
             
        -     
        +    
             
             
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/api/scripting/JSObject.java
        --- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -30,13 +30,23 @@
          */
         public abstract class JSObject {
             /**
        -     * Call a JavaScript method
        +     * Call a JavaScript function
              *
        -     * @param methodName name of method
        +     * @param functionName name of function
              * @param args arguments to method
              * @return result of call
              */
        -    public abstract Object call(String methodName, Object args[]);
        +    public abstract Object call(String functionName, Object... args);
        +
        +    /**
        +     * Call a JavaScript method as a constructor. This is equivalent to
        +     * calling new obj.Method(arg1, arg2...) in JavaScript.
        +     *
        +     * @param functionName name of function
        +     * @param args arguments to method
        +     * @return result of constructor call
        +     */
        +    public abstract Object newObject(String functionName, Object... args);
         
             /**
              * Evaluate a JavaScript expression
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/api/scripting/NashornException.java
        --- a/nashorn/src/jdk/nashorn/api/scripting/NashornException.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornException.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,6 +25,9 @@
         
         package jdk.nashorn.api.scripting;
         
        +import java.util.ArrayList;
        +import java.util.List;
        +import jdk.nashorn.internal.codegen.CompilerConstants;
         import jdk.nashorn.internal.runtime.ECMAErrors;
         
         /**
        @@ -136,4 +139,53 @@
                 return column;
             }
         
        +    /**
        +     * Returns array javascript stack frames from the given exception object.
        +     *
        +     * @param exception exception from which stack frames are retrieved and filtered
        +     * @return array of javascript stack frames
        +     */
        +    public static StackTraceElement[] getScriptFrames(final Throwable exception) {
        +        final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
        +        final List filtered = new ArrayList<>();
        +        for (final StackTraceElement st : frames) {
        +            if (ECMAErrors.isScriptFrame(st)) {
        +                final String className = "<" + st.getFileName() + ">";
        +                String methodName = st.getMethodName();
        +                if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
        +                    methodName = "";
        +                }
        +                filtered.add(new StackTraceElement(className, methodName,
        +                        st.getFileName(), st.getLineNumber()));
        +            }
        +        }
        +        return filtered.toArray(new StackTraceElement[filtered.size()]);
        +    }
        +
        +    /**
        +     * Return a formatted script stack trace string with frames information separated by '\n'
        +     *
        +     * @param exception exception for which script stack string is returned
        +     * @return formatted stack trace string
        +     */
        +    public static String getScriptStackString(final Throwable exception) {
        +        final StringBuilder buf = new StringBuilder();
        +        final StackTraceElement[] frames = getScriptFrames((Throwable)exception);
        +        for (final StackTraceElement st : frames) {
        +            buf.append("\tat ");
        +            buf.append(st.getMethodName());
        +            buf.append(" (");
        +            buf.append(st.getFileName());
        +            buf.append(':');
        +            buf.append(st.getLineNumber());
        +            buf.append(")\n");
        +        }
        +        final int len = buf.length();
        +        // remove trailing '\n'
        +        if (len > 0) {
        +            assert buf.charAt(len - 1) == '\n';
        +            buf.deleteCharAt(len - 1);
        +        }
        +        return buf.toString();
        +    }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java
        --- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -71,6 +71,9 @@
             private final ScriptEngineFactory factory;
             private final Context             nashornContext;
             private final ScriptObject        global;
        +    // initialized bit late to be made 'final'. Property object for "context"
        +    // property of global object
        +    private Property                  contextProperty;
         
             // default options passed to Nashorn Options object
             private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" };
        @@ -281,13 +284,16 @@
         
                 nashornContext.initGlobal(newGlobal);
         
        +        final int NON_ENUMERABLE_CONSTANT = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE;
                 // current ScriptContext exposed as "context"
        -        newGlobal.addOwnProperty("context", Property.NOT_ENUMERABLE, UNDEFINED);
        +        // "context" is non-writable from script - but script engine still
        +        // needs to set it and so save the context Property object
        +        contextProperty = newGlobal.addOwnProperty("context", NON_ENUMERABLE_CONSTANT, UNDEFINED);
                 // current ScriptEngine instance exposed as "engine". We added @SuppressWarnings("LeakingThisInConstructor") as
                 // NetBeans identifies this assignment as such a leak - this is a false positive as we're setting this property
                 // in the Global of a Context we just created - both the Context and the Global were just created and can not be
                 // seen from another thread outside of this constructor.
        -        newGlobal.addOwnProperty("engine", Property.NOT_ENUMERABLE, this);
        +        newGlobal.addOwnProperty("engine", NON_ENUMERABLE_CONSTANT, this);
                 // global script arguments with undefined value
                 newGlobal.addOwnProperty("arguments", Property.NOT_ENUMERABLE, UNDEFINED);
                 // file name default is null
        @@ -322,9 +328,10 @@
         
             // scripts should see "context" and "engine" as variables
             private void setContextVariables(final ScriptContext ctxt) {
        -        ctxt.setAttribute("context", ctxt, ScriptContext.ENGINE_SCOPE);
                 final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
        -        ctxtGlobal.set("context", ctxt, false);
        +        // set "context" global variable via contextProperty - because this
        +        // property is non-writable
        +        contextProperty.setObjectValue(ctxtGlobal, ctxtGlobal, ctxt, false);
                 Object args = ScriptObjectMirror.unwrap(ctxt.getAttribute("arguments"), ctxtGlobal);
                 if (args == null || args == UNDEFINED) {
                     args = ScriptRuntime.EMPTY_ARRAY;
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
        --- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -102,7 +102,7 @@
         
             // JSObject methods
             @Override
        -    public Object call(final String methodName, final Object args[]) {
        +    public Object call(final String functionName, final Object... args) {
                 final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
                 final boolean globalChanged = (oldGlobal != global);
         
        @@ -111,9 +111,9 @@
                         NashornScriptEngine.setNashornGlobal(global);
                     }
         
        -            final Object val = sobj.get(methodName);
        +            final Object val = functionName == null? sobj : sobj.get(functionName);
                     if (! (val instanceof ScriptFunction)) {
        -                throw new RuntimeException("No such method: " + methodName);
        +                throw new RuntimeException("No such function " + ((functionName != null)? functionName : ""));
                     }
         
                     final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
        @@ -130,6 +130,34 @@
             }
         
             @Override
        +    public Object newObject(final String functionName, final Object... args) {
        +        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
        +        final boolean globalChanged = (oldGlobal != global);
        +
        +        try {
        +            if (globalChanged) {
        +                NashornScriptEngine.setNashornGlobal(global);
        +            }
        +
        +            final Object val = functionName == null? sobj : sobj.get(functionName);
        +            if (! (val instanceof ScriptFunction)) {
        +                throw new RuntimeException("not a constructor " + ((functionName != null)? functionName : ""));
        +            }
        +
        +            final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
        +            return wrap(ScriptRuntime.checkAndConstruct((ScriptFunction)val, unwrapArray(modArgs, global)), global);
        +        } catch (final RuntimeException | Error e) {
        +            throw e;
        +        } catch (final Throwable t) {
        +            throw new RuntimeException(t);
        +        } finally {
        +            if (globalChanged) {
        +                NashornScriptEngine.setNashornGlobal(oldGlobal);
        +            }
        +        }
        +    }
        +
        +    @Override
             public Object eval(final String s) {
                 return inGlobal(new Callable() {
                     @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/codegen/ClassEmitter.java
        --- a/nashorn/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/codegen/ClassEmitter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -165,7 +165,8 @@
             /**
              * Constructor from the compiler
              *
        -     * @param compiler      Compiler
        +     * @param env           Script environment
        +     * @param sourceName    Source name
              * @param unitClassName Compile unit class name.
              * @param strictMode    Should we generate this method in strict mode
              */
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java
        --- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -244,7 +244,7 @@
             /**
              * Check if this symbol can be accessed directly with a putfield or getfield or dynamic load
              *
        -     * @param function function to check for fast scope
        +     * @param symbol symbol to check for fast scope
              * @return true if fast scope
              */
             private boolean isFastScope(final Symbol symbol) {
        @@ -1016,6 +1016,8 @@
                 assert lc.hasCompileUnits();
         
                 method = lc.pushMethodEmitter(unit.getClassEmitter().method(functionNode));
        +        // new method - reset last line number
        +        lastLineNumber = -1;
                 // Mark end for variable tables.
                 method.begin();
         
        @@ -1093,7 +1095,7 @@
             private void lineNumber(final Statement statement) {
                 final int lineNumber = statement.getLineNumber();
                 if (lineNumber != lastLineNumber) {
        -            method.lineNumber(statement.getLineNumber());
        +            method.lineNumber(lineNumber);
                 }
                 lastLineNumber = lineNumber;
             }
        @@ -1108,7 +1110,7 @@
              * @return the method generator that was used
              */
             private MethodEmitter loadArray(final ArrayLiteralNode arrayLiteralNode, final ArrayType arrayType) {
        -        assert arrayType == Type.INT_ARRAY || arrayType == Type.NUMBER_ARRAY || arrayType == Type.OBJECT_ARRAY;
        +        assert arrayType == Type.INT_ARRAY || arrayType == Type.LONG_ARRAY || arrayType == Type.NUMBER_ARRAY || arrayType == Type.OBJECT_ARRAY;
         
                 final Node[]          nodes    = arrayLiteralNode.getValue();
                 final Object          presets  = arrayLiteralNode.getPresets();
        @@ -1460,7 +1462,9 @@
                     rhs = tmp;
                 }
         
        -        if (isNullLiteral(rhs)) {
        +        // this is a null literal check, so if there is implicit coercion
        +        // involved like {D}x=null, we will fail - this is very rare
        +        if (isNullLiteral(rhs) && lhs.getType().isObject()) {
                     final Label trueLabel  = new Label("trueLabel");
                     final Label falseLabel = new Label("falseLabel");
                     final Label endLabel   = new Label("end");
        @@ -1843,7 +1847,8 @@
                     // If expression not int see if we can convert, if not use deflt to trigger default.
                     if (!type.isInteger()) {
                         method.load(deflt);
        -                method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, type.getTypeClass(), int.class));
        +                final Class exprClass = type.getTypeClass();
        +                method.invoke(staticCallNoLookup(ScriptRuntime.class, "switchTagAsInt", int.class, exprClass.isPrimitive()? exprClass : Object.class, int.class));
                     }
         
                     // If reasonable size and not too sparse (80%), use table otherwise use lookup.
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/codegen/Compiler.java
        --- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -245,9 +245,9 @@
             /**
              * Constructor
              *
        +     * @param env          script environment
              * @param installer    code installer
        -     * @param functionNode function node (in any available {@link CompilationState}) to compile
        -     * @param sequence     {@link Compiler#CompilationSequence} of {@link CompilationPhase}s to apply as this compilation
        +     * @param sequence     {@link Compiler.CompilationSequence} of {@link CompilationPhase}s to apply as this compilation
              * @param strict       should this compilation use strict mode semantics
              */
             //TODO support an array of FunctionNodes for batch lazy compilation
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java
        --- a/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -82,13 +82,13 @@
              * Debug field logger
              * Should we print debugging information for fields when they are generated and getters/setters are called?
              */
        -    public static final DebugLogger LOG          = new DebugLogger("fields", "nashorn.fields.debug");
        +    public static final DebugLogger LOG = new DebugLogger("fields", "nashorn.fields.debug");
         
             /**
              * is field debugging enabled. Several modules in codegen and properties use this, hence
              * public access.
              */
        -    public static final boolean     DEBUG_FIELDS = LOG.isEnabled();
        +    public static final boolean DEBUG_FIELDS = LOG.isEnabled();
         
             /**
              * Should the runtime only use java.lang.Object slots for fields? If this is false, the representation
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/codegen/types/Type.java
        --- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -36,6 +36,7 @@
         import static jdk.internal.org.objectweb.asm.Opcodes.IALOAD;
         import static jdk.internal.org.objectweb.asm.Opcodes.IASTORE;
         import static jdk.internal.org.objectweb.asm.Opcodes.INVOKESTATIC;
        +import static jdk.internal.org.objectweb.asm.Opcodes.LALOAD;
         import static jdk.internal.org.objectweb.asm.Opcodes.LASTORE;
         import static jdk.internal.org.objectweb.asm.Opcodes.NEWARRAY;
         import static jdk.internal.org.objectweb.asm.Opcodes.POP;
        @@ -43,6 +44,7 @@
         import static jdk.internal.org.objectweb.asm.Opcodes.SWAP;
         import static jdk.internal.org.objectweb.asm.Opcodes.T_DOUBLE;
         import static jdk.internal.org.objectweb.asm.Opcodes.T_INT;
        +import static jdk.internal.org.objectweb.asm.Opcodes.T_LONG;
         
         import java.lang.invoke.MethodHandle;
         import java.util.Collections;
        @@ -729,19 +731,19 @@
         
                 @Override
                 public Type aload(final MethodVisitor method) {
        -            method.visitInsn(IALOAD);
        -            return INT;
        +            method.visitInsn(LALOAD);
        +            return LONG;
                 }
         
                 @Override
                 public Type newarray(final MethodVisitor method) {
        -            method.visitIntInsn(NEWARRAY, T_INT);
        +            method.visitIntInsn(NEWARRAY, T_LONG);
                     return this;
                 }
         
                 @Override
                 public Type getElementType() {
        -            return INT;
        +            return LONG;
                 }
             };
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java
        --- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -621,8 +621,10 @@
                     elementType = Type.INT;
                     analyzeElements();
         
        -            if (elementType == Type.INT) {
        +            if (elementType.isInteger()) {
                         presetIntArray();
        +            } else if (elementType.isLong()) {
        +                presetLongArray();
                     } else if (elementType.isNumeric()) {
                         presetNumberArray();
                     } else {
        @@ -649,6 +651,25 @@
                     postsets = Arrays.copyOf(computed, nComputed);
                 }
         
        +        private void presetLongArray() {
        +            final long[] array = new long[value.length];
        +            final int[] computed = new int[value.length];
        +            int nComputed = 0;
        +
        +            for (int i = 0; i < value.length; i++) {
        +                final Object element = objectAsConstant(value[i]);
        +
        +                if (element instanceof Number) {
        +                    array[i] = ((Number)element).longValue();
        +                } else {
        +                    computed[nComputed++] = i;
        +                }
        +            }
        +
        +            presets = array;
        +            postsets = Arrays.copyOf(computed, nComputed);
        +        }
        +
                 private void presetNumberArray() {
                     final double[] array = new double[value.length];
                     final int[] computed = new int[value.length];
        @@ -746,6 +767,8 @@
                 public Type getType() {
                     if (elementType.isInteger()) {
                         return Type.INT_ARRAY;
        +            } else if (elementType.isLong()) {
        +                return Type.LONG_ARRAY;
                     } else if (elementType.isNumeric()) {
                         return Type.NUMBER_ARRAY;
                     } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -34,6 +34,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.PropertyDescriptor;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -63,16 +64,19 @@
             @Property
             public Object set;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             AccessorPropertyDescriptor() {
                 this(false, false, UNDEFINED, UNDEFINED);
             }
         
             AccessorPropertyDescriptor(final boolean configurable, final boolean enumerable, final Object get, final Object set) {
        +        super(Global.objectPrototype(), $nasgenmap$);
                 this.configurable = configurable;
                 this.enumerable   = enumerable;
                 this.get          = get;
                 this.set          = set;
        -        setProto(Global.objectPrototype());
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/ArrayBufferView.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -29,6 +29,7 @@
         import jdk.nashorn.internal.objects.annotations.Getter;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
        @@ -38,6 +39,9 @@
         @ScriptClass("ArrayBufferView")
         abstract class ArrayBufferView extends ScriptObject {
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             ArrayBufferView(final NativeArrayBuffer buffer, final int byteOffset, final int elementLength) {
                 checkConstructorArgs(buffer, byteOffset, elementLength);
                 this.setProto(getPrototype());
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.PropertyDescriptor;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
        @@ -61,16 +62,19 @@
             @Property
             public Object value;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             DataPropertyDescriptor() {
                 this(false, false, false, UNDEFINED);
             }
         
             DataPropertyDescriptor(final boolean configurable, final boolean enumerable, final boolean writable, final Object value) {
        +        super(Global.objectPrototype(), $nasgenmap$);
                 this.configurable = configurable;
                 this.enumerable   = enumerable;
                 this.writable     = writable;
                 this.value        = value;
        -        setProto(Global.objectPrototype());
             }
         
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -30,6 +30,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.PropertyDescriptor;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -51,14 +52,17 @@
             @Property
             public Object enumerable;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             GenericPropertyDescriptor() {
                 this(false, false);
             }
         
             GenericPropertyDescriptor(final boolean configurable, final boolean enumerable) {
        +        super(Global.objectPrototype(), $nasgenmap$);
                 this.configurable = configurable;
                 this.enumerable   = enumerable;
        -        setProto(Global.objectPrototype());
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/Global.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,9 +25,9 @@
         
         package jdk.nashorn.internal.objects;
         
        +import static jdk.nashorn.internal.lookup.Lookup.MH;
         import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
         import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
        -import static jdk.nashorn.internal.lookup.Lookup.MH;
         
         import java.io.IOException;
         import java.io.PrintWriter;
        @@ -43,6 +43,7 @@
         import java.util.Map;
         import jdk.internal.dynalink.linker.GuardedInvocation;
         import jdk.internal.dynalink.linker.LinkRequest;
        +import jdk.nashorn.internal.lookup.MethodHandleFactory;
         import jdk.nashorn.internal.objects.annotations.Attribute;
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
        @@ -52,8 +53,10 @@
         import jdk.nashorn.internal.runtime.GlobalObject;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.NativeJavaPackage;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptEnvironment;
         import jdk.nashorn.internal.runtime.PropertyDescriptor;
        +import jdk.nashorn.internal.runtime.arrays.ArrayData;
         import jdk.nashorn.internal.runtime.regexp.RegExpResult;
         import jdk.nashorn.internal.runtime.Scope;
         import jdk.nashorn.internal.runtime.ScriptFunction;
        @@ -378,6 +381,9 @@
         
             private final Context context;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             /**
              * Constructor
              *
        @@ -483,7 +489,7 @@
         
             @Override
             public ScriptObject newObject() {
        -        return newEmptyInstance();
        +        return new JO(getObjectPrototype());
             }
         
             @Override
        @@ -1241,7 +1247,17 @@
              * @return the new array
              */
             public static NativeArray allocate(final Object[] initial) {
        -        return new NativeArray(initial);
        +        ArrayData arrayData = ArrayData.allocate(initial);
        +
        +        for (int index = 0; index < initial.length; index++) {
        +            final Object value = initial[index];
        +
        +            if (value == ScriptRuntime.EMPTY) {
        +                arrayData = arrayData.delete(index);
        +            }
        +        }
        +
        +        return new NativeArray(arrayData);
             }
         
             /**
        @@ -1251,7 +1267,7 @@
              * @return the new array
              */
             public static NativeArray allocate(final double[] initial) {
        -        return new NativeArray(initial);
        +        return new NativeArray(ArrayData.allocate(initial));
             }
         
             /**
        @@ -1261,7 +1277,7 @@
              * @return the new array
              */
             public static NativeArray allocate(final long[] initial) {
        -        return new NativeArray(initial);
        +        return new NativeArray(ArrayData.allocate(initial));
             }
         
             /**
        @@ -1271,7 +1287,7 @@
              * @return the new array
              */
             public static NativeArray allocate(final int[] initial) {
        -        return new NativeArray(initial);
        +        return new NativeArray(ArrayData.allocate(initial));
             }
         
             /**
        @@ -1328,9 +1344,7 @@
              * @return New empty object.
              */
             public static ScriptObject newEmptyInstance() {
        -        final ScriptObject sobj = new JO();
        -        sobj.setProto(objectPrototype());
        -        return sobj;
        +        return Global.instance().newObject();
             }
         
             /**
        @@ -1544,7 +1558,7 @@
                 addOwnProperty("echo", Attribute.NOT_ENUMERABLE, value);
         
                 // Nashorn extension: global.$OPTIONS (scripting-mode-only)
        -        final ScriptObject options = newEmptyInstance();
        +        final ScriptObject options = newObject();
                 final ScriptEnvironment scriptEnv = context.getEnv();
                 copyOptions(options, scriptEnv);
                 addOwnProperty("$OPTIONS", Attribute.NOT_ENUMERABLE, options);
        @@ -1553,7 +1567,7 @@
                 if (System.getSecurityManager() == null) {
                     // do not fill $ENV if we have a security manager around
                     // Retrieve current state of ENV variables.
        -            final ScriptObject env = newEmptyInstance();
        +            final ScriptObject env = newObject();
                     env.putAll(System.getenv());
                     addOwnProperty(ScriptingFunctions.ENV_NAME, Attribute.NOT_ENUMERABLE, env);
                 } else {
        @@ -1780,7 +1794,11 @@
         
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        -        return MH.findStatic(MethodHandles.publicLookup(), Global.class, name, MH.type(rtype, types));
        +        try {
        +            return MethodHandles.lookup().findStatic(Global.class, name, MH.type(rtype, types));
        +        } catch (final NoSuchMethodException | IllegalAccessException e) {
        +            throw new MethodHandleFactory.LookupException(e);
        +        }
             }
         
             RegExpResult getLastRegExpResult() {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArguments.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,9 +25,9 @@
         
         package jdk.nashorn.internal.objects;
         
        +import static jdk.nashorn.internal.lookup.Lookup.MH;
         import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
         import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
        -import static jdk.nashorn.internal.lookup.Lookup.MH;
         
         import java.lang.invoke.MethodHandle;
         import java.lang.invoke.MethodHandles;
        @@ -42,6 +42,7 @@
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
         import jdk.nashorn.internal.lookup.Lookup;
        +import jdk.nashorn.internal.lookup.MethodHandleFactory;
         
         /**
          * ECMA 10.6 Arguments Object.
        @@ -60,13 +61,13 @@
             private static final MethodHandle G$CALLEE = findOwnMH("G$callee", Object.class, Object.class);
             private static final MethodHandle S$CALLEE = findOwnMH("S$callee", void.class, Object.class, Object.class);
         
        -    private static final PropertyMap nasgenmap$;
        +    private static final PropertyMap map$;
         
             static {
                 PropertyMap map = PropertyMap.newMap(NativeArguments.class);
                 map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH);
                 map = Lookup.newProperty(map, "callee", Property.NOT_ENUMERABLE, G$CALLEE, S$CALLEE);
        -        nasgenmap$ = map;
        +        map$ = map;
             }
         
             private Object length;
        @@ -75,8 +76,8 @@
             // This is lazily initialized - only when delete is invoked at all
             private BitSet deleted;
         
        -    NativeArguments(final Object[] arguments, final Object callee, final int numParams) {
        -        super(nasgenmap$);
        +    NativeArguments(final ScriptObject proto, final Object[] arguments, final Object callee, final int numParams) {
        +        super(proto, map$);
                 setIsArguments();
         
                 setArray(ArrayData.allocate(arguments));
        @@ -101,9 +102,6 @@
                 }
                 System.arraycopy(arguments, 0, newValues, 0, Math.min(newValues.length, arguments.length));
                 this.namedArgs = ArrayData.allocate(newValues);
        -
        -        // set Object.prototype as __proto__
        -        this.setProto(Global.objectPrototype());
             }
         
             @Override
        @@ -125,7 +123,7 @@
             @Override
             public void setArgument(final int key, final Object value) {
                 if (namedArgs.has(key)) {
        -            namedArgs.set(key, value, false);
        +            namedArgs = namedArgs.set(key, value, false);
                 }
             }
         
        @@ -552,7 +550,8 @@
             public static ScriptObject allocate(final Object[] arguments, final ScriptFunction callee, final int numParams) {
                 // Strict functions won't always have a callee for arguments, and will pass null instead.
                 final boolean isStrict = callee == null || callee.isStrict();
        -        return isStrict ? new NativeStrictArguments(arguments, numParams) : new NativeArguments(arguments, callee, numParams);
        +        final ScriptObject proto = Global.objectPrototype();
        +        return isStrict ? new NativeStrictArguments(proto, arguments, numParams) : new NativeArguments(proto, arguments, callee, numParams);
             }
         
             /**
        @@ -624,7 +623,11 @@
             }
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        -        return MH.findStatic(MethodHandles.publicLookup(), NativeArguments.class, name, MH.type(rtype, types));
        +        try {
        +            return MethodHandles.lookup().findStatic(NativeArguments.class, name, MH.type(rtype, types));
        +        } catch (final NoSuchMethodException | IllegalAccessException e) {
        +            throw new MethodHandleFactory.LookupException(e);
        +        }
             }
         
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeArray.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -50,6 +50,7 @@
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.PropertyDescriptor;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -82,6 +83,8 @@
         
             private static final InvokeByName TO_LOCALE_STRING = new InvokeByName("toLocaleString", ScriptObject.class, String.class);
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
         
             /*
              * Constructors.
        @@ -126,8 +129,8 @@
                 this.setArray(arrayData);
             }
         
        -    private NativeArray(final ArrayData arrayData) {
        -        setProto(Global.instance().getArrayPrototype());
        +    NativeArray(final ArrayData arrayData) {
        +        super(Global.instance().getArrayPrototype(), $nasgenmap$);
                 this.setArray(arrayData);
                 this.setIsArray();
             }
        @@ -856,8 +859,12 @@
                         }
         
                         // delete missing elements - which are at the end of sorted array
        -                sobj.setArray(array.delete(sorted.length, len - 1));
        -            }
        +                if (sorted.length != len) {
        +                    array = array.delete(sorted.length, len - 1);
        +                }
        +
        +                sobj.setArray(array);
        +           }
         
                     return sobj;
                 } catch (final ClassCastException | NullPointerException e) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArrayBuffer.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.Getter;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
         
        @@ -39,6 +40,9 @@
         final class NativeArrayBuffer extends ScriptObject {
             private final byte[] buffer;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             @Constructor(arity = 1)
             public static Object constructor(final boolean newObj, final Object self, final Object... args) {
                 if (args.length == 0) {
        @@ -49,8 +53,8 @@
             }
         
             protected NativeArrayBuffer(final byte[] byteArray) {
        +        super(Global.instance().getArrayBufferPrototype(), $nasgenmap$);
                 this.buffer = byteArray;
        -        this.setProto(Global.instance().getArrayBufferPrototype());
             }
         
             protected NativeArrayBuffer(final int byteLength) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeBoolean.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -37,6 +37,7 @@
         import jdk.nashorn.internal.objects.annotations.Function;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
         import jdk.nashorn.internal.lookup.MethodHandleFactory;
        @@ -52,13 +53,16 @@
         
             final static MethodHandle WRAPFILTER = findWrapFilter();
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeBoolean(final boolean value) {
                 this(value, Global.instance().getBooleanPrototype());
             }
         
             private NativeBoolean(final boolean value, final ScriptObject proto) {
        +        super(proto, $nasgenmap$);
                 this.value = value;
        -        this.setProto(proto);
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeDate.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,6 +42,7 @@
         import jdk.nashorn.internal.parser.DateParser;
         import jdk.nashorn.internal.runtime.ConsString;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptEnvironment;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
        @@ -100,16 +101,19 @@
             private double time;
             private final TimeZone timezone;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeDate() {
                 this(System.currentTimeMillis());
             }
         
             NativeDate(final double time) {
        +        super(Global.instance().getDatePrototype(), $nasgenmap$);
                 final ScriptEnvironment env = Global.getEnv();
         
                 this.time = time;
                 this.timezone = env._timezone;
        -        this.setProto(Global.instance().getDatePrototype());
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDebug.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -47,8 +47,12 @@
          */
         @ScriptClass("Debug")
         public final class NativeDebug extends ScriptObject {
        +
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeDebug() {
        -        this.setProto(Global.objectPrototype());
        +        super(Global.objectPrototype(), $nasgenmap$);
             }
         
             @Override
        @@ -187,7 +191,7 @@
                 out.println("Scope count " + ScriptObject.getScopeCount());
                 out.println("ScriptObject listeners added " + PropertyListenerManager.getListenersAdded());
                 out.println("ScriptObject listeners removed " + PropertyListenerManager.getListenersRemoved());
        -        out.println("ScriptFunction count " + ScriptObject.getCount());
        +        out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount());
                 out.println("ScriptFunction invokes " + ScriptFunction.getInvokes());
                 out.println("ScriptFunction allocations " + ScriptFunction.getAllocations());
                 out.println("PropertyMap count " + PropertyMap.getCount());
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -30,18 +30,17 @@
         
         import java.lang.invoke.MethodHandle;
         import java.lang.invoke.MethodHandles;
        -import java.util.ArrayList;
        -import java.util.List;
        -import jdk.nashorn.internal.codegen.CompilerConstants;
        +import jdk.nashorn.api.scripting.NashornException;
        +import jdk.nashorn.internal.lookup.MethodHandleFactory;
         import jdk.nashorn.internal.objects.annotations.Attribute;
         import jdk.nashorn.internal.objects.annotations.Constructor;
         import jdk.nashorn.internal.objects.annotations.Function;
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        -import jdk.nashorn.internal.runtime.ECMAErrors;
         import jdk.nashorn.internal.runtime.ECMAException;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
         
        @@ -85,8 +84,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeError(final Object msg) {
        -        this.setProto(Global.instance().getErrorPrototype());
        +        super(Global.instance().getErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        @@ -114,6 +116,21 @@
             }
         
             /**
        +     * Nashorn extension: Error.captureStackTrace. Capture stack trace at the point of call into the Error object provided.
        +     *
        +     * @param self self reference
        +     * @return undefined
        +     */
        +    @Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
        +    public static Object captureStackTrace(final Object self, final Object errorObj) {
        +        Global.checkObject(errorObj);
        +        final ScriptObject sobj = (ScriptObject)errorObj;
        +        final ECMAException exp = new ECMAException(sobj, null);
        +        sobj.set("stack", getScriptStackString(sobj, exp), false);
        +        return UNDEFINED;
        +    }
        +
        +    /**
              * Nashorn extension: Error.dumpStack
              * dumps the stack of the current thread.
              *
        @@ -143,6 +160,30 @@
             }
         
             /**
        +     * Nashorn extension: Error.prototype.getStackTrace()
        +     * "stack" property is an array typed value containing {@link StackTraceElement}
        +     * objects of JavaScript stack frames.
        +     *
        +     * @param self  self reference
        +     *
        +     * @return      stack trace as a script array.
        +     */
        +    @Function(attributes = Attribute.NOT_ENUMERABLE)
        +    public static Object getStackTrace(final Object self) {
        +        Global.checkObject(self);
        +        final ScriptObject sobj = (ScriptObject)self;
        +        final Object exception = ECMAException.getException(sobj);
        +        Object[] res;
        +        if (exception instanceof Throwable) {
        +            res = NashornException.getScriptFrames((Throwable)exception);
        +        } else {
        +            res = ScriptRuntime.EMPTY_ARRAY;
        +        }
        +
        +        return new NativeArray(res);
        +    }
        +
        +    /**
              * Nashorn extension: Error.prototype.lineNumber
              *
              * @param self self reference
        @@ -228,8 +269,8 @@
         
             /**
              * Nashorn extension: Error.prototype.stack
        -     * "stack" property is an array typed value containing {@link StackTraceElement}
        -     * objects of JavaScript stack frames.
        +     * "stack" property is a string typed value containing JavaScript stack frames.
        +     * Each frame information is separated bv "\n" character.
              *
              * @param self  self reference
              *
        @@ -243,27 +284,11 @@
                 }
         
                 final Object exception = ECMAException.getException(sobj);
        -        Object[] res;
                 if (exception instanceof Throwable) {
        -            final StackTraceElement[] frames = ((Throwable)exception).getStackTrace();
        -            final List filtered = new ArrayList<>();
        -            for (final StackTraceElement st : frames) {
        -                if (ECMAErrors.isScriptFrame(st)) {
        -                    final String className = "<" + st.getFileName() + ">";
        -                    String methodName = st.getMethodName();
        -                    if (methodName.equals(CompilerConstants.RUN_SCRIPT.symbolName())) {
        -                        methodName = "";
        -                    }
        -                    filtered.add(new StackTraceElement(className, methodName,
        -                            st.getFileName(), st.getLineNumber()));
        -                }
        -            }
        -            res = filtered.toArray();
        +            return getScriptStackString(sobj, (Throwable)exception);
                 } else {
        -            res = ScriptRuntime.EMPTY_ARRAY;
        +            return "";
                 }
        -
        -        return new NativeArray(res);
             }
         
             /**
        @@ -328,6 +353,14 @@
             }
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        -        return MH.findStatic(MethodHandles.publicLookup(), NativeError.class, name, MH.type(rtype, types));
        +        try {
        +            return MethodHandles.lookup().findStatic(NativeError.class, name, MH.type(rtype, types));
        +        } catch (final NoSuchMethodException | IllegalAccessException e) {
        +            throw new MethodHandleFactory.LookupException(e);
        +        }
        +    }
        +
        +    private static String getScriptStackString(final ScriptObject sobj, final Throwable exp) {
        +        return JSType.toString(sobj) + "\n" + NashornException.getScriptStackString(exp);
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeEvalError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -52,10 +53,13 @@
         
             /** ECMA 15.1.1.1 message property */
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
        +    public Object message;
         
        -    public Object message;
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeEvalError(final Object msg) {
        -        this.setProto(Global.instance().getEvalErrorPrototype());
        +        super(Global.instance().getEvalErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFloat32Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -46,6 +47,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 4;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFloat64Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -46,6 +47,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 8;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -38,6 +38,7 @@
         import jdk.nashorn.internal.runtime.Context;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.ParserException;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -52,6 +53,10 @@
          */
         @ScriptClass("Function")
         public final class NativeFunction {
        +
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             // do *not* create me!
             private NativeFunction() {
             }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt16Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -39,6 +40,10 @@
          */
         @ScriptClass("Int16Array")
         public final class NativeInt16Array extends ArrayBufferView {
        +
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             /**
              * The size in bytes of each element in the array.
              */
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt32Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -45,6 +46,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 4;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeInt8Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -45,6 +46,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 1;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSAdapter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,6 +42,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.FindProperty;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -142,9 +143,12 @@
         
             private static final MethodHandle IS_JSADAPTOR = findOwnMH("isJSAdaptor", boolean.class, Object.class, Object.class, MethodHandle.class, Object.class, ScriptFunction.class);
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeJSAdapter(final ScriptObject proto, final Object overrides, final ScriptObject adaptee) {
        +        super(proto, $nasgenmap$);
                 this.adaptee = wrapAdaptee(adaptee);
        -        this.setProto(proto);
                 if (overrides instanceof ScriptObject) {
                     this.overrides = true;
                     final ScriptObject sobj = (ScriptObject)overrides;
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,6 +42,7 @@
         import jdk.nashorn.internal.runtime.ConsString;
         import jdk.nashorn.internal.runtime.JSONFunctions;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;
        @@ -58,9 +59,11 @@
             private static final MethodHandle REPLACER_INVOKER = Bootstrap.createDynamicInvoker("dyn:call", Object.class,
                     ScriptFunction.class, ScriptObject.class, Object.class, Object.class);
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
         
             NativeJSON() {
        -        this.setProto(Global.objectPrototype());
        +        super(Global.objectPrototype(), $nasgenmap$);
             }
         
             /**
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeJava.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJava.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -40,6 +40,7 @@
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.ListAdapter;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.linker.JavaAdapterFactory;
         
        @@ -52,6 +53,9 @@
         @ScriptClass("Java")
         public final class NativeJava {
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private NativeJava() {
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJavaImporter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -34,6 +34,7 @@
         import jdk.nashorn.internal.objects.annotations.Function;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.runtime.NativeJavaPackage;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -55,9 +56,12 @@
         public final class NativeJavaImporter extends ScriptObject {
             private final Object[] args;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeJavaImporter(final Object[] args) {
        +        super(Global.instance().getJavaImporterPrototype(), $nasgenmap$);
                 this.args = args;
        -        this.setProto(Global.instance().getJavaImporterPrototype());
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeMath.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeMath.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.SpecializedFunction;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -41,8 +42,11 @@
         @ScriptClass("Math")
         public final class NativeMath extends ScriptObject {
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeMath() {
        -        this.setProto(Global.objectPrototype());
        +        super(Global.objectPrototype(), $nasgenmap$);
             }
         
             /** ECMA 15.8.1.1 - E, always a double constant. Not writable or configurable */
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeNumber.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -45,6 +45,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
         import jdk.nashorn.internal.lookup.MethodHandleFactory;
        @@ -83,15 +84,18 @@
             private final boolean isInt;
             private final boolean isLong;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeNumber(final double value) {
                 this(value, Global.instance().getNumberPrototype());
             }
         
             private NativeNumber(final double value, final ScriptObject proto) {
        +        super(proto, $nasgenmap$);
                 this.value = value;
                 this.isInt  = isRepresentableAsInt(value);
                 this.isLong = isRepresentableAsLong(value);
        -        this.setProto(proto);
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeObject.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -36,6 +36,7 @@
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.ECMAException;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -53,6 +54,9 @@
         public final class NativeObject {
             private static final InvokeByName TO_STRING = new InvokeByName("toString", ScriptObject.class);
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private NativeObject() {
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRangeError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -54,8 +55,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeRangeError(final Object msg) {
        -        setProto(Global.instance().getRangeErrorPrototype());
        +        super(Global.instance().getRangeErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeReferenceError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -54,8 +55,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeReferenceError(final Object msg) {
        -        this.setProto(Global.instance().getReferenceErrorPrototype());
        +        super(Global.instance().getReferenceErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExp.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -43,6 +43,7 @@
         import jdk.nashorn.internal.runtime.BitVector;
         import jdk.nashorn.internal.runtime.JSType;
         import jdk.nashorn.internal.runtime.ParserException;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.regexp.RegExp;
         import jdk.nashorn.internal.runtime.regexp.RegExpFactory;
         import jdk.nashorn.internal.runtime.regexp.RegExpResult;
        @@ -66,6 +67,9 @@
             // Reference to global object needed to support static RegExp properties
             private Global globalObject;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeRegExp(final String input, final String flagString) {
                 try {
                     this.regexp = RegExpFactory.create(input, flagString);
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Setter;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.regexp.RegExpResult;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
        @@ -49,14 +50,22 @@
             @Property
             public Object input;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeRegExpExecResult(final RegExpResult result) {
        -        setProto(Global.instance().getArrayPrototype());
        +        super(Global.instance().getArrayPrototype(), $nasgenmap$);
                 setIsArray();
                 this.setArray(ArrayData.allocate(result.getGroups().clone()));
                 this.index = result.getIndex();
                 this.input = result.getInput();
             }
         
        +    @Override
        +    public String getClassName() {
        +        return "Array";
        +    }
        +
             /**
              * Length getter
              * @param self self reference
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeStrictArguments.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -37,6 +37,7 @@
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         import jdk.nashorn.internal.lookup.Lookup;
        +import jdk.nashorn.internal.lookup.MethodHandleFactory;
         
         /**
          * ECMA 10.6 Arguments Object.
        @@ -50,22 +51,24 @@
             private static final MethodHandle S$LENGTH = findOwnMH("S$length", void.class, Object.class, Object.class);
         
             // property map for strict mode arguments object
        -    private static final PropertyMap nasgenmap$;
        +    private static final PropertyMap map$;
         
             static {
                 PropertyMap map = PropertyMap.newMap(NativeStrictArguments.class);
                 map = Lookup.newProperty(map, "length", Property.NOT_ENUMERABLE, G$LENGTH, S$LENGTH);
                 // In strict mode, the caller and callee properties should throw TypeError
        -        map = ScriptFunctionImpl.newThrowerProperty(map, "caller");
        -        map = ScriptFunctionImpl.newThrowerProperty(map, "callee");
        -        nasgenmap$ = map;
        +        // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
        +        final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
        +        map = map.addProperty(map.newUserAccessors("caller", flags));
        +        map = map.addProperty(map.newUserAccessors("callee", flags));
        +        map$ = map;
             }
         
             private Object   length;
             private final Object[] namedArgs;
         
        -    NativeStrictArguments(final Object[] values, final int numParams) {
        -        super(nasgenmap$);
        +    NativeStrictArguments(final ScriptObject proto, final Object[] values, final int numParams) {
        +        super(proto, map$);
                 setIsArguments();
         
                 final ScriptFunction func = ScriptFunctionImpl.getTypeErrorThrower();
        @@ -83,8 +86,6 @@
                     Arrays.fill(namedArgs, UNDEFINED);
                 }
                 System.arraycopy(values, 0, namedArgs, 0, Math.min(namedArgs.length, values.length));
        -
        -        this.setProto(Global.objectPrototype());
             }
         
             @Override
        @@ -142,6 +143,10 @@
             }
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        -        return MH.findStatic(MethodHandles.publicLookup(), NativeStrictArguments.class, name, MH.type(rtype, types));
        +        try {
        +            return MethodHandles.lookup().findStatic(NativeStrictArguments.class, name, MH.type(rtype, types));
        +        } catch (final NoSuchMethodException | IllegalAccessException e) {
        +            throw new MethodHandleFactory.LookupException(e);
        +        }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeString.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeString.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -52,6 +52,7 @@
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.ConsString;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.ScriptRuntime;
        @@ -70,14 +71,17 @@
         
             static final MethodHandle WRAPFILTER = findWrapFilter();
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeString(final CharSequence value) {
                 this(value, Global.instance().getStringPrototype());
             }
         
             private NativeString(final CharSequence value, final ScriptObject proto) {
        +        super(proto, $nasgenmap$);
                 assert value instanceof String || value instanceof ConsString;
                 this.value = value;
        -        this.setProto(proto);
             }
         
             @Override
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeSyntaxError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -54,8 +55,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeSyntaxError(final Object msg) {
        -        this.setProto(Global.instance().getSyntaxErrorPrototype());
        +        super(Global.instance().getSyntaxErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeTypeError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -54,8 +55,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeTypeError(final Object msg) {
        -        this.setProto(Global.instance().getTypeErrorPrototype());
        +        super(Global.instance().getTypeErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeURIError.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,6 +33,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         
         /**
        @@ -53,8 +54,11 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE, where = Where.PROTOTYPE)
             public Object message;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             NativeURIError(final Object msg) {
        -        this.setProto(Global.instance().getURIErrorPrototype());
        +        super(Global.instance().getURIErrorPrototype(), $nasgenmap$);
                 if (msg != UNDEFINED) {
                     this.instMessage = JSType.toString(msg);
                 } else {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint16Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -45,6 +46,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 2;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint32Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -46,6 +47,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 4;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteBegin, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint8Array.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -31,6 +31,7 @@
         import jdk.nashorn.internal.objects.annotations.Property;
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -45,6 +46,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 1;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,6 +32,7 @@
         import jdk.nashorn.internal.objects.annotations.ScriptClass;
         import jdk.nashorn.internal.objects.annotations.Where;
         import jdk.nashorn.internal.runtime.JSType;
        +import jdk.nashorn.internal.runtime.PropertyMap;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.runtime.arrays.ArrayData;
         
        @@ -46,6 +47,9 @@
             @Property(attributes = Attribute.NOT_ENUMERABLE | Attribute.NOT_WRITABLE | Attribute.NOT_CONFIGURABLE, where = Where.CONSTRUCTOR)
             public static final int BYTES_PER_ELEMENT = 1;
         
        +    // initialized by nasgen
        +    private static PropertyMap $nasgenmap$;
        +
             private static final Factory FACTORY = new Factory(BYTES_PER_ELEMENT) {
                 @Override
                 public ArrayBufferView construct(final NativeArrayBuffer buffer, final int byteOffset, final int length) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -35,6 +35,7 @@
         import jdk.nashorn.internal.runtime.ScriptFunction;
         import jdk.nashorn.internal.runtime.ScriptObject;
         import jdk.nashorn.internal.lookup.Lookup;
        +import jdk.nashorn.internal.lookup.MethodHandleFactory;
         
         /**
          * Instances of this class serve as "prototype" object for script functions.
        @@ -43,7 +44,7 @@
          *
          */
         public class PrototypeObject extends ScriptObject {
        -    private static final PropertyMap nasgenmap$;
        +    private static final PropertyMap map$;
         
             private Object constructor;
         
        @@ -53,11 +54,11 @@
             static {
                 PropertyMap map = PropertyMap.newMap(PrototypeObject.class);
                 map = Lookup.newProperty(map, "constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR);
        -        nasgenmap$ = map;
        +        map$ = map;
             }
         
             PrototypeObject() {
        -        this(nasgenmap$);
        +        this(map$);
             }
         
             /**
        @@ -66,12 +67,12 @@
              * @param map property map
              */
             public PrototypeObject(final PropertyMap map) {
        -        super(map != nasgenmap$ ? map.addAll(nasgenmap$) : nasgenmap$);
        +        super(map != map$ ? map.addAll(map$) : map$);
                 setProto(Global.objectPrototype());
             }
         
             PrototypeObject(final ScriptFunction func) {
        -        this();
        +        this(map$);
                 this.constructor = func;
             }
         
        @@ -106,6 +107,10 @@
             }
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        -        return MH.findStatic(MethodHandles.publicLookup(), PrototypeObject.class, name, MH.type(rtype, types));
        +        try {
        +            return MethodHandles.lookup().findStatic(PrototypeObject.class, name, MH.type(rtype, types));
        +        } catch (final NoSuchMethodException | IllegalAccessException e) {
        +            throw new MethodHandleFactory.LookupException(e);
        +        }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
        --- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -51,7 +51,7 @@
             // property map for bound functions
             private static final PropertyMap boundfunctionmap$;
             // property map for non-strict, non-bound functions.
        -    private static final PropertyMap nasgenmap$;
        +    private static final PropertyMap map$;
         
             // Marker object for lazily initialized prototype object
             private static final Object LAZY_PROTOTYPE = new Object();
        @@ -65,7 +65,7 @@
              * @param specs specialized versions of this method, if available, null otherwise
              */
             ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final MethodHandle[] specs) {
        -        super(name, invokeHandle, nasgenmap$, null, specs, false, true, true);
        +        super(name, invokeHandle, map$, null, specs, false, true, true);
                 init();
             }
         
        @@ -79,7 +79,7 @@
              * @param specs specialized versions of this method, if available, null otherwise
              */
             ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final MethodHandle[] specs) {
        -        super(name, invokeHandle, map.addAll(nasgenmap$), null, specs, false, true, true);
        +        super(name, invokeHandle, map.addAll(map$), null, specs, false, true, true);
                 init();
             }
         
        @@ -124,8 +124,8 @@
                 map = Lookup.newProperty(map, "prototype", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, G$PROTOTYPE, S$PROTOTYPE);
                 map = Lookup.newProperty(map, "length",    Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$LENGTH, null);
                 map = Lookup.newProperty(map, "name",      Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$NAME, null);
        -        nasgenmap$ = map;
        -        strictmodemap$ = createStrictModeMap(nasgenmap$);
        +        map$ = map;
        +        strictmodemap$ = createStrictModeMap(map$);
                 boundfunctionmap$ = createBoundFunctionMap(strictmodemap$);
             }
         
        @@ -149,19 +149,17 @@
                 return typeErrorThrower;
             }
         
        -    // add a new property that throws TypeError on get as well as set
        -    static synchronized PropertyMap newThrowerProperty(final PropertyMap map, final String name) {
        -        return map.newProperty(name, Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, -1,
        -                Lookup.TYPE_ERROR_THROWER_GETTER, Lookup.TYPE_ERROR_THROWER_SETTER);
        -    }
        -
        -    private static PropertyMap createStrictModeMap(final PropertyMap functionMap) {
        -        return newThrowerProperty(newThrowerProperty(functionMap, "arguments"), "caller");
        +    private static PropertyMap createStrictModeMap(PropertyMap map) {
        +        final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
        +        // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
        +        map = map.addProperty(map.newUserAccessors("arguments", flags));
        +        map = map.addProperty(map.newUserAccessors("caller", flags));
        +        return map;
             }
         
             // Choose the map based on strict mode!
             private static PropertyMap getMap(final boolean strict) {
        -        return strict ? strictmodemap$ : nasgenmap$;
        +        return strict ? strictmodemap$ : map$;
             }
         
             private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
        @@ -260,12 +258,15 @@
                 this.setProto(Global.instance().getFunctionPrototype());
                 this.prototype = LAZY_PROTOTYPE;
         
        -        if (isStrict()) {
        -            final ScriptFunction func = getTypeErrorThrower();
        -            // We have to fill user accessor functions late as these are stored
        -            // in this object rather than in the PropertyMap of this object.
        -            setUserAccessors("arguments", func, func);
        -            setUserAccessors("caller", func, func);
        +        // We have to fill user accessor functions late as these are stored
        +        // in this object rather than in the PropertyMap of this object.
        +
        +        if (findProperty("arguments", true) != null) {
        +            setUserAccessors("arguments", getTypeErrorThrower(), getTypeErrorThrower());
        +        }
        +
        +        if (findProperty("caller", true) != null) {
        +            setUserAccessors("caller", getTypeErrorThrower(), getTypeErrorThrower());
                 }
             }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/parser/Parser.java
        --- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -535,15 +535,12 @@
                     if (!(lhs instanceof AccessNode ||
                           lhs instanceof IndexNode ||
                           lhs instanceof IdentNode)) {
        -                if (env._early_lvalue_error) {
        -                    throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
        -                }
        -                return referenceError(lhs, rhs);
        +                return referenceError(lhs, rhs, env._early_lvalue_error);
                     }
         
                     if (lhs instanceof IdentNode) {
                         if (!checkIdentLValue((IdentNode)lhs)) {
        -                    return referenceError(lhs, rhs);
        +                    return referenceError(lhs, rhs, false);
                         }
                         verifyStrictIdent((IdentNode)lhs, "assignment");
                     }
        @@ -767,8 +764,6 @@
                 case LBRACE:
                     block();
                     break;
        -        case RBRACE:
        -            break;
                 case VAR:
                     variableStatement(true);
                     break;
        @@ -1267,6 +1262,7 @@
                 case RBRACE:
                 case SEMICOLON:
                 case EOL:
        +        case EOF:
                     break;
         
                 default:
        @@ -1314,6 +1310,7 @@
                 case RBRACE:
                 case SEMICOLON:
                 case EOL:
        +        case EOF:
                     break;
         
                 default:
        @@ -1368,6 +1365,7 @@
                 case RBRACE:
                 case SEMICOLON:
                 case EOL:
        +        case EOF:
                     break;
         
                 default:
        @@ -1403,6 +1401,7 @@
                 case RBRACE:
                 case SEMICOLON:
                 case EOL:
        +        case EOF:
                     break;
         
                 default:
        @@ -1928,7 +1927,7 @@
         
                 // Object context.
                 // Prepare to accumulate elements.
        -       // final List elements = new ArrayList<>();
        +        // final List elements = new ArrayList<>();
                 final Map map = new LinkedHashMap<>();
         
                 // Create a block for the object literal.
        @@ -1941,6 +1940,9 @@
                             break loop;
         
                         case COMMARIGHT:
        +                    if (commaSeen) {
        +                        throw error(AbstractParser.message("expected.property.id", type.getNameOrType()));
        +                    }
                             next();
                             commaSeen = true;
                             break;
        @@ -2566,7 +2568,7 @@
                          */
         
                         // just expression as function body
        -                final Node expr = expression();
        +                final Node expr = assignmentExpression(true);
                         assert lc.getCurrentBlock() == lc.getFunctionBody(functionNode);
                         // create a return statement - this creates code in itself and does not need to be
                         // wrapped into an ExecuteNode
        @@ -2612,7 +2614,10 @@
                 }
             }
         
        -    private static RuntimeNode referenceError(final Node lhs, final Node rhs) {
        +    private RuntimeNode referenceError(final Node lhs, final Node rhs, final boolean earlyError) {
        +        if (earlyError) {
        +            throw error(JSErrorType.REFERENCE_ERROR, AbstractParser.message("invalid.lvalue"), lhs.getToken());
        +        }
                 final ArrayList args = new ArrayList<>();
                 args.add(lhs);
                 if (rhs == null) {
        @@ -2690,18 +2695,18 @@
                     final Node lhs = leftHandSideExpression();
                     // ++, -- without operand..
                     if (lhs == null) {
        -                // error would have been issued when looking for 'lhs'
        -                return null;
        +                throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
                     }
        +
                     if (!(lhs instanceof AccessNode ||
                           lhs instanceof IndexNode ||
                           lhs instanceof IdentNode)) {
        -                return referenceError(lhs, null);
        +                return referenceError(lhs, null, env._early_lvalue_error);
                     }
         
                     if (lhs instanceof IdentNode) {
                         if (!checkIdentLValue((IdentNode)lhs)) {
        -                    return referenceError(lhs, null);
        +                    return referenceError(lhs, null, false);
                         }
                         verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
                     }
        @@ -2720,16 +2725,21 @@
                     case DECPREFIX:
                         final TokenType opType = type;
                         final Node lhs = expression;
        +                // ++, -- without operand..
        +                if (lhs == null) {
        +                    throw error(AbstractParser.message("expected.lvalue", type.getNameOrType()));
        +                }
        +
                         if (!(lhs instanceof AccessNode ||
                            lhs instanceof IndexNode ||
                            lhs instanceof IdentNode)) {
                             next();
        -                    return referenceError(lhs, null);
        +                    return referenceError(lhs, null, env._early_lvalue_error);
                         }
                         if (lhs instanceof IdentNode) {
                             if (!checkIdentLValue((IdentNode)lhs)) {
                                 next();
        -                        return referenceError(lhs, null);
        +                        return referenceError(lhs, null, false);
                             }
                             verifyStrictIdent((IdentNode)lhs, "operand for " + opType.getName() + " operator");
                         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -288,7 +288,7 @@
             }
         
             @Override
        -    protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict)  {
        +    public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict)  {
                 if (isSpill()) {
                     self.spill[getSlot()] = value;
                 } else {
        @@ -303,7 +303,7 @@
             }
         
             @Override
        -    protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
        +    public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
                 if (isSpill()) {
                     return self.spill[getSlot()];
                 }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/Context.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -101,13 +101,7 @@
             /** Is Context global debug mode enabled ? */
             public static final boolean DEBUG = Options.getBooleanProperty("nashorn.debug");
         
        -    private static final ThreadLocal currentGlobal =
        -        new ThreadLocal() {
        -            @Override
        -            protected ScriptObject initialValue() {
        -                 return null;
        -            }
        -        };
        +    private static final ThreadLocal currentGlobal = new ThreadLocal<>();
         
             /**
              * Get the current global scope
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/ECMAException.java
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/FindProperty.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -89,7 +89,7 @@
                 MethodHandle setter = property.getSetter(type, getOwner().getMap());
                 if (property instanceof UserAccessorProperty) {
                     final UserAccessorProperty uc = (UserAccessorProperty) property;
        -            setter = MH.insertArguments(setter, 0, (isInherited() ? getOwner() : null),
        +            setter = MH.insertArguments(setter, 0, isInherited() ? getOwner() : null,
                             uc.getSetterSlot(), strict? property.getKey() : null);
                 }
         
        @@ -109,7 +109,7 @@
              * @return appropriate receiver
              */
             public ScriptObject getGetterReceiver() {
        -        return property != null && property.hasGetterFunction() ? self : prototype;
        +        return property != null && property.hasGetterFunction(prototype) ? self : prototype;
             }
         
            /**
        @@ -117,7 +117,7 @@
              * @return appropriate receiver
              */
             public ScriptObject getSetterReceiver() {
        -        return property != null && property.hasSetterFunction() ? self : prototype;
        +        return property != null && property.hasSetterFunction(prototype) ? self : prototype;
             }
         
             /**
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/FunctionScope.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/FunctionScope.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/FunctionScope.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -54,9 +54,8 @@
              * @param arguments   arguments
              */
             public FunctionScope(final PropertyMap map, final ScriptObject callerScope, final Object arguments) {
        -        super(map);
        +        super(callerScope, map);
                 this.arguments = arguments;
        -        setProto(callerScope);
                 setIsScope();
             }
         
        @@ -67,9 +66,8 @@
              * @param callerScope caller scope
              */
             public FunctionScope(final PropertyMap map, final ScriptObject callerScope) {
        -        super(map);
        +        super(callerScope, map);
                 this.arguments = null;
        -        setProto(callerScope);
                 setIsScope();
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/JSType.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -911,7 +911,7 @@
         
                 for (int i = start; i < length ; i++) {
                     if (digit(chars[i], radix) == -1) {
        -                break;
        +                return Double.NaN;
                     }
                     pos++;
                 }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/Property.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -180,17 +180,19 @@
         
             /**
              * Check whether this property has a user defined getter function. See {@link UserAccessorProperty}
        +     * @param obj object containing getter
              * @return true if getter function exists, false is default
              */
        -    public boolean hasGetterFunction() {
        +    public boolean hasGetterFunction(final ScriptObject obj) {
                 return false;
             }
         
             /**
              * Check whether this property has a user defined setter function. See {@link UserAccessorProperty}
        +     * @param obj object containing setter
              * @return true if getter function exists, false is default
              */
        -    public boolean hasSetterFunction() {
        +    public boolean hasSetterFunction(final ScriptObject obj) {
                 return false;
             }
         
        @@ -363,7 +365,7 @@
              * @param value the new property value
              * @param strict is this a strict setter?
              */
        -    protected abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
        +    public abstract void setObjectValue(ScriptObject self, ScriptObject owner, Object value, boolean strict);
         
             /**
              * Set the Object value of this property from {@code owner}. This allows to bypass creation of the
        @@ -373,7 +375,7 @@
              * @param owner the owner object
              * @return  the property value
              */
        -    protected abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
        +    public abstract Object getObjectValue(ScriptObject self, ScriptObject owner);
         
             /**
              * Abstract method for retrieving the setter for the property. We do not know
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -25,6 +25,8 @@
         
         package jdk.nashorn.internal.runtime;
         
        +import jdk.nashorn.internal.scripts.JO;
        +
         import static jdk.nashorn.internal.runtime.PropertyHashMap.EMPTY_HASHMAP;
         
         import java.lang.invoke.MethodHandle;
        @@ -166,7 +168,7 @@
              */
             public static PropertyMap newMap(final Class structure, final Collection properties, final int fieldCount, final int fieldMaximum) {
                 // Reduce the number of empty maps in the context.
        -        if (structure == jdk.nashorn.internal.scripts.JO.class) {
        +        if (structure == JO.class) {
                     return EMPTY_MAP;
                 }
         
        @@ -302,7 +304,7 @@
              *
              * @return New {@link PropertyMap} with {@link Property} added.
              */
        -    PropertyMap addProperty(final Property property) {
        +    public PropertyMap addProperty(final Property property) {
                 PropertyMap newMap = checkHistory(property);
         
                 if (newMap == null) {
        @@ -383,6 +385,21 @@
                 return newMap;
             }
         
        +    /*
        +     * Make a new UserAccessorProperty property. getter and setter functions are stored in
        +     * this ScriptObject and slot values are used in property object. Note that slots
        +     * are assigned speculatively and should be added to map before adding other
        +     * properties.
        +     */
        +    public UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) {
        +        int oldSpillLength = spillLength;
        +
        +        final int getterSlot = oldSpillLength++;
        +        final int setterSlot = oldSpillLength++;
        +
        +        return new UserAccessorProperty(key, propertyFlags, getterSlot, setterSlot);
        +    }
        +
             /**
              * Find a property in the map.
              *
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -203,6 +203,16 @@
             }
         
             /**
        +     * Execute this script function as a constructor.
        +     * @param arguments  Call arguments.
        +     * @return Newly constructed result.
        +     * @throws Throwable if there is an exception/error with the invocation or thrown from it
        +     */
        +    Object construct(final Object... arguments) throws Throwable {
        +        return data.construct(this, arguments);
        +    }
        +
        +    /**
              * Allocate function. Called from generated {@link ScriptObject} code
              * for allocation as a factory method
              *
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -216,6 +216,12 @@
                 return composeGenericMethod(code.mostGeneric().getInvoker());
             }
         
        +    final MethodHandle getGenericConstructor() {
        +        ensureCodeGenerated();
        +        ensureConstructor(code.mostGeneric());
        +        return composeGenericMethod(code.mostGeneric().getConstructor());
        +    }
        +
             private CompiledFunction getBest(final MethodType callSiteType) {
                 ensureCodeGenerated();
                 return code.best(callSiteType);
        @@ -535,10 +541,74 @@
                 }
             }
         
        +    Object construct(final ScriptFunction fn, final Object... arguments) throws Throwable {
        +        final MethodHandle mh = getGenericConstructor();
        +
        +        final Object[]     args       = arguments == null ? ScriptRuntime.EMPTY_ARRAY : arguments;
        +
        +        if (isVarArg(mh)) {
        +            if (needsCallee(mh)) {
        +                return mh.invokeExact(fn, args);
        +            }
        +            return mh.invokeExact(args);
        +        }
        +
        +        final int paramCount = mh.type().parameterCount();
        +        if (needsCallee(mh)) {
        +            switch (paramCount) {
        +            case 1:
        +                return mh.invokeExact(fn);
        +            case 2:
        +                return mh.invokeExact(fn, getArg(args, 0));
        +            case 3:
        +                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1));
        +            case 4:
        +                return mh.invokeExact(fn, getArg(args, 0), getArg(args, 1), getArg(args, 2));
        +            default:
        +                return mh.invokeWithArguments(withArguments(fn, paramCount, args));
        +            }
        +        }
        +
        +        switch (paramCount) {
        +        case 0:
        +            return mh.invokeExact();
        +        case 1:
        +            return mh.invokeExact(getArg(args, 0));
        +        case 2:
        +            return mh.invokeExact(getArg(args, 0), getArg(args, 1));
        +        case 3:
        +            return mh.invokeExact(getArg(args, 0), getArg(args, 1), getArg(args, 2));
        +        default:
        +            return mh.invokeWithArguments(withArguments(null, paramCount, args));
        +        }
        +    }
        +
             private static Object getArg(final Object[] args, final int i) {
                 return i < args.length ? args[i] : UNDEFINED;
             }
         
        +    private static Object[] withArguments(final ScriptFunction fn, final int argCount, final Object[] args) {
        +        final Object[] finalArgs = new Object[argCount];
        +
        +        int nextArg = 0;
        +        if (fn != null) {
        +            //needs callee
        +            finalArgs[nextArg++] = fn;
        +        }
        +
        +        // Don't add more args that there is argCount in the handle (including self and callee).
        +        for (int i = 0; i < args.length && nextArg < argCount;) {
        +            finalArgs[nextArg++] = args[i++];
        +        }
        +
        +        // If we have fewer args than argCount, pad with undefined.
        +        while (nextArg < argCount) {
        +            finalArgs[nextArg++] = UNDEFINED;
        +        }
        +
        +        return finalArgs;
        +    }
        +
             private static Object[] withArguments(final ScriptFunction fn, final Object self, final int argCount, final Object[] args) {
                 final Object[] finalArgs = new Object[argCount];
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -170,13 +170,30 @@
                 }
         
                 this.arrayData = ArrayData.EMPTY_ARRAY;
        -
        -        if (map == null) {
        -            this.setMap(PropertyMap.newMap(getClass()));
        -            return;
        +        this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
        +    }
        +
        +    /**
        +     * Constructor that directly sets the prototype to {@code proto} and property map to
        +     * {@code map} without invalidating the map as calling {@link #setProto(ScriptObject)}
        +     * would do. This should only be used for objects that are always constructed with the
        +     * same combination of prototype and property map.
        +     *
        +     * @param proto the prototype object
        +     * @param map intial {@link PropertyMap}
        +     */
        +    protected ScriptObject(final ScriptObject proto, final PropertyMap map) {
        +        if (Context.DEBUG) {
        +            ScriptObject.count++;
                 }
         
        -        this.setMap(map);
        +        this.arrayData = ArrayData.EMPTY_ARRAY;
        +        this.setMap(map == null ? PropertyMap.newMap(getClass()) : map);
        +        this.proto = proto;
        +
        +        if (proto != null) {
        +            proto.setIsPrototype();
        +        }
             }
         
             /**
        @@ -777,30 +794,18 @@
             public final Property modifyOwnProperty(final Property oldProperty, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
                 Property newProperty;
                 if (oldProperty instanceof UserAccessorProperty) {
        -            // re-use the slots of the old user accessor property.
                     final UserAccessorProperty uc = (UserAccessorProperty) oldProperty;
        -
        -            int getterSlot = uc.getGetterSlot();
        -            // clear the old getter and set the new getter
        +            final int getterSlot = uc.getGetterSlot();
        +            final int setterSlot = uc.getSetterSlot();
                     setSpill(getterSlot, getter);
        -            // if getter function is null, flag the slot to be negative (less by 1)
        -            if (getter == null) {
        -                getterSlot = -getterSlot - 1;
        -            }
        -
        -            int setterSlot = uc.getSetterSlot();
        -            // clear the old setter and set the new setter
                     setSpill(setterSlot, setter);
        -            // if setter function is null, flag the slot to be negative (less by 1)
        -            if (setter == null) {
        -                setterSlot = -setterSlot - 1;
        +
        +            // if just flipping getter and setter with new functions, no need to change property or map
        +            if (uc.flags == propertyFlags) {
        +                return oldProperty;
                     }
         
                     newProperty = new UserAccessorProperty(oldProperty.getKey(), propertyFlags, getterSlot, setterSlot);
        -            // if just flipping getter and setter with new functions, no need to change property or map
        -            if (oldProperty.equals(newProperty)) {
        -                return oldProperty;
        -            }
                 } else {
                     // erase old property value and create new user accessor property
                     erasePropertyValue(oldProperty);
        @@ -862,12 +867,10 @@
              */
             public final void setUserAccessors(final String key, final ScriptFunction getter, final ScriptFunction setter) {
                 final Property oldProperty = getMap().findProperty(key);
        -        if (oldProperty != null) {
        -            final UserAccessorProperty newProperty = newUserAccessors(oldProperty.getKey(), oldProperty.getFlags(), getter, setter);
        -            modifyOwnProperty(oldProperty, newProperty);
        +        if (oldProperty instanceof UserAccessorProperty) {
        +            modifyOwnProperty(oldProperty, oldProperty.getFlags(), getter, setter);
                 } else {
        -            final UserAccessorProperty newProperty = newUserAccessors(key, 0, getter, setter);
        -            addOwnProperty(newProperty);
        +            addOwnProperty(newUserAccessors(key, oldProperty != null ? oldProperty.getFlags() : 0, getter, setter));
                 }
             }
         
        @@ -1712,7 +1715,7 @@
         
                     final ScriptObject prototype = find.getOwner();
         
        -            if (!property.hasGetterFunction()) {
        +            if (!property.hasGetterFunction(prototype)) {
                         methodHandle = bindTo(methodHandle, prototype);
                     }
                     return new GuardedInvocation(methodHandle, getMap().getProtoGetSwitchPoint(proto, name), guard);
        @@ -3144,49 +3147,30 @@
              * Make a new UserAccessorProperty property. getter and setter functions are stored in
              * this ScriptObject and slot values are used in property object.
              */
        -    private UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
        -        int oldSpillLength = getMap().getSpillLength();
        -
        -        int getterSlot = oldSpillLength++;
        -        setSpill(getterSlot, getter);
        -        // if getter function is null, flag the slot to be negative (less by 1)
        -        if (getter == null) {
        -            getterSlot = -getterSlot - 1;
        -        }
        -
        -        int setterSlot = oldSpillLength++;
        -
        -        setSpill(setterSlot, setter);
        -        // if setter function is null, flag the slot to be negative (less by 1)
        -        if (setter == null) {
        -            setterSlot = -setterSlot - 1;
        -        }
        -
        -        return new UserAccessorProperty(key, propertyFlags, getterSlot, setterSlot);
        +    protected final UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
        +        final UserAccessorProperty property = getMap().newUserAccessors(key, propertyFlags);
        +        setSpill(property.getGetterSlot(), getter);
        +        setSpill(property.getSetterSlot(), setter);
        +
        +        return property;
             }
         
        -    private void setSpill(final int slot, final Object value) {
        -        if (slot >= 0) {
        -            final int index = slot;
        -            if (spill == null) {
        -                // create new spill.
        -                spill = new Object[Math.max(index + 1, SPILL_RATE)];
        -            } else if (index >= spill.length) {
        -                // grow spill as needed
        -                final Object[] newSpill = new Object[index + 1];
        -                System.arraycopy(spill, 0, newSpill, 0, spill.length);
        -                spill = newSpill;
        -            }
        -
        -            spill[index] = value;
        +    protected final void setSpill(final int slot, final Object value) {
        +        if (spill == null) {
        +            // create new spill.
        +            spill = new Object[Math.max(slot + 1, SPILL_RATE)];
        +        } else if (slot >= spill.length) {
        +            // grow spill as needed
        +            final Object[] newSpill = new Object[slot + 1];
        +            System.arraycopy(spill, 0, newSpill, 0, spill.length);
        +            spill = newSpill;
                 }
        +
        +        spill[slot] = value;
             }
         
        -    // user accessors are either stored in spill array slots
        -    // get the accessor value using slot number. Note that slot is spill array index.
        -    Object getSpill(final int slot) {
        -        final int index = slot;
        -        return (index < 0 || (index >= spill.length)) ? null : spill[index];
        +    protected Object getSpill(final int slot) {
        +        return spill != null && slot < spill.length ? spill[slot] : null;
             }
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -127,6 +127,17 @@
              * @param deflt default to use if not convertible.
              * @return int tag value (or deflt.)
              */
        +    public static int switchTagAsInt(final boolean tag, final int deflt) {
        +        return deflt;
        +    }
        +
        +    /**
        +     * Converts a switch tag value to a simple integer. deflt value if it can't.
        +     *
        +     * @param tag   Switch statement tag value.
        +     * @param deflt default to use if not convertible.
        +     * @return int tag value (or deflt.)
        +     */
             public static int switchTagAsInt(final long tag, final int deflt) {
                 return isRepresentableAsInt(tag) ? (int)tag : deflt;
             }
        @@ -361,6 +372,47 @@
             }
         
             /**
        +     * Check that the target function is associated with current Context.
        +     * And also make sure that 'self', if ScriptObject, is from current context.
        +     *
        +     * Call a function as a constructor given args.
        +     *
        +     * @param target ScriptFunction object.
        +     * @param args   Call arguments.
        +     * @return Constructor call result.
        +     */
        +    public static Object checkAndConstruct(final ScriptFunction target, final Object... args) {
        +        final ScriptObject global = Context.getGlobalTrusted();
        +        if (! (global instanceof GlobalObject)) {
        +            throw new IllegalStateException("No current global set");
        +        }
        +
        +        if (target.getContext() != global.getContext()) {
        +            throw new IllegalArgumentException("'target' function is not from current Context");
        +        }
        +
        +        // all in order - call real 'construct'
        +        return construct(target, args);
        +    }
        +
        +    /*
        +     * Call a script function as a constructor with given args.
        +     *
        +     * @param target ScriptFunction object.
        +     * @param args   Call arguments.
        +     * @return Constructor call result.
        +     */
        +    public static Object construct(final ScriptFunction target, final Object... args) {
        +        try {
        +            return target.construct(args);
        +        } catch (final RuntimeException | Error e) {
        +            throw e;
        +        } catch (final Throwable t) {
        +            throw new RuntimeException(t);
        +        }
        +    }
        +
        +    /**
              * Generic implementation of ECMA 9.12 - SameValue algorithm
              *
              * @param x first value to compare
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/SetMethodCreator.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -151,9 +151,10 @@
                 assert methodHandle != null;
                 assert property     != null;
         
        +        final ScriptObject prototype = find.getOwner();
                 final MethodHandle boundHandle;
        -        if (!property.hasSetterFunction() && find.isInherited()) {
        -            boundHandle = ScriptObject.bindTo(methodHandle, find.getOwner());
        +        if (!property.hasSetterFunction(prototype) && find.isInherited()) {
        +            boundHandle = ScriptObject.bindTo(methodHandle, prototype);
                 } else {
                     boundHandle = methodHandle;
                 }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/URIUtils.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -27,8 +27,6 @@
         
         import static jdk.nashorn.internal.runtime.ECMAErrors.uriError;
         
        -import java.io.UnsupportedEncodingException;
        -
         /**
          * URI handling global functions. ECMA 15.1.3 URI Handling Function Properties
          *
        @@ -127,6 +125,7 @@
         
                     k += 2;
                     char C;
        +            // Most significant bit is zero
                     if ((B & 0x80) == 0) {
                         C = (char) B;
                         if (!component && URI_RESERVED.indexOf(C) >= 0) {
        @@ -137,49 +136,68 @@
                             sb.append(C);
                         }
                     } else {
        -                int n;
        -                for (n = 1; n < 6; n++) {
        -                    if (((B << n) & 0x80) == 0) {
        -                        break;
        -                    }
        -                }
        +                // n is utf8 length, V is codepoint and minV is lower bound
        +                int n, V, minV;
         
        -                if (n == 1 || n > 4) {
        +                if ((B & 0xC0) == 0x80) {
        +                    // 10xxxxxx - illegal first byte
        +                    return error(string, k);
        +                } else if ((B & 0x20) == 0) {
        +                    // 110xxxxx 10xxxxxx
        +                    n = 2;
        +                    V = B & 0x1F;
        +                    minV = 0x80;
        +                } else if ((B & 0x10) == 0) {
        +                    // 1110xxxx 10xxxxxx 10xxxxxx
        +                    n = 3;
        +                    V = B & 0x0F;
        +                    minV = 0x800;
        +                } else if ((B & 0x08) == 0) {
        +                    // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
        +                    n = 4;
        +                    V = B & 0x07;
        +                    minV = 0x10000;
        +                } else if ((B & 0x04) == 0) {
        +                    // 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
        +                    n = 5;
        +                    V =  B & 0x03;
        +                    minV = 0x200000;
        +                } else if ((B & 0x02) == 0) {
        +                    // 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
        +                    n = 6;
        +                    V = B & 0x01;
        +                    minV = 0x4000000;
        +                } else {
                             return error(string, k);
                         }
         
        -                if ((k + (3 * (n - 1))) >= len) {
        +                // check bound for sufficient chars
        +                if (k + (3*(n-1)) >= len) {
                             return error(string, k);
                         }
         
        -                final byte[] bbuf = new byte[n];
        -                bbuf[0] = (byte) B;
        -
                         for (int j = 1; j < n; j++) {
                             k++;
                             if (string.charAt(k) != '%') {
                                 return error(string, k);
                             }
         
        -                    if (k + 2 == len) {
        -                        return error(string, k);
        -                    }
        -
                             B = toHexByte(string.charAt(k + 1), string.charAt(k + 2));
                             if (B < 0 || (B & 0xC0) != 0x80) {
                                 return error(string, k + 1);
                             }
         
        +                    V = (V << 6) | (B & 0x3F);
                             k += 2;
        -                    bbuf[j] = (byte) B;
                         }
         
        -                int V;
        -                try {
        -                    V = ucs4Char(bbuf);
        -                } catch (final Exception e) {
        -                    throw uriError(e, "bad.uri", string, Integer.toString(k));
        +                // Check for overlongs and invalid codepoints.
        +                // The high and low surrogate halves used by UTF-16
        +                // (U+D800 through U+DFFF) are not legal Unicode values.
        +                if ((V < minV) || (V >= 0xD800 && V <= 0xDFFF)) {
        +                    V = Integer.MAX_VALUE;
                         }
        +
                         if (V < 0x10000) {
                             C = (char) V;
                             if (!component && URI_RESERVED.indexOf(C) >= 0) {
        @@ -224,10 +242,6 @@
                 return -1;
             }
         
        -    private static int ucs4Char(final byte[] utf8) throws UnsupportedEncodingException {
        -        return new String(utf8, "UTF-8").codePointAt(0);
        -    }
        -
             private static String toHexEscape(final int u0) {
                 int u = u0;
                 int len;
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -96,19 +96,19 @@
             }
         
             /**
        -     * Return getter slot for this UserAccessorProperty. Slots start with first embed field.
        +     * Return getter spill slot for this UserAccessorProperty.
              * @return getter slot
              */
             public int getGetterSlot() {
        -        return getterSlot < 0 ? -getterSlot - 1 : getterSlot;
        +        return getterSlot;
             }
         
             /**
        -     * Return setter slot for this UserAccessorProperty. Slots start with first embed field.
        +     * Return setter spill slot for this UserAccessorProperty.
              * @return setter slot
              */
             public int getSetterSlot() {
        -        return setterSlot < 0 ? -setterSlot - 1 : setterSlot;
        +        return setterSlot;
             }
         
             @Override
        @@ -124,7 +124,7 @@
         
                 final UserAccessorProperty uc = (UserAccessorProperty) other;
                 return getterSlot == uc.getterSlot && setterSlot == uc.setterSlot;
        -     }
        +    }
         
             @Override
             public int hashCode() {
        @@ -136,34 +136,26 @@
              */
             @Override
             public int getSpillCount() {
        -        // calculate how many spill array slots used by this propery.
        -        int count = 0;
        -        if (getGetterSlot() >= 0) {
        -            count++;
        -        }
        -        if (getSetterSlot() >= 0) {
        -            count++;
        -        }
        -        return count;
        +        return 2;
             }
         
             @Override
        -    public boolean hasGetterFunction() {
        -        return getterSlot > -1;
        +    public boolean hasGetterFunction(final ScriptObject obj) {
        +        return obj.getSpill(getterSlot) != null;
             }
         
             @Override
        -    public boolean hasSetterFunction() {
        -        return setterSlot > -1;
        +    public boolean hasSetterFunction(final ScriptObject obj) {
        +        return obj.getSpill(setterSlot) != null;
             }
         
             @Override
        -    protected Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
        +    public Object getObjectValue(final ScriptObject self, final ScriptObject owner) {
                 return userAccessorGetter(owner, getGetterSlot(), self);
             }
         
             @Override
        -    protected void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
        +    public void setObjectValue(final ScriptObject self, final ScriptObject owner, final Object value, final boolean strict) {
                 userAccessorSetter(owner, getSetterSlot(), strict ? getKey() : null, self, value);
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayData.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -295,6 +295,29 @@
             public abstract ArrayData set(int index, double value, boolean strict);
         
             /**
        +     * Set an empty value at a given index. Should only affect Object array.
        +     *
        +     * @param index the index
        +     * @return new array data (or same)
        +     */
        +    public ArrayData setEmpty(final int index) {
        +        // Do nothing.
        +        return this;
        +    }
        +
        +    /**
        +     * Set an empty value for a given range. Should only affect Object array.
        +     *
        +     * @param lo range low end
        +     * @param hi range high end
        +     * @return new array data (or same)
        +     */
        +    public ArrayData setEmpty(final long lo, final long hi) {
        +        // Do nothing.
        +        return this;
        +    }
        +
        +    /**
              * Get an int value from a given index
              *
              * @param index the index
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -129,6 +129,18 @@
             }
         
             @Override
        +    public ArrayData setEmpty(final int index) {
        +        underlying.setEmpty(index);
        +        return this;
        +    }
        +
        +    @Override
        +    public ArrayData setEmpty(final long lo, final long hi) {
        +        underlying.setEmpty(lo, hi);
        +        return this;
        +    }
        +
        +    @Override
             public int getInt(final int index) {
                 return underlying.getInt(index);
             }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -142,6 +142,7 @@
                 final long longIndex = ArrayIndex.toLongIndex(index);
                 assert longIndex >= 0 && longIndex < length();
                 deleted.set(longIndex);
        +        underlying.setEmpty(index);
                 return this;
             }
         
        @@ -149,6 +150,7 @@
             public ArrayData delete(final long fromIndex, final long toIndex) {
                 assert fromIndex >= 0 && fromIndex <= toIndex && toIndex < length();
                 deleted.setRange(fromIndex, toIndex + 1);
        +        underlying.setEmpty(fromIndex, toIndex);
                 return this;
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -202,6 +202,8 @@
             @Override
             public ArrayData delete(final int index) {
                 final long longIndex = ArrayIndex.toLongIndex(index);
        +        underlying.setEmpty(index);
        +
                 if (longIndex + 1 == lo) {
                     lo = longIndex;
                 } else if (longIndex - 1 == hi) {
        @@ -220,6 +222,7 @@
                 }
                 lo = Math.min(fromIndex, lo);
                 hi = Math.max(toIndex, hi);
        +        underlying.setEmpty(lo, hi);
                 return this;
             }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -139,6 +139,18 @@
             }
         
             @Override
        +    public ArrayData setEmpty(final int index) {
        +        array[index] = ScriptRuntime.EMPTY;
        +        return this;
        +    }
        +
        +    @Override
        +    public ArrayData setEmpty(final long lo, final long hi) {
        +        Arrays.fill(array, (int)Math.max(lo, 0L), (int)Math.min(hi, (long)Integer.MAX_VALUE), ScriptRuntime.EMPTY);
        +        return this;
        +    }
        +
        +    @Override
             public int getInt(final int index) {
                 return JSType.toInt32(array[index]);
             }
        @@ -165,11 +177,13 @@
         
             @Override
             public ArrayData delete(final int index) {
        +        setEmpty(index);
                 return new DeletedRangeArrayFilter(this, index, index);
             }
         
             @Override
             public ArrayData delete(final long fromIndex, final long toIndex) {
        +        setEmpty(fromIndex, toIndex);
                 return new DeletedRangeArrayFilter(this, fromIndex, toIndex);
             }
         
        @@ -181,7 +195,7 @@
         
                 final int newLength = (int) (length() - 1);
                 final Object elem = array[newLength];
        -        array[newLength] = 0;
        +        setEmpty(newLength);
                 setLength(newLength);
                 return elem;
             }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -204,6 +204,18 @@
             }
         
             @Override
        +    public ArrayData setEmpty(final int index) {
        +        underlying.setEmpty(index);
        +        return this;
        +    }
        +
        +    @Override
        +    public ArrayData setEmpty(final long lo, final long hi) {
        +        underlying.setEmpty(lo, hi);
        +        return this;
        +    }
        +
        +    @Override
             public int getInt(final int index) {
                 if (index >= 0 && index < maxDenseLength) {
                     return underlying.getInt(index);
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java
        --- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -45,44 +45,14 @@
          * as ScriptObjects from other Nashorn contexts.
          */
         final class JSObjectLinker implements TypeBasedGuardingDynamicLinker {
        -   /**
        -     * Instances of this class are used to represent a method member of a JSObject
        -     */
        -    private static final class JSObjectMethod {
        -        // The name of the JSObject method property
        -        private final String name;
        -
        -        JSObjectMethod(final String name) {
        -            this.name = name;
        -        }
        -
        -        String getName() {
        -            return name;
        -        }
        -
        -        static GuardedInvocation lookup(final CallSiteDescriptor desc) {
        -            final String operator = CallSiteDescriptorFactory.tokenizeOperators(desc).get(0);
        -            switch (operator) {
        -                case "call": {
        -                    // collect everything except the first two - JSObjectMethod instance and the actual 'self'
        -                    final int paramCount = desc.getMethodType().parameterCount();
        -                    final MethodHandle caller = MH.asCollector(JSOBJECTMETHOD_CALL, Object[].class, paramCount - 2);
        -                    return new GuardedInvocation(caller, null, IS_JSOBJECTMETHOD_GUARD);
        -                }
        -                default:
        -                    return null;
        -            }
        -        }
        -    }
        -
             @Override
             public boolean canLinkType(final Class type) {
                 return canLinkTypeStatic(type);
             }
         
             static boolean canLinkTypeStatic(final Class type) {
        -        // can link JSObject and JSObjectMethod
        -        return JSObject.class.isAssignableFrom(type) || JSObjectMethod.class.isAssignableFrom(type);
        +        // can link JSObject
        +        return JSObject.class.isAssignableFrom(type);
             }
         
             @Override
        @@ -99,8 +69,6 @@
                 final GuardedInvocation inv;
                 if (self instanceof JSObject) {
                     inv = lookup(desc);
        -        } else if (self instanceof JSObjectMethod) {
        -            inv = JSObjectMethod.lookup(desc);
                 } else {
                     throw new AssertionError(); // Should never reach here.
                 }
        @@ -115,7 +83,7 @@
                     case "getProp":
                     case "getElem":
                     case "getMethod":
        -                return c > 2 ? findGetMethod(desc, operator) : findGetIndexMethod();
        +                return c > 2 ? findGetMethod(desc) : findGetIndexMethod();
                     case "setProp":
                     case "setElem":
                         return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
        @@ -123,15 +91,14 @@
                     case "callMethod":
                         return findCallMethod(desc, operator);
                     case "new":
        +                return findNewMethod(desc);
                     default:
                         return null;
                 }
             }
         
        -    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final String operator) {
        -        // if "getMethod" then return JSObjectMethod object - which just holds the name of the method
        -        // subsequently, link on dyn:call for JSObjectMethod will actually call that method
        -        final MethodHandle getter = MH.insertArguments("getMethod".equals(operator)? JSOBJECT_GETMETHOD : JSOBJECT_GET, 1, desc.getNameToken(2));
        +    private static GuardedInvocation findGetMethod(final CallSiteDescriptor desc) {
        +        final MethodHandle getter = MH.insertArguments(JSOBJECT_GET, 1, desc.getNameToken(2));
                 return new GuardedInvocation(getter, null, IS_JSOBJECT_GUARD);
             }
         
        @@ -156,9 +123,9 @@
                 return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
             }
         
        -    @SuppressWarnings("unused")
        -    private static boolean isJSObjectMethod(final Object self) {
        -        return self instanceof JSObjectMethod;
        +    private static GuardedInvocation findNewMethod(final CallSiteDescriptor desc) {
        +        MethodHandle func = MH.asCollector(JSOBJECT_NEW, Object[].class, desc.getMethodType().parameterCount() - 1);
        +        return new GuardedInvocation(func, null, IS_JSOBJECT_GUARD);
             }
         
             @SuppressWarnings("unused")
        @@ -166,12 +133,6 @@
                 return self instanceof JSObject;
             }
         
        -
        -    @SuppressWarnings("unused")
        -    private static Object getMethod(final Object jsobj, final Object key) {
        -        return new JSObjectMethod(Objects.toString(key));
        -    }
        -
             @SuppressWarnings("unused")
             private static Object get(final Object jsobj, final Object key) {
                 if (key instanceof String) {
        @@ -200,11 +161,8 @@
             }
         
             @SuppressWarnings("unused")
        -    private static Object jsObjectMethodCall(final Object jsObjMethod, final Object jsobj, final Object... args) {
        -        // we have JSObjectMethod, JSObject and args. Get method name from JSObjectMethod instance
        -        final String methodName = ((JSObjectMethod)jsObjMethod).getName();
        -        // call the method on JSObject
        -        return ((JSObject)jsobj).call(methodName, args);
        +    private static Object newObject(final Object jsobj, final Object... args) {
        +        return ((JSObject)jsobj).newObject(null, args);
             }
         
             private static int getIndex(final Number n) {
        @@ -214,13 +172,11 @@
         
             private static final MethodHandleFunctionality MH = MethodHandleFactory.getFunctionality();
         
        -    private static final MethodHandle IS_JSOBJECTMETHOD_GUARD = findOwnMH("isJSObjectMethod", boolean.class, Object.class);
             private static final MethodHandle IS_JSOBJECT_GUARD = findOwnMH("isJSObject", boolean.class, Object.class);
        -    private static final MethodHandle JSOBJECT_GETMETHOD = findOwnMH("getMethod", Object.class, Object.class, Object.class);
             private static final MethodHandle JSOBJECT_GET = findOwnMH("get", Object.class, Object.class, Object.class);
             private static final MethodHandle JSOBJECT_PUT = findOwnMH("put", Void.TYPE, Object.class, Object.class, Object.class);
             private static final MethodHandle JSOBJECT_CALL = findOwnMH("call", Object.class, Object.class, Object.class, Object[].class);
        -    private static final MethodHandle JSOBJECTMETHOD_CALL = findOwnMH("jsObjectMethodCall", Object.class, Object.class, Object.class, Object[].class);
        +    private static final MethodHandle JSOBJECT_NEW = findOwnMH("newObject", Object.class, Object.class, Object[].class);
         
             private static MethodHandle findOwnMH(final String name, final Class rtype, final Class... types) {
                 final Class   own = JSObjectLinker.class;
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties
        --- a/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/Messages.properties	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,6 +42,8 @@
         parser.error.expected.operand=Expected an operand but found {0}
         parser.error.expected.stmt=Expected statement but found {0}
         parser.error.expected.comma=Expected comma but found {0}
        +parser.error.expected.property.id=Expected property id but found {0}
        +parser.error.expected.lvalue=Expected l-value but found {0}
         parser.error.expected=Expected {0} but found {1}
         parser.error.invalid.return=Invalid return statement
         parser.error.no.func.decl.here=Function declarations can only occur at program or function body level. You should use a function expression here instead.
        diff -r 0273c023680c -r 6ed8434664ed nashorn/src/jdk/nashorn/internal/scripts/JO.java
        --- a/nashorn/src/jdk/nashorn/internal/scripts/JO.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/src/jdk/nashorn/internal/scripts/JO.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -32,11 +32,14 @@
          * Empty object class.
          */
         public class JO extends ScriptObject {
        +
        +    private static final PropertyMap map$ = PropertyMap.newMap(JO.class);
        +
             /**
              * Constructor
              */
             public JO() {
        -        super(PropertyMap.newMap(JO.class));
        +        super(map$);
             }
         
             /**
        @@ -49,6 +52,15 @@
             }
         
             /**
        +     * Constructor given an initial prototype using the default property map
        +     *
        +     * @param proto the prototype object
        +     */
        +    public JO(final ScriptObject proto) {
        +        super(proto, map$);
        +    }
        +
        +    /**
              * Used by FunctionObjectCreator. A method handle of this method is passed to the ScriptFunction constructor.
              *
              * @param map  the property map to use for allocatorMap
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8010697.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8010697.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,59 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +
        +/**
        + * JDK-8010697: DeletedArrayFilter seems to leak memory
        + *
        + * @test
        + * @run
        + */
        +
        +var N = 1000;
        +
        +var array = new Array(N);
        +var WeakReferenceArray = Java.type("java.lang.ref.WeakReference[]");
        +var refArray = new WeakReferenceArray(N);
        +
        +for (var i = 0; i < N; i ++) {
        +    var object = new java.lang.Object();
        +    array[i] = object;
        +    refArray[i] = new java.lang.ref.WeakReference(object);
        +}
        +
        +object = null;
        +
        +for (var i = 0; i < N; i ++) {
        +    delete array[i];
        +}
        +
        +java.lang.System.gc();
        +java.lang.System.gc();
        +
        +for (var i = 0; i < N; i ++) {
        +    if (refArray[i].get() != null) {
        +        print("Reference found at " + i);
        +        exit(0);
        +    }
        +}
        +
        +print("All references gone");
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8010697.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8010697.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,1 @@
        +All references gone
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8010732.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8010732.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,48 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + *
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + *
        + * 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.
        + */
        +
        +/**
        + * JDK-8010732: BigDecimal, BigInteger and Long handling in nashorn
        + *
        + * @test
        + * @run
        + */
        +
        +var x = new java.math.BigDecimal(1111.5);
        +var y = new java.math.BigDecimal(2222.5);
        +
        +print(x);
        +print(y);
        +
        +print(x + y);
        +print(x - y);
        +print(x * y);
        +print(x / y);
        +print(Math.sin(x));
        +
        +print(x.toString());
        +print(y.toString());
        +print(x.class);
        +print(y.class);
        +print(x.doubleValue() + y.doubleValue());
        +
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8010732.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8010732.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,12 @@
        +1111.5
        +2222.5
        +3334
        +-1111
        +2470308.75
        +0.5001124859392576
        +-0.5841231854504038
        +1111.5
        +2222.5
        +class java.math.BigDecimal
        +class java.math.BigDecimal
        +3334
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8012164.js
        --- a/nashorn/test/script/basic/JDK-8012164.js	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/JDK-8012164.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -37,8 +37,9 @@
           try {
               throw new Error('foo');
           } catch (e) {
        -      for (i in e.stack) {
        -          printFrame(e.stack[i]);
        +      var frames = e.getStackTrace();
        +      for (i in frames) {
        +          printFrame(frames[i]);
               }
           }
         }
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8012164.js.EXPECTED
        --- a/nashorn/test/script/basic/JDK-8012164.js.EXPECTED	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/JDK-8012164.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,3 +1,3 @@
         .error(test/script/basic/JDK-8012164.js:38)
         .func(test/script/basic/JDK-8012164.js:33)
        -.(test/script/basic/JDK-8012164.js:46)
        +.(test/script/basic/JDK-8012164.js:47)
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8014781.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8014781.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,40 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8014781: support Error.captureStackTrace
        + *
        + * @test
        + * @run
        + */
        +
        +function MyError() {
        +    Error.captureStackTrace(this);
        +}
        +
        +function func() {
        +    return new MyError();
        +}
        +
        +var e = func();
        +print(e.stack.replace(/\\/g, '/'));
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8014781.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8014781.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,4 @@
        +[object Object]
        +	at MyError (test/script/basic/JDK-8014781.js:32)
        +	at func (test/script/basic/JDK-8014781.js:36)
        +	at  (test/script/basic/JDK-8014781.js:39)
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8015347.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8015347.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,39 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8015347: Parsing issue with decodeURIComponent
        + *
        + * @test
        + * @run
        + */
        +
        +try {
        +    decodeURIComponent("%C0%80");
        +    fail("Should have thrown URIError");
        +} catch (e) {
        +    if (! (e instanceof URIError)) {
        +        fail("Expected URIError, but got " + e);
        +    }
        +}
        +
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8015959.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8015959.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,54 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8015959: Can't call foreign constructor
        + *
        + * @test
        + * @run
        + */
        +
        +function check(global) {
        +    var obj = new global.Point(344, 12);
        +    print("obj.x " + obj.x);
        +    print("obj.y " + obj.y);
        +    print("obj instanceof global.Point? " + (obj instanceof global.Point))
        +
        +    var P = global.Point;
        +    var p = new P(343, 54);
        +    print("p.x " + p.x);
        +    print("p.y " + p.y);
        +    print("p instanceof P? " + (p instanceof P))
        +}
        +
        +print("check with loadWithNewGlobal");
        +check(loadWithNewGlobal({
        +   name: "myscript",
        +   script: "function Point(x, y) { this.x = x; this.y = y }; this"
        +}));
        +
        +print("check with script engine");
        +var m = new javax.script.ScriptEngineManager();
        +var e = m.getEngineByName('nashorn');
        +check(e.eval("function Point(x, y) { this.x = x; this.y = y }; this"));
        +
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8015959.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8015959.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,14 @@
        +check with loadWithNewGlobal
        +obj.x 344
        +obj.y 12
        +obj instanceof global.Point? true
        +p.x 343
        +p.y 54
        +p instanceof P? true
        +check with script engine
        +obj.x 344
        +obj.y 12
        +obj instanceof global.Point? true
        +p.x 343
        +p.y 54
        +p instanceof P? true
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8015969.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8015969.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,75 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8015969: Needs to enforce and document that global "context" and "engine" can't be modified when running via jsr223
        + *
        + * @test
        + * @option -scripting
        + * @run
        + */
        +
        +var m = new javax.script.ScriptEngineManager();
        +var e = m.getEngineByName("nashorn");
        +
        +e.eval(<>e>>>0;
        +    var x = [z];
        +}
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8017950.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8017950.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,47 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8017950: error.stack should be a string rather than an array
        + *
        + * @test
        + * @run
        + */
        +
        +function func() {
        +    try {
        +        throw new Error();
        +    } catch (e){
        +        print(e.stack.replace(/\\/g, '/'))
        +    }
        +}
        +
        +function f() { 
        +    func()
        +}
        +
        +function g() {
        +    f()
        +}
        +
        +g()
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8017950.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8017950.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,5 @@
        +Error
        +	at func (test/script/basic/JDK-8017950.js:33)
        +	at f (test/script/basic/JDK-8017950.js:40)
        +	at g (test/script/basic/JDK-8017950.js:44)
        +	at  (test/script/basic/JDK-8017950.js:47)
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019226.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019226.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,39 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019226: line number not generated for first statement if it is on the same function declaration line 
        + *
        + * @test
        + * @run
        + */
        +
        +function func1() { func2() }
        +
        +function func2() { throw new Error("failed!") }
        +
        +try {
        +    func1()
        +} catch (e) {
        +    print(e.stack.replace(/\\/g, '/'))
        +}
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019226.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019226.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,4 @@
        +Error: failed!
        +	at func2 (test/script/basic/JDK-8019226.js:33)
        +	at func1 (test/script/basic/JDK-8019226.js:31)
        +	at  (test/script/basic/JDK-8019226.js:36)
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019473.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019473.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,62 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019473: Parser issues related to functions and blocks
        + *
        + * @test
        + * @run
        + */
        +
        +function checkNoError(code) {
        +    try {
        +        Function(code);
        +    } catch (e) {
        +        print("no error expected for: " + code + " , got " + e);
        +    }
        +}
        +
        +// implicit newlines at EOF should be accepted
        +checkNoError("for(;;) continue")
        +checkNoError("return")
        +checkNoError("yield")
        +checkNoError("for(;;) break")
        +
        +function checkError(code) {
        +    try {
        +        eval(code);
        +        print("SyntaxError expected for: " + code);
        +    } catch (e) {
        +        if (! (e instanceof SyntaxError)) {
        +            fail("SyntaxError expected, got " + e);
        +        }
        +    }
        +}
        +
        +checkError("function f() { case0: }");
        +checkError("function f() { if(0) }");
        +checkError("function f() { if(0); else }");
        +checkError("function f() { while(0) }");
        +
        +// comma expression as closure expression
        +checkError("function sq(x) x, x*x");
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019478.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019478.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,33 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019478: Object.prototype.toString.call(/a/.exec("a")) === "[object Array]" should be true
        + *
        + * @test
        + * @run
        + */
        +
        +if (Object.prototype.toString.call(/a/.exec("a")) !== "[object Array]") {
        +    fail("Object.prototype.toString.call(/a/.exec('a')) !== '[object Array]'");
        +}
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019482.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019482.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,41 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019482: Number("0x0.0p0") should evaluate to NaN
        + *
        + * @test
        + * @run
        + */
        +
        +function checkHexLiteral(str) {
        +    if (! isNaN(Number(str))) {
        +        fail("Number(" + str + ") is not NaN");
        +    }
        +}
        +
        +checkHexLiteral("0x0.0");
        +checkHexLiteral("0x0.0p");
        +checkHexLiteral("0x12tu");
        +checkHexLiteral("0x12.2e22");
        +checkHexLiteral("0xtu");
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019488.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019488.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,68 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019488: switch on literals result in NoSuchMethodError or VerifyError
        + *
        + * @test
        + * @run
        + */
        +
        +switch("") {
        +    case 0:
        +        break
        +}
        +
        +switch(true) {
        +    case 0:
        +        print("0"); break;
        +    case 1:
        +        print("1"); break;
        +}
        +
        +switch(false) {
        +    case 0:
        +        print("0"); break;
        +    case 1:
        +        print("1"); break;
        +}
        +
        +switch([]) {
        +    case 1:
        +        print("1");
        +}
        +
        +switch (undefined) {
        +    case 0:
        +        print("0");
        +}
        +
        +switch (null) {
        +    case 0:
        +        print("0");
        +}
        +
        +switch({}) {
        +    case 1:
        +        print("1");
        +}
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019508.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019508.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,56 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019508: Comma handling in object literal parsing is wrong
        + *
        + * @test
        + * @run
        + */
        +
        +function checkObjLiteral(str) {
        +    try {
        +        eval(str);
        +        fail("SyntaxError expected for: " + str);
        +    } catch (e) {
        +        if (! (e instanceof SyntaxError)) {
        +            fail("expected SyntaxError, got " + e);
        +        }
        +        print(e.message.replace(/\\/g, '/'));
        +    }
        +}
        +
        +// only comma
        +checkObjLiteral("({,})");
        +
        +// starting with comma
        +checkObjLiteral("({, a:2 })");
        +
        +// consecutive commas
        +checkObjLiteral("({a:3,,})");
        +
        +// missing comma
        +checkObjLiteral("({a:3 b:2}");
        +
        +// single trailing comma is okay!
        +var obj = { a: 3, };
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019508.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019508.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,12 @@
        +test/script/basic/JDK-8019508.js#33:1:2 Expected property id but found ,
        +({,})
        +  ^
        +test/script/basic/JDK-8019508.js#33:1:2 Expected property id but found ,
        +({, a:2 })
        +  ^
        +test/script/basic/JDK-8019508.js#33:1:6 Expected property id but found ,
        +({a:3,,})
        +      ^
        +test/script/basic/JDK-8019508.js#33:1:6 Expected comma but found ident
        +({a:3 b:2}
        +      ^
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019553.js
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019553.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,43 @@
        +/*
        + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
        + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        + * 
        + * This code is free software; you can redistribute it and/or modify it
        + * under the terms of the GNU General Public License version 2 only, as
        + * published by the Free Software Foundation.
        + * 
        + * 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.
        + */
        +
        +/**
        + * JDK-8019553:  NPE on illegal l-value for increment and decrement
        + *
        + * @test
        + * @run
        + */
        +
        +function check(str) {
        +    try {
        +        eval(str);
        +        fail("SyntaxError expected for: " + str);
        +    } catch (e) {
        +        print(e.toString().replace(/\\/g, '/'));
        +    }
        +}
        +
        +check("++ +3");
        +check("++ -7");
        +check("-- +2");
        +check("-- -8");
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/JDK-8019553.js.EXPECTED
        --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
        +++ b/nashorn/test/script/basic/JDK-8019553.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -0,0 +1,12 @@
        +SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found +
        +++ +3
        +   ^
        +SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found -
        +++ -7
        +   ^
        +SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found +
        +-- +2
        +   ^
        +SyntaxError: test/script/basic/JDK-8019553.js#33:1:3 Expected l-value but found -
        +-- -8
        +   ^
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/NASHORN-109.js
        --- a/nashorn/test/script/basic/NASHORN-109.js	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/NASHORN-109.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,8 +33,9 @@
                 throw new Error("error");
             }
         } catch (e) {
        -    for (i in e.stack) { 
        -        print(e.stack[i].methodName + ' ' + e.stack[i].lineNumber);
        +    var frames = e.getStackTrace();
        +    for (i in frames) {
        +        print(frames[i].methodName + ' ' + frames[i].lineNumber);
             }
         }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/NASHORN-296.js
        --- a/nashorn/test/script/basic/NASHORN-296.js	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/NASHORN-296.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -33,7 +33,7 @@
                 load({ script: 'throw new Error()', name: name });
             } catch(e) {
                 // normalize windows path separator to URL style
        -        var actual = e.stack[0].fileName;
        +        var actual = e.getStackTrace()[0].fileName;
                 if (actual !== name) {
                     fail("expected file name to be " + name +
                          ", actually got file name " + actual);
        @@ -48,6 +48,6 @@
         try {
             throw new Error();
         } catch (e) {
        -    test(e.stack[0].fileName.substring(6));
        +    test(e.getStackTrace()[0].fileName.substring(6));
         }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/NASHORN-51.js
        --- a/nashorn/test/script/basic/NASHORN-51.js	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/NASHORN-51.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -35,28 +35,28 @@
                 eval(literals[i] + "++");
                 print("ERROR!! post increment : " + literals[i]);
             } catch (e) {
        -        print(e);
        +        print(e.toString().replace(/\\/g, '/'));
             }
         
             try {
                 eval(literals[i] + "--");
                 print("ERROR!! post decrement : " + literals[i]);
             } catch (e) {
        -        print(e);
        +        print(e.toString().replace(/\\/g, '/'));
             }
         
             try {
                 eval("++" + literals[i]);
                 print("ERROR!! pre increment : " + literals[i]);
             } catch (e) {
        -        print(e);
        +        print(e.toString().replace(/\\/g, '/'));
             }
         
             try {
                 eval("--" + literals[i]);
                 print("ERROR!! pre decrement : " + literals[i]);
             } catch (e) {
        -        print(e);
        +        print(e.toString().replace(/\\/g, '/'));
             }
         }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/NASHORN-51.js.EXPECTED
        --- a/nashorn/test/script/basic/NASHORN-51.js.EXPECTED	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/NASHORN-51.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,24 +1,72 @@
        -ReferenceError: "1" can not be used as the left-hand side of assignment
        -ReferenceError: "1" can not be used as the left-hand side of assignment
        -ReferenceError: "1" can not be used as the left-hand side of assignment
        -ReferenceError: "1" can not be used as the left-hand side of assignment
        -ReferenceError: "0" can not be used as the left-hand side of assignment
        -ReferenceError: "0" can not be used as the left-hand side of assignment
        -ReferenceError: "0" can not be used as the left-hand side of assignment
        -ReferenceError: "0" can not be used as the left-hand side of assignment
        -ReferenceError: "3.14" can not be used as the left-hand side of assignment
        -ReferenceError: "3.14" can not be used as the left-hand side of assignment
        -ReferenceError: "3.14" can not be used as the left-hand side of assignment
        -ReferenceError: "3.14" can not be used as the left-hand side of assignment
        -ReferenceError: "true" can not be used as the left-hand side of assignment
        -ReferenceError: "true" can not be used as the left-hand side of assignment
        -ReferenceError: "true" can not be used as the left-hand side of assignment
        -ReferenceError: "true" can not be used as the left-hand side of assignment
        -ReferenceError: "false" can not be used as the left-hand side of assignment
        -ReferenceError: "false" can not be used as the left-hand side of assignment
        -ReferenceError: "false" can not be used as the left-hand side of assignment
        -ReferenceError: "false" can not be used as the left-hand side of assignment
        -ReferenceError: "null" can not be used as the left-hand side of assignment
        -ReferenceError: "null" can not be used as the left-hand side of assignment
        -ReferenceError: "null" can not be used as the left-hand side of assignment
        -ReferenceError: "null" can not be used as the left-hand side of assignment
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +1++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +1--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++1
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--1
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +0++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +0--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++0
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--0
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +3.14++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +3.14--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++3.14
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--3.14
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +true++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +true--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++true
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--true
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +false++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +false--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++false
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--false
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#35:1:0 Invalid left hand side for assignment
        +null++
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#42:1:0 Invalid left hand side for assignment
        +null--
        +^
        +ReferenceError: test/script/basic/NASHORN-51.js#49:1:2 Invalid left hand side for assignment
        +++null
        +  ^
        +ReferenceError: test/script/basic/NASHORN-51.js#56:1:2 Invalid left hand side for assignment
        +--null
        +  ^
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/basic/errorstack.js
        --- a/nashorn/test/script/basic/errorstack.js	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/basic/errorstack.js	Thu Jul 11 12:50:20 2013 -0700
        @@ -22,7 +22,7 @@
          */
         
         /**
        - * "stack" property of Error objects. (nashorn extension).
        + * "getStackTrace()" method of Error objects. (nashorn extension).
          *
          * @test
          * @run
        @@ -43,9 +43,9 @@
         try {
             func1();
         } catch (e) {
        -    // "stack" is java.lang.StackTraceElement object
        -    for (i in e.stack) {
        -        print(e.stack[i].methodName + " : " + e.stack[i].lineNumber);
        +    var frames = e.getStackTrace();
        +    for (i in frames) {
        +        print(frames[i].methodName + " : " + frames[i].lineNumber);
             }
         }
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/script/error/NASHORN-57.js.EXPECTED
        --- a/nashorn/test/script/error/NASHORN-57.js.EXPECTED	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/script/error/NASHORN-57.js.EXPECTED	Thu Jul 11 12:50:20 2013 -0700
        @@ -1,3 +1,3 @@
        -test/script/error/NASHORN-57.js:35:2 Expected statement but found ;
        +test/script/error/NASHORN-57.js:35:2 Expected l-value but found ;
         ++;
           ^
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -39,7 +39,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
        - * @run testng jdk.nashorn.api.javaaccess.BooleanAccessTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
          */
         public class BooleanAccessTest {
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -42,7 +42,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
        - * @run testng jdk.nashorn.api.javaaccess.MethodAccessTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
          */
         public class MethodAccessTest {
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -39,7 +39,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
        - * @run testng jdk.nashorn.api.javaaccess.NumberAccessTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
          */
         public class NumberAccessTest {
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -38,7 +38,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
        - * @run testng jdk.nashorn.api.javaaccess.NumberBoxingTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
          */
         public class NumberBoxingTest {
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -38,7 +38,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
        - * @run testng jdk.nashorn.api.javaaccess.ObjectAccessTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
          */
         public class ObjectAccessTest {
         
        diff -r 0273c023680c -r 6ed8434664ed nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
        --- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Tue Jul 02 17:38:10 2013 -0700
        +++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Thu Jul 11 12:50:20 2013 -0700
        @@ -38,7 +38,7 @@
         /**
          * @test
          * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
        - * @run testng jdk.nashorn.api.javaaccess.StringAccessTest
        + * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
          */
         public class StringAccessTest {