# HG changeset patch # User prr # Date 1517331827 28800 # Node ID 2d03ebb72df2211b48d7754490a3d298776db7ac # Parent fb62f481671e4d6eff9682058fedb643e99ac1be# Parent b2f2bdba04725e0a546f6156401f19bf20b89196 Merge diff -r fb62f481671e -r 2d03ebb72df2 bin/idea.sh --- a/bin/idea.sh Tue Jan 30 11:53:00 2018 +0530 +++ b/bin/idea.sh Tue Jan 30 09:03:47 2018 -0800 @@ -30,9 +30,10 @@ } SCRIPT_DIR=`dirname $0` -PWD=`pwd` +#assume TOP is the dir from which the script has been called +TOP=`pwd` cd $SCRIPT_DIR; SCRIPT_DIR=`pwd` -cd ../; TOP=`pwd`; cd $PWD +cd $TOP; IDEA_OUTPUT=$TOP/.idea VERBOSE="false" @@ -66,30 +67,42 @@ mkdir $IDEA_OUTPUT || exit 1 cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd` -IDEA_MAKE="$TOP/make/idea" +MAKE_DIR="$SCRIPT_DIR/../make" +IDEA_MAKE="$MAKE_DIR/idea" IDEA_TEMPLATE="$IDEA_MAKE/template" -IML_TEMPLATE="$IDEA_TEMPLATE/jdk.iml" -ANT_TEMPLATE="$IDEA_TEMPLATE/ant.xml" -MISC_TEMPLATE="$IDEA_TEMPLATE/misc.xml" -IDEA_IML="$IDEA_OUTPUT/jdk.iml" -IDEA_ANT="$IDEA_OUTPUT/ant.xml" -IDEA_MISC="$IDEA_OUTPUT/misc.xml" + +cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT" + +#init template variables +for file in `ls -p $IDEA_TEMPLATE | grep -v /`; do + VAR_SUFFIX=`echo $file | cut -d'.' -f1 | tr [:lower:] [:upper:]` + eval "$VAR_SUFFIX"_TEMPLATE="$IDEA_TEMPLATE"/$file + eval IDEA_"$VAR_SUFFIX"="$IDEA_OUTPUT"/$file +done + +#override template variables +if [ -d "$TEMPLATES_OVERRIDE" ] ; then + for file in `ls -p "$TEMPLATES_OVERRIDE" | grep -v /`; do + cp "$TEMPLATES_OVERRIDE"/$file "$IDEA_OUTPUT"/ + VAR_SUFFIX=`echo $file | cut -d'.' -f1 | tr [:lower:] [:upper:]` + eval "$VAR_SUFFIX"_TEMPLATE="$TEMPLATES_OVERRIDE"/$file + done +fi if [ "$VERBOSE" = "true" ] ; then echo "output dir: $IDEA_OUTPUT" echo "idea template dir: $IDEA_TEMPLATE" fi -if [ ! -f "$IML_TEMPLATE" ] ; then - echo "FATAL: cannot find $IML_TEMPLATE" >&2; exit 1 +if [ ! -f "$JDK_TEMPLATE" ] ; then + echo "FATAL: cannot find $JDK_TEMPLATE" >&2; exit 1 fi if [ ! -f "$ANT_TEMPLATE" ] ; then echo "FATAL: cannot find $ANT_TEMPLATE" >&2; exit 1 fi -cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT" -cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I make/common idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1 +cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I $MAKE_DIR/.. idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1 cd $SCRIPT_DIR . $IDEA_OUTPUT/env.cfg @@ -118,11 +131,12 @@ root=$@ relativePath="`echo "$root" | sed -e s@"$TOP/\(.*$\)"@"\1"@`" folder="`echo "$SOURCE_FOLDER" | sed -e s@"\(.*/\)####\(.*\)"@"\1$relativePath\2"@`" - printf "%s\n" "$folder" >> $IDEA_IML + printf "%s\n" "$folder" >> $IDEA_JDK } ### Generate project iml -rm -f $IDEA_IML + +rm -f $IDEA_JDK while IFS= read -r line do if echo "$line" | egrep "^ .* /dev/null ; then @@ -133,9 +147,9 @@ done fi else - printf "%s\n" "$line" >> $IDEA_IML + printf "%s\n" "$line" >> $IDEA_JDK fi -done < "$IML_TEMPLATE" +done < "$JDK_TEMPLATE" MODULE_NAME=" " diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/basics.m4 --- a/make/autoconf/basics.m4 Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/basics.m4 Tue Jan 30 09:03:47 2018 -0800 @@ -586,69 +586,71 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], [ AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit], - [use this devkit for compilers, tools and resources])], - [ - BASIC_FIXUP_PATH([with_devkit]) - DEVKIT_ROOT="$with_devkit" - # Check for a meta data info file in the root of the devkit - if test -f "$DEVKIT_ROOT/devkit.info"; then - . $DEVKIT_ROOT/devkit.info - # This potentially sets the following: - # A descriptive name of the devkit - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME]) - # Corresponds to --with-extra-path - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH]) - # Corresponds to --with-toolchain-path - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH]) - # Corresponds to --with-sysroot - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT]) + [use this devkit for compilers, tools and resources])]) - # Identifies the Visual Studio version in the devkit - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION]) - # The Visual Studio include environment variable - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE]) - # The Visual Studio lib environment variable - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB]) - # Corresponds to --with-msvcr-dll - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL]) - # Corresponds to --with-msvcp-dll - BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL]) - fi + if test "x$with_devkit" = xyes; then + AC_MSG_ERROR([--with-devkit must have a value]) + elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then + BASIC_FIXUP_PATH([with_devkit]) + DEVKIT_ROOT="$with_devkit" + # Check for a meta data info file in the root of the devkit + if test -f "$DEVKIT_ROOT/devkit.info"; then + . $DEVKIT_ROOT/devkit.info + # This potentially sets the following: + # A descriptive name of the devkit + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME]) + # Corresponds to --with-extra-path + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH]) + # Corresponds to --with-toolchain-path + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH]) + # Corresponds to --with-sysroot + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT]) + + # Identifies the Visual Studio version in the devkit + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION]) + # The Visual Studio include environment variable + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE]) + # The Visual Studio lib environment variable + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB]) + # Corresponds to --with-msvcr-dll + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL]) + # Corresponds to --with-msvcp-dll + BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL]) + fi - AC_MSG_CHECKING([for devkit]) - if test "x$DEVKIT_NAME" != x; then - AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT]) - else - AC_MSG_RESULT([$DEVKIT_ROOT]) - fi + AC_MSG_CHECKING([for devkit]) + if test "x$DEVKIT_NAME" != x; then + AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT]) + else + AC_MSG_RESULT([$DEVKIT_ROOT]) + fi - BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) + BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH) - # Fallback default of just /bin if DEVKIT_PATH is not defined - if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then - DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" - fi - BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH) + # Fallback default of just /bin if DEVKIT_PATH is not defined + if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then + DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" + fi + BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH) - # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known - # places for backwards compatiblity. - if test "x$DEVKIT_SYSROOT" != x; then - SYSROOT="$DEVKIT_SYSROOT" - elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then - SYSROOT="$DEVKIT_ROOT/$host_alias/libc" - elif test -d "$DEVKIT_ROOT/$host/sys-root"; then - SYSROOT="$DEVKIT_ROOT/$host/sys-root" - fi + # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known + # places for backwards compatiblity. + if test "x$DEVKIT_SYSROOT" != x; then + SYSROOT="$DEVKIT_SYSROOT" + elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then + SYSROOT="$DEVKIT_ROOT/$host_alias/libc" + elif test -d "$DEVKIT_ROOT/$host/sys-root"; then + SYSROOT="$DEVKIT_ROOT/$host/sys-root" + fi - if test "x$DEVKIT_ROOT" != x; then - DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib" - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64" - fi - AC_SUBST(DEVKIT_LIB_DIR) - fi - ] - ) + if test "x$DEVKIT_ROOT" != x; then + DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib" + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64" + fi + AC_SUBST(DEVKIT_LIB_DIR) + fi + fi # You can force the sysroot if the sysroot encoded into the compiler tools # is not correct. @@ -1185,9 +1187,6 @@ AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES], [ - # Did user specify any unknown variables? - BASIC_CHECK_LEFTOVER_OVERRIDDEN - AC_MSG_CHECKING([if build directory is on local disk]) BASIC_CHECK_DIR_ON_LOCAL_DISK($OUTPUTDIR, [OUTPUT_DIR_IS_LOCAL="yes"], diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/configure.ac --- a/make/autoconf/configure.ac Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/configure.ac Tue Jan 30 09:03:47 2018 -0800 @@ -280,6 +280,9 @@ # This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features. HOTSPOT_VALIDATE_JVM_FEATURES +# Did user specify any unknown variables? +BASIC_CHECK_LEFTOVER_OVERRIDDEN + # We're messing a bit with internal autoconf variables to put the config.status # in the output directory instead of the current directory. CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status" diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/generated-configure.sh --- a/make/autoconf/generated-configure.sh Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/generated-configure.sh Tue Jan 30 09:03:47 2018 -0800 @@ -5117,7 +5117,7 @@ ################################################################################ # The order of these defines the priority by which we try to find them. -VALID_VS_VERSIONS="2013 2012 2010" +VALID_VS_VERSIONS="2013 2012 2010 2015 2017" VS_DESCRIPTION_2010="Microsoft Visual Studio 2010" VS_VERSION_INTERNAL_2010=100 @@ -5150,6 +5150,30 @@ VS_VS_PLATFORM_NAME_2013="v120" VS_SDK_PLATFORM_NAME_2013= +VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING" +VS_VERSION_INTERNAL_2015=140 +VS_MSVCR_2015=vcruntime140.dll +VS_MSVCP_2015=msvcp140.dll +VS_ENVVAR_2015="VS140COMNTOOLS" +VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0" +VS_SDK_INSTALLDIR_2015= +VS_VS_PLATFORM_NAME_2015="v140" +VS_SDK_PLATFORM_NAME_2015= +# The vcvars of 2015 breaks if 2017 is also installed. Work around this by +# explicitly specifying Windows Kit 8.1 to be used. +VS_ENV_ARGS_2015="8.1" + +VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING" +VS_VERSION_INTERNAL_2017=141 +VS_MSVCR_2017=vcruntime140.dll +VS_MSVCP_2017=msvcp140.dll +VS_ENVVAR_2017="VS150COMNTOOLS" +VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017" +VS_EDITIONS_2017="Community Professional Enterprise" +VS_SDK_INSTALLDIR_2017= +VS_VS_PLATFORM_NAME_2017="v141" +VS_SDK_PLATFORM_NAME_2017= + ################################################################################ @@ -5191,7 +5215,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1516225089 +DATE_WHEN_GENERATED=1517274450 ############################################################################### # @@ -17113,6 +17137,12 @@ # Check whether --with-devkit was given. if test "${with_devkit+set}" = set; then : withval=$with_devkit; +fi + + + if test "x$with_devkit" = xyes; then + as_fn_error $? "--with-devkit must have a value" "$LINENO" 5 + elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then # Only process if variable expands to non-empty @@ -17245,77 +17275,77 @@ fi fi - DEVKIT_ROOT="$with_devkit" - # Check for a meta data info file in the root of the devkit - if test -f "$DEVKIT_ROOT/devkit.info"; then - . $DEVKIT_ROOT/devkit.info - # This potentially sets the following: - # A descriptive name of the devkit + DEVKIT_ROOT="$with_devkit" + # Check for a meta data info file in the root of the devkit + if test -f "$DEVKIT_ROOT/devkit.info"; then + . $DEVKIT_ROOT/devkit.info + # This potentially sets the following: + # A descriptive name of the devkit if test "x$DEVKIT_NAME" = x; then eval DEVKIT_NAME="\${DEVKIT_NAME_${OPENJDK_TARGET_CPU}}" fi - # Corresponds to --with-extra-path + # Corresponds to --with-extra-path if test "x$DEVKIT_EXTRA_PATH" = x; then eval DEVKIT_EXTRA_PATH="\${DEVKIT_EXTRA_PATH_${OPENJDK_TARGET_CPU}}" fi - # Corresponds to --with-toolchain-path + # Corresponds to --with-toolchain-path if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then eval DEVKIT_TOOLCHAIN_PATH="\${DEVKIT_TOOLCHAIN_PATH_${OPENJDK_TARGET_CPU}}" fi - # Corresponds to --with-sysroot + # Corresponds to --with-sysroot if test "x$DEVKIT_SYSROOT" = x; then eval DEVKIT_SYSROOT="\${DEVKIT_SYSROOT_${OPENJDK_TARGET_CPU}}" fi - # Identifies the Visual Studio version in the devkit + # Identifies the Visual Studio version in the devkit if test "x$DEVKIT_VS_VERSION" = x; then eval DEVKIT_VS_VERSION="\${DEVKIT_VS_VERSION_${OPENJDK_TARGET_CPU}}" fi - # The Visual Studio include environment variable + # The Visual Studio include environment variable if test "x$DEVKIT_VS_INCLUDE" = x; then eval DEVKIT_VS_INCLUDE="\${DEVKIT_VS_INCLUDE_${OPENJDK_TARGET_CPU}}" fi - # The Visual Studio lib environment variable + # The Visual Studio lib environment variable if test "x$DEVKIT_VS_LIB" = x; then eval DEVKIT_VS_LIB="\${DEVKIT_VS_LIB_${OPENJDK_TARGET_CPU}}" fi - # Corresponds to --with-msvcr-dll + # Corresponds to --with-msvcr-dll if test "x$DEVKIT_MSVCR_DLL" = x; then eval DEVKIT_MSVCR_DLL="\${DEVKIT_MSVCR_DLL_${OPENJDK_TARGET_CPU}}" fi - # Corresponds to --with-msvcp-dll + # Corresponds to --with-msvcp-dll if test "x$DEVKIT_MSVCP_DLL" = x; then eval DEVKIT_MSVCP_DLL="\${DEVKIT_MSVCP_DLL_${OPENJDK_TARGET_CPU}}" fi - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5 + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5 $as_echo_n "checking for devkit... " >&6; } - if test "x$DEVKIT_NAME" != x; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5 + if test "x$DEVKIT_NAME" != x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5 $as_echo "$DEVKIT_NAME in $DEVKIT_ROOT" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5 $as_echo "$DEVKIT_ROOT" >&6; } - fi + fi if test "x$DEVKIT_EXTRA_PATH" != x; then @@ -17327,10 +17357,10 @@ fi - # Fallback default of just /bin if DEVKIT_PATH is not defined - if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then - DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" - fi + # Fallback default of just /bin if DEVKIT_PATH is not defined + if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then + DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin" + fi if test "x$DEVKIT_TOOLCHAIN_PATH" != x; then if test "x$TOOLCHAIN_PATH" = x; then @@ -17341,27 +17371,24 @@ fi - # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known - # places for backwards compatiblity. - if test "x$DEVKIT_SYSROOT" != x; then - SYSROOT="$DEVKIT_SYSROOT" - elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then - SYSROOT="$DEVKIT_ROOT/$host_alias/libc" - elif test -d "$DEVKIT_ROOT/$host/sys-root"; then - SYSROOT="$DEVKIT_ROOT/$host/sys-root" - fi - - if test "x$DEVKIT_ROOT" != x; then - DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib" - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64" - fi - - fi - - -fi - + # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known + # places for backwards compatiblity. + if test "x$DEVKIT_SYSROOT" != x; then + SYSROOT="$DEVKIT_SYSROOT" + elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then + SYSROOT="$DEVKIT_ROOT/$host_alias/libc" + elif test -d "$DEVKIT_ROOT/$host/sys-root"; then + SYSROOT="$DEVKIT_ROOT/$host/sys-root" + fi + + if test "x$DEVKIT_ROOT" != x; then + DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib" + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64" + fi + + fi + fi # You can force the sysroot if the sysroot encoded into the compiler tools # is not correct. @@ -32299,7 +32326,11 @@ elif test "x$DEVKIT_VS_VERSION" != x; then VS_VERSION=$DEVKIT_VS_VERSION TOOLCHAIN_VERSION=$VS_VERSION - eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + # If the devkit has a name, use that as description + VS_DESCRIPTION="$DEVKIT_NAME" + if test "x$VS_DESCRIPTION" = x; then + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + fi eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" @@ -32367,7 +32398,9 @@ eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}" eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}" eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}" + eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}" eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}" + eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}" # When using --with-tools-dir, assume it points to the correct and default # version of Visual Studio or that --with-toolchain-version was also set. @@ -32378,12 +32411,6 @@ VS_BASE="$with_tools_dir/../.." METHOD="--with-tools-dir" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - windows_path="$VS_BASE" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -32394,19 +32421,42 @@ VS_BASE="$unix_path" fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32417,12 +32467,6 @@ VS_BASE="$with_tools_dir/../../.." METHOD="--with-tools-dir" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - windows_path="$VS_BASE" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -32433,19 +32477,42 @@ VS_BASE="$unix_path" fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32464,7 +32531,6 @@ fi VS_ENV_CMD="" - VS_ENV_ARGS="" if test "x$VS_COMNTOOLS" != x; then @@ -32473,12 +32539,6 @@ VS_BASE="$VS_COMNTOOLS/../.." METHOD="$VS_COMNTOOLS_VAR variable" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - windows_path="$VS_BASE" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -32489,19 +32549,42 @@ VS_BASE="$unix_path" fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32514,12 +32597,6 @@ VS_BASE="$PROGRAMFILES/$VS_INSTALL_DIR" METHOD="well-known name" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - windows_path="$VS_BASE" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -32530,19 +32607,42 @@ VS_BASE="$unix_path" fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32557,12 +32657,6 @@ VS_BASE="$PROGRAMFILES_X86/$VS_INSTALL_DIR" METHOD="well-known name" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - windows_path="$VS_BASE" if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then @@ -32573,19 +32667,42 @@ VS_BASE="$unix_path" fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32597,11 +32714,61 @@ VS_BASE="C:/Program Files/$VS_INSTALL_DIR" METHOD="well-known name" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi + + windows_path="$VS_BASE" + if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then + unix_path=`$CYGPATH -u "$windows_path"` + VS_BASE="$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'` + VS_BASE="$unix_path" + fi + + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi + + if test -d "$VS_BASE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 + eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" + fi + fi + fi + + + if test "x$VS_ENV_CMD" = x; then + VS_VERSION="${VS_VERSION}" + VS_BASE="C:/Program Files (x86)/$VS_INSTALL_DIR" + METHOD="well-known name" windows_path="$VS_BASE" @@ -32613,58 +32780,42 @@ VS_BASE="$unix_path" fi - if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 - eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} - fi - fi - fi - - - if test "x$VS_ENV_CMD" = x; then - VS_VERSION="${VS_VERSION}" - VS_BASE="C:/Program Files (x86)/$VS_INSTALL_DIR" - METHOD="well-known name" - - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" - fi - - - windows_path="$VS_BASE" - if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then - unix_path=`$CYGPATH -u "$windows_path"` - VS_BASE="$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'` - VS_BASE="$unix_path" - fi + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done + fi if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;} + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;} - { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;} fi fi fi @@ -32917,6 +33068,11 @@ fi done + TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION" + if test "$TOOLCHAIN_VERSION" -gt 2013; then + UNSUPPORTED_TOOLCHAIN_VERSION=yes + fi + # If we have a devkit, skip all of the below. if test "x$DEVKIT_VS_VERSION" = x; then @@ -33249,6 +33405,9 @@ # This will end up something like: # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # In some cases, the VS_ENV_CMD will change directory, change back so + # the set-vs-env.sh ends up in the right place. + $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE # These will end up something like: # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh # The trailing space for everyone except PATH is no typo, but is needed due @@ -33670,7 +33829,7 @@ if test "x$XCODE_VERSION_OUTPUT" != x; then # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '` - TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode" + TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION" else # Currently we do not define this for other toolchains. This might change as the need arise. TOOLCHAIN_VERSION= @@ -55888,7 +56047,6 @@ MSVC_DLL= if test "x$MSVC_DLL" = x; then - # Probe: Using well-known location from Visual Studio 10.0 if test "x$VCINSTALLDIR" != x; then CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" @@ -55901,15 +56059,27 @@ CYGWIN_VC_INSTALL_DIR="$unix_path" fi - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" - else - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" - fi - $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL" + if test "$VS_VERSION" -lt 2017; then + # Probe: Using well-known location from Visual Studio 12.0 and older + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + else + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + fi + else + # Probe: Using well-known location from VS 2017 + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + else + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + fi + fi + # In case any of the above finds more than one file, loop over them. + for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do + $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll" DLL_NAME="$DLL_NAME" - POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL" + POSSIBLE_MSVC_DLL="$possible_msvc_dll" METHOD="well-known location in VCINSTALLDIR" if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5 @@ -56082,6 +56252,7 @@ fi fi + done fi fi @@ -57237,7 +57408,6 @@ MSVC_DLL= if test "x$MSVC_DLL" = x; then - # Probe: Using well-known location from Visual Studio 10.0 if test "x$VCINSTALLDIR" != x; then CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" @@ -57250,15 +57420,27 @@ CYGWIN_VC_INSTALL_DIR="$unix_path" fi - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" - else - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" - fi - $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL" + if test "$VS_VERSION" -lt 2017; then + # Probe: Using well-known location from Visual Studio 12.0 and older + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + else + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + fi + else + # Probe: Using well-known location from VS 2017 + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + else + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + fi + fi + # In case any of the above finds more than one file, loop over them. + for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do + $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll" DLL_NAME="$DLL_NAME" - POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL" + POSSIBLE_MSVC_DLL="$possible_msvc_dll" METHOD="well-known location in VCINSTALLDIR" if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5 @@ -57431,6 +57613,7 @@ fi fi + done fi fi @@ -68900,16 +69083,6 @@ fi - # Did user specify any unknown variables? - - if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then - # Replace the separating ! with spaces before presenting for end user. - unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The following variables might be unknown to configure: $unknown_variables" >&5 -$as_echo "$as_me: WARNING: The following variables might be unknown to configure: $unknown_variables" >&2;} - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if build directory is on local disk" >&5 $as_echo_n "checking if build directory is on local disk... " >&6; } @@ -68991,6 +69164,16 @@ done +# Did user specify any unknown variables? + + if test "x$CONFIGURE_OVERRIDDEN_VARIABLES" != x; then + # Replace the separating ! with spaces before presenting for end user. + unknown_variables=${CONFIGURE_OVERRIDDEN_VARIABLES//!/ } + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: The following variables might be unknown to configure: $unknown_variables" >&5 +$as_echo "$as_me: WARNING: The following variables might be unknown to configure: $unknown_variables" >&2;} + fi + + # We're messing a bit with internal autoconf variables to put the config.status # in the output directory instead of the current directory. CONFIG_STATUS="$CONFIGURESUPPORT_OUTPUTDIR/config.status" @@ -70223,10 +70406,7 @@ printf "* Environment: $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n" fi printf "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)\n" - if test "x$TOOLCHAIN_VERSION" != "x"; then - print_version=" $TOOLCHAIN_VERSION" - fi - printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" + printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n" printf "* C Compiler: Version $CC_VERSION_NUMBER (at $CC)\n" printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at $CXX)\n" @@ -70274,6 +70454,12 @@ printf "\n" fi + if test "x$UNSUPPORTED_TOOLCHAIN_VERSION" = "xyes"; then + printf "WARNING: The toolchain version used is known to have issues. Please\n" + printf "consider using a supported version unless you know what you are doing.\n" + printf "\n" + fi + # Locate config.log. diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/help.m4 --- a/make/autoconf/help.m4 Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/help.m4 Tue Jan 30 09:03:47 2018 -0800 @@ -242,10 +242,7 @@ printf "* Environment: $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n" fi printf "* Boot JDK: $BOOT_JDK_VERSION (at $BOOT_JDK)\n" - if test "x$TOOLCHAIN_VERSION" != "x"; then - print_version=" $TOOLCHAIN_VERSION" - fi - printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" + printf "* Toolchain: $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n" printf "* C Compiler: Version $CC_VERSION_NUMBER (at $CC)\n" printf "* C++ Compiler: Version $CXX_VERSION_NUMBER (at $CXX)\n" @@ -292,6 +289,12 @@ printf "You should run without '--no-create | -n' to create the configuration.\n" printf "\n" fi + + if test "x$UNSUPPORTED_TOOLCHAIN_VERSION" = "xyes"; then + printf "WARNING: The toolchain version used is known to have issues. Please\n" + printf "consider using a supported version unless you know what you are doing.\n" + printf "\n" + fi ]) AC_DEFUN_ONCE([HELP_REPEAT_WARNINGS], diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/toolchain.m4 --- a/make/autoconf/toolchain.m4 Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/toolchain.m4 Tue Jan 30 09:03:47 2018 -0800 @@ -286,7 +286,7 @@ if test "x$XCODE_VERSION_OUTPUT" != x; then # For Xcode, we set the Xcode version as TOOLCHAIN_VERSION TOOLCHAIN_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | $CUT -f 2 -d ' '` - TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode" + TOOLCHAIN_DESCRIPTION="$TOOLCHAIN_DESCRIPTION from Xcode $TOOLCHAIN_VERSION" else # Currently we do not define this for other toolchains. This might change as the need arise. TOOLCHAIN_VERSION= diff -r fb62f481671e -r 2d03ebb72df2 make/autoconf/toolchain_windows.m4 --- a/make/autoconf/toolchain_windows.m4 Tue Jan 30 11:53:00 2018 +0530 +++ b/make/autoconf/toolchain_windows.m4 Tue Jan 30 09:03:47 2018 -0800 @@ -25,7 +25,7 @@ ################################################################################ # The order of these defines the priority by which we try to find them. -VALID_VS_VERSIONS="2013 2012 2010" +VALID_VS_VERSIONS="2013 2012 2010 2015 2017" VS_DESCRIPTION_2010="Microsoft Visual Studio 2010" VS_VERSION_INTERNAL_2010=100 @@ -58,6 +58,30 @@ VS_VS_PLATFORM_NAME_2013="v120" VS_SDK_PLATFORM_NAME_2013= +VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING" +VS_VERSION_INTERNAL_2015=140 +VS_MSVCR_2015=vcruntime140.dll +VS_MSVCP_2015=msvcp140.dll +VS_ENVVAR_2015="VS140COMNTOOLS" +VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0" +VS_SDK_INSTALLDIR_2015= +VS_VS_PLATFORM_NAME_2015="v140" +VS_SDK_PLATFORM_NAME_2015= +# The vcvars of 2015 breaks if 2017 is also installed. Work around this by +# explicitly specifying Windows Kit 8.1 to be used. +VS_ENV_ARGS_2015="8.1" + +VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING" +VS_VERSION_INTERNAL_2017=141 +VS_MSVCR_2017=vcruntime140.dll +VS_MSVCP_2017=msvcp140.dll +VS_ENVVAR_2017="VS150COMNTOOLS" +VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017" +VS_EDITIONS_2017="Community Professional Enterprise" +VS_SDK_INSTALLDIR_2017= +VS_VS_PLATFORM_NAME_2017="v141" +VS_SDK_PLATFORM_NAME_2017= + ################################################################################ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT], @@ -67,23 +91,41 @@ VS_BASE="$2" METHOD="$3" - if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then - VCVARSFILE="vc/bin/vcvars32.bat" - else - VCVARSFILE="vc/bin/amd64/vcvars64.bat" + BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE) + # In VS 2017, the default installation is in a subdir named after the edition. + # Find the first one present and use that. + if test "x$VS_EDITIONS" != x; then + for edition in $VS_EDITIONS; do + if test -d "$VS_BASE/$edition"; then + VS_BASE="$VS_BASE/$edition" + break + fi + done fi - BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE) if test -d "$VS_BASE"; then - if test -f "$VS_BASE/$VCVARSFILE"; then - AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) - VS_ENV_CMD="$VS_BASE/$VCVARSFILE" - # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see - # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013 + AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) + if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then + VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat" + else + VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \ + vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat" + fi + + for VCVARSFILE in $VCVARSFILES; do + if test -f "$VS_BASE/$VCVARSFILE"; then + VS_ENV_CMD="$VS_BASE/$VCVARSFILE" + break + fi + done + + if test "x$VS_ENV_CMD" = x; then + AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring]) + else + # PLATFORM_TOOLSET is used during the compilation of the freetype sources + # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', + # 'v110' or 'v120' for VS 2010, 2012 or VS2013 eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" - else - AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD]) - AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring]) fi fi fi @@ -133,7 +175,9 @@ eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}" eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}" eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}" + eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}" eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}" + eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}" # When using --with-tools-dir, assume it points to the correct and default # version of Visual Studio or that --with-toolchain-version was also set. @@ -153,7 +197,6 @@ fi VS_ENV_CMD="" - VS_ENV_ARGS="" if test "x$VS_COMNTOOLS" != x; then TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}], @@ -213,7 +256,11 @@ elif test "x$DEVKIT_VS_VERSION" != x; then VS_VERSION=$DEVKIT_VS_VERSION TOOLCHAIN_VERSION=$VS_VERSION - eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + # If the devkit has a name, use that as description + VS_DESCRIPTION="$DEVKIT_NAME" + if test "x$VS_DESCRIPTION" = x; then + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" + fi eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" @@ -267,6 +314,11 @@ break fi done + + TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION" + if test "$TOOLCHAIN_VERSION" -gt 2013; then + UNSUPPORTED_TOOLCHAIN_VERSION=yes + fi ]) ################################################################################ @@ -320,6 +372,9 @@ # This will end up something like: # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE + # In some cases, the VS_ENV_CMD will change directory, change back so + # the set-vs-env.sh ends up in the right place. + $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE # These will end up something like: # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh # The trailing space for everyone except PATH is no typo, but is needed due @@ -483,18 +538,30 @@ MSVC_DLL= if test "x$MSVC_DLL" = x; then - # Probe: Using well-known location from Visual Studio 10.0 if test "x$VCINSTALLDIR" != x; then CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR" BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR) - if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + if test "$VS_VERSION" -lt 2017; then + # Probe: Using well-known location from Visual Studio 12.0 and older + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + else + POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + fi else - POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME" + # Probe: Using well-known location from VS 2017 + if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + else + POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`" + fi fi - $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL" - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], - [well-known location in VCINSTALLDIR]) + # In case any of the above finds more than one file, loop over them. + for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do + $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll" + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll], + [well-known location in VCINSTALLDIR]) + done fi fi @@ -576,7 +643,7 @@ TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit]) if test "x$MSVC_DLL" = x; then AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit]) - fi + fi MSVCR_DLL="$MSVC_DLL" else TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}]) @@ -599,7 +666,7 @@ TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit]) if test "x$MSVC_DLL" = x; then AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit]) - fi + fi MSVCP_DLL="$MSVC_DLL" else TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}]) diff -r fb62f481671e -r 2d03ebb72df2 make/devkit/createWindowsDevkit.sh --- a/make/devkit/createWindowsDevkit.sh Tue Jan 30 11:53:00 2018 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -#!/bin/bash -# -# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. Oracle designates this -# particular file as subject to the "Classpath" exception as provided -# by Oracle in the LICENSE file that accompanied this code. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# - -# This script copies parts of a Visual Studio 2013 installation into a devkit -# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin. -# erik.joelsson@oracle.com - -VS_VERSION="2013" -VS_VERSION_NUM="12.0" -VS_VERSION_NUM_NODOT="120" -SDK_VERSION="8.1" -VS_VERSION_SP="SP4" - -SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" -BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" -DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}${VS_VERSION_SP}-devkit" -DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" - -echo "Creating devkit in $DEVKIT_ROOT" - -MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcr${VS_VERSION_NUM_NODOT}.dll -MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll - -################################################################################ -# Copy Visual Studio files - -eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\"" -VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")" -echo "VS_INSTALL_DIR: $VS_INSTALL_DIR" - -if [ ! -d $DEVKIT_ROOT/VC ]; then - echo "Copying VC..." - mkdir -p $DEVKIT_ROOT/VC/bin - cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/ - cp "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/ - cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/ - mkdir -p $DEVKIT_ROOT/VC/lib - cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/ - cp "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/ - cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/ - mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib - cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/ - cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/ - cp "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/ - mkdir -p $DEVKIT_ROOT/VC/redist - cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/ - cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/ - # The redist runtime libs are needed to run the compiler but may not be - # installed on the machine where the devkit will be used. - cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/ - cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/ - cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/ - cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/ - # The msvcdis dll is needed to run some of the tools in VC/bin but is not - # shipped in that directory. Copy it from the common dir. - cp "$VS_INSTALL_DIR/Common7/IDE/msvcdis${VS_VERSION_NUM_NODOT}.dll" \ - $DEVKIT_ROOT/VC/bin/ -fi - -################################################################################ -# Copy SDK files - -PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`" -SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")" -echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR" - -if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then - echo "Copying SDK..." - mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin - cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/ - cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/ - mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib - cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/ - cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/ - cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/ -fi - -################################################################################ -# Generate devkit.info - -echo-info() { - echo "$1" >> $DEVKIT_ROOT/devkit.info -} - -echo "Generating devkit.info..." -rm -f $DEVKIT_ROOT/devkit.info -echo-info "# This file describes to configure how to interpret the contents of this devkit" -echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\"" -echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\"" -echo-info "" -echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" -echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" -echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\"" -echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\"" -echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\"" -echo-info "" -echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" -echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" -echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\"" -echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\"" -echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\"" - -################################################################################ -# Copy this script - -echo "Copying this script..." -cp $0 $DEVKIT_ROOT/ - -################################################################################ -# Create bundle - -echo "Creating bundle: $DEVKIT_BUNDLE" -(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .) diff -r fb62f481671e -r 2d03ebb72df2 make/devkit/createWindowsDevkit2013.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/devkit/createWindowsDevkit2013.sh Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,136 @@ +#!/bin/bash +# +# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This script copies parts of a Visual Studio 2013 installation into a devkit +# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin. +# erik.joelsson@oracle.com + +VS_VERSION="2013" +VS_VERSION_NUM="12.0" +VS_VERSION_NUM_NODOT="120" +SDK_VERSION="8.1" +VS_VERSION_SP="SP4" + +SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" +BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" +DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}${VS_VERSION_SP}-devkit" +DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" + +echo "Creating devkit in $DEVKIT_ROOT" + +MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcr${VS_VERSION_NUM_NODOT}.dll +MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll + +################################################################################ +# Copy Visual Studio files + +eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\"" +VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")" +echo "VS_INSTALL_DIR: $VS_INSTALL_DIR" + +if [ ! -d $DEVKIT_ROOT/VC ]; then + echo "Copying VC..." + mkdir -p $DEVKIT_ROOT/VC/bin + cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/ + cp "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/ + cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/ + mkdir -p $DEVKIT_ROOT/VC/lib + cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/ + cp "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/ + cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/ + mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib + cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/ + cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/ + cp "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/ + mkdir -p $DEVKIT_ROOT/VC/redist + cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/ + cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/ + # The redist runtime libs are needed to run the compiler but may not be + # installed on the machine where the devkit will be used. + cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/ + cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/ + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/ + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/ + # The msvcdis dll is needed to run some of the tools in VC/bin but is not + # shipped in that directory. Copy it from the common dir. + cp "$VS_INSTALL_DIR/Common7/IDE/msvcdis${VS_VERSION_NUM_NODOT}.dll" \ + $DEVKIT_ROOT/VC/bin/ +fi + +################################################################################ +# Copy SDK files + +PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`" +SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")" +echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR" + +if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then + echo "Copying SDK..." + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin + cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/ + cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/ + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib + cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/ +fi + +################################################################################ +# Generate devkit.info + +echo-info() { + echo "$1" >> $DEVKIT_ROOT/devkit.info +} + +echo "Generating devkit.info..." +rm -f $DEVKIT_ROOT/devkit.info +echo-info "# This file describes to configure how to interpret the contents of this devkit" +echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\"" +echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" +echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\"" +echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" +echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\"" +echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\"" + +################################################################################ +# Copy this script + +echo "Copying this script..." +cp $0 $DEVKIT_ROOT/ + +################################################################################ +# Create bundle + +echo "Creating bundle: $DEVKIT_BUNDLE" +(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .) diff -r fb62f481671e -r 2d03ebb72df2 make/devkit/createWindowsDevkit2015.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/devkit/createWindowsDevkit2015.sh Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,142 @@ +#!/bin/bash +# +# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This script copies parts of a Visual Studio installation into a devkit +# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin. +# erik.joelsson@oracle.com + +VS_VERSION="2015" +VS_VERSION_NUM="14.0" +VS_VERSION_NUM_NODOT="140" +SDK_VERSION="8.1" +VS_VERSION_SP="update3" + +SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" +BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" +DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}${VS_VERSION_SP}-devkit" +DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" + +echo "Creating devkit in $DEVKIT_ROOT" + +MSVCR_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/vcruntime${VS_VERSION_NUM_NODOT}.dll +MSVCP_DLL=Microsoft.VC${VS_VERSION_NUM_NODOT}.CRT/msvcp${VS_VERSION_NUM_NODOT}.dll + +################################################################################ +# Copy Visual Studio files + +eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\"" +VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")" +echo "VS_INSTALL_DIR: $VS_INSTALL_DIR" + +if [ ! -d $DEVKIT_ROOT/VC ]; then + echo "Copying VC..." + mkdir -p $DEVKIT_ROOT/VC/bin + cp -r "$VS_INSTALL_DIR/VC/bin/amd64" $DEVKIT_ROOT/VC/bin/ + cp "$VS_INSTALL_DIR/VC/bin/"*.* $DEVKIT_ROOT/VC/bin/ + cp -r "$VS_INSTALL_DIR/VC/bin/1033/" $DEVKIT_ROOT/VC/bin/ + mkdir -p $DEVKIT_ROOT/VC/lib + cp -r "$VS_INSTALL_DIR/VC/lib/amd64" $DEVKIT_ROOT/VC/lib/ + cp "$VS_INSTALL_DIR/VC/lib/"*.* $DEVKIT_ROOT/VC/lib/ + cp -r "$VS_INSTALL_DIR/VC/include" $DEVKIT_ROOT/VC/ + mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib + cp -r "$VS_INSTALL_DIR/VC/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/ + cp -r "$VS_INSTALL_DIR/VC/atlmfc/lib/amd64" $DEVKIT_ROOT/VC/atlmfc/lib/ + cp "$VS_INSTALL_DIR/VC/atlmfc/lib/"*.* $DEVKIT_ROOT/VC/atlmfc/lib/ + mkdir -p $DEVKIT_ROOT/VC/redist + cp -r "$VS_INSTALL_DIR/VC/redist/x64" $DEVKIT_ROOT/VC/redist/ + cp -r "$VS_INSTALL_DIR/VC/redist/x86" $DEVKIT_ROOT/VC/redist/ + # The redist runtime libs are needed to run the compiler but may not be + # installed on the machine where the devkit will be used. + cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/ + cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/ + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/amd64/ + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/amd64/ + # The msvcdis dll is needed to run some of the tools in VC/bin but is not + # shipped in that directory. Copy it from the common dir. + cp "$VS_INSTALL_DIR/Common7/IDE/msvcdis${VS_VERSION_NUM_NODOT}.dll" \ + $DEVKIT_ROOT/VC/bin/ +fi + +################################################################################ +# Copy SDK files + +PROGRAMFILES_X86="`env | sed -n 's/^ProgramFiles(x86)=//p'`" +SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")" +echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR" + +if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then + echo "Copying SDK..." + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin + cp -r "$SDK_INSTALL_DIR/bin/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/ + cp -r "$SDK_INSTALL_DIR/bin/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/ + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib + cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x64 $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/lib/"winv*/um/x86 $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/include" $DEVKIT_ROOT/$SDK_VERSION/ + # In 2015, the new Universal CRT is delivered in the sdk 10 directory + # so need to include that as well. + mkdir -p $DEVKIT_ROOT/10/lib + cp -r "$SDK_INSTALL_DIR/../10/lib/10.0.10240.0/ucrt" $DEVKIT_ROOT/10/lib/ + mkdir -p $DEVKIT_ROOT/10/include + cp -r "$SDK_INSTALL_DIR/../10/include/10.0.10240.0/ucrt" $DEVKIT_ROOT/10/include/ +fi + +################################################################################ +# Generate devkit.info + +echo-info() { + echo "$1" >> $DEVKIT_ROOT/devkit.info +} + +echo "Generating devkit.info..." +rm -f $DEVKIT_ROOT/devkit.info +echo-info "# This file describes to configure how to interpret the contents of this devkit" +echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\"" +echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt;\$DEVKIT_ROOT/10/include/ucrt\"" +echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib;\$DEVKIT_ROOT/VC/atlmfc/lib;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86;\$DEVKIT_ROOT/10/lib/ucrt/x86\"" +echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/amd64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt;\$DEVKIT_ROOT/10/include/ucrt\"" +echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/amd64;\$DEVKIT_ROOT/VC/atlmfc/lib/amd64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64;\$DEVKIT_ROOT/10/lib/ucrt/x64\"" +echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\"" + +################################################################################ +# Copy this script + +echo "Copying this script..." +cp $0 $DEVKIT_ROOT/ + +################################################################################ +# Create bundle + +echo "Creating bundle: $DEVKIT_BUNDLE" +(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .) diff -r fb62f481671e -r 2d03ebb72df2 make/devkit/createWindowsDevkit2017.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/devkit/createWindowsDevkit2017.sh Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,172 @@ +#!/bin/bash +# +# Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This script copies parts of a Visual Studio installation into a devkit +# suitable for building OpenJDK and OracleJDK. Needs to run in Cygwin. +# erik.joelsson@oracle.com + +VS_VERSION="2017" +VS_VERSION_NUM_NODOT="150" +VS_DLL_VERSION="140" +SDK_VERSION="10" +SDK_FULL_VERSION="10.0.16299.0" +MSVC_DIR="Microsoft.VC141.CRT" + +SCRIPT_DIR="$(cd "$(dirname $0)" > /dev/null && pwd)" +BUILD_DIR="${SCRIPT_DIR}/../../build/devkit" + +################################################################################ +# Prepare settings + +# Work around the insanely named ProgramFiles(x86) env variable +PROGRAMFILES_X86="$(cygpath "$(env | sed -n 's/^ProgramFiles(x86)=//p')")" + +# Find Visual Studio installation dir +eval VSNNNCOMNTOOLS="\"\${VS${VS_VERSION_NUM_NODOT}COMNTOOLS}\"" +if [ -d "$VSNNNCOMNTOOLS" ]; then + VS_INSTALL_DIR="$(cygpath "$VSNNNCOMNTOOLS/../..")" +else + VS_INSTALL_DIR="${PROGRAMFILES_X86}/Microsoft Visual Studio/2017" + VS_INSTALL_DIR="$(ls -d "${VS_INSTALL_DIR}/"{Community,Professional} 2>/dev/null | head -n1)" + VS_INSTALL_DIR="$(cygpath "$VS_INSTALL_DIR")" +fi +echo "VS_INSTALL_DIR: $VS_INSTALL_DIR" + +# Extract semantic version +POTENTIAL_INI_FILES="Common7\IDE\wdexpress.isolation.ini Common7\IDE\devenv.isolation.ini" +for f in $POTENTIAL_INI_FILES; do + if [ -f "$VS_INSTALL_DIR/$f" ]; then + VS_VERSION_SP="$(grep ^SemanticVersion= "$VS_INSTALL_DIR/$f")" + # Remove SemnaticVersion= + VS_VERSION_SP="${VS_VERSION_SP#*=}" + # Remove suffix of too detailed numbering starting with + + VS_VERSION_SP="${VS_VERSION_SP%+*}" + break + fi +done +if [ -z "$VS_VERSION_SP" ]; then + echo "Failed to find SP version" + exit 1 +fi +echo "Found Version SP: $VS_VERSION_SP" + +# Setup output dirs +DEVKIT_ROOT="${BUILD_DIR}/VS${VS_VERSION}-${VS_VERSION_SP}-devkit" +DEVKIT_BUNDLE="${DEVKIT_ROOT}.tar.gz" + +echo "Creating devkit in $DEVKIT_ROOT" + +MSVCR_DLL=${MSVC_DIR}/vcruntime${VS_DLL_VERSION}.dll +MSVCP_DLL=${MSVC_DIR}/msvcp${VS_DLL_VERSION}.dll + +################################################################################ +# Copy Visual Studio files + +if [ ! -d $DEVKIT_ROOT/VC ]; then + VC_SUBDIR="VC/Tools/MSVC/14.12.25827" + REDIST_SUBDIR="VC/Redist/MSVC/14.12.25810" + echo "Copying VC..." + mkdir -p $DEVKIT_ROOT/VC/bin + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/bin/Hostx64/x64" $DEVKIT_ROOT/VC/bin/ + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/bin/Hostx86/x86" $DEVKIT_ROOT/VC/bin/ + mkdir -p $DEVKIT_ROOT/VC/lib + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/lib/x64" $DEVKIT_ROOT/VC/lib/ + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/lib/x86" $DEVKIT_ROOT/VC/lib/ + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/include" $DEVKIT_ROOT/VC/ + mkdir -p $DEVKIT_ROOT/VC/atlmfc/lib + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/atlmfc/lib/x64" $DEVKIT_ROOT/VC/atlmfc/lib/ + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/atlmfc/lib/x86" $DEVKIT_ROOT/VC/atlmfc/lib/ + cp -r "$VS_INSTALL_DIR/${VC_SUBDIR}/atlmfc/include" $DEVKIT_ROOT/VC/atlmfc/ + mkdir -p $DEVKIT_ROOT/VC/Auxiliary + cp -r "$VS_INSTALL_DIR/VC/Auxiliary/Build" $DEVKIT_ROOT/VC/Auxiliary/ + mkdir -p $DEVKIT_ROOT/VC/redist + cp -r "$VS_INSTALL_DIR/$REDIST_SUBDIR/x64" $DEVKIT_ROOT/VC/redist/ + cp -r "$VS_INSTALL_DIR/$REDIST_SUBDIR/x86" $DEVKIT_ROOT/VC/redist/ + + # The redist runtime libs are needed to run the compiler but may not be + # installed on the machine where the devkit will be used. + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/x86 + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/x86 + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/x64 + cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/x64 +fi + +################################################################################ +# Copy SDK files + +SDK_INSTALL_DIR="$(cygpath "$PROGRAMFILES_X86/Windows Kits/$SDK_VERSION")" +echo "SDK_INSTALL_DIR: $SDK_INSTALL_DIR" + +if [ ! -d $DEVKIT_ROOT/$SDK_VERSION ]; then + echo "Copying SDK..." + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/bin + cp -r "$SDK_INSTALL_DIR/bin/$SDK_FULL_VERSION/x64" $DEVKIT_ROOT/$SDK_VERSION/bin/ + cp -r "$SDK_INSTALL_DIR/bin/$SDK_FULL_VERSION/x86" $DEVKIT_ROOT/$SDK_VERSION/bin/ + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/lib + cp -r "$SDK_INSTALL_DIR/lib/$SDK_FULL_VERSION/um/x64" $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/lib/$SDK_FULL_VERSION/um/x86" $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/lib/$SDK_FULL_VERSION/ucrt/x64" $DEVKIT_ROOT/$SDK_VERSION/lib/ + cp -r "$SDK_INSTALL_DIR/lib/$SDK_FULL_VERSION/ucrt/x86" $DEVKIT_ROOT/$SDK_VERSION/lib/ + mkdir -p $DEVKIT_ROOT/$SDK_VERSION/include + cp -r "$SDK_INSTALL_DIR/include/$SDK_FULL_VERSION/"* $DEVKIT_ROOT/$SDK_VERSION/include/ +fi + +################################################################################ +# Generate devkit.info + +echo-info() { + echo "$1" >> $DEVKIT_ROOT/devkit.info +} + +echo "Generating devkit.info..." +rm -f $DEVKIT_ROOT/devkit.info +echo-info "# This file describes to configure how to interpret the contents of this devkit" +echo-info "DEVKIT_NAME=\"Microsoft Visual Studio $VS_VERSION $VS_VERSION_SP (devkit)\"" +echo-info "DEVKIT_VS_VERSION=\"$VS_VERSION\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86=\"\$DEVKIT_ROOT/VC/bin/x86:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" +echo-info "DEVKIT_VS_LIB_x86=\"\$DEVKIT_ROOT/VC/lib/x86;\$DEVKIT_ROOT/VC/atlmfc/lib/x86;\$DEVKIT_ROOT/$SDK_VERSION/lib/x86\"" +echo-info "DEVKIT_MSVCR_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86=\"\$DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL\"" +echo-info "" +echo-info "DEVKIT_TOOLCHAIN_PATH_x86_64=\"\$DEVKIT_ROOT/VC/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x64:\$DEVKIT_ROOT/$SDK_VERSION/bin/x86\"" +echo-info "DEVKIT_VS_INCLUDE_x86_64=\"\$DEVKIT_ROOT/VC/include;\$DEVKIT_ROOT/VC/atlmfc/include;\$DEVKIT_ROOT/$SDK_VERSION/include/shared;\$DEVKIT_ROOT/$SDK_VERSION/include/ucrt;\$DEVKIT_ROOT/$SDK_VERSION/include/um;\$DEVKIT_ROOT/$SDK_VERSION/include/winrt\"" +echo-info "DEVKIT_VS_LIB_x86_64=\"\$DEVKIT_ROOT/VC/lib/x64;\$DEVKIT_ROOT/VC/atlmfc/lib/x64;\$DEVKIT_ROOT/$SDK_VERSION/lib/x64\"" +echo-info "DEVKIT_MSVCR_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL\"" +echo-info "DEVKIT_MSVCP_DLL_x86_64=\"\$DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL\"" + +################################################################################ +# Copy this script + +echo "Copying this script..." +cp $0 $DEVKIT_ROOT/ + +################################################################################ +# Create bundle + +echo "Creating bundle: $DEVKIT_BUNDLE" +(cd "$DEVKIT_ROOT" && tar zcf "$DEVKIT_BUNDLE" .) diff -r fb62f481671e -r 2d03ebb72df2 make/idea/idea.gmk --- a/make/idea/idea.gmk Tue Jan 30 11:53:00 2018 +0530 +++ b/make/idea/idea.gmk Tue Jan 30 09:03:47 2018 -0800 @@ -20,16 +20,9 @@ SEL_MODULES := $(MODULES) endif - # Find all source dirs for a particular module - # $1 - Module to find source dirs for - FindIdeaModuleSrcDirs = \ - $(strip $(addsuffix /$(strip $1), $(GENERATED_SRC_DIRS) $(IMPORT_MODULES_SRC)) \ - $(wildcard $(foreach sub, $(SRC_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))))) - - idea: $(ECHO) "SUPPORT=$(SUPPORT_OUTPUTDIR)" >> $(OUT) - $(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(SEL_MODULES), $(call FindIdeaModuleSrcDirs,$(mod)))\"" >> $(OUT) + $(ECHO) "MODULE_ROOTS=\"$(foreach mod, $(SEL_MODULES), $(call FindModuleSrcDirs,$(mod)))\"" >> $(OUT) $(ECHO) "MODULE_NAMES=\"$(strip $(foreach mod, $(SEL_MODULES), $(mod)))\"" >> $(OUT) $(ECHO) "SEL_MODULES=\"$(SEL_MODULES)\"" >> $(OUT) $(ECHO) "BOOT_JDK=\"$(BOOT_JDK)\"" >> $(OUT) diff -r fb62f481671e -r 2d03ebb72df2 make/idea/template/ant.xml --- a/make/idea/template/ant.xml Tue Jan 30 11:53:00 2018 +0530 +++ b/make/idea/template/ant.xml Tue Jan 30 09:03:47 2018 -0800 @@ -3,7 +3,6 @@ - diff -r fb62f481671e -r 2d03ebb72df2 make/idea/template/build.xml --- a/make/idea/template/build.xml Tue Jan 30 11:53:00 2018 +0530 +++ b/make/idea/template/build.xml Tue Jan 30 09:03:47 2018 -0800 @@ -6,32 +6,16 @@ new JdkLogger(project) - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + @@ -43,71 +27,17 @@ **** Global JDK Build Targets --> - - - - - - + - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r fb62f481671e -r 2d03ebb72df2 make/idea/template/jdk.iml --- a/make/idea/template/jdk.iml Tue Jan 30 11:53:00 2018 +0530 +++ b/make/idea/template/jdk.iml Tue Jan 30 09:03:47 2018 -0800 @@ -4,11 +4,9 @@ - - - + diff -r fb62f481671e -r 2d03ebb72df2 src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Tue Jan 30 11:53:00 2018 +0530 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp Tue Jan 30 09:03:47 2018 -0800 @@ -963,8 +963,12 @@ RegisterOrConstant itable_index, Register method_result, Register scan_temp, - Label& L_no_such_interface) { - assert_different_registers(recv_klass, intf_klass, method_result, scan_temp); + Label& L_no_such_interface, + bool return_method) { + assert_different_registers(recv_klass, intf_klass, scan_temp); + assert_different_registers(method_result, intf_klass, scan_temp); + assert(recv_klass != method_result || !return_method, + "recv_klass can be destroyed when method isn't needed"); assert(itable_index.is_constant() || itable_index.as_register() == method_result, "caller must use same register for non-constant itable index as for method"); @@ -982,12 +986,14 @@ lea(scan_temp, Address(recv_klass, scan_temp, Address::lsl(3))); add(scan_temp, scan_temp, vtable_base); - // Adjust recv_klass by scaled itable_index, so we can free itable_index. - assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); - // lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off)); - lea(recv_klass, Address(recv_klass, itable_index, Address::lsl(3))); - if (itentry_off) - add(recv_klass, recv_klass, itentry_off); + if (return_method) { + // Adjust recv_klass by scaled itable_index, so we can free itable_index. + assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); + // lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off)); + lea(recv_klass, Address(recv_klass, itable_index, Address::lsl(3))); + if (itentry_off) + add(recv_klass, recv_klass, itentry_off); + } // for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) { // if (scan->interface() == intf) { @@ -1021,8 +1027,10 @@ bind(found_method); // Got a hit. - ldr(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes())); - ldr(method_result, Address(recv_klass, scan_temp)); + if (return_method) { + ldrw(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes())); + ldr(method_result, Address(recv_klass, scan_temp, Address::uxtw(0))); + } } // virtual method calling @@ -1041,7 +1049,8 @@ ldr(method_result, Address(method_result, vtable_offset_in_bytes)); } else { vtable_offset_in_bytes += vtable_index.as_constant() * wordSize; - ldr(method_result, Address(recv_klass, vtable_offset_in_bytes)); + ldr(method_result, + form_address(rscratch1, recv_klass, vtable_offset_in_bytes, 0)); } } diff -r fb62f481671e -r 2d03ebb72df2 src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp Tue Jan 30 11:53:00 2018 +0530 +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp Tue Jan 30 09:03:47 2018 -0800 @@ -875,7 +875,8 @@ RegisterOrConstant itable_index, Register method_result, Register scan_temp, - Label& no_such_interface); + Label& no_such_interface, + bool return_method = true); // virtual method calling // n.b. x86 allows RegisterOrConstant for vtable_index diff -r fb62f481671e -r 2d03ebb72df2 src/hotspot/cpu/aarch64/templateTable_aarch64.cpp --- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Tue Jan 30 11:53:00 2018 +0530 +++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Tue Jan 30 09:03:47 2018 -0800 @@ -3279,11 +3279,11 @@ transition(vtos, vtos); assert(byte_no == f1_byte, "use this argument"); - prepare_invoke(byte_no, r0, rmethod, // get f1 Klass*, f2 itable index + prepare_invoke(byte_no, r0, rmethod, // get f1 Klass*, f2 Method* r2, r3); // recv, flags // r0: interface klass (from f1) - // rmethod: itable index (from f2) + // rmethod: method (from f2) // r2: receiver // r3: flags @@ -3302,10 +3302,27 @@ __ null_check(r2, oopDesc::klass_offset_in_bytes()); __ load_klass(r3, r2); + Label no_such_interface, no_such_method; + + // Receiver subtype check against REFC. + // Superklass in r0. Subklass in r3. Blows rscratch2, r13 + __ lookup_interface_method(// inputs: rec. class, interface, itable index + r3, r0, noreg, + // outputs: scan temp. reg, scan temp. reg + rscratch2, r13, + no_such_interface, + /*return_method=*/false); + // profile this call __ profile_virtual_call(r3, r13, r19); - Label no_such_interface, no_such_method; + // Get declaring interface class from method, and itable index + __ ldr(r0, Address(rmethod, Method::const_offset())); + __ ldr(r0, Address(r0, ConstMethod::constants_offset())); + __ ldr(r0, Address(r0, ConstantPool::pool_holder_offset_in_bytes())); + __ ldrw(rmethod, Address(rmethod, Method::itable_index_offset())); + __ subw(rmethod, rmethod, Method::itable_index_max); + __ negw(rmethod, rmethod); __ lookup_interface_method(// inputs: rec. class, interface, itable index r3, r0, rmethod, diff -r fb62f481671e -r 2d03ebb72df2 src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp --- a/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp Tue Jan 30 11:53:00 2018 +0530 +++ b/src/hotspot/cpu/aarch64/vtableStubs_aarch64.cpp Tue Jan 30 09:03:47 2018 -0800 @@ -29,6 +29,7 @@ #include "code/vtableStubs.hpp" #include "interp_masm_aarch64.hpp" #include "memory/resourceArea.hpp" +#include "oops/compiledICHolder.hpp" #include "oops/instanceKlass.hpp" #include "oops/klassVtable.hpp" #include "runtime/sharedRuntime.hpp" @@ -62,8 +63,8 @@ #ifndef PRODUCT if (CountCompiledCalls) { - __ lea(r19, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); - __ incrementw(Address(r19)); + __ lea(r16, ExternalAddress((address) SharedRuntime::nof_megamorphic_calls_addr())); + __ incrementw(Address(r16)); } #endif @@ -72,13 +73,13 @@ // get receiver klass address npe_addr = __ pc(); - __ load_klass(r19, j_rarg0); + __ load_klass(r16, j_rarg0); #ifndef PRODUCT if (DebugVtables) { Label L; // check offset vs vtable length - __ ldrw(rscratch1, Address(r19, Klass::vtable_length_offset())); + __ ldrw(rscratch1, Address(r16, Klass::vtable_length_offset())); __ cmpw(rscratch1, vtable_index * vtableEntry::size()); __ br(Assembler::GT, L); __ enter(); @@ -90,7 +91,7 @@ } #endif // PRODUCT - __ lookup_virtual_method(r19, vtable_index, rmethod); + __ lookup_virtual_method(r16, vtable_index, rmethod); if (DebugVtables) { Label L; @@ -140,28 +141,44 @@ #endif // Entry arguments: - // rscratch2: Interface + // rscratch2: CompiledICHolder // j_rarg0: Receiver - // Free registers (non-args) are r0 (interface), rmethod + + // Most registers are in use; we'll use r16, rmethod, r10, r11 + const Register recv_klass_reg = r10; + const Register holder_klass_reg = r16; // declaring interface klass (DECC) + const Register resolved_klass_reg = rmethod; // resolved interface klass (REFC) + const Register temp_reg = r11; + const Register icholder_reg = rscratch2; + + Label L_no_such_interface; + + __ ldr(resolved_klass_reg, Address(icholder_reg, CompiledICHolder::holder_klass_offset())); + __ ldr(holder_klass_reg, Address(icholder_reg, CompiledICHolder::holder_metadata_offset())); // get receiver (need to skip return address on top of stack) - assert(VtableStub::receiver_location() == j_rarg0->as_VMReg(), "receiver expected in j_rarg0"); // get receiver klass (also an implicit null-check) address npe_addr = __ pc(); - - // Most registers are in use; we'll use r0, rmethod, r10, r11 - __ load_klass(r10, j_rarg0); - - Label throw_icce; + __ load_klass(recv_klass_reg, j_rarg0); - // Get Method* and entrypoint for compiler + // Receiver subtype check against REFC. + // Destroys recv_klass_reg value. + __ lookup_interface_method(// inputs: rec. class, interface + recv_klass_reg, resolved_klass_reg, noreg, + // outputs: scan temp. reg1, scan temp. reg2 + recv_klass_reg, temp_reg, + L_no_such_interface, + /*return_method=*/false); + + // Get selected method from declaring class and itable index + __ load_klass(recv_klass_reg, j_rarg0); // restore recv_klass_reg __ lookup_interface_method(// inputs: rec. class, interface, itable index - r10, rscratch2, itable_index, - // outputs: method, scan temp. reg - rmethod, r11, - throw_icce); + recv_klass_reg, holder_klass_reg, itable_index, + // outputs: method, scan temp. reg + rmethod, temp_reg, + L_no_such_interface); // method (rmethod): Method* // j_rarg0: receiver @@ -183,7 +200,7 @@ __ ldr(rscratch1, Address(rmethod, Method::from_compiled_offset())); __ br(rscratch1); - __ bind(throw_icce); + __ bind(L_no_such_interface); __ far_jump(RuntimeAddress(StubRoutines::throw_IncompatibleClassChangeError_entry())); __ flush(); @@ -205,11 +222,11 @@ int size = DebugVtables ? 216 : 0; if (CountCompiledCalls) size += 6 * 4; - // FIXME + // FIXME: vtable stubs only need 36 bytes if (is_vtable_stub) size += 52; else - size += 104; + size += 176; return size; // In order to tune these parameters, run the JVM with VM options @@ -217,33 +234,58 @@ // actual itable stubs. Run it with -Xmx31G -XX:+UseCompressedOops. // // If Universe::narrow_klass_base is nonzero, decoding a compressed - // class can take zeveral instructions. Run it with -Xmx31G - // -XX:+UseCompressedOops. + // class can take zeveral instructions. // // The JVM98 app. _202_jess has a megamorphic interface call. // The itable code looks like this: - // Decoding VtableStub itbl[1]@12 - // ldr w10, [x1,#8] - // lsl x10, x10, #3 - // ldr w11, [x10,#280] - // add x11, x10, x11, uxtx #3 - // add x11, x11, #0x1b8 - // ldr x12, [x11] - // cmp x9, x12 - // b.eq success - // loop: - // cbz x12, throw_icce - // add x11, x11, #0x10 - // ldr x12, [x11] - // cmp x9, x12 - // b.ne loop - // success: - // ldr x11, [x11,#8] - // ldr x12, [x10,x11] - // ldr x8, [x12,#72] - // br x8 - // throw_icce: - // b throw_ICCE_entry + + // ldr xmethod, [xscratch2,#CompiledICHolder::holder_klass_offset] + // ldr x0, [xscratch2] + // ldr w10, [x1,#oopDesc::klass_offset_in_bytes] + // mov xheapbase, #0x3c000000 // #narrow_klass_base + // movk xheapbase, #0x3f7, lsl #32 + // add x10, xheapbase, x10 + // mov xheapbase, #0xe7ff0000 // #heapbase + // movk xheapbase, #0x3f7, lsl #32 + // ldr w11, [x10,#vtable_length_offset] + // add x11, x10, x11, uxtx #3 + // add x11, x11, #itableMethodEntry::method_offset_in_bytes + // ldr x10, [x11] + // cmp xmethod, x10 + // b.eq found_method + // search: + // cbz x10, no_such_interface + // add x11, x11, #0x10 + // ldr x10, [x11] + // cmp xmethod, x10 + // b.ne search + // found_method: + // ldr w10, [x1,#oopDesc::klass_offset_in_bytes] + // mov xheapbase, #0x3c000000 // #narrow_klass_base + // movk xheapbase, #0x3f7, lsl #32 + // add x10, xheapbase, x10 + // mov xheapbase, #0xe7ff0000 // #heapbase + // movk xheapbase, #0x3f7, lsl #32 + // ldr w11, [x10,#vtable_length_offset] + // add x11, x10, x11, uxtx #3 + // add x11, x11, #itableMethodEntry::method_offset_in_bytes + // add x10, x10, #itentry_off + // ldr xmethod, [x11] + // cmp x0, xmethod + // b.eq found_method2 + // search2: + // cbz xmethod, 0x000003ffa872e6cc + // add x11, x11, #0x10 + // ldr xmethod, [x11] + // cmp x0, xmethod + // b.ne search2 + // found_method2: + // ldr w11, [x11,#itableOffsetEntry::offset_offset_in_bytes] + // ldr xmethod, [x10,w11,uxtw] + // ldr xscratch1, [xmethod,#Method::from_compiled_offset] + // br xscratch1 + // no_such_interface: + // b throw_ICCE_entry } diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/lang/ClassLoader.java --- a/src/java.base/share/classes/java/lang/ClassLoader.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/lang/ClassLoader.java Tue Jan 30 09:03:47 2018 -0800 @@ -1876,14 +1876,15 @@ * value until the system is fully initialized. * *

The name of the built-in system class loader is {@code "app"}. - * The class path used by the built-in system class loader is determined - * by the system property "{@code java.class.path}" during early - * initialization of the VM. If the system property is not defined, - * or its value is an empty string, then there is no class path - * when the initial module is a module on the application module path, - * i.e. a named module. If the initial module is not on - * the application module path then the class path defaults to - * the current working directory. + * The system property "{@code java.class.path}" is read during early + * initialization of the VM to determine the class path. + * An empty value of "{@code java.class.path}" property is interpreted + * differently depending on whether the initial module (the module + * containing the main class) is named or unnamed: + * If named, the built-in system class loader will have no class path and + * will search for classes and resources using the application module path; + * otherwise, if unnamed, it will set the class path to the current + * working directory. * * @return The system {@code ClassLoader} * diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/lang/System.java --- a/src/java.base/share/classes/java/lang/System.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/lang/System.java Tue Jan 30 09:03:47 2018 -0800 @@ -631,7 +631,8 @@ * java.class.version * Java class format version number * java.class.path - * Java class path + * Java class path (refer to + * {@link ClassLoader#getSystemClassLoader()} for details) * java.library.path * List of paths to search when loading libraries * java.io.tmpdir diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/lang/VersionProps.java.template --- a/src/java.base/share/classes/java/lang/VersionProps.java.template Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/lang/VersionProps.java.template Tue Jan 30 09:03:47 2018 -0800 @@ -166,15 +166,8 @@ * Print version info. */ private static void print(boolean err, boolean newln) { - boolean isHeadless = false; PrintStream ps = err ? System.err : System.out; - /* Report that we're running headless if the property is true */ - String headless = System.getProperty("java.awt.headless"); - if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) { - isHeadless = true; - } - /* First line: platform version. */ if (err) { ps.println(launcher_name + " version \"" + java_version + "\"" diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/net/Inet6Address.java --- a/src/java.base/share/classes/java/net/Inet6Address.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/net/Inet6Address.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -595,7 +595,7 @@ } ObjectInputStream.GetField gf = s.readFields(); - byte[] ipaddress = (byte[])gf.get("ipaddress", null); + byte[] ipaddress = (byte[])gf.get("ipaddress", new byte[0]); int scope_id = gf.get("scope_id", -1); boolean scope_id_set = gf.get("scope_id_set", false); boolean scope_ifname_set = gf.get("scope_ifname_set", false); diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/text/DateFormatSymbols.java --- a/src/java.base/share/classes/java/text/DateFormatSymbols.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -394,6 +394,12 @@ /** * Gets month strings. For example: "January", "February", etc. + * An array with either 12 or 13 elements will be returned depending + * on whether or not {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} + * is supported. Use + * {@link java.util.Calendar#JANUARY Calendar.JANUARY}, + * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, + * etc. to index the result array. * *

If the language requires different forms for formatting and * stand-alone usages, this method returns month names in the @@ -405,10 +411,9 @@ * Calendar Elements in the Unicode Locale Data Markup Language * (LDML) specification for more details. * - * @return the month strings. Use - * {@link java.util.Calendar#JANUARY Calendar.JANUARY}, - * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, - * etc. to index the result array. + * @implSpec This method returns 13 elements since + * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported. + * @return the month strings. */ public String[] getMonths() { return Arrays.copyOf(months, months.length); @@ -427,6 +432,12 @@ /** * Gets short month strings. For example: "Jan", "Feb", etc. + * An array with either 12 or 13 elements will be returned depending + * on whether or not {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} + * is supported. Use + * {@link java.util.Calendar#JANUARY Calendar.JANUARY}, + * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, + * etc. to index the result array. * *

If the language requires different forms for formatting and * stand-alone usages, this method returns short month names in @@ -438,10 +449,9 @@ * Calendar Elements in the Unicode Locale Data Markup Language * (LDML) specification for more details. * - * @return the short month strings. Use - * {@link java.util.Calendar#JANUARY Calendar.JANUARY}, - * {@link java.util.Calendar#FEBRUARY Calendar.FEBRUARY}, - * etc. to index the result array. + * @implSpec This method returns 13 elements since + * {@link java.util.Calendar#UNDECIMBER Calendar.UNDECIMBER} is supported. + * @return the short month strings. */ public String[] getShortMonths() { return Arrays.copyOf(shortMonths, shortMonths.length); diff -r fb62f481671e -r 2d03ebb72df2 src/java.base/share/classes/java/time/temporal/IsoFields.java --- a/src/java.base/share/classes/java/time/temporal/IsoFields.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.base/share/classes/java/time/temporal/IsoFields.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -708,9 +708,8 @@ return (R) temporal.with(WEEK_BASED_YEAR, Math.addExact(temporal.get(WEEK_BASED_YEAR), amount)); case QUARTER_YEARS: - // no overflow (256 is multiple of 4) - return (R) temporal.plus(amount / 256, YEARS) - .plus((amount % 256) * 3, MONTHS); + return (R) temporal.plus(amount / 4, YEARS) + .plus((amount % 4) * 3, MONTHS); default: throw new IllegalStateException("Unreachable"); } diff -r fb62f481671e -r 2d03ebb72df2 src/java.logging/share/classes/java/util/logging/LogManager.java --- a/src/java.logging/share/classes/java/util/logging/LogManager.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.logging/share/classes/java/util/logging/LogManager.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -396,12 +396,6 @@ // Create and retain Logger for the root of the namespace. owner.addLogger(root); - // For backward compatibility: add any handlers configured using - // ".handlers" - owner.createLoggerHandlers("", ".handlers") - .stream() - .forEach(root::addHandler); - // Initialize level if not yet initialized if (!root.isLevelInitialized()) { root.setLevel(defaultLevel); @@ -995,7 +989,8 @@ } } - private List createLoggerHandlers(final String name, final String handlersPropertyName) + private List createLoggerHandlers(final String name, + final String handlersPropertyName) { String names[] = parseClassNames(handlersPropertyName); List handlers = new ArrayList<>(names.length); @@ -1198,7 +1193,7 @@ } drainLoggerRefQueueBounded(); LoggerContext cx = getUserContext(); - if (cx.addLocalLogger(logger)) { + if (cx.addLocalLogger(logger) || forceLoadHandlers(logger)) { // Do we have a per logger handler too? // Note: this will add a 200ms penalty loadLoggerHandlers(logger, name, name + ".handlers"); @@ -1208,6 +1203,26 @@ } } + + // Checks whether the given logger is a special logger + // that still requires handler initialization. + // This method will only return true for the root and + // global loggers and only if called by the thread that + // performs initialization of the LogManager, during that + // initialization. Must only be called by addLogger. + @SuppressWarnings("deprecation") + private boolean forceLoadHandlers(Logger logger) { + // Called just after reading the primordial configuration, in + // the same thread that reads it. + // The root and global logger would already be present in the context + // by this point, but we would not have called loadLoggerHandlers + // yet. + return (logger == rootLogger || logger == Logger.global) + && !initializationDone + && initializedCalled + && configurationLock.isHeldByCurrentThread(); + } + // Private method to set a level on a logger. // If necessary, we raise privilege before doing the call. private static void doSetLevel(final Logger logger, final Level level) { diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java --- a/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -138,6 +138,12 @@ case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: return "aes256-cts-hmac-sha1-96"; + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return "aes128-cts-hmac-sha256-128"; + + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + return "aes256-cts-hmac-sha384-192"; + case EncryptedData.ETYPE_NULL: return "none"; diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java --- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/CipherHelper.java Tue Jan 30 09:03:47 2018 -0800 @@ -40,6 +40,8 @@ import java.security.GeneralSecurityException; import java.security.NoSuchAlgorithmException; import sun.security.krb5.*; +import sun.security.krb5.internal.crypto.Aes128Sha2; +import sun.security.krb5.internal.crypto.Aes256Sha2; import sun.security.krb5.internal.crypto.Des3; import sun.security.krb5.internal.crypto.Aes128; import sun.security.krb5.internal.crypto.Aes256; @@ -101,6 +103,8 @@ case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: sgnAlg = -1; sealAlg = -1; break; @@ -365,6 +369,33 @@ throw ge; } + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + try { + byte[] answer = Aes128Sha2.calculateChecksum(keybytes, key_usage, + buf, 0, total); + return answer; + } catch (GeneralSecurityException e) { + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use AES128 signing algorithm - " + + e.getMessage()); + ge.initCause(e); + throw ge; + } + + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + try { + byte[] answer = Aes256Sha2.calculateChecksum(keybytes, key_usage, + buf, 0, total); + return answer; + } catch (GeneralSecurityException e) { + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use AES256 signing algorithm - " + + e.getMessage()); + ge.initCause(e); + throw ge; + } + + default: throw new GSSException(GSSException.FAILURE, -1, "Unsupported encryption type: " + etype); @@ -517,6 +548,11 @@ case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: return Aes256.getChecksumLength(); + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return Aes128Sha2.getChecksumLength(); + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + return Aes256Sha2.getChecksumLength(); + case EncryptedData.ETYPE_ARCFOUR_HMAC: // only first 8 octets of HMAC Sgn_Cksum are used return HMAC_CHECKSUM_SIZE; @@ -574,6 +610,14 @@ aes256Decrypt(token, ciphertext, cStart, cLen, plaintext, pStart, key_usage); break; + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + aes128Sha2Decrypt(token, ciphertext, cStart, cLen, + plaintext, pStart, key_usage); + break; + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + aes256Sha2Decrypt(token, ciphertext, cStart, cLen, + plaintext, pStart, key_usage); + break; default: throw new GSSException(GSSException.FAILURE, -1, "Unsupported etype: " + etype); @@ -654,6 +698,14 @@ aes256Decrypt(token, ciphertext, 0, cLen, plaintext, pStart, key_usage); break; + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + aes128Sha2Decrypt(token, ciphertext, 0, cLen, + plaintext, pStart, key_usage); + break; + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + aes256Sha2Decrypt(token, ciphertext, 0, cLen, + plaintext, pStart, key_usage); + break; default: throw new GSSException(GSSException.FAILURE, -1, "Unsupported etype: " + etype); @@ -720,6 +772,12 @@ case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: return aes256Encrypt(confounder, tokenHeader, plaintext, start, len, key_usage); + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return aes128Sha2Encrypt(confounder, tokenHeader, + plaintext, start, len, key_usage); + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + return aes256Sha2Encrypt(confounder, tokenHeader, + plaintext, start, len, key_usage); default: throw new GSSException(GSSException.FAILURE, -1, "Unsupported etype: " + etype); @@ -796,6 +854,14 @@ ctext = aes256Encrypt(confounder, tokenHeader, plaintext, pStart, pLen, key_usage); break; + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + ctext = aes128Sha2Encrypt(confounder, tokenHeader, + plaintext, pStart, pLen, key_usage); + break; + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + ctext = aes256Sha2Encrypt(confounder, tokenHeader, + plaintext, pStart, pLen, key_usage); + break; default: throw new GSSException(GSSException.FAILURE, -1, "Unsupported etype: " + etype); @@ -1317,6 +1383,38 @@ } } + private byte[] aes128Sha2Encrypt(byte[] confounder, byte[] tokenHeader, + byte[] plaintext, int start, int len, int key_usage) + throws GSSException { + + // encrypt { AES-plaintext-data | filler | header } + // AES-plaintext-data { confounder | plaintext } + // WrapToken = { tokenHeader | + // Encrypt (confounder | plaintext | tokenHeader ) | HMAC } + + byte[] all = new byte[confounder.length + len + tokenHeader.length]; + System.arraycopy(confounder, 0, all, 0, confounder.length); + System.arraycopy(plaintext, start, all, confounder.length, len); + System.arraycopy(tokenHeader, 0, all, confounder.length+len, + tokenHeader.length); + + // Krb5Token.debug("\naes128Sha2Encrypt:" + Krb5Token.getHexBytes(all)); + try { + byte[] answer = Aes128Sha2.encryptRaw(keybytes, key_usage, + ZERO_IV_AES, + all, 0, all.length); + // Krb5Token.debug("\naes128Sha2Encrypt encrypted:" + + // Krb5Token.getHexBytes(answer)); + return answer; + } catch (Exception e) { + // GeneralSecurityException, KrbCryptoException + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use Aes128Sha2 Cipher - " + e.getMessage()); + ge.initCause(e); + throw ge; + } + } + private void aes128Decrypt(WrapToken_v2 token, byte[] ciphertext, int cStart, int cLen, byte[] plaintext, int pStart, int key_usage) throws GSSException { @@ -1354,6 +1452,43 @@ */ } + private void aes128Sha2Decrypt(WrapToken_v2 token, byte[] ciphertext, + int cStart, int cLen, byte[] plaintext, int pStart, int key_usage) + throws GSSException { + + byte[] ptext = null; + + try { + ptext = Aes128Sha2.decryptRaw(keybytes, key_usage, + ZERO_IV_AES, ciphertext, cStart, cLen); + } catch (GeneralSecurityException e) { + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use AES128Sha2 Cipher - " + e.getMessage()); + ge.initCause(e); + throw ge; + } + + /* + Krb5Token.debug("\naes128Sha2Decrypt in: " + + Krb5Token.getHexBytes(ciphertext, cStart, cLen)); + Krb5Token.debug("\naes128Sha2Decrypt plain: " + + Krb5Token.getHexBytes(ptext)); + Krb5Token.debug("\naes128Sha2Decrypt ptext: " + + Krb5Token.getHexBytes(ptext)); + */ + + // Strip out confounder and token header + int len = ptext.length - WrapToken_v2.CONFOUNDER_SIZE - + WrapToken_v2.TOKEN_HEADER_SIZE; + System.arraycopy(ptext, WrapToken_v2.CONFOUNDER_SIZE, + plaintext, pStart, len); + + /* + Krb5Token.debug("\naes128Sha2Decrypt plaintext: " + + Krb5Token.getHexBytes(plaintext, pStart, len)); + */ + } + private byte[] aes256Encrypt(byte[] confounder, byte[] tokenHeader, byte[] plaintext, int start, int len, int key_usage) throws GSSException { @@ -1386,6 +1521,38 @@ } } + private byte[] aes256Sha2Encrypt(byte[] confounder, byte[] tokenHeader, + byte[] plaintext, int start, int len, int key_usage) + throws GSSException { + + // encrypt { AES-plaintext-data | filler | header } + // AES-plaintext-data { confounder | plaintext } + // WrapToken = { tokenHeader | + // Encrypt (confounder | plaintext | tokenHeader ) | HMAC } + + byte[] all = new byte[confounder.length + len + tokenHeader.length]; + System.arraycopy(confounder, 0, all, 0, confounder.length); + System.arraycopy(plaintext, start, all, confounder.length, len); + System.arraycopy(tokenHeader, 0, all, confounder.length+len, + tokenHeader.length); + + // Krb5Token.debug("\naes256Sha2Encrypt:" + Krb5Token.getHexBytes(all)); + + try { + byte[] answer = Aes256Sha2.encryptRaw(keybytes, key_usage, + ZERO_IV_AES, all, 0, all.length); + // Krb5Token.debug("\naes256Sha2Encrypt encrypted:" + + // Krb5Token.getHexBytes(answer)); + return answer; + } catch (Exception e) { + // GeneralSecurityException, KrbCryptoException + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use Aes256Sha2 Cipher - " + e.getMessage()); + ge.initCause(e); + throw ge; + } + } + private void aes256Decrypt(WrapToken_v2 token, byte[] ciphertext, int cStart, int cLen, byte[] plaintext, int pStart, int key_usage) throws GSSException { @@ -1423,6 +1590,43 @@ } + private void aes256Sha2Decrypt(WrapToken_v2 token, byte[] ciphertext, + int cStart, int cLen, byte[] plaintext, int pStart, int key_usage) + throws GSSException { + + byte[] ptext; + try { + ptext = Aes256Sha2.decryptRaw(keybytes, key_usage, + ZERO_IV_AES, ciphertext, cStart, cLen); + } catch (GeneralSecurityException e) { + GSSException ge = new GSSException(GSSException.FAILURE, -1, + "Could not use AES256Sha2 Cipher - " + e.getMessage()); + ge.initCause(e); + throw ge; + } + + /* + Krb5Token.debug("\naes256Sha2Decrypt in: " + + Krb5Token.getHexBytes(ciphertext, cStart, cLen)); + Krb5Token.debug("\naes256Sha2Decrypt plain: " + + Krb5Token.getHexBytes(ptext)); + Krb5Token.debug("\naes256Sha2Decrypt ptext: " + + Krb5Token.getHexBytes(ptext)); + */ + + // Strip out confounder and token header + int len = ptext.length - WrapToken_v2.CONFOUNDER_SIZE - + WrapToken_v2.TOKEN_HEADER_SIZE; + System.arraycopy(ptext, WrapToken_v2.CONFOUNDER_SIZE, + plaintext, pStart, len); + + /* + Krb5Token.debug("\naes256Sha2Decrypt plaintext: " + + Krb5Token.getHexBytes(plaintext, pStart, len)); + */ + + } + /** * This class provides a truncated inputstream needed by WrapToken. The * truncated inputstream is passed to CipherInputStream. It prevents diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/Checksum.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -66,6 +66,10 @@ public static final int CKSUMTYPE_HMAC_SHA1_96_AES128 = 15; // 96 public static final int CKSUMTYPE_HMAC_SHA1_96_AES256 = 16; // 96 + // rfc8009 + public static final int CKSUMTYPE_HMAC_SHA256_128_AES128 = 19; // 96 + public static final int CKSUMTYPE_HMAC_SHA384_192_AES256 = 20; // 96 + // draft-brezak-win2k-krb-rc4-hmac-04.txt public static final int CKSUMTYPE_HMAC_MD5_ARCFOUR = -138; diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/Config.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/Config.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -578,7 +578,8 @@ if (Files.isDirectory(p)) continue; String name = p.getFileName().toString(); if (name.matches("[a-zA-Z0-9_-]+") || - name.endsWith(".conf")) { + (!name.startsWith(".") && + name.endsWith(".conf"))) { // if dir is absolute, so is p readConfigFileLines(p, content, dups); } @@ -1030,11 +1031,19 @@ } else if (input.startsWith("a") || (input.startsWith("A"))) { // AES if (input.equalsIgnoreCase("aes128-cts") || - input.equalsIgnoreCase("aes128-cts-hmac-sha1-96")) { + input.equalsIgnoreCase("aes128-sha1") || + input.equalsIgnoreCase("aes128-cts-hmac-sha1-96")) { result = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96; } else if (input.equalsIgnoreCase("aes256-cts") || - input.equalsIgnoreCase("aes256-cts-hmac-sha1-96")) { + input.equalsIgnoreCase("aes256-sha1") || + input.equalsIgnoreCase("aes256-cts-hmac-sha1-96")) { result = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96; + } else if (input.equalsIgnoreCase("aes128-sha2") || + input.equalsIgnoreCase("aes128-cts-hmac-sha256-128")) { + result = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128; + } else if (input.equalsIgnoreCase("aes256-sha2") || + input.equalsIgnoreCase("aes256-cts-hmac-sha384-192")) { + result = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192; // ARCFOUR-HMAC } else if (input.equalsIgnoreCase("arcfour-hmac") || input.equalsIgnoreCase("arcfour-hmac-md5")) { @@ -1057,6 +1066,10 @@ result = Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128; } else if (input.equalsIgnoreCase("hmac-sha1-96-aes256")) { result = Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256; + } else if (input.equalsIgnoreCase("hmac-sha256-128-aes128")) { + result = Checksum.CKSUMTYPE_HMAC_SHA256_128_AES128; + } else if (input.equalsIgnoreCase("hmac-sha384-192-aes256")) { + result = Checksum.CKSUMTYPE_HMAC_SHA384_192_AES256; } else if (input.equalsIgnoreCase("hmac-md5-rc4") || input.equalsIgnoreCase("hmac-md5-arcfour") || input.equalsIgnoreCase("hmac-md5-enc")) { diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/EncryptedData.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,6 +79,12 @@ public static final int ETYPE_AES256_CTS_HMAC_SHA1_96 = 18; // 16 0 16 + // rfc8009 + public static final int + ETYPE_AES128_CTS_HMAC_SHA256_128 = 19; // 16 0 16 + public static final int + ETYPE_AES256_CTS_HMAC_SHA384_192 = 20; // 16 0 16 + /* used by self */ private EncryptedData() { } diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/EncryptionKey.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -252,6 +252,12 @@ case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: return Aes256.stringToKey(password, salt, s2kparams); + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return Aes128Sha2.stringToKey(password, salt, s2kparams); + + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + return Aes256Sha2.stringToKey(password, salt, s2kparams); + default: throw new IllegalArgumentException("encryption type " + EType.toString(keyType) + " not supported"); @@ -293,6 +299,15 @@ throw new IllegalArgumentException("Algorithm " + algorithm + " not enabled"); } + } else if (algorithm.equalsIgnoreCase("aes128-cts-hmac-sha256-128")) { + keyType = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128; + } else if (algorithm.equalsIgnoreCase("aes256-cts-hmac-sha384-192")) { + keyType = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192; + // validate if AES256 is enabled + if (!EType.isSupported(keyType)) { + throw new IllegalArgumentException("Algorithm " + algorithm + + " not enabled"); + } } else { throw new IllegalArgumentException("Algorithm " + algorithm + " not supported"); diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java Tue Jan 30 09:03:47 2018 -0800 @@ -356,6 +356,8 @@ case Checksum.CKSUMTYPE_HMAC_MD5_ARCFOUR: case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES128: case Checksum.CKSUMTYPE_HMAC_SHA1_96_AES256: + case Checksum.CKSUMTYPE_HMAC_SHA256_128_AES128: + case Checksum.CKSUMTYPE_HMAC_SHA384_192_AES256: cksum = new Checksum(Checksum.CKSUMTYPE_DEFAULT, temp, key, KeyUsage.KU_PA_TGS_REQ_CKSUM); break; diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes128CtsHmacSha2EType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes128CtsHmacSha2EType.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.KrbCryptoException; +import sun.security.krb5.internal.*; +import java.security.GeneralSecurityException; +import sun.security.krb5.EncryptedData; +import sun.security.krb5.Checksum; + +/* + * This class encapsulates the encryption type for aes128-cts-hmac-sha256-128 + */ + +public final class Aes128CtsHmacSha2EType extends EType { + + public int eType() { + return EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128; + } + + public int minimumPadSize() { + return 0; + } + + public int confounderSize() { + return blockSize(); + } + + public int checksumType() { + return Checksum.CKSUMTYPE_HMAC_SHA256_128_AES128; + } + + public int checksumSize() { + return Aes128Sha2.getChecksumLength(); + } + + public int blockSize() { + return 16; + } + + public int keyType() { + return Krb5.KEYTYPE_AES; + } + + public int keySize() { + return 16; // bytes + } + + public byte[] encrypt(byte[] data, byte[] key, int usage) + throws KrbCryptoException { + byte[] ivec = new byte[blockSize()]; + return encrypt(data, key, ivec, usage); + } + + public byte[] encrypt(byte[] data, byte[] key, byte[] ivec, int usage) + throws KrbCryptoException { + try { + return Aes128Sha2.encrypt(key, usage, ivec, data, 0, data.length); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + public byte[] decrypt(byte[] cipher, byte[] key, int usage) + throws KrbApErrException, KrbCryptoException { + byte[] ivec = new byte[blockSize()]; + return decrypt(cipher, key, ivec, usage); + } + + public byte[] decrypt(byte[] cipher, byte[] key, byte[] ivec, int usage) + throws KrbApErrException, KrbCryptoException { + try { + return Aes128Sha2.decrypt(key, usage, ivec, cipher, 0, cipher.length); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + // Override default, because our decrypted data does not return confounder + // Should eventually get rid of EType.decryptedData and + // EncryptedData.decryptedData altogether + public byte[] decryptedData(byte[] data) { + return data; + } +} diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes128Sha2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes128Sha2.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.internal.crypto.dk.AesSha2DkCrypto; +import sun.security.krb5.KrbCryptoException; +import java.security.GeneralSecurityException; + +/** + * Class with static methods for doing aes128-cts-hmac-sha256-128 operations. + */ + +public class Aes128Sha2 { + private static final AesSha2DkCrypto CRYPTO = new AesSha2DkCrypto(128); + + private Aes128Sha2() { + } + + public static byte[] stringToKey(char[] password, String salt, byte[] params) + throws GeneralSecurityException { + return CRYPTO.stringToKey(password, salt, params); + } + + // in bytes + public static int getChecksumLength() { + return CRYPTO.getChecksumLength(); + } + + public static byte[] calculateChecksum(byte[] baseKey, int usage, + byte[] input, int start, int len) throws GeneralSecurityException { + return CRYPTO.calculateChecksum(baseKey, usage, input, start, len); + } + + public static byte[] encrypt(byte[] baseKey, int usage, + byte[] ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + return CRYPTO.encrypt(baseKey, usage, ivec, null /* new_ivec */, + plaintext, start, len); + } + + /* Encrypt plaintext; do not add confounder, or checksum */ + public static byte[] encryptRaw(byte[] baseKey, int usage, + byte[] ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + return CRYPTO.encryptRaw(baseKey, usage, ivec, plaintext, start, len); + } + + public static byte[] decrypt(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) + throws GeneralSecurityException { + return CRYPTO.decrypt(baseKey, usage, ivec, ciphertext, start, len); + } + + /* Decrypt ciphertext; do not remove confounder, or check checksum */ + public static byte[] decryptRaw(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) + throws GeneralSecurityException { + return CRYPTO.decryptRaw(baseKey, usage, ivec, ciphertext, start, len); + } +}; diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes256CtsHmacSha2EType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes256CtsHmacSha2EType.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.KrbCryptoException; +import sun.security.krb5.internal.*; +import java.security.GeneralSecurityException; +import sun.security.krb5.EncryptedData; +import sun.security.krb5.Checksum; + +/* + * This class encapsulates the encryption type for aes256-cts-hmac-sha384-192 + */ + +public final class Aes256CtsHmacSha2EType extends EType { + + public int eType() { + return EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192; + } + + public int minimumPadSize() { + return 0; + } + + public int confounderSize() { + return blockSize(); + } + + public int checksumType() { + return Checksum.CKSUMTYPE_HMAC_SHA384_192_AES256; + } + + public int checksumSize() { + return Aes256Sha2.getChecksumLength(); + } + + public int blockSize() { + return 16; + } + + public int keyType() { + return Krb5.KEYTYPE_AES; + } + + public int keySize() { + return 32; // bytes + } + + public byte[] encrypt(byte[] data, byte[] key, int usage) + throws KrbCryptoException { + byte[] ivec = new byte[blockSize()]; + return encrypt(data, key, ivec, usage); + } + + public byte[] encrypt(byte[] data, byte[] key, byte[] ivec, int usage) + throws KrbCryptoException { + try { + return Aes256Sha2.encrypt(key, usage, ivec, data, 0, data.length); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + public byte[] decrypt(byte[] cipher, byte[] key, int usage) + throws KrbApErrException, KrbCryptoException { + byte[] ivec = new byte[blockSize()]; + return decrypt(cipher, key, ivec, usage); + } + + public byte[] decrypt(byte[] cipher, byte[] key, byte[] ivec, int usage) + throws KrbApErrException, KrbCryptoException { + try { + return Aes256Sha2.decrypt(key, usage, ivec, cipher, 0, cipher.length); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + // Override default, because our decrypted data does not return confounder + // Should eventually get rid of EType.decryptedData and + // EncryptedData.decryptedData altogether + public byte[] decryptedData(byte[] data) { + return data; + } +} diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes256Sha2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/Aes256Sha2.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.internal.crypto.dk.AesSha2DkCrypto; +import sun.security.krb5.KrbCryptoException; +import java.security.GeneralSecurityException; + +/** + * Class with static methods for doing aes256-cts-hmac-sha384-192 operations. + */ + +public class Aes256Sha2 { + private static final AesSha2DkCrypto CRYPTO = new AesSha2DkCrypto(256); + + private Aes256Sha2() { + } + + public static byte[] stringToKey(char[] password, String salt, byte[] params) + throws GeneralSecurityException { + return CRYPTO.stringToKey(password, salt, params); + } + + // in bytes + public static int getChecksumLength() { + return CRYPTO.getChecksumLength(); + } + + public static byte[] calculateChecksum(byte[] baseKey, int usage, + byte[] input, int start, int len) throws GeneralSecurityException { + return CRYPTO.calculateChecksum(baseKey, usage, input, start, len); + } + + public static byte[] encrypt(byte[] baseKey, int usage, + byte[] ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + return CRYPTO.encrypt(baseKey, usage, ivec, null /* new_ivec */, + plaintext, start, len); + } + + /* Encrypt plaintext; do not add confounder, padding, or checksum */ + public static byte[] encryptRaw(byte[] baseKey, int usage, + byte[] ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + return CRYPTO.encryptRaw(baseKey, usage, ivec, plaintext, start, len); + } + + public static byte[] decrypt(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) + throws GeneralSecurityException { + return CRYPTO.decrypt(baseKey, usage, ivec, ciphertext, start, len); + } + + /* + * Decrypt ciphertext; do not remove confounder, padding, or check + * checksum + */ + public static byte[] decryptRaw(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) + throws GeneralSecurityException { + return CRYPTO.decryptRaw(baseKey, usage, ivec, ciphertext, start, len); + } +}; diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/EType.java Tue Jan 30 09:03:47 2018 -0800 @@ -106,7 +106,19 @@ "sun.security.krb5.internal.crypto.Aes256CtsHmacSha1EType"; break; - case EncryptedData.ETYPE_ARCFOUR_HMAC: + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + eType = new Aes128CtsHmacSha2EType(); + eTypeName = + "sun.security.krb5.internal.crypto.Aes128CtsHmacSha2EType"; + break; + + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + eType = new Aes256CtsHmacSha2EType(); + eTypeName = + "sun.security.krb5.internal.crypto.Aes256CtsHmacSha2EType"; + break; + + case EncryptedData.ETYPE_ARCFOUR_HMAC: eType = new ArcFourHmacEType(); eTypeName = "sun.security.krb5.internal.crypto.ArcFourHmacEType"; break; @@ -189,20 +201,23 @@ // is set to false. private static final int[] BUILTIN_ETYPES = new int[] { - EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96, - EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, - EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, - EncryptedData.ETYPE_ARCFOUR_HMAC, - EncryptedData.ETYPE_DES_CBC_CRC, - EncryptedData.ETYPE_DES_CBC_MD5, + EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96, + EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, + EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192, + EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128, + EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, + EncryptedData.ETYPE_ARCFOUR_HMAC, + EncryptedData.ETYPE_DES_CBC_CRC, + EncryptedData.ETYPE_DES_CBC_MD5, }; private static final int[] BUILTIN_ETYPES_NOAES256 = new int[] { - EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, - EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, - EncryptedData.ETYPE_ARCFOUR_HMAC, - EncryptedData.ETYPE_DES_CBC_CRC, - EncryptedData.ETYPE_DES_CBC_MD5, + EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96, + EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128, + EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD, + EncryptedData.ETYPE_ARCFOUR_HMAC, + EncryptedData.ETYPE_DES_CBC_CRC, + EncryptedData.ETYPE_DES_CBC_MD5, }; @@ -363,7 +378,10 @@ return "RC4 with HMAC"; case 24: return "RC4 with HMAC EXP"; - + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + return "AES128 CTS mode with HMAC SHA256-128"; + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: + return "AES256 CTS mode with HMAC SHA384-192"; } return "Unknown (" + type + ")"; } diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes128CksumType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes128CksumType.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.Checksum; +import sun.security.krb5.KrbCryptoException; +import sun.security.krb5.internal.*; +import java.security.GeneralSecurityException; + +/* + * This class encapsulates the checksum type for aes128-cts-sha256 + */ + +public class HmacSha2Aes128CksumType extends CksumType { + + public HmacSha2Aes128CksumType() { + } + + public int confounderSize() { + return 16; + } + + public int cksumType() { + return Checksum.CKSUMTYPE_HMAC_SHA256_128_AES128; + } + + public boolean isSafe() { + return true; + } + + public int cksumSize() { + return 16; // bytes + } + + public int keyType() { + return Krb5.KEYTYPE_AES; + } + + public int keySize() { + return 16; // bytes + } + + public byte[] calculateChecksum(byte[] data, int size) { + return null; + } + + /** + * Calculates keyed checksum. + * @param data the data used to generate the checksum. + * @param size length of the data. + * @param key the key used to encrypt the checksum. + * @return keyed checksum. + */ + public byte[] calculateKeyedChecksum(byte[] data, int size, byte[] key, + int usage) throws KrbCryptoException { + + try { + return Aes128Sha2.calculateChecksum(key, usage, data, 0, size); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + /** + * Verifies keyed checksum. + * @param data the data. + * @param size the length of data. + * @param key the key used to encrypt the checksum. + * @param checksum the checksum. + * @return true if verification is successful. + */ + public boolean verifyKeyedChecksum(byte[] data, int size, + byte[] key, byte[] checksum, int usage) throws KrbCryptoException { + + try { + byte[] newCksum = Aes128Sha2.calculateChecksum(key, usage, + data, 0, size); + return isChecksumEqual(checksum, newCksum); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes256CksumType.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/HmacSha2Aes256CksumType.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto; + +import sun.security.krb5.Checksum; +import sun.security.krb5.KrbCryptoException; +import sun.security.krb5.internal.*; +import java.security.GeneralSecurityException; + +/* + * This class encapsulates the checksum type for aes256-cts-sha384 + */ + +public class HmacSha2Aes256CksumType extends CksumType { + + public HmacSha2Aes256CksumType() { + } + + public int confounderSize() { + return 16; + } + + public int cksumType() { + return Checksum.CKSUMTYPE_HMAC_SHA384_192_AES256; + } + + public boolean isSafe() { + return true; + } + + public int cksumSize() { + return 24; // bytes + } + + public int keyType() { + return Krb5.KEYTYPE_AES; + } + + public int keySize() { + return 32; // bytes + } + + public byte[] calculateChecksum(byte[] data, int size) { + return null; + } + + /** + * Calculates keyed checksum. + * @param data the data used to generate the checksum. + * @param size length of the data. + * @param key the key used to encrypt the checksum. + * @return keyed checksum. + */ + public byte[] calculateKeyedChecksum(byte[] data, int size, byte[] key, + int usage) throws KrbCryptoException { + + try { + return Aes256Sha2.calculateChecksum(key, usage, data, 0, size); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } + + /** + * Verifies keyed checksum. + * @param data the data. + * @param size the length of data. + * @param key the key used to encrypt the checksum. + * @param checksum the checksum. + * @return true if verification is successful. + */ + public boolean verifyKeyedChecksum(byte[] data, int size, + byte[] key, byte[] checksum, int usage) throws KrbCryptoException { + + try { + byte[] newCksum = Aes256Sha2.calculateChecksum(key, usage, data, + 0, size); + return isChecksumEqual(checksum, newCksum); + } catch (GeneralSecurityException e) { + KrbCryptoException ke = new KrbCryptoException(e.getMessage()); + ke.initCause(e); + throw ke; + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/AesSha2DkCrypto.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,541 @@ +/* + * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. 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.crypto.dk; + +import javax.crypto.Cipher; +import javax.crypto.Mac; +import javax.crypto.SecretKeyFactory; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.PBEKeySpec; +import java.security.GeneralSecurityException; +import sun.security.krb5.KrbCryptoException; +import sun.security.krb5.Confounder; +import sun.security.krb5.internal.crypto.KeyUsage; +import java.util.Arrays; + +/** + * This class provides the implementation of AES Encryption with + * HMAC-SHA2 for Kerberos 5 + * https://tools.ietf.org/html/rfc8009 + * + * Algorithm profile described in [KCRYPTO]: + * +--------------------------------------------------------------------+ + * | protocol key format 128- or 256-bit string | + * | | + * | string-to-key function PBKDF2+DK with variable | + * | iteration count (see | + * | above) | + * | | + * | default string-to-key parameters 00 00 80 00 | + * | | + * | key-generation seed length key size | + * | | + * | random-to-key function identity function | + * | | + * | hash function, H SHA-256 / SHA-384 | + * | | + * | HMAC output size, h 16/24 octets | + * | | + * | message block size, m 1 octet | + * | | + * | encryption/decryption functions, AES in CBC-CTS mode | + * | E and D (cipher block size 16 | + * | octets), with next to | + * | last block as CBC-style | + * | ivec | + * +--------------------------------------------------------------------+ + * + * Supports aes128-cts-hmac-sha256-128 and aes256-cts-hmac-sha384-192 + */ + +public class AesSha2DkCrypto extends DkCrypto { + + private static final boolean debug = false; + + private static final int BLOCK_SIZE = 16; + private static final int DEFAULT_ITERATION_COUNT = 32768; + private static final byte[] ZERO_IV = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 }; + + private static final byte[] ETYPE_NAME_128 = + "aes128-cts-hmac-sha256-128".getBytes(); + private static final byte[] ETYPE_NAME_256 = + "aes256-cts-hmac-sha384-192".getBytes(); + + private final int hashSize; + private final int keyLength; + + public AesSha2DkCrypto(int length) { + keyLength = length; + hashSize = (length == 128?128:192)/8; + } + + protected int getKeySeedLength() { + return keyLength; // bits; AES key material + } + + public byte[] stringToKey(char[] password, String salt, byte[] s2kparams) + throws GeneralSecurityException { + + byte[] saltUtf8 = null; + try { + saltUtf8 = salt.getBytes("UTF-8"); + return stringToKey(password, saltUtf8, s2kparams); + } catch (Exception e) { + return null; + } finally { + if (saltUtf8 != null) { + Arrays.fill(saltUtf8, (byte)0); + } + } + } + + // https://tools.ietf.org/html/rfc8009#section-4 + private byte[] stringToKey(char[] secret, byte[] salt, byte[] params) + throws GeneralSecurityException { + + int iter_count = DEFAULT_ITERATION_COUNT; + if (params != null) { + if (params.length != 4) { + throw new RuntimeException("Invalid parameter to stringToKey"); + } + iter_count = readBigEndian(params, 0, 4); + } + + byte[] saltp = new byte[26 + 1 + salt.length]; + if (keyLength == 128) { + System.arraycopy(ETYPE_NAME_128, 0, saltp, 0, 26); + } else { + System.arraycopy(ETYPE_NAME_256, 0, saltp, 0, 26); + } + System.arraycopy(salt, 0, saltp, 27, salt.length); + byte[] tmpKey = randomToKey(PBKDF2(secret, saltp, iter_count, + getKeySeedLength())); + byte[] result = dk(tmpKey, KERBEROS_CONSTANT); + return result; + } + + protected byte[] randomToKey(byte[] in) { + // simple identity operation + return in; + } + + /* + * https://tools.ietf.org/html/rfc8009#section-3 defines + * a new key derivation function: + * + * KDF-HMAC-SHA2(key, label, k) = k-truncate(K1) + * K1 = HMAC-SHA-256(key, 0x00000001 | label | 0x00 | k) or + * K1 = HMAC-SHA-384(key, 0x00000001 | label | 0x00 | k) + * + * where label is constant below. + */ + protected byte[] dr(byte[] key, byte[] constant) + throws GeneralSecurityException { + byte[] result; + byte[] input = new byte[constant.length + 9]; + // 0x00000001 at the beginning + input[3] = 1; + // label follows + System.arraycopy(constant, 0, input, 4, constant.length); + SecretKeySpec tkey = new SecretKeySpec(key, "HMAC"); + Mac mac = Mac.getInstance( + keyLength == 128? "HmacSHA256": "HmacSHA384"); + mac.init(tkey); + + int k; + if (keyLength == 128) { + // key length for enc and hmac both 128 + k = 128; + } else { + byte last = constant[constant.length-1]; + if (last == (byte)0x99 || last == (byte)0x55) { + // 192 for hmac + k = 192; + } else { + // 256 for enc + k = 256; + } + } + // 0x00 and k at the end + input[input.length - 1] = (byte)(k); + input[input.length - 2] = (byte)(k / 256); + + result = mac.doFinal(input); + return Arrays.copyOf(result, k / 8); + } + + protected Cipher getCipher(byte[] key, byte[] ivec, int mode) + throws GeneralSecurityException { + + // IV + if (ivec == null) { + ivec = ZERO_IV; + } + SecretKeySpec secretKey = new SecretKeySpec(key, "AES"); + Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); + IvParameterSpec encIv = new IvParameterSpec(ivec, 0, ivec.length); + cipher.init(mode, secretKey, encIv); + return cipher; + } + + // get an instance of the AES Cipher in CTS mode + public int getChecksumLength() { + return hashSize; // bytes + } + + /** + * Get the truncated HMAC + */ + protected byte[] getHmac(byte[] key, byte[] msg) + throws GeneralSecurityException { + + SecretKey keyKi = new SecretKeySpec(key, "HMAC"); + Mac m = Mac.getInstance(keyLength == 128 ? "HmacSHA256" : "HmacSHA384"); + m.init(keyKi); + + // generate hash + byte[] hash = m.doFinal(msg); + + // truncate hash + byte[] output = new byte[hashSize]; + System.arraycopy(hash, 0, output, 0, hashSize); + return output; + } + + private byte[] deriveKey(byte[] baseKey, int usage, byte type) + throws GeneralSecurityException { + byte[] constant = new byte[5]; + constant[0] = (byte) ((usage>>24)&0xff); + constant[1] = (byte) ((usage>>16)&0xff); + constant[2] = (byte) ((usage>>8)&0xff); + constant[3] = (byte) (usage&0xff); + constant[4] = type; + return dk(baseKey, constant); + } + + /** + * Calculate the checksum + */ + public byte[] calculateChecksum(byte[] baseKey, int usage, byte[] input, + int start, int len) throws GeneralSecurityException { + + if (!KeyUsage.isValid(usage)) { + throw new GeneralSecurityException("Invalid key usage number: " + + usage); + } + + byte[] Kc = deriveKey(baseKey, usage, (byte) 0x99); // Checksum key + if (debug) { + System.err.println("usage: " + usage); + traceOutput("input", input, start, Math.min(len, 32)); + traceOutput("baseKey", baseKey, 0, baseKey.length); + traceOutput("Kc", Kc, 0, Kc.length); + } + + try { + // Generate checksum + // H1 = HMAC(Kc, input) + byte[] hmac = getHmac(Kc, input); + if (debug) { + traceOutput("hmac", hmac, 0, hmac.length); + } + if (hmac.length == getChecksumLength()) { + return hmac; + } else if (hmac.length > getChecksumLength()) { + byte[] buf = new byte[getChecksumLength()]; + System.arraycopy(hmac, 0, buf, 0, buf.length); + return buf; + } else { + throw new GeneralSecurityException("checksum size too short: " + + hmac.length + "; expecting : " + getChecksumLength()); + } + } finally { + Arrays.fill(Kc, 0, Kc.length, (byte)0); + } + } + + /** + * Performs encryption using derived key; adds confounder. + */ + public byte[] encrypt(byte[] baseKey, int usage, + byte[] ivec, byte[] new_ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + + if (!KeyUsage.isValid(usage)) { + throw new GeneralSecurityException("Invalid key usage number: " + + usage); + } + byte[] output = encryptCTS(baseKey, usage, ivec, new_ivec, plaintext, + start, len, true); + return output; + } + + /** + * Performs encryption using derived key; does not add confounder. + */ + public byte[] encryptRaw(byte[] baseKey, int usage, + byte[] ivec, byte[] plaintext, int start, int len) + throws GeneralSecurityException, KrbCryptoException { + + if (!KeyUsage.isValid(usage)) { + throw new GeneralSecurityException("Invalid key usage number: " + + usage); + } + byte[] output = encryptCTS(baseKey, usage, ivec, null, plaintext, + start, len, false); + return output; + } + + /** + * @param baseKey key from which keys are to be derived using usage + * @param ciphertext E(Ke, conf | plaintext | padding, ivec) | H1[1..h] + */ + public byte[] decrypt(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) throws GeneralSecurityException { + + if (!KeyUsage.isValid(usage)) { + throw new GeneralSecurityException("Invalid key usage number: " + + usage); + } + byte[] output = decryptCTS(baseKey, usage, ivec, ciphertext, + start, len, true); + return output; + } + + /** + * Decrypts data using specified key and initial vector. + * @param baseKey encryption key to use + * @param ciphertext encrypted data to be decrypted + * @param usage ignored + */ + public byte[] decryptRaw(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len) + throws GeneralSecurityException { + + if (!KeyUsage.isValid(usage)) { + throw new GeneralSecurityException("Invalid key usage number: " + + usage); + } + byte[] output = decryptCTS(baseKey, usage, ivec, ciphertext, + start, len, false); + return output; + } + + /** + * Encrypt AES in CBC-CTS mode using derived keys. + */ + private byte[] encryptCTS(byte[] baseKey, int usage, byte[] ivec, + byte[] new_ivec, byte[] plaintext, int start, int len, + boolean confounder_exists) + throws GeneralSecurityException, KrbCryptoException { + + byte[] Ke = null; + byte[] Ki = null; + + if (debug) { + System.err.println("usage: " + usage); + if (ivec != null) { + traceOutput("old_state.ivec", ivec, 0, ivec.length); + } + traceOutput("plaintext", plaintext, start, Math.min(len, 32)); + traceOutput("baseKey", baseKey, 0, baseKey.length); + } + + try { + Ke = deriveKey(baseKey, usage, (byte) 0xaa); // Encryption key + + byte[] toBeEncrypted = null; + if (confounder_exists) { + byte[] confounder = Confounder.bytes(BLOCK_SIZE); + toBeEncrypted = new byte[confounder.length + len]; + System.arraycopy(confounder, 0, toBeEncrypted, + 0, confounder.length); + System.arraycopy(plaintext, start, toBeEncrypted, + confounder.length, len); + } else { + toBeEncrypted = new byte[len]; + System.arraycopy(plaintext, start, toBeEncrypted, 0, len); + } + + // encryptedData + HMAC + byte[] output = new byte[toBeEncrypted.length + hashSize]; + + // AES in JCE + Cipher cipher = Cipher.getInstance("AES/CTS/NoPadding"); + SecretKeySpec secretKey = new SecretKeySpec(Ke, "AES"); + IvParameterSpec encIv = new IvParameterSpec(ivec, 0, ivec.length); + cipher.init(Cipher.ENCRYPT_MODE, secretKey, encIv); + cipher.doFinal(toBeEncrypted, 0, toBeEncrypted.length, output); + + Ki = deriveKey(baseKey, usage, (byte) 0x55); + if (debug) { + traceOutput("Ki", Ki, 0, Ke.length); + } + + // Generate checksum + // H = HMAC(Ki, IV | C) + byte[] msg = Arrays.copyOf(ivec, ivec.length + toBeEncrypted.length); + System.arraycopy(output, 0, msg, ivec.length, toBeEncrypted.length); + byte[] hmac = getHmac(Ki, msg); + + // encryptedData + HMAC + System.arraycopy(hmac, 0, output, toBeEncrypted.length, + hmac.length); + return output; + } finally { + if (Ke != null) { + Arrays.fill(Ke, 0, Ke.length, (byte) 0); + } + if (Ki != null) { + Arrays.fill(Ki, 0, Ki.length, (byte) 0); + } + } + } + + /** + * Decrypt AES in CBC-CTS mode using derived keys. + */ + private byte[] decryptCTS(byte[] baseKey, int usage, byte[] ivec, + byte[] ciphertext, int start, int len, boolean confounder_exists) + throws GeneralSecurityException { + + byte[] Ke = null; + byte[] Ki = null; + + try { + Ke = deriveKey(baseKey, usage, (byte) 0xaa); // Encryption key + + if (debug) { + System.err.println("usage: " + usage); + if (ivec != null) { + traceOutput("old_state.ivec", ivec, 0, ivec.length); + } + traceOutput("ciphertext", ciphertext, start, Math.min(len, 32)); + traceOutput("baseKey", baseKey, 0, baseKey.length); + traceOutput("Ke", Ke, 0, Ke.length); + } + + // Decrypt [confounder | plaintext ] (without checksum) + + // AES in JCE + Cipher cipher = Cipher.getInstance("AES/CTS/NoPadding"); + SecretKeySpec secretKey = new SecretKeySpec(Ke, "AES"); + IvParameterSpec encIv = new IvParameterSpec(ivec, 0, ivec.length); + cipher.init(Cipher.DECRYPT_MODE, secretKey, encIv); + byte[] plaintext = cipher.doFinal(ciphertext, start, len-hashSize); + + if (debug) { + traceOutput("AES PlainText", plaintext, 0, + Math.min(plaintext.length, 32)); + } + + Ki = deriveKey(baseKey, usage, (byte) 0x55); // Integrity key + if (debug) { + traceOutput("Ki", Ki, 0, Ke.length); + } + + // Verify checksum + // H = HMAC(Ki, IV | C) + byte[] msg = Arrays.copyOf(ivec, ivec.length + len-hashSize); + System.arraycopy(ciphertext, start, msg, ivec.length, len-hashSize); + byte[] calculatedHmac = getHmac(Ki, msg); + int hmacOffset = start + len - hashSize; + if (debug) { + traceOutput("calculated Hmac", calculatedHmac, + 0, calculatedHmac.length); + traceOutput("message Hmac", ciphertext, hmacOffset, hashSize); + } + boolean cksumFailed = false; + if (calculatedHmac.length >= hashSize) { + for (int i = 0; i < hashSize; i++) { + if (calculatedHmac[i] != ciphertext[hmacOffset+i]) { + cksumFailed = true; + if (debug) { + System.err.println("Checksum failed !"); + } + break; + } + } + } + if (cksumFailed) { + throw new GeneralSecurityException("Checksum failed"); + } + + if (confounder_exists) { + // Get rid of confounder + // [ confounder | plaintext ] + byte[] output = new byte[plaintext.length - BLOCK_SIZE]; + System.arraycopy(plaintext, BLOCK_SIZE, output, + 0, output.length); + return output; + } else { + return plaintext; + } + } finally { + if (Ke != null) { + Arrays.fill(Ke, 0, Ke.length, (byte) 0); + } + if (Ki != null) { + Arrays.fill(Ki, 0, Ki.length, (byte) 0); + } + } + } + + /* + * Invoke the PKCS#5 PBKDF2 algorithm + */ + private static byte[] PBKDF2(char[] secret, byte[] salt, + int count, int keyLength) throws GeneralSecurityException { + + PBEKeySpec keySpec = new PBEKeySpec(secret, salt, count, keyLength); + SecretKeyFactory skf = + SecretKeyFactory.getInstance(keyLength == 128 ? + "PBKDF2WithHmacSHA256" : "PBKDF2WithHmacSHA384"); + SecretKey key = skf.generateSecret(keySpec); + byte[] result = key.getEncoded(); + + return result; + } + + public static final int readBigEndian(byte[] data, int pos, int size) { + int retVal = 0; + int shifter = (size-1)*8; + while (size > 0) { + retVal += (data[pos] & 0xff) << shifter; + shifter -= 8; + pos++; + size--; + } + return retVal; + } + +} diff -r fb62f481671e -r 2d03ebb72df2 src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java --- a/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. */ /* @@ -478,7 +478,7 @@ * * DR(Key, Constant) = k-truncate(K1 | K2 | K3 | K4 ...) */ - private byte[] dr(byte[] key, byte[] constant) + protected byte[] dr(byte[] key, byte[] constant) throws GeneralSecurityException { Cipher encCipher = getCipher(key, null, Cipher.ENCRYPT_MODE); @@ -667,7 +667,7 @@ new HexDumpEncoder().encodeBuffer( new ByteArrayInputStream(output, offset, len), out); - System.err.println(traceTag + ":" + out.toString()); + System.err.println(traceTag + ":\n" + out.toString()); } catch (Exception e) { } } diff -r fb62f481671e -r 2d03ebb72df2 src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/Translet.java --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/Translet.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/Translet.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,6 +1,5 @@ /* * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. - * @LastModified: Oct 2017 */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff -r fb62f481671e -r 2d03ebb72df2 src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/output/TransletOutputHandlerFactory.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,6 +1,5 @@ /* * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. - * @LastModified: Oct 2017 */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff -r fb62f481671e -r 2d03ebb72df2 src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,6 +1,5 @@ /* * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. - * @LastModified: Oct 2017 */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff -r fb62f481671e -r 2d03ebb72df2 src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathContext.java --- a/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathContext.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/java.xml/share/classes/com/sun/org/apache/xpath/internal/XPathContext.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,6 +1,5 @@ /* * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. - * @LastModified: Oct 2017 */ /* * Licensed to the Apache Software Foundation (ASF) under one or more diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java Tue Jan 30 09:03:47 2018 -0800 @@ -633,6 +633,7 @@ boolean haveSourcePath = includeSourcePath && fileManager.hasLocation(SOURCE_PATH); if (verbose && verbosePath) { + verbosePath = false; // print once per compile if (fileManager instanceof StandardJavaFileManager) { StandardJavaFileManager fm = (StandardJavaFileManager)fileManager; if (haveSourcePath && wantSourceFiles) { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java Tue Jan 30 09:03:47 2018 -0800 @@ -1889,7 +1889,7 @@ Name paramName = name.table.fromString("arg" + i); VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this); newParams.append(param); - + i++; } params = newParams.toList(); } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java Tue Jan 30 09:03:47 2018 -0800 @@ -2107,9 +2107,8 @@ List prevBounds = bounds.get(ib); if (bound == qtype) return; for (Type b : prevBounds) { - //check for redundancy - use strict version of isSameType on tvars - //(as the standard version will lead to false positives w.r.t. clones ivars) - if (types.isSameType(b, bound2, true)) return; + //check for redundancy - do not add same bound twice + if (types.isSameType(b, bound2)) return; } bounds.put(ib, prevBounds.prepend(bound2)); notifyBoundChange(ib, bound2, false); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java Tue Jan 30 09:03:47 2018 -0800 @@ -1291,12 +1291,9 @@ * lists are of different length, return false. */ public boolean isSameTypes(List ts, List ss) { - return isSameTypes(ts, ss, false); - } - public boolean isSameTypes(List ts, List ss, boolean strict) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && - isSameType(ts.head, ss.head, strict)) { + isSameType(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } @@ -1325,15 +1322,15 @@ * Is t the same type as s? */ public boolean isSameType(Type t, Type s) { - return isSameType(t, s, false); - } - public boolean isSameType(Type t, Type s, boolean strict) { - return strict ? - isSameTypeStrict.visit(t, s) : - isSameTypeLoose.visit(t, s); + return isSameTypeVisitor.visit(t, s); } // where - abstract class SameTypeVisitor extends TypeRelation { + + /** + * Type-equality relation - type variables are considered + * equals if they share the same object identity. + */ + TypeRelation isSameTypeVisitor = new TypeRelation() { public Boolean visitType(Type t, Type s) { if (t.equalsIgnoreMetadata(s)) @@ -1350,7 +1347,7 @@ 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, (TypeVar)s); + return t == s; } else { //special case for s == ? super X, where upper(s) = u @@ -1365,8 +1362,6 @@ } } - abstract boolean sameTypeVars(TypeVar tv1, TypeVar tv2); - @Override public Boolean visitWildcardType(WildcardType t, Type s) { if (!s.hasTag(WILDCARD)) { @@ -1374,7 +1369,7 @@ } else { WildcardType t2 = (WildcardType)s; return (t.kind == t2.kind || (t.isExtendsBound() && s.isExtendsBound())) && - isSameType(t.type, t2.type, true); + isSameType(t.type, t2.type); } } @@ -1411,10 +1406,8 @@ } return t.tsym == s.tsym && visit(t.getEnclosingType(), s.getEnclosingType()) - && containsTypes(t.getTypeArguments(), s.getTypeArguments()); - } - - abstract protected boolean containsTypes(List ts1, List ts2); + && containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments()); + } @Override public Boolean visitArrayType(ArrayType t, Type s) { @@ -1471,70 +1464,6 @@ public Boolean visitErrorType(ErrorType t, Type s) { return true; } - } - - /** - * Standard type-equality relation - type variables are considered - * equals if they share the same type symbol. - */ - TypeRelation isSameTypeLoose = new LooseSameTypeVisitor(); - - private class LooseSameTypeVisitor extends SameTypeVisitor { - - /** cache of the type-variable pairs being (recursively) tested. */ - private Set cache = new HashSet<>(); - - @Override - boolean sameTypeVars(TypeVar tv1, TypeVar tv2) { - return tv1.tsym == tv2.tsym && checkSameBounds(tv1, tv2); - } - @Override - protected boolean containsTypes(List ts1, List ts2) { - return containsTypeEquivalent(ts1, ts2); - } - - /** - * Since type-variable bounds can be recursive, we need to protect against - * infinite loops - where the same bounds are checked over and over recursively. - */ - private boolean checkSameBounds(TypeVar tv1, TypeVar tv2) { - TypePair p = new TypePair(tv1, tv2, true); - if (cache.add(p)) { - try { - return visit(tv1.getUpperBound(), tv2.getUpperBound()); - } finally { - cache.remove(p); - } - } else { - return false; - } - } - }; - - /** - * Strict type-equality relation - type variables are considered - * equals if they share the same object identity. - */ - TypeRelation isSameTypeStrict = new SameTypeVisitor() { - @Override - boolean sameTypeVars(TypeVar tv1, TypeVar tv2) { - return tv1 == tv2; - } - @Override - protected boolean containsTypes(List ts1, List ts2) { - return isSameTypes(ts1, ts2, true); - } - - @Override - public Boolean visitWildcardType(WildcardType t, Type s) { - if (!s.hasTag(WILDCARD)) { - return false; - } else { - WildcardType t2 = (WildcardType)s; - return t.kind == t2.kind && - isSameType(t.type, t2.type, true); - } - } }; // @@ -3848,17 +3777,11 @@ // where class TypePair { final Type t1; - final Type t2; - boolean strict; + final Type t2;; TypePair(Type t1, Type t2) { - this(t1, t2, false); - } - - TypePair(Type t1, Type t2, boolean strict) { this.t1 = t1; this.t2 = t2; - this.strict = strict; } @Override public int hashCode() { @@ -3869,8 +3792,8 @@ if (!(obj instanceof TypePair)) return false; TypePair typePair = (TypePair)obj; - return isSameType(t1, typePair.t1, strict) - && isSameType(t2, typePair.t2, strict); + return isSameType(t1, typePair.t1) + && isSameType(t2, typePair.t2); } } Set mergeCache = new HashSet<>(); @@ -4460,7 +4383,7 @@ Type tmpLower = Si.lower.hasTag(UNDETVAR) ? ((UndetVar)Si.lower).qtype : Si.lower; if (!Si.bound.hasTag(ERROR) && !Si.lower.hasTag(ERROR) && - isSameType(tmpBound, tmpLower, false)) { + isSameType(tmpBound, tmpLower)) { currentS.head = Si.bound; } } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java Tue Jan 30 09:03:47 2018 -0800 @@ -565,7 +565,7 @@ List argtypes) { final Type restype; - if (spMethod == null || types.isSameType(spMethod.getReturnType(), syms.objectType, true)) { + if (spMethod == null || types.isSameType(spMethod.getReturnType(), syms.objectType)) { // The return type of the polymorphic signature is polymorphic, // and is computed from the enclosing tree E, as follows: // if E is a cast, then use the target type of the cast expression @@ -1227,8 +1227,8 @@ } else { IncorporationBinaryOp that = (IncorporationBinaryOp)o; return opKind == that.opKind && - types.isSameType(op1, that.op1, true) && - types.isSameType(op2, that.op2, true); + types.isSameType(op1, that.op1) && + types.isSameType(op2, that.op2); } } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java Tue Jan 30 09:03:47 2018 -0800 @@ -788,7 +788,7 @@ JCTypeCast typeCast = newExpression.hasTag(Tag.TYPECAST) ? (JCTypeCast) newExpression : null; - tree.expr = typeCast != null && types.isSameType(typeCast.type, originalTarget, true) + tree.expr = typeCast != null && types.isSameType(typeCast.type, originalTarget) ? typeCast.expr : newExpression; } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -358,6 +358,6 @@ } } buf.append(")"); - return foundTypeVariable ? configuration.links.getName(buf.toString()) : null; + return foundTypeVariable ? writer.links.getName(buf.toString()) : null; } } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -90,7 +90,7 @@ this.utils = configuration.utils; this.contents = configuration.contents; this.resources = configuration.resources; - this.links = configuration.links; + this.links = writer.links; } public AbstractMemberWriter(SubWriterHolderWriter writer) { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Table; -import java.util.Arrays; - import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; @@ -292,7 +290,7 @@ */ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { - return Links.createLink( + return links.createLink( SectionName.ANNOTATION_TYPE_FIELD_SUMMARY, contents.navField); } else { @@ -305,7 +303,7 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.ANNOTATION_TYPE_FIELD_DETAIL, contents.navField)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -159,7 +159,7 @@ @Override protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { - return Links.createLink( + return links.createLink( SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY, contents.navAnnotationTypeOptionalMember); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Table; -import java.util.Arrays; -import java.util.List; - import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; @@ -308,7 +305,7 @@ */ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { - return Links.createLink( + return links.createLink( SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY, contents.navAnnotationTypeRequiredMember); } else { @@ -321,7 +318,7 @@ */ protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL, contents.navAnnotationTypeMember)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,7 @@ */ @Override protected Content getNavLinkPackage() { - Content linkContent = Links.createLink(DocPaths.PACKAGE_SUMMARY, + Content linkContent = links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel); Content li = HtmlTree.LI(linkContent); return li; @@ -133,7 +133,7 @@ */ @Override protected Content getNavLinkClassUse() { - Content linkContent = Links.createLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel); + Content linkContent = links.createLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel); Content li = HtmlTree.LI(linkContent); return li; } @@ -347,7 +347,7 @@ */ @Override protected Content getNavLinkTree() { - Content treeLinkContent = Links.createLink(DocPaths.PACKAGE_TREE, + Content treeLinkContent = links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel, "", ""); Content li = HtmlTree.LI(treeLinkContent); return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -515,7 +515,7 @@ */ protected Content getNavLinkPackage() { Content linkContent = - Links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), contents.packageLabel); + links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_SUMMARY), contents.packageLabel); Content li = HtmlTree.LI(linkContent); return li; } @@ -550,8 +550,8 @@ */ protected Content getNavLinkTree() { Content linkContent = utils.isEnclosingPackageIncluded(typeElement) - ? Links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel) - : Links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel); + ? links.createLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), contents.treeLabel) + : links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), contents.treeLabel); Content li = HtmlTree.LI(linkContent); return li; } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -120,7 +120,7 @@ */ @Override protected Content getNavLinkPackage() { - Content linkContent = Links.createLink(DocPaths.PACKAGE_SUMMARY, + Content linkContent = links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel); Content li = HtmlTree.LI(linkContent); return li; @@ -144,7 +144,7 @@ */ @Override protected Content getNavLinkClassUse() { - Content linkContent = Links.createLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel); + Content linkContent = links.createLink(DocPaths.CLASS_USE.resolve(filename), contents.useLabel); Content li = HtmlTree.LI(linkContent); return li; } @@ -660,7 +660,7 @@ */ @Override protected Content getNavLinkTree() { - Content treeLinkContent = Links.createLink(DocPaths.PACKAGE_TREE, + Content treeLinkContent = links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel, "", ""); Content li = HtmlTree.LI(treeLinkContent); return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstantsSummaryWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -135,13 +135,13 @@ //add link to summary Content link; if (pkg.isUnnamed()) { - link = Links.createLink(SectionName.UNNAMED_PACKAGE_ANCHOR, + link = links.createLink(SectionName.UNNAMED_PACKAGE_ANCHOR, contents.defaultPackageLabel, "", ""); } else { String parsedPackageName = utils.parsePackageName(pkg); Content packageNameContent = getPackageLabel(parsedPackageName); packageNameContent.addContent(".*"); - link = Links.createLink(DocLink.fragment(parsedPackageName), + link = links.createLink(DocLink.fragment(parsedPackageName), packageNameContent, "", ""); PackageElement abbrevPkg = configuration.workArounds.getAbbreviatedPackageElement(pkg); printedPackageHeaders.add(abbrevPkg); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConstructorWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -300,7 +300,7 @@ @Override protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { - return Links.createLink(SectionName.CONSTRUCTOR_SUMMARY, + return links.createLink(SectionName.CONSTRUCTOR_SUMMARY, contents.navConstructor); } else { return contents.navConstructor; @@ -313,7 +313,7 @@ @Override protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.CONSTRUCTOR_DETAIL, contents.navConstructor)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/EnumConstantWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -281,7 +281,7 @@ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { if (typeElement == null) { - return Links.createLink(SectionName.ENUM_CONSTANT_SUMMARY, + return links.createLink(SectionName.ENUM_CONSTANT_SUMMARY, contents.navEnum); } else { return links.createLink( @@ -299,7 +299,7 @@ @Override protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.ENUM_CONSTANT_DETAIL, contents.navEnum)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -310,7 +310,7 @@ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { if (typeElement == null) { - return Links.createLink( + return links.createLink( SectionName.FIELD_SUMMARY, contents.navField); } else { @@ -329,7 +329,7 @@ @Override protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.FIELD_DETAIL, contents.navField)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,7 +29,6 @@ import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; -import jdk.javadoc.internal.doclets.formats.html.markup.Links; import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; @@ -54,6 +53,7 @@ /** * Constructor to construct HelpWriter object. + * @param configuration the configuration * @param filename File to be generated. */ public HelpWriter(HtmlConfiguration configuration, @@ -67,6 +67,7 @@ * will get generated if and only if "-helpfile" and "-nohelp" is not used * on the command line. * + * @param configuration the configuration * @throws DocFileIOException if there is a problem while generating the documentation */ public static void generate(HtmlConfiguration configuration) throws DocFileIOException { @@ -133,7 +134,7 @@ ? HtmlTree.SECTION(overviewHeading) : HtmlTree.LI(HtmlStyle.blockList, overviewHeading); Content line3 = contents.getContent("doclet.Help_line_3", - Links.createLink(DocPaths.overviewSummary(configuration.frames), + links.createLink(DocPaths.overviewSummary(configuration.frames), configuration.getText("doclet.Overview"))); Content overviewPara = HtmlTree.P(line3); htmlTree.addContent(overviewPara); @@ -283,7 +284,7 @@ ? HtmlTree.SECTION(treeHead) : HtmlTree.LI(HtmlStyle.blockList, treeHead); Content line17 = contents.getContent("doclet.Help_line_17_with_tree_link", - Links.createLink(DocPaths.OVERVIEW_TREE, + links.createLink(DocPaths.OVERVIEW_TREE, configuration.getText("doclet.Class_Hierarchy")), HtmlTree.CODE(new StringContent("java.lang.Object"))); Content treePara = HtmlTree.P(line17); @@ -308,7 +309,7 @@ ? HtmlTree.SECTION(dHead) : HtmlTree.LI(HtmlStyle.blockList, dHead); Content line20 = contents.getContent("doclet.Help_line_20_with_deprecated_api_link", - Links.createLink(DocPaths.DEPRECATED_LIST, + links.createLink(DocPaths.DEPRECATED_LIST, configuration.getText("doclet.Deprecated_API"))); Content dPara = HtmlTree.P(line20); htmlTree.addContent(dPara); @@ -321,10 +322,10 @@ if (configuration.createindex) { Content indexlink; if (configuration.splitindex) { - indexlink = Links.createLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)), + indexlink = links.createLink(DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)), configuration.getText("doclet.Index")); } else { - indexlink = Links.createLink(DocPaths.INDEX_ALL, + indexlink = links.createLink(DocPaths.INDEX_ALL, configuration.getText("doclet.Index")); } Content indexHead = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, @@ -378,7 +379,7 @@ ? HtmlTree.SECTION(allclassesHead) : HtmlTree.LI(HtmlStyle.blockList, allclassesHead); Content line27 = contents.getContent("doclet.Help_line_27", - Links.createLink(DocPaths.AllClasses(configuration.frames), + links.createLink(DocPaths.AllClasses(configuration.frames), resources.getText("doclet.All_Classes"))); Content allclassesPara = HtmlTree.P(line27); htmlTree.addContent(allclassesPara); @@ -406,7 +407,7 @@ ? HtmlTree.SECTION(constHead) : HtmlTree.LI(HtmlStyle.blockList, constHead); Content line29 = contents.getContent("doclet.Help_line_29", - Links.createLink(DocPaths.CONSTANT_VALUES, + links.createLink(DocPaths.CONSTANT_VALUES, resources.getText("doclet.Constants_Summary"))); Content constPara = HtmlTree.P(line29); htmlTree.addContent(constPara); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Jan 30 09:03:47 2018 -0800 @@ -245,8 +245,6 @@ protected final Messages messages; - protected Links links; - /** * Creates an object to hold the configuration for a doclet. * @@ -363,7 +361,6 @@ setTopFile(docEnv); workArounds.initDocLint(doclintOpts.values(), tagletManager.getCustomTagNames(), Utils.toLowerCase(htmlVersion.name())); - links = new Links(htmlVersion); return true; } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -197,7 +197,7 @@ this.contents = configuration.contents; this.messages = configuration.messages; this.resources = configuration.resources; - this.links = configuration.links; + this.links = new Links(path, configuration.htmlVersion); this.utils = configuration.utils; this.path = path; this.pathToRoot = path.parent().invert(); @@ -371,7 +371,7 @@ */ public Content getTargetPackageLink(PackageElement pkg, String target, Content label) { - return Links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); + return links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); } /** @@ -385,7 +385,7 @@ */ public Content getTargetModulePackageLink(PackageElement pkg, String target, Content label, ModuleElement mdle) { - return Links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), + return links.createLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY), label, "", target); } @@ -398,7 +398,7 @@ * @return a content for the target module link */ public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { - return Links.createLink(pathToRoot.resolve( + return links.createLink(pathToRoot.resolve( DocPaths.moduleSummary(mdle)), label, "", target); } @@ -509,7 +509,7 @@ //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, - Links.createLink(SectionName.SKIP_NAVBAR_TOP, skipNavLinks, + links.createLink(SectionName.SKIP_NAVBAR_TOP, skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } else { @@ -519,7 +519,7 @@ Content a = links.createAnchor(SectionName.NAVBAR_BOTTOM); navDiv.addContent(a); Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, - Links.createLink(SectionName.SKIP_NAVBAR_BOTTOM, skipNavLinks, + links.createLink(SectionName.SKIP_NAVBAR_BOTTOM, skipNavLinks, skipNavLinks.toString(), "")); navDiv.addContent(skipLinkContent); } @@ -651,7 +651,7 @@ * @return a content tree for the link */ protected Content getNavLinkContents() { - Content linkContent = Links.createLink(pathToRoot.resolve(DocPaths.overviewSummary(configuration.frames)), + Content linkContent = links.createLink(pathToRoot.resolve(DocPaths.overviewSummary(configuration.frames)), contents.overviewLabel, "", ""); Content li = HtmlTree.LI(linkContent); return li; @@ -720,7 +720,7 @@ public Content getNavLinkPrevious(DocPath prev) { Content li; if (prev != null) { - li = HtmlTree.LI(Links.createLink(prev, contents.prevLabel, "", "")); + li = HtmlTree.LI(links.createLink(prev, contents.prevLabel, "", "")); } else li = HtmlTree.LI(contents.prevLabel); @@ -737,7 +737,7 @@ public Content getNavLinkNext(DocPath next) { Content li; if (next != null) { - li = HtmlTree.LI(Links.createLink(next, contents.nextLabel, "", "")); + li = HtmlTree.LI(links.createLink(next, contents.nextLabel, "", "")); } else li = HtmlTree.LI(contents.nextLabel); @@ -752,7 +752,7 @@ */ protected Content getNavShowLists(DocPath link) { DocLink dl = new DocLink(link, path.getPath(), null); - Content framesContent = Links.createLink(dl, contents.framesLabel, "", "_top"); + Content framesContent = links.createLink(dl, contents.framesLabel, "", "_top"); Content li = HtmlTree.LI(framesContent); return li; } @@ -773,7 +773,7 @@ * @return a content tree for the link */ protected Content getNavHideLists(DocPath link) { - Content noFramesContent = Links.createLink(link, contents.noFramesLabel, "", "_top"); + Content noFramesContent = links.createLink(link, contents.noFramesLabel, "", "_top"); Content li = HtmlTree.LI(noFramesContent); return li; } @@ -791,7 +791,7 @@ DocPath docPath = packages.size() == 1 && configuration.getSpecifiedTypeElements().isEmpty() ? pathString(packages.get(0), DocPaths.PACKAGE_TREE) : pathToRoot.resolve(DocPaths.OVERVIEW_TREE); - return HtmlTree.LI(Links.createLink(docPath, contents.treeLabel, "", "")); + return HtmlTree.LI(links.createLink(docPath, contents.treeLabel, "", "")); } /** @@ -801,7 +801,7 @@ * @return a content tree for the link */ protected Content getNavLinkMainTree(String label) { - Content mainTreeContent = Links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), + Content mainTreeContent = links.createLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), new StringContent(label)); Content li = HtmlTree.LI(mainTreeContent); return li; @@ -823,7 +823,7 @@ * @return a content tree for the link */ protected Content getNavLinkDeprecated() { - Content linkContent = Links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), + Content linkContent = links.createLink(pathToRoot.resolve(DocPaths.DEPRECATED_LIST), contents.deprecatedLabel, "", ""); Content li = HtmlTree.LI(linkContent); return li; @@ -837,7 +837,7 @@ * @return a content tree for the link */ protected Content getNavLinkClassIndex() { - Content allClassesContent = Links.createLink(pathToRoot.resolve( + Content allClassesContent = links.createLink(pathToRoot.resolve( DocPaths.AllClasses(configuration.frames)), contents.allClassesLabel, "", ""); Content li = HtmlTree.LI(allClassesContent); @@ -850,7 +850,7 @@ * @return a content tree for the link */ protected Content getNavLinkIndex() { - Content linkContent = Links.createLink(pathToRoot.resolve( + Content linkContent = links.createLink(pathToRoot.resolve( (configuration.splitindex ? DocPaths.INDEX_FILES.resolve(DocPaths.indexN(1)) : DocPaths.INDEX_ALL)), @@ -875,7 +875,7 @@ DocFile file = DocFile.createFileForInput(configuration, helpfile); helpfilenm = DocPath.create(file.getName()); } - Content linkContent = Links.createLink(pathToRoot.resolve(helpfilenm), + Content linkContent = links.createLink(pathToRoot.resolve(helpfilenm), contents.helpLabel, "", ""); Content li = HtmlTree.LI(linkContent); return li; @@ -999,12 +999,12 @@ } } if (included || packageElement == null) { - return Links.createLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), + return links.createLink(pathString(packageElement, DocPaths.PACKAGE_SUMMARY), label); } else { DocLink crossPkgLink = getCrossPackageLink(utils.getPackageName(packageElement)); if (crossPkgLink != null) { - return Links.createLink(crossPkgLink, label); + return links.createLink(crossPkgLink, label); } else { return label; } @@ -1021,7 +1021,7 @@ public Content getModuleLink(ModuleElement mdle, Content label) { boolean included = utils.isIncluded(mdle); return (included) - ? Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") + ? links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") : label; } @@ -1051,7 +1051,7 @@ DocPath href = pathToRoot .resolve(DocPaths.SOURCE_OUTPUT) .resolve(DocPath.forClass(utils, te)); - Content linkContent = Links.createLink(href + Content linkContent = links.createLink(href .fragment(SourceToHTMLConverter.getAnchorName(utils, typeElement)), label, "", ""); htmltree.addContent(linkContent); } @@ -1115,7 +1115,7 @@ */ DocLink link = configuration.extern.getExternalLink(packageName, pathToRoot, className + ".html", refMemName); - return Links.createLink(link, + return links.createLink(link, (label == null) || label.isEmpty() ? defaultLabel : label, strong, resources.getText("doclet.Href_Class_Or_Interface_Title", packageName), @@ -1422,7 +1422,7 @@ ? getCrossModuleLink(refClassName) : getCrossPackageLink(refClassName); if (elementCrossLink != null) { // Element cross link found - return Links.createLink(elementCrossLink, + return links.createLink(elementCrossLink, (label.isEmpty() ? text : label), true); } else if ((classCrossLink = getCrossClassLink(refClassName, refMemName, label, false, !isLinkPlain)) != null) { @@ -1752,8 +1752,9 @@ result.addContent(sb); Content docRootContent = new ContentBuilder(); + boolean isHRef = inAnAtag() && node.getName().toString().equalsIgnoreCase("href"); for (DocTree dt : node.getValue()) { - if (utils.isText(dt) && inAnAtag()) { + if (utils.isText(dt) && isHRef) { String text = ((TextTree) dt).getBody(); if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) { result.addContent(configuration.docrootparent); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,7 +33,6 @@ import javax.lang.model.type.TypeMirror; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; -import jdk.javadoc.internal.doclets.formats.html.markup.Links; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; @@ -93,7 +92,7 @@ DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || !(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) { - link.addContent(Links.createLink( + link.addContent(m_writer.links.createLink( filename.fragment(classLinkInfo.where), label, classLinkInfo.isStrong, diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -432,7 +432,7 @@ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { if (typeElement == null) { - return Links.createLink( + return links.createLink( SectionName.METHOD_SUMMARY, contents.navMethod); } else { @@ -451,7 +451,7 @@ @Override protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.METHOD_DETAIL, contents.navMethod)); } else { liNav.addContent(contents.navMethod); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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,7 +101,7 @@ ? HtmlTree.MAIN() : body; Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, - Links.createLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); + mdlgen.links.createLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.indexContainer); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ * @param ul the Content object to which the all classes link should be added */ protected void addAllClassesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.ALLCLASSES_FRAME, + Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME, contents.allClassesLabel, "", "packageFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); @@ -165,7 +165,7 @@ * @param ul the Content object to which the all packages link should be added */ protected void addAllPackagesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.OVERVIEW_FRAME, + Content linkContent = links.createLink(DocPaths.OVERVIEW_FRAME, contents.allPackagesLabel, "", "packageListFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -143,12 +143,12 @@ Content pkgLabel; if (!pkg.isUnnamed()) { pkgLabel = getPackageLabel(utils.getPackageName(pkg)); - packageLinkContent = Links.createLink(pathString(pkg, + packageLinkContent = links.createLink(pathString(pkg, DocPaths.PACKAGE_FRAME), pkgLabel, "", "packageFrame"); } else { pkgLabel = new StringContent(""); - packageLinkContent = Links.createLink(DocPaths.PACKAGE_FRAME, + packageLinkContent = links.createLink(DocPaths.PACKAGE_FRAME, pkgLabel, "", "packageFrame"); } Content li = HtmlTree.LI(packageLinkContent); @@ -189,7 +189,7 @@ * @param ul the Content object to which the all classes link should be added */ protected void addAllClassesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.ALLCLASSES_FRAME, + Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME, contents.allClassesLabel, "", "packageFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); @@ -202,7 +202,7 @@ * @param ul the Content object to which the all packages link should be added */ protected void addAllPackagesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.OVERVIEW_FRAME, + Content linkContent = links.createLink(DocPaths.OVERVIEW_FRAME, contents.allPackagesLabel, "", "packageListFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); @@ -215,7 +215,7 @@ * @param ul the Content object to which the all modules link should be added */ protected void addAllModulesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.MODULE_OVERVIEW_FRAME, + Content linkContent = links.createLink(DocPaths.MODULE_OVERVIEW_FRAME, contents.allModulesLabel, "", "packageListFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -951,20 +951,20 @@ Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); Content liNav = new HtmlTree(HtmlTag.LI); liNav.addContent(!utils.getFullBody(mdle).isEmpty() && !configuration.nocomment - ? Links.createLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription) + ? links.createLink(SectionName.MODULE_DESCRIPTION, contents.navModuleDescription) : contents.navModuleDescription); addNavGap(liNav); liNav.addContent((display(requires) || display(indirectModules)) - ? Links.createLink(SectionName.MODULES, contents.navModules) + ? links.createLink(SectionName.MODULES, contents.navModules) : contents.navModules); addNavGap(liNav); liNav.addContent((display(packages) || display(indirectPackages) || display(indirectOpenPackages)) - ? Links.createLink(SectionName.PACKAGES, contents.navPackages) + ? links.createLink(SectionName.PACKAGES, contents.navPackages) : contents.navPackages); addNavGap(liNav); liNav.addContent((displayServices(uses, usesTrees) || displayServices(provides.keySet(), providesTrees)) - ? Links.createLink(SectionName.SERVICES, contents.navServices) + ? links.createLink(SectionName.SERVICES, contents.navServices) : contents.navServices); ulNav.addContent(liNav); return ulNav; @@ -1056,7 +1056,7 @@ if (prevModule == null) { li = HtmlTree.LI(contents.prevModuleLabel); } else { - li = HtmlTree.LI(Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( + li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( prevModule)), contents.prevModuleLabel, "", "")); } return li; @@ -1073,7 +1073,7 @@ if (nextModule == null) { li = HtmlTree.LI(contents.nextModuleLabel); } else { - li = HtmlTree.LI(Links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( + li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( nextModule)), contents.nextModuleLabel, "", "")); } return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -213,7 +213,7 @@ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { if (typeElement == null) { - return Links.createLink( + return links.createLink( SectionName.NESTED_CLASS_SUMMARY, contents.navNested); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ package jdk.javadoc.internal.doclets.formats.html; -import java.util.Collection; - import javax.lang.model.element.PackageElement; import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; @@ -110,11 +108,11 @@ Content packageLabel; if (pe.isUnnamed()) { packageLabel = new StringContent(""); - packageLinkContent = Links.createLink(DocPaths.PACKAGE_FRAME, + packageLinkContent = links.createLink(DocPaths.PACKAGE_FRAME, packageLabel, "", "packageFrame"); } else { packageLabel = getPackageLabel(pe.getQualifiedName()); - packageLinkContent = Links.createLink(pathString(pe, + packageLinkContent = links.createLink(pathString(pe, DocPaths.PACKAGE_FRAME), packageLabel, "", "packageFrame"); } @@ -153,7 +151,7 @@ */ @Override protected void addAllClassesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.ALLCLASSES_FRAME, + Content linkContent = links.createLink(DocPaths.ALLCLASSES_FRAME, contents.allClassesLabel, "", "packageFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); @@ -167,7 +165,7 @@ */ @Override protected void addAllModulesLink(Content ul) { - Content linkContent = Links.createLink(DocPaths.MODULE_OVERVIEW_FRAME, + Content linkContent = links.createLink(DocPaths.MODULE_OVERVIEW_FRAME, contents.allModulesLabel, "", "packageListFrame"); Content li = HtmlTree.LI(linkContent); ul.addContent(li); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -232,7 +232,7 @@ */ @Override protected Content getNavLinkPackage() { - Content linkContent = Links.createLink(DocPaths.PACKAGE_SUMMARY, + Content linkContent = links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel); Content li = HtmlTree.LI(linkContent); return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -223,7 +223,7 @@ DocPath dp = pathString(te, DocPaths.CLASS_USE.resolve(DocPath.forName(utils, te))); Content stringContent = new StringContent(utils.getSimpleName(te)); - Content typeContent = Links.createLink(dp.fragment(getPackageAnchorName(usingPackage)), + Content typeContent = links.createLink(dp.fragment(getPackageAnchorName(usingPackage)), stringContent); Content summary = new ContentBuilder(); addIndexComment(te, summary); @@ -288,7 +288,7 @@ */ @Override protected Content getNavLinkPackage() { - Content linkContent = Links.createLink(DocPaths.PACKAGE_SUMMARY, + Content linkContent = links.createLink(DocPaths.PACKAGE_SUMMARY, contents.packageLabel); Content li = HtmlTree.LI(linkContent); return li; @@ -312,7 +312,7 @@ */ @Override protected Content getNavLinkTree() { - Content linkContent = Links.createLink(DocPaths.PACKAGE_TREE, + Content linkContent = links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel); Content li = HtmlTree.LI(linkContent); return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -385,7 +385,7 @@ */ @Override protected Content getNavLinkClassUse() { - Content useLink = Links.createLink(DocPaths.PACKAGE_USE, + Content useLink = links.createLink(DocPaths.PACKAGE_USE, contents.useLabel, "", ""); Content li = HtmlTree.LI(useLink); return li; @@ -403,7 +403,7 @@ li = HtmlTree.LI(contents.prevPackageLabel); } else { DocPath p = DocPath.relativePath(packageElement, prev); - li = HtmlTree.LI(Links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), + li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), contents.prevPackageLabel, "", "")); } return li; @@ -421,7 +421,7 @@ li = HtmlTree.LI(contents.nextPackageLabel); } else { DocPath p = DocPath.relativePath(packageElement, next); - li = HtmlTree.LI(Links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), + li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), contents.nextPackageLabel, "", "")); } return li; @@ -435,7 +435,7 @@ */ @Override protected Content getNavLinkTree() { - Content useLink = Links.createLink(DocPaths.PACKAGE_TREE, + Content useLink = links.createLink(DocPaths.PACKAGE_TREE, contents.treeLabel, "", ""); Content li = HtmlTree.LI(useLink); return li; diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * 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,7 +332,7 @@ protected Content getNavSummaryLink(TypeElement typeElement, boolean link) { if (link) { if (typeElement == null) { - return Links.createLink( + return links.createLink( SectionName.PROPERTY_SUMMARY, contents.navProperty); } else { @@ -351,7 +351,7 @@ @Override protected void addNavDetailLink(boolean link, Content liNav) { if (link) { - liNav.addContent(Links.createLink( + liNav.addContent(links.createLink( SectionName.PROPERTY_DETAIL, contents.navProperty)); } else { diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SplitIndexWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -177,7 +177,7 @@ protected void addLinksForIndexes(Content contentTree) { for (int i = 0; i < indexElements.size(); i++) { int j = i + 1; - contentTree.addContent(Links.createLink(DocPaths.indexN(j), + contentTree.addContent(links.createLink(DocPaths.indexN(j), new StringContent(indexElements.get(i).toString()))); contentTree.addContent(Contents.SPACE); } @@ -195,7 +195,7 @@ return HtmlTree.LI(prevletterLabel); } else { - Content prevLink = Links.createLink(DocPaths.indexN(prev), + Content prevLink = links.createLink(DocPaths.indexN(prev), prevletterLabel); return HtmlTree.LI(prevLink); } @@ -213,7 +213,7 @@ return HtmlTree.LI(nextletterLabel); } else { - Content nextLink = Links.createLink(DocPaths.indexN(next), + Content nextLink = links.createLink(DocPaths.indexN(next), nextletterLabel); return HtmlTree.LI(nextLink); } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,7 @@ } String desc = ch.getText(itt.getDescription()); - String anchorName = configuration.links.getName(tagText); + String anchorName = htmlWriter.links.getName(tagText); Content result = HtmlTree.A_ID(HtmlStyle.searchTagResult, anchorName, new StringContent(tagText)); if (configuration.createindex && !tagText.isEmpty()) { SearchIndexItem si = new SearchIndexItem(); @@ -288,7 +288,7 @@ ((ClassWriterImpl) htmlWriter).getTypeElement().getQualifiedName() + "." + utils.getSimpleName(holder); DocLink link = constantsPath.fragment(whichConstant); - body.addContent(Links.createLink(link, + body.addContent(htmlWriter.links.createLink(link, new StringContent(configuration.getText("doclet.Constants_Summary")))); } if (utils.isClass(holder) && utils.isSerializable((TypeElement)holder)) { @@ -298,7 +298,7 @@ appendSeparatorIfNotEmpty(body); DocPath serialPath = htmlWriter.pathToRoot.resolve(DocPaths.SERIALIZED_FORM); DocLink link = serialPath.fragment(utils.getFullyQualifiedName(holder)); - body.addContent(Links.createLink(link, + body.addContent(htmlWriter.links.createLink(link, new StringContent(configuration.getText("doclet.Serialized_Form")))); } } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -162,7 +162,7 @@ continue; } DocPath link = pathString(pkg, DocPaths.PACKAGE_TREE); - Content li = HtmlTree.LI(Links.createLink(link, + Content li = HtmlTree.LI(links.createLink(link, new StringContent(utils.getPackageName(pkg)))); if (i < packages.size() - 1) { li.addContent(", "); diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Links.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * 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,17 +46,20 @@ */ public class Links { + private final DocPath file; private final HtmlVersion version; /** - * Creates a {@code Links} object for a specific HTML version. + * Creates a {@code Links} object for a specific file, to be written in a specific HTML version. * The version is used by the {@link #getName(String) getName} method * to help determine valid HTML names (ids), and to determine whether * to use an {@code id} or {@code name} attribute when creating anchors. * + * @param file the file * @param version the HTML version */ - public Links(HtmlVersion version) { + public Links(DocPath file, HtmlVersion version) { + this.file = file; this.version = version; } @@ -118,7 +121,7 @@ */ public Content createLink(String where, Content label) { DocLink l = DocLink.fragment(getName(where)); - return Links.createLink(l, label, "", ""); + return createLink(l, label, "", ""); } /** @@ -128,9 +131,9 @@ * @param label the content for the link * @return a content tree for the link */ - public static Content createLink(SectionName sectionName, Content label) { + public Content createLink(SectionName sectionName, Content label) { DocLink l = DocLink.fragment(sectionName.getName()); - return Links.createLink(l, label, "", ""); + return createLink(l, label, "", ""); } /** @@ -145,7 +148,7 @@ */ public Content createLink(SectionName sectionName, String where, Content label) { DocLink l = DocLink.fragment(sectionName.getName() + getName(where)); - return Links.createLink(l, label, "", ""); + return createLink(l, label, "", ""); } /** @@ -157,7 +160,7 @@ * @param target the target for the link, or null * @return a content tree for the link */ - public static Content createLink(SectionName sectionName, Content label, String title, String target) { + public Content createLink(SectionName sectionName, Content label, String title, String target) { DocLink l = DocLink.fragment(sectionName.getName()); return createLink(l, label, title, target); } @@ -169,8 +172,8 @@ * @param label the content for the link * @return a content tree for the link */ - public static Content createLink(DocPath path, String label) { - return Links.createLink(path, new StringContent(label), false, "", ""); + public Content createLink(DocPath path, String label) { + return createLink(path, new StringContent(label), false, "", ""); } /** @@ -180,8 +183,8 @@ * @param label the content for the link * @return a content tree for the link */ - public static Content createLink(DocPath path, Content label) { - return Links.createLink(path, label, "", ""); + public Content createLink(DocPath path, Content label) { + return createLink(path, label, "", ""); } /** @@ -196,7 +199,7 @@ * @param target the target for the link, or null * @return a content tree for the link */ - public static Content createLink(DocPath path, Content label, boolean strong, + public Content createLink(DocPath path, Content label, boolean strong, String title, String target) { return createLink(new DocLink(path), label, strong, title, target); } @@ -210,8 +213,8 @@ * @param target the target for the link, or null * @return a content tree for the link */ - public static Content createLink(DocPath path, Content label, String title, String target) { - return Links.createLink(new DocLink(path), label, title, target); + public Content createLink(DocPath path, Content label, String title, String target) { + return createLink(new DocLink(path), label, title, target); } /** @@ -221,8 +224,8 @@ * @param label the content for the link * @return a content tree for the link */ - public static Content createLink(DocLink link, Content label) { - return Links.createLink(link, label, "", ""); + public Content createLink(DocLink link, Content label) { + return createLink(link, label, "", ""); } /** @@ -234,8 +237,8 @@ * @param target the target for the link, or null * @return a content tree for the link */ - public static Content createLink(DocLink link, Content label, String title, String target) { - HtmlTree anchor = HtmlTree.A(link.toString(), label); + public Content createLink(DocLink link, Content label, String title, String target) { + HtmlTree anchor = HtmlTree.A(link.relativizeAgainst(file).toString(), label); if (title != null && title.length() != 0) { anchor.addAttr(HtmlAttr.TITLE, title); } @@ -257,7 +260,7 @@ * @param target the target for the link, or null * @return a content tree for the link */ - public static Content createLink(DocLink link, Content label, boolean strong, + public Content createLink(DocLink link, Content label, boolean strong, String title, String target) { return createLink(link, label, strong, title, target, false); } @@ -275,13 +278,13 @@ * @param isExternal is the link external to the generated documentation * @return a content tree for the link */ - public static Content createLink(DocLink link, Content label, boolean strong, + public Content createLink(DocLink link, Content label, boolean strong, String title, String target, boolean isExternal) { Content body = label; if (strong) { body = HtmlTree.SPAN(HtmlStyle.typeNameLink, body); } - HtmlTree l = HtmlTree.A(link.toString(), body); + HtmlTree l = HtmlTree.A(link.relativizeAgainst(file).toString(), body); if (title != null && title.length() != 0) { l.addAttr(HtmlAttr.TITLE, title); } @@ -302,13 +305,12 @@ * @param isExternal is the link external to the generated documentation * @return a content tree for the link */ - public static Content createLink(DocLink link, Content label, boolean isExternal) { - HtmlTree anchor = HtmlTree.A(link.toString(), label); + public Content createLink(DocLink link, Content label, boolean isExternal) { + HtmlTree anchor = HtmlTree.A(link.relativizeAgainst(file).toString(), label); anchor.setStyle(HtmlStyle.externalLink); return anchor; } - /** * Converts a name to a valid HTML name (id). * This depends on the HTML version specified when the {@code Links} object was created. diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocLink.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocLink.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocLink.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,51 +39,101 @@ * */ public class DocLink { - final String path; + final DocPath path; final String query; final String fragment; - /** Create a DocLink representing the URI {@code #fragment}. */ + /** + * Creates a DocLink representing the URI {@code #fragment}. + * @param fragment the fragment + * @return the DocLink + */ public static DocLink fragment(String fragment) { - return new DocLink((String) null, (String) null, fragment); - } - - /** Create a DocLink representing the URI {@code path}. */ - public DocLink(DocPath path) { - this(path.getPath(), null, null); + return new DocLink((DocPath) null, (String) null, fragment); } /** - * Create a DocLink representing the URI {@code path?query#fragment}. - * query and fragment may be null. + * Creates a DocLink representing the URI {@code path}. + * @param path the path */ - public DocLink(DocPath path, String query, String fragment) { - this(path.getPath(), query, fragment); + public DocLink(DocPath path) { + this(path, null, null); } /** - * Create a DocLink representing the URI {@code path?query#fragment}. + * Creates a DocLink representing the URI {@code path?query#fragment}. * Any of the component parts may be null. + * @param path the path + * @param query the query + * @param fragment the fragment */ - public DocLink(String path, String query, String fragment) { + public DocLink(DocPath path, String query, String fragment) { this.path = path; this.query = query; this.fragment = fragment; } /** - * Return the link in the form "path?query#fragment", omitting any empty + * Creates a DocLink representing the URI {@code path?query#fragment}. + * Any of the component parts may be null. + * @param path the path + * @param query the query + * @param fragment the fragment + */ + public DocLink(String path, String query, String fragment) { + this(DocPath.create(path), query, fragment); + } + + /** + * Creates a DocLink formed by relativizing the path against a given base. + * @param base the base + * @return the DocLink + */ + public DocLink relativizeAgainst(DocPath base) { + if (base.isEmpty() || path == null) { + return this; + } + + // The following guards against the (ugly) use-case of using DocPath to contain a URL + if (isAbsoluteURL(path)) { + return this; + } + + DocPath newPath = base.relativize(path); + // avoid generating an empty link by using the basename of the path if necessary + if (newPath.isEmpty() && isEmpty(query) && isEmpty(fragment)) { + newPath = path.basename(); + } + return new DocLink(newPath, query, fragment); + } + + // return true if the path begins :// + private boolean isAbsoluteURL(DocPath path) { + String s = path.getPath(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (Character.isLetter(c)) { + continue; + } + return (c == ':' && i + 2 < s.length() && s.charAt(i + 1)== '/' && s.charAt(i + 2)== '/'); + } + return false; + } + + /** + * Returns the link in the form "path?query#fragment", omitting any empty * components. + * @return the string */ @Override public String toString() { // common fast path if (path != null && isEmpty(query) && isEmpty(fragment)) - return path; + return path.getPath(); StringBuilder sb = new StringBuilder(); if (path != null) - sb.append(path); + sb.append(path.getPath()); if (!isEmpty(query)) sb.append("?").append(query); if (!isEmpty(fragment)) diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,11 @@ package jdk.javadoc.internal.doclets.toolkit.util; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + import javax.lang.model.element.ModuleElement; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; @@ -48,16 +53,21 @@ public static final DocPath parent = new DocPath(".."); /** - * Create a path from a string. + * Creates a path from a string. + * @param p the string + * @return the path */ public static DocPath create(String p) { return (p == null) || p.isEmpty() ? empty : new DocPath(p); } /** - * Return the path for a class. + * Returns the path for a class. * For example, if the class is java.lang.Object, * the path is java/lang/Object.html. + * @param utils utility class for handling type elements + * @param typeElement the type element + * @return the path */ public static DocPath forClass(Utils utils, TypeElement typeElement) { return (typeElement == null) @@ -66,14 +76,24 @@ } /** - * Return the path for the simple name of the class. + * Returns the path for the simple name of a class. * For example, if the class is java.lang.Object, * the path is Object.html. + * @param utils utility class for handling type elements + * @param typeElement the type element + * @return the path */ public static DocPath forName(Utils utils, TypeElement typeElement) { return (typeElement == null) ? empty : new DocPath(utils.getSimpleName(typeElement) + ".html"); } + /** + * Returns the path for the name of a module. + * For example, if the module is java.base, + * the path is java.base. + * @param mdle the module element + * @return the path + */ public static DocPath forModule(ModuleElement mdle) { return mdle == null || mdle.isUnnamed() ? empty @@ -81,18 +101,23 @@ } /** - * Return the path for the package of a class. + * Returns the path for the package of a class. * For example, if the class is java.lang.Object, * the path is java/lang. + * @param utils utility class for handling type elements + * @param typeElement the type element + * @return the path */ public static DocPath forPackage(Utils utils, TypeElement typeElement) { return (typeElement == null) ? empty : forPackage(utils.containingPackage(typeElement)); } /** - * Return the path for a package. + * Returns the path for a package. * For example, if the package is java.lang, * the path is java/lang. + * @param pkgElement the package element + * @return the path */ public static DocPath forPackage(PackageElement pkgElement) { return pkgElement == null || pkgElement.isUnnamed() @@ -101,9 +126,11 @@ } /** - * Return the inverse path for a package. + * Returns the inverse path for a package. * For example, if the package is java.lang, * the inverse path is ../... + * @param pkgElement the package element + * @return the path */ public static DocPath forRoot(PackageElement pkgElement) { String name = (pkgElement == null || pkgElement.isUnnamed()) @@ -113,7 +140,10 @@ } /** - * Return the relative path from one package to another. + * Returns the relative path from one package to another. + * @param from the initial package + * @param to the target package + * @return the path */ public static DocPath relativePath(PackageElement from, PackageElement to) { return forRoot(from).resolve(forPackage(to)); @@ -146,7 +176,9 @@ } /** - * Return the path formed by appending the specified string to the current path. + * Returns the path formed by appending the specified string to the current path. + * @param p the string + * @return the path */ public DocPath resolve(String p) { if (p == null || p.isEmpty()) @@ -157,7 +189,9 @@ } /** - * Return the path by appending the specified path to the current path. + * Returns the path by appending the specified path to the current path. + * @param p the path + * @return the path */ public DocPath resolve(DocPath p) { if (p == null || p.isEmpty()) @@ -170,28 +204,121 @@ /** * Return the inverse path for this path. * For example, if the path is a/b/c, the inverse path is ../../.. + * @return the path */ public DocPath invert() { return new DocPath(path.replaceAll("[^/]+", "..")); } /** + * Returns the path formed by eliminating empty components, + * '.' components, and redundant name/.. components. + * @return the path + */ + public DocPath normalize() { + return path.isEmpty() + ? this + : new DocPath(String.join("/", normalize(path))); + } + + private static List normalize(String path) { + return normalize(Arrays.asList(path.split("/"))); + } + + private static List normalize(List parts) { + if (parts.stream().noneMatch(s -> s.isEmpty() || s.equals(".") || s.equals(".."))) { + return parts; + } + List normalized = new ArrayList<>(); + for (String part : parts) { + switch (part) { + case "": + case ".": + break; + case "..": + int n = normalized.size(); + if (n > 0 && !normalized.get(n - 1).equals("..")) { + normalized.remove(n - 1); + } else { + normalized.add(part); + } + break; + default: + normalized.add(part); + } + } + return normalized; + } + + /** + * Normalize and relativize a path against this path, + * assuming that this path is for a file (not a directory), + * in which the other path will appear. + * + * @param other the path to be relativized. + * @return the simplified path + */ + public DocPath relativize(DocPath other) { + if (other == null || other.path.isEmpty()) { + return this; + } + + if (path.isEmpty()) { + return other; + } + + List originParts = normalize(path); + int sep = path.lastIndexOf("/"); + List destParts = sep == -1 + ? normalize(other.path) + : normalize(path.substring(0, sep + 1) + other.path); + int common = 0; + while (common < originParts.size() + && common < destParts.size() + && originParts.get(common).equals(destParts.get(common))) { + common++; + } + + List newParts; + if (common == originParts.size()) { + newParts = destParts.subList(common, destParts.size()); + } else { + newParts = new ArrayList<>(); + newParts.addAll(Collections.nCopies(originParts.size() - common - 1, "..")); + newParts.addAll(destParts.subList(common, destParts.size())); + } + return new DocPath(String.join("/", newParts)); + } + + /** * Return true if this path is empty. + * @return true if this path is empty */ public boolean isEmpty() { return path.isEmpty(); } + /** + * Creates a DocLink formed from this path and a fragment identifier. + * @param fragment the fragment + * @return the link + */ public DocLink fragment(String fragment) { return new DocLink(path, null, fragment); } + /** + * Creates a DocLink formed from this path and a query string. + * @param query the query string + * @return the link + */ public DocLink query(String query) { return new DocLink(path, query, null); } /** - * Return this path as a string. + * Returns this path as a string. + * @return the path */ // This is provided instead of using toString() to help catch // unintended use of toString() in string concatenation sequences. diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -180,10 +180,11 @@ if (fnd == null) return null; + // The following is somewhat questionable since we are using DocPath + // to contain external URLs! DocPath p = fnd.relative ? relativepath.resolve(fnd.path).resolve(filename) : DocPath.create(fnd.path).resolve(filename); - return new DocLink(p, "is-external=true", memberName); } diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -77,9 +77,6 @@ * a member of this type, if the size of the argument list * does not match the number of declared arguments for the method, or * if the method is not static or is a static initializer. - * @throws InvalidTypeException if any argument in the - * argument list is not assignable to the corresponding method argument - * type. * @throws ClassNotLoadedException if any argument type has not yet been loaded * through the appropriate class loader. * @throws IncompatibleThreadStateException if the specified thread has not diff -r fb62f481671e -r 2d03ebb72df2 src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java --- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java Tue Jan 30 11:53:00 2018 +0530 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/IRTranslator.java Tue Jan 30 09:03:47 2018 -0800 @@ -473,9 +473,9 @@ @Override public boolean enterClassNode(final ClassNode classNode) { assert !classNode.isStatement(): "should not reach here for class declaration"; - + final IdentNode className = classNode.getIdent(); curExpr = new ClassExpressionTreeImpl(classNode, - translateIdent(classNode.getIdent()), + className != null? translateIdent(className) : null, translateExpr(classNode.getClassHeritage()), translateProperty(classNode.getConstructor()), translateProperties(classNode.getClassElements())); diff -r fb62f481671e -r 2d03ebb72df2 test/TestCommon.gmk --- a/test/TestCommon.gmk Tue Jan 30 11:53:00 2018 +0530 +++ b/test/TestCommon.gmk Tue Jan 30 09:03:47 2018 -0800 @@ -332,9 +332,45 @@ TEST_SELECTION = $(TESTDIRS) endif -ifdef CONCURRENCY - JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY) +ifeq ($(UNAME_S), SunOS) + NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line) +endif +ifeq ($(UNAME_S), Linux) + NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor) +endif +ifeq ($(UNAME_S), Darwin) + NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) +endif +ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) + ifneq ($(NUMBER_OF_PROCESSORS), ) + NUM_CORES := $(NUMBER_OF_PROCESSORS) + else + ifneq ($(HOTSPOT_BUILD_JOBS), ) + NUM_CORES := $(HOTSPOT_BUILD_JOBS) + else + NUM_CORES := 1 # fallback + endif + endif endif + +ifndef CONCURRENCY_FACTOR + CONCURRENCY_FACTOR = 1 +endif + +# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR +CONCURRENCY := $(shell awk \ + 'BEGIN { \ + c = $(NUM_CORES) / 2; \ + if (c > 12) c = 12; \ + c = c * $(CONCURRENCY_FACTOR); \ + if (c < 1) c = 1; \ + printf "%.0f", c; \ + }') +JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY) + +# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's +JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY)) + ifdef EXTRA_JTREG_OPTIONS JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) endif diff -r fb62f481671e -r 2d03ebb72df2 test/hotspot/jtreg/Makefile --- a/test/hotspot/jtreg/Makefile Tue Jan 30 11:53:00 2018 +0530 +++ b/test/hotspot/jtreg/Makefile Tue Jan 30 09:03:47 2018 -0800 @@ -38,47 +38,6 @@ IGNORE_MARKED_TESTS := true -# Get OS name from uname (Cygwin inexplicably adds _NT-5.1) -UNAME_S := $(shell uname -s | cut -f1 -d_) - -ifeq ($(UNAME_S), SunOS) - NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line) -endif -ifeq ($(UNAME_S), Linux) - NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor) -endif -ifeq ($(UNAME_S), Darwin) - NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu) -endif -ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN) - ifneq ($(NUMBER_OF_PROCESSORS), ) - NUM_CORES := $(NUMBER_OF_PROCESSORS) - else - ifneq ($(HOTSPOT_BUILD_JOBS), ) - NUM_CORES := $(HOTSPOT_BUILD_JOBS) - else - NUM_CORES := 1 # fallback - endif - endif -endif - -ifndef CONCURRENCY_FACTOR - CONCURRENCY_FACTOR = 1 -endif - -# Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR -CONCURRENCY := $(shell awk \ - 'BEGIN { \ - c = $(NUM_CORES) / 2; \ - if (c > 12) c = 12; \ - c = c * $(CONCURRENCY_FACTOR); \ - if (c < 1) c = 1; \ - printf "%.0f", c; \ - }') - -# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's -JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY)) - # Include the common base file with most of the logic include ../../TestCommon.gmk diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/ProblemList.txt diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; +import java.io.ObjectStreamConstants; +import static java.io.ObjectStreamConstants.STREAM_MAGIC; +import static java.io.ObjectStreamConstants.TC_CLASSDESC; +import static java.io.ObjectStreamConstants.TC_ENDBLOCKDATA; +import static java.io.ObjectStreamConstants.TC_NULL; +import static java.io.ObjectStreamConstants.TC_OBJECT; +import java.net.Inet6Address; +/** + * @test + * @bug 8194676 + * @summary NullPointerException is thrown if ipaddress is not set. + * @run main Inet6AddressSerTest + */ +public class Inet6AddressSerTest implements ObjectStreamConstants { + + static class PayloadTest { + + private static byte[] serialize(String className) throws IOException { + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DataOutputStream dos = new DataOutputStream(baos)) { + // stream headers + dos.writeShort(STREAM_MAGIC); + dos.writeShort(5); // version + + // Inet6Address + dos.writeByte(TC_OBJECT); + dos.writeByte(TC_CLASSDESC); + dos.writeUTF(className); + dos.writeLong(6880410070516793377L); + dos.writeByte(2); + dos.writeShort(0); + dos.writeByte(TC_ENDBLOCKDATA); + dos.writeByte(TC_NULL); + return baos.toByteArray(); + } + } + + private static Object deserialize(final byte[] buffer) + throws IOException, ClassNotFoundException { + try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(buffer))) { + return ois.readObject(); + } + } + + void test(String className) throws IOException, ClassNotFoundException { + deserialize(serialize(className)); + } + } + + public static void main(String[] args) throws IOException, ClassNotFoundException { + try { + new PayloadTest().test(Inet6Address.class.getName()); + throw new RuntimeException("Expected exception not raised"); + } catch (InvalidObjectException ioe) { + if (ioe.getMessage().contains("invalid address length")) { + System.out.println(String.format("Got expected exception: %s", ioe)); + } else { + throw new RuntimeException("Expected exception not raised"); + } + } catch (RuntimeException re) { + throw new RuntimeException("Expected exception not raised"); + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/time/test/java/time/TestLocalDate.java --- a/test/jdk/java/time/test/java/time/TestLocalDate.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/java/time/test/java/time/TestLocalDate.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,6 +67,7 @@ import java.time.LocalDate; import java.time.Month; import java.time.temporal.ChronoUnit; +import java.time.temporal.IsoFields; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; @@ -444,4 +445,40 @@ } } + @DataProvider(name="quarterYearsToAdd") + Object[][] provider_quarterYearsToAdd() { + return new Object[][] { + {Long.valueOf(-1000000000)}, + {Long.valueOf(-256)}, + {Long.valueOf(-255)}, + {Long.valueOf(-1)}, + {Long.valueOf(0)}, + {Long.valueOf(1)}, + {Long.valueOf(255)}, + {Long.valueOf(256)}, + {Long.valueOf(1000000000)}, + }; + } + + @Test(dataProvider="quarterYearsToAdd") + public void test_plus_QuarterYears(long quarterYears) { + LocalDate t0 = TEST_2007_07_15 + .plus(quarterYears, IsoFields.QUARTER_YEARS); + LocalDate t1 = TEST_2007_07_15 + .plus(quarterYears, ChronoUnit.MONTHS) + .plus(quarterYears, ChronoUnit.MONTHS) + .plus(quarterYears, ChronoUnit.MONTHS); + assertEquals(t0, t1); + } + + @Test(dataProvider="quarterYearsToAdd") + public void test_minus_QuarterYears(long quarterYears) { + LocalDate t0 = TEST_2007_07_15 + .minus(quarterYears, IsoFields.QUARTER_YEARS); + LocalDate t1 = TEST_2007_07_15 + .minus(quarterYears, ChronoUnit.MONTHS) + .minus(quarterYears, ChronoUnit.MONTHS) + .minus(quarterYears, ChronoUnit.MONTHS); + assertEquals(t0, t1); + } } diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/BlankLines.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/BlankLines.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4218776 + * @summary Test loading of properties files with blank lines + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +/** + * This class tests to see if a properties object correctly handles blank + * lines in a properties file + */ +public class BlankLines { + public static void main(String []args) + { + try { + // create test file + File file = new File("test.properties"); + + // write a single space to the test file + FileOutputStream fos = new FileOutputStream(file); + fos.write(' '); + fos.close(); + + // test empty properties + Properties prop1 = new Properties(); + + // now load the file we just created, into a + // properties object. + // the properties object should have no elements, + // but due to a bug, it has an empty key/value. + // key = "", value = "" + Properties prop2 = new Properties(); + InputStream is = new FileInputStream(file); + try { + prop2.load(is); + } finally { + is.close(); + } + if (!prop1.equals(prop2)) + throw new RuntimeException("Incorrect properties loading."); + + // cleanup + file.delete(); + } + catch(IOException e) {} + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/CloseXMLStream.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/CloseXMLStream.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 6270682 + * @summary Test the input stream is closed after loadtoXML returns. + */ + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.util.Properties; + +public class CloseXMLStream { + public static void main(String[] args) throws Throwable { + class ExpectedClosingException extends RuntimeException {}; + Properties props = new Properties(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + props.storeToXML(out, null); + ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()) { + public void close() { + throw new ExpectedClosingException(); + } + }; + try { + props.loadFromXML(in); + throw new Exception("Failed: loadFromXML does not close the is!"); + } catch (ExpectedClosingException ex) { /*OK*/ } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/EscapeSpace.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/EscapeSpace.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4219644 + * @summary Escaping of spaces required only for leading spaces in the value + * part of the property. + */ + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; + +public class EscapeSpace { + + static String props = + "key1=\\ \\ Value1, has leading and trailing spaces\\ \n" + + "key2=Value2,\\ does not have\\ leading or trailing\\ spaces\n" + + "key3=Value3,has,no,spaces\n" + + "key4=Value4, does not have leading spaces\\ \n" + + "key5=\\t\\ \\ Value5, has leading tab and no trailing spaces\n" + + "key6=\\ \\ Value6,doesnothaveembeddedspaces\\ \\ \n" + + "\\ key1\\ test\\ =key1, has leading and trailing spaces \n" + + "key2\\ test=key2, does not have leading or trailing spaces\n" + + "key3test=key3,has,no,spaces\n" + + "key4\\ test\\ =key4, does not have leading spaces \n" + + "\\t\\ key5\\ test=key5, has leading tab and no trailing spaces\n" + + "\\ \\ key6\\ \\ =\\ key6,doesnothaveembeddedspaces "; + static void load(Properties p, String file) throws Exception + { + FileInputStream fis = null; + BufferedInputStream bis = null; + + try { + fis = new FileInputStream(file); + bis = new BufferedInputStream( fis ); + + p.load(bis); + } + catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } finally { + if (fis != null) + fis.close(); + } + } + + static void store(Properties p, String file) throws Exception + { + + FileOutputStream fos = null; + BufferedOutputStream bos = null; + + try { + fos = new FileOutputStream(file); + bos = new BufferedOutputStream( fos ); + + p.store( bos, "Omitting escape characters for non leading space \" \" in properties"); + } + catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } finally { + if (fos != null) + fos.close(); + } + } + + public static void main( String args[] ) throws Exception + { + ByteArrayInputStream bais = new ByteArrayInputStream(props.getBytes()); + Properties props0 = new Properties(); + // Load properties with escape character '\' before space characters + try { + props0.load(bais); + } catch (IOException e) { + throw new RuntimeException(e.getMessage()); + } + + Properties props1 = new Properties(); + /* + * Put the same properties, but without the escape char for space in + * value part. + */ + props1.put( "key1", " Value1, has leading and trailing spaces " ); + props1.put( "key2", + "Value2, does not have leading or trailing spaces" ); + props1.put( "key3", "Value3,has,no,spaces" ); + props1.put( "key4", "Value4, does not have leading spaces " ); + props1.put( "key5", + "\t Value5, has leading tab and no trailing spaces" ); + props1.put( "key6", " Value6,doesnothaveembeddedspaces " ); + props1.put( " key1 test ", "key1, has leading and trailing spaces " ); + props1.put( "key2 test", + "key2, does not have leading or trailing spaces" ); + props1.put( "key3test", "key3,has,no,spaces" ); + props1.put( "key4 test ", "key4, does not have leading spaces " ); + props1.put( "\t key5 test", + "key5, has leading tab and no trailing spaces" ); + props1.put( " key6 ", " key6,doesnothaveembeddedspaces " ); + + // Check if both the properties match + if (!props0.equals(props1)) + throw new RuntimeException("Test failed"); + + + // Also store the new properties to a file + store(props1, "out1.props"); + + Properties props2 = new Properties(); + // Reread the properties from the file + load(props2, "out1.props"); + + // Make sure that the properties match + if (!props1.equals(props2)) + throw new RuntimeException("Test failed"); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/GenerifiedUses.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/GenerifiedUses.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 5060820 5054615 5056707 5061476 + * @modules java.desktop + * java.naming + * @compile GenerifiedUses.java + */ + +import java.awt.image.CropImageFilter; +import java.awt.image.ImageFilter; +import java.awt.image.PixelGrabber; +import java.awt.image.ReplicateScaleFilter; +import java.util.Properties; +import javax.naming.InitialContext; +import javax.naming.directory.InitialDirContext; +import javax.naming.spi.NamingManager; + +public class GenerifiedUses { + + static void foo() throws Exception { + + Properties props = new Properties(); + + // 5060820 + new InitialDirContext(props); + + // 5054615 + new InitialContext(props); + + // 5056707 + NamingManager.getObjectInstance(null, null, null, props); + + // 5061476 + new CropImageFilter(0, 0, 0, 0).setProperties(props); + new ImageFilter().setProperties(props); + new PixelGrabber(null, 0, 0, 0, 0, false).setProperties(props); + new ReplicateScaleFilter(1, 1).setProperties(props); + + } + +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/LoadParsing.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/LoadParsing.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4115936 4385195 4972297 + * @summary checks for processing errors in properties.load + */ + +import java.io.File; +import java.io.FileInputStream; +import java.util.Properties; + +public class LoadParsing { + public static void main(String[] argv) throws Exception { + File f = new File(System.getProperty("test.src", "."), "input.txt"); + FileInputStream myIn = new FileInputStream(f); + Properties myProps = new Properties(); + int size = 0; + try { + myProps.load(myIn); + } finally { + myIn.close(); + } + + if (!myProps.getProperty("key1").equals("value1")) + throw new RuntimeException("Bad comment parsing"); + if (!myProps.getProperty("key2").equals("abc\\defg\\")) + throw new RuntimeException("Bad slash parsing"); + if (!myProps.getProperty("key3").equals("value3")) + throw new RuntimeException("Adds spaces to key"); + if (!myProps.getProperty("key4").equals(":value4")) + throw new RuntimeException("Bad separator parsing"); + if (myProps.getProperty("#") != null) + throw new RuntimeException( + "Does not recognize comments with leading spaces"); + if ((size=myProps.size()) != 4) + throw new RuntimeException( + "Wrong number of keys in Properties; expected 4, got " + + size + "."); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/LoadParsing2.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/LoadParsing2.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4881291 4094886 + * @summary checks for processing errors in properties.load + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Properties; + +public class LoadParsing2 { + public static void main(String[] argv) throws Exception { + for (int i = 0; i < dfiles.length; i++) { + test(dfiles[i], keys[i], values[i], true); + test(dfiles[i], keys[i], values[i], false); + } + } + + private static Properties getLoadedProperties(InputStream is, + boolean doStream) + throws Exception + { + Properties props = new Properties(); + if (doStream) + props.load(is); + else + props.load(new InputStreamReader(is, "UTF-8")); + return props; + } + + private static void test(String fnData, + String[] keys, + String[] values, + boolean doStream) + throws Exception + { + File f = new File(System.getProperty("test.src", "."), fnData); + FileInputStream myIn = new FileInputStream(f); + Properties myProps = getLoadedProperties(myIn, doStream); + for (int i = 0; i < keys.length; i++) { + if (!myProps.getProperty(keys[i]).equals(values[i])) { + throw new RuntimeException("Test1: Bad parsing at " + i); + } + } + } + + static String[] keys1 = { + "\\", + "\\:key12", + "key16 b", + "key14_asdfa", + "\\\\", + "key8notassign", + "key17", + "key15", + "keyabcdef", + "key13dialog.3", + "key7", + "key6", + "key5", + "key3", + "key2", + "key1", + "key9 Term", + "key0" + }; + + static String[] keys2 = { + "key1", + "key2" + }; + + static String[] keys3 = { + "key1", + "key2" + }; + + static String[] values1 = { + "key10=bar", + "bar2", + " abcdef", + "", + "key11=bar2", + "abcdef", + "#barbaz", + " abcdef", + "", + "", + "Symbol,SYMBOL_CHARSET ", + "WingDings,SYMBOL_CHARSET \\abc", + "==Arial,ANSI_CHARSET", + "", + "= abcde", + "value1", + "ABCDE", + "abcd" + }; + + static String[] values2 = { + "-monotype-timesnewroman-regular-r---*-%d-*-*-p-*-iso8859-1serif.1a-monotype-timesnewroman-regular-r-normal--*-%d-*-*-p-*-iso8859-2serif.2a-b&h-LucidaBrightLat4-Normal-r-normal--*-%d-*-*-p-*-iso8859-4serif.3a-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5serif.4a-monotype-timesnewromangreek-regular-r-normal--*-%d-*-*-p-*-iso8859-7serif.5a-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9serif.6a-monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15serif.7a-hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1serif.8a-sun-song-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0serif.9a-ricoh-hgminchol-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0serif.10a-ricoh-hgminchol-medium-r-normal--*-%d-*-*-m-*-jisx0208.1983-0serif.11a-ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0serif.12a-hanyang-myeongjo-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3serif.13a-urw-itczapfdingbats-medium-r-normal--*-%d-*-*-p-*-sun-fontspecificserif.14a-*-symbol-medium-r-normal--*-%d-*-*-p-*-sun-fontspecificbserif.italic.0=-monotype-timesbnewbroman-regular-i---*-%d-*-*-p-*-iso8859-1bserif.italic.1=-monotype-timesbnewbroman-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-2", + "-b&h-LucidaBrightLat4-normal-i-normal-Italic-*-%d-*-*-p-*-iso8859-4" + }; + + static String[] values3 = { + "-monotype-times new roman-regular-r---*-%d-*-*-p-*-iso8859-1, -monotype-times new roman-regular-r-normal--*-%d-*-*-p-*-iso8859-2, -b&h-LucidaBrightLat4-Normal-r-normal--*-%d-*-*-p-*-iso8859-4, -monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-5, -monotype-times new roman greek-regular-r-normal--*-%d-*-*-p-*-iso8859-7, -monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-9, -monotype-times-regular-r-normal--*-%d-*-*-p-*-iso8859-15, -hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1, -sun-song-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0, -ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0, -ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0, -ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0, -hanyang-myeongjo-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3", + "-monotype-times new roman-regular-i---*-%d-*-*-p-*-iso8859-1, -monotype-times new roman-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-2, -b&h-LucidaBrightLat4-normal-i-normal-Italic-*-%d-*-*-p-*-iso8859-4, -monotype-times-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-5, -monotype-times new roman greek-regular-i-normal--*-%d-*-*-p-*-iso8859-7, -monotype-times-regular-i-normal-italic-*-%d-*-*-p-*-iso8859-9, -monotype-times-regular-i-normal--*-%d-*-*-p-*-iso8859-15, -hanyi-ming-medium-r-normal--*-%d-*-*-m-*-big5-1, -sun-song-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0, -ricoh-hg gothic b-medium-r-normal--*-%d-*-*-m-*-jisx0201.1976-0, -ricoh-hg gothic b-medium-r-normal-*-*-%d-*-*-m-*-jisx0208.1983-0, -ricoh-heiseimin-w3-r-normal--*-%d-*-*-m-*-jisx0212.1990-0, -hanyang-myeongjo-medium-r-normal--*-%d-*-*-m-*-ksc5601.1992-3" + }; + + static String[][] keys = {keys1, keys1, keys2, keys2, keys3}; + static String[][] values = {values1, values1, values2, values2, values3}; + static String[] dfiles = { + "testData1", + "testData1.dos", + "testData2", + "testData2.dos", + "testData3.dos" + }; +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/LoadSeparators.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/LoadSeparators.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4192678 + * @summary Test loading of values that are key value separators + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Properties; + +/** + * This class tests to see if a properties object can successfully save and + * load properties with a non-escaped value that is also a key value separator + * + */ +public class LoadSeparators { + public static void main(String[] argv) throws Exception { + try { + // Destroy old test file if any + // Create a properties file + File propFile = new File("testout"); + propFile.delete(); + + // Create a properties file + FileOutputStream myOut = new FileOutputStream(propFile); + String testProperty = "Test3=="; + myOut.write(testProperty.getBytes()); + myOut.close(); + + // Load the properties set + FileInputStream myIn = new FileInputStream("testout"); + Properties myNewProps = new Properties(); + try { + myNewProps.load(myIn); + } finally { + myIn.close(); + } + + // Read in the test property + String equalSign = myNewProps.getProperty("Test3"); + + // Clean up + propFile.delete(); + + if (!equalSign.equals("=")) + throw new Exception("Cannot read key-value separators."); + } catch (IOException e) { + System.err.println(e); + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/PropertiesTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/PropertiesTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,494 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 tests the load and store methods of Properties class + * @author Xueming Shen + * @bug 4094886 + * @modules jdk.charsets + * @key randomness + */ + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; +import java.util.Properties; +import java.util.Random; + +public class PropertiesTest { + + private static boolean failure = false; + private static int failCount = 0; + + /** + * Main to interpret arguments and run several tests. + * + */ + public static void main(String[] args) throws Exception { + BlankLines(); + EscapeSpace(); + LoadParsing(); + SaveEncoding(); + SaveLoadBasher(); + SaveSeparator(); + SaveClose(); + SaveComments(); + UnicodeEscape(); + + if (failure) + throw new RuntimeException("Failure in Properties testing."); + else + System.err.println("OKAY: All tests passed."); + } + + private static void report(String testName) { + int spacesToAdd = 30 - testName.length(); + StringBuffer paddedNameBuffer = new StringBuffer(testName); + for (int i=0; i 0) + failure = true; + failCount = 0; + } + + private static void check(Properties prop1, Properties prop2) { + if (!prop1.equals(prop2)) + failCount++; + } + + private static Reader getReader(String src, String csn) + throws Exception { + return new InputStreamReader( + new ByteArrayInputStream(src.getBytes()), + csn); + } + + private static OutputStream getFOS(String name) + throws Exception + { + return new FileOutputStream(name); + } + + private static Writer getFOSW(String name, String csn) + throws Exception + { + return new OutputStreamWriter( + new FileOutputStream(name), + csn); + } + + private static Reader getReader(byte[] src, String csn) + throws Exception { + return new InputStreamReader(new ByteArrayInputStream(src), csn); + } + + private static InputStream getInputStream(String src) { + return new ByteArrayInputStream(src.getBytes()); + } + + private static InputStream getInputStream(byte[] src) { + return new ByteArrayInputStream(src); + } + + private static void BlankLines() throws Exception { + // write a single space to the output stream + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + baos.write(' '); + // test empty properties + Properties prop1 = new Properties(); + + // now load the file we just created, into a properties object. + // the properties object should have no elements, but due to a + // bug, it has an empty key/value. key = "", value = "" + Properties prop2 = new Properties(); + prop2.load(getInputStream(baos.toByteArray())); + check(prop1, prop2); + + // test reader + prop2 = new Properties(); + prop2.load(getReader(baos.toByteArray(), "UTF-8")); + check(prop1, prop2); + + report("BlinkLine"); + } + + private static void EscapeSpace() throws Exception { + String propsCases = + "key1=\\ \\ Value\\u4e001, has leading and trailing spaces\\ \n" + + "key2=Value\\u4e002,\\ does not have\\ leading or trailing\\ spaces\n" + + "key3=Value\\u4e003,has,no,spaces\n" + + "key4=Value\\u4e004, does not have leading spaces\\ \n" + + "key5=\\t\\ \\ Value\\u4e005, has leading tab and no trailing spaces\n" + + "key6=\\ \\ Value\\u4e006,doesnothaveembeddedspaces\\ \\ \n" + + "\\ key1\\ test\\ =key1, has leading and trailing spaces \n" + + "key2\\ test=key2, does not have leading or trailing spaces\n" + + "key3test=key3,has,no,spaces\n" + + "key4\\ test\\ =key4, does not have leading spaces \n" + + "\\t\\ key5\\ test=key5, has leading tab and no trailing spaces\n" + + "\\ \\ key6\\ \\ =\\ key6,doesnothaveembeddedspaces "; + + // Put the same properties, but without the escape char for space in + // value part. + Properties props = new Properties(); + props.put("key1", " Value\u4e001, has leading and trailing spaces "); + props.put("key2", "Value\u4e002, does not have leading or trailing spaces"); + props.put("key3", "Value\u4e003,has,no,spaces"); + props.put("key4", "Value\u4e004, does not have leading spaces "); + props.put("key5", "\t Value\u4e005, has leading tab and no trailing spaces"); + props.put("key6", " Value\u4e006,doesnothaveembeddedspaces "); + props.put(" key1 test ", "key1, has leading and trailing spaces "); + props.put("key2 test", "key2, does not have leading or trailing spaces"); + props.put("key3test", "key3,has,no,spaces"); + props.put("key4 test ", "key4, does not have leading spaces "); + props.put("\t key5 test", "key5, has leading tab and no trailing spaces"); + props.put(" key6 ", " key6,doesnothaveembeddedspaces "); + + // Load properties with escape character '\' before space characters + Properties props1 = new Properties(); + props1.load(getInputStream(propsCases)); + check(props1, props); + + // Test Reader + props1 = new Properties(); + props1.load(getReader(propsCases, "UTF-8")); + check(props1, props); + + // Also store the new properties to a storage + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + props.store(baos, "EscapeSpace Test"); + + props1 = new Properties(); + props1.load(getInputStream(baos.toByteArray())); + check(props1, props); + + // Reader should work as well + props1 = new Properties(); + props1.load(getReader(baos.toByteArray(), "UTF-8")); + check(props1, props); + + // Try Writer + baos = new ByteArrayOutputStream(); + props.store(new OutputStreamWriter(baos, "UTF-8"), + "EscapeSpace Test"); + + props1 = new Properties(); + props1.load(getReader(baos.toByteArray(), "UTF-8")); + check(props1, props); + + report("EscapeSpace"); + } + + private static void LoadParsing() throws Exception { + File f = new File(System.getProperty("test.src", "."), "input.txt"); + FileInputStream myIn = new FileInputStream(f); + Properties myProps = new Properties(); + int size = 0; + try { + myProps.load(myIn); + } finally { + myIn.close(); + } + + if (!myProps.getProperty("key1").equals("value1") || // comment + !myProps.getProperty("key2").equals("abc\\defg\\") || // slash + !myProps.getProperty("key3").equals("value3") || // spaces in key + !myProps.getProperty("key4").equals(":value4") || // separator + // Does not recognize comments with leading spaces + (myProps.getProperty("#") != null) || + // Wrong number of keys in Properties + ((size=myProps.size()) != 4)) + failCount++; + report("LoadParsing"); + } + + private static void SaveEncoding() throws Exception { + // Create a properties object to save + Properties props = new Properties(); + props.put("signal", "val\u0019"); + props.put("ABC 10", "value0"); + props.put("\uff10test", "value\u0020"); + props.put("key with spaces", "value with spaces"); + props.put("key with space and Chinese_\u4e00", "valueWithChinese_\u4e00"); + props.put(" special#=key ", "value3"); + + // Save the properties and check output + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + props.store(baos,"A test"); + + // Read properties file and verify \u0019 + BufferedReader in = new BufferedReader( + new InputStreamReader( + new ByteArrayInputStream( + baos.toByteArray()))); + String firstLine = "foo"; + while (!firstLine.startsWith("signal")) + firstLine = in.readLine(); + if (firstLine.length() != 16) + failCount++; + + // Load the properties set + Properties newProps = new Properties(); + newProps.load(getInputStream(baos.toByteArray())); + check(newProps, props); + + // Store(Writer)/Load(Reader) + baos = new ByteArrayOutputStream(); + props.store(new OutputStreamWriter(baos, "EUC_JP"), "A test"); + newProps = new Properties(); + newProps.load(getReader(baos.toByteArray(), "EUC_JP")); + check(newProps, props); + + report("SaveEncoding"); + } + + /** + * This class tests to see if a properties object + * can successfully save and load properties + * using character encoding + */ + private static void SaveLoadBasher() throws Exception { + String keyValueSeparators = "=: \t\r\n\f#!\\"; + + Properties originalProps = new Properties(); + Properties loadedProps = new Properties(); + + // Generate a unicode key and value + Random generator = new Random(); + int achar=0; + StringBuffer aKeyBuffer = new StringBuffer(120); + StringBuffer aValueBuffer = new StringBuffer(120); + String aKey; + String aValue; + int maxKeyLen = 100; + int maxValueLen = 100; + int maxPropsNum = 300; + for (int x=0; x> kvsetNew = propsNew.entrySet(); + Set> kvset = props.entrySet(); + if (!kvsetNew.containsAll(kvset) || !kvset.containsAll(kvsetNew)) { + */ + if (!props.equals (propsNew)) { + System.out.println("Wrong output:"); + System.out.println(baos.toString("iso8859-1")); + failed = true; + } + } + if (failed) + throw new RuntimeException("Incorrect Properties Comment Output."); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/SaveEncoding.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/SaveEncoding.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4026910 4011163 4077980 4096786 4213537 + * @summary Test for saving and loading encoded keys and values + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Properties; + +/** + * This class tests to see if the properties object saves + * and loads keys and values properly + */ +public class SaveEncoding { + + public static void main(String argv[]) { + int testSucceeded=0; + FileOutputStream myOutput; + + // Create a properties object to save + Properties myProperties = new Properties(); + myProperties.put("signal", "val\u0019"); + myProperties.put("ABC 10", "value0"); + myProperties.put("\uff10test", "value\u0020"); + myProperties.put("key with spaces", "value with spaces"); + myProperties.put(" special#=key ", "value3"); + + try { + // Destroy old test file if any + File myFile = new File("testout"); + myFile.delete(); + + // Save the object and check output + myOutput = new FileOutputStream("testout"); + myProperties.store(myOutput,"A test"); + myOutput.close(); + + // Read properties file and verify \u0019 + FileInputStream inFile = new FileInputStream("testout"); + BufferedReader in = new BufferedReader( + new InputStreamReader(inFile)); + String firstLine = "foo"; + while (!firstLine.startsWith("signal")) + firstLine = in.readLine(); + inFile.close(); + if (firstLine.length() != 16) + throw new RuntimeException( + "Incorrect storage of values < 32."); + + // Load the properties set + FileInputStream myIn = new FileInputStream("testout"); + Properties myNewProps = new Properties(); + try { + myNewProps.load(myIn); + } finally { + myIn.close(); + } + + // Check the results + if (!myNewProps.equals(myProperties)) + throw new RuntimeException( + "Properties is not character encoding safe."); + } catch (IOException e) { // Do nothing + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/SaveLoadBasher.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/SaveLoadBasher.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4077980 4011163 4096786 4075955 + * @summary Test properties save and load methods + * @key randomness + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; +import java.util.Random; + +/** + * This class tests to see if a properties object + * can successfully save and load properties + * using character encoding + */ +public class SaveLoadBasher { + + private static String keyValueSeparators = "=: \t\r\n\f#!\\"; + + public static void main(String[] args) throws Exception { + + Properties originalProps = new Properties(); + Properties loadedProps = new Properties(); + + // Generate a unicode key and value + Random generator = new Random(); + int achar=0; + StringBuffer aKeyBuffer = new StringBuffer(120); + StringBuffer aValueBuffer = new StringBuffer(120); + String aKey; + String aValue; + for (int x=0; x<300; x++) { + for(int y=0; y<100; y++) { + achar = generator.nextInt(); + char test; + if(achar < 99999) { + test = (char)(achar); + } + else { + int zz = achar % 10; + test = keyValueSeparators.charAt(zz); + } + aKeyBuffer.append(test); + } + aKey = aKeyBuffer.toString(); + for(int y=0; y<100; y++) { + achar = generator.nextInt(); + char test = (char)(achar); + aValueBuffer.append(test); + } + aValue = aValueBuffer.toString(); + + // Attempt to add to original + try { + originalProps.put(aKey, aValue); + } + catch (IllegalArgumentException e) { + System.err.println("disallowing..."); + } + aKeyBuffer.setLength(0); + aValueBuffer.setLength(0); + } + + // Destroy old test file if it exists + File oldTestFile = new File("props3"); + oldTestFile.delete(); + + // Save original + System.out.println("Saving..."); + OutputStream out = new FileOutputStream("props3"); + originalProps.store(out, "test properties"); + out.close(); + + // Load in the set + System.out.println("Loading..."); + InputStream in = new FileInputStream("props3"); + try { + loadedProps.load(in); + } finally { + in.close(); + } + + // Compare results + if (!originalProps.equals(loadedProps)) + throw new RuntimeException("Properties load and save failed"); + + } + +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/SaveSeparator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/SaveSeparator.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4062657 + * @summary Verify that property.save uses local lineseparator + */ + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Properties; + +/* Note: this regression test only detects incorrect line + * separator on platform running the test + */ + +public class SaveSeparator { + + public static void main(String[] argv) throws IOException { + // Save a property set + Properties myProps = new Properties(); + ByteArrayOutputStream myOut = new ByteArrayOutputStream(40); + myProps.store(myOut, "A test"); + + // Examine the result to verify that line.separator was used + String theSeparator = System.getProperty("line.separator"); + String content = myOut.toString(); + if (!content.endsWith(theSeparator)) + throw new RuntimeException("Incorrect Properties line separator."); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/StoreDeadlock.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/StoreDeadlock.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 6199320 + * @summary Properties.store() causes deadlock when concurrently calling TimeZone apis + * @run main/timeout=20 StoreDeadlock + * @author Xueming Shen + */ + +import java.io.IOException; +import java.util.Properties; +import java.util.TimeZone; + +public class StoreDeadlock { + public StoreDeadlock() { + Properties sysproperty = System.getProperties(); + Thread1 t1 = new Thread1(sysproperty); + Thread2 t2 = new Thread2(); + t1.start(); + t2.start(); + } + public static void main(String[] args) { + StoreDeadlock deadlock = new StoreDeadlock(); + } + class Thread1 extends Thread { + Properties sp; + public Thread1(Properties p) { + sp = p; + } + public void run() { + try { + sp.store(System.out, null); + } catch (IOException e) { + System.out.println("IOException : " + e); + } + } + } + class Thread2 extends Thread { + public void run() { + System.out.println("tz=" + TimeZone.getTimeZone("PST")); + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/StringPropertyNames.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/StringPropertyNames.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 6253413 8059361 + * @summary Test for Properties.stringPropertyNames() if the system + * properties contain another list of properties as the defaults. + * @author Mandy Chung + * + * @run build StringPropertyNames + * @run main StringPropertyNames + */ + +import java.util.Properties; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.Set; + +public class StringPropertyNames { + private static int NUM_SHARE_PROPS = 2; + private static int NUM_PROPS1 = 3; + private static int NUM_PROPS2 = 5; + private static String KEY = "good.property."; + private static String VALUE = "good.value."; + public static void main(String[] argv) throws Exception { + Properties props1 = new Properties(); + Properties props2 = new Properties(props1); + + // add several new properties + for (int i = 0; i < NUM_PROPS1; i++) { + props1.put(KEY + "1." + i, VALUE + "1." + i); + } + for (int i = 0; i < NUM_PROPS2; i++) { + props2.put(KEY + "2." + i, VALUE + "2." + i); + } + + // add the same properties in both props1 and props2 + for (int i = 0; i < NUM_SHARE_PROPS; i++) { + props1.put(KEY + i, VALUE + "1." + i); + props2.put(KEY + i, VALUE + "2." + i); + } + checkProperties(props1, + NUM_PROPS1 + NUM_SHARE_PROPS, // size of props1 + NUM_PROPS1 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_SHARE_PROPS, // num of keys in propertyName(), + false); + checkProperties(props2, + NUM_PROPS2 + NUM_SHARE_PROPS, // size of props2 + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS, // num of keys in propertyName(), + false); + + // Add non-String value + props1.put(KEY + "9", new Integer(4)); + checkProperties(props1, + NUM_PROPS1 + NUM_SHARE_PROPS + 1, // size of props1 + NUM_PROPS1 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_SHARE_PROPS + 1, // num of keys in propertyName(), + false); + checkProperties(props2, + NUM_PROPS2 + NUM_SHARE_PROPS, // size of props2 + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS + 1, // num of keys in propertyName(), + false); + Object v = props1.remove(KEY + "9"); + if (v == null) { + throw new RuntimeException("Test Failed: " + + "Key " + KEY + "9" + " not found"); + } + + // Add a non-String key + props1.put(new Integer(5), "good.value.5"); + props2.put(new Object(), new Object()); + checkProperties(props1, + NUM_PROPS1 + NUM_SHARE_PROPS + 1, // size of props1 + NUM_PROPS1 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_SHARE_PROPS + 1, // num of keys in propertyName(), + true); + checkProperties(props2, + NUM_PROPS2 + NUM_SHARE_PROPS + 1, // size of props2 + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS, // num of string keys + NUM_PROPS1 + NUM_PROPS2 + NUM_SHARE_PROPS + 2, // num of keys in propertyName(), + true); + System.out.println("Test passed."); + } + + private static void checkProperties(Properties props, + int propSize, + int numStringKeys, + int enumerateSize, + boolean hasNonStringKeys) { + // check the size of the properties + if (props.size() != propSize) { + throw new RuntimeException("Test Failed: " + + "Expected number of properties = " + + propSize + " but found = " + props.size()); + } + + // check the number of properties whose key and value + // are both strings + Set keys = props.stringPropertyNames(); + if (keys.size() != numStringKeys) { + throw new RuntimeException("Test Failed: " + + "Expected number of String keys = " + + numStringKeys + " but found = " + keys.size()); + } + boolean cceThrown = false; + try { + // check the number of properties whose key are strings + // but its value can be anything in the current impl + int count = 0; + Enumeration e = props.propertyNames(); + for (;e.hasMoreElements(); e.nextElement()) { + count++; + } + if (count != enumerateSize) { + throw new RuntimeException("Test Failed: " + + "Expected number of enumerated keys = " + + enumerateSize + " but found = " + count); + } + } catch (ClassCastException e) { + if (!hasNonStringKeys) { + RuntimeException re = new RuntimeException("Test Failed: " + + "ClassCastException is expected not to be thrown"); + re.initCause(e); + throw re; + } + cceThrown = true; + } + + if ((hasNonStringKeys && !cceThrown)) { + throw new RuntimeException("Test Failed: " + + "ClassCastException is expected to be thrown"); + } + + // make sure the set cannot be modified + try { + keys.add("xyzzy"); + throw new RuntimeException("Test Failed: " + + "add() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException ignore) { } + + Iterator it = keys.iterator(); + if (it.hasNext()) { + try { + keys.remove(it.next()); + throw new RuntimeException("Test Failed: " + + "remove() should have thrown UnsupportedOperationException"); + } catch (UnsupportedOperationException ignore) { } + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/UnicodeEscape.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/UnicodeEscape.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4792682 + * @summary Test for correct exception with a short unicode escape +*/ + +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStream; +import java.util.Properties; + +public class UnicodeEscape { + + public static void main(String argv[]) throws Exception { + save(); + load(); + } + + private static void save() throws Exception { + FileWriter out = new FileWriter("a.properties"); + out.write("a=b\nb=\\u0\n"); + out.close(); + } + + private static void load() throws Exception { + Properties properties = new Properties(); + InputStream in = new FileInputStream("a.properties"); + try { + properties.load(in); + } catch (IllegalArgumentException iae) { + // Correct result + } finally { + in.close(); + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/Properties/XMLSaveLoadBasher.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/Properties/XMLSaveLoadBasher.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 4749531 5015114 5055738 + * @summary Test properties XML save and load methods + * @key randomness + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Properties; +import java.util.Random; + +/** + * This class tests to see if a properties object + * can successfully save and load properties in XML + */ +public class XMLSaveLoadBasher { + + private static final int MAX_KEY_SIZE = 120; + private static final int MIN_KEY_SIZE = 1; + private static final int MAX_VALUE_SIZE = 120; + private static final int MIN_VALUE_SIZE = 0; + + public static void main(String[] args) throws Exception { + testSaveLoad("UTF-8", "test save"); + testSaveLoad("UTF-8", null); + testSaveLoad("ISO-8859-1", "test save"); + testSaveLoad("KOI8-R", "test save"); + } + + private static void testSaveLoad(String encoding, String comment) + throws Exception + { + Properties originalProps = new Properties(); + Properties loadedProps = new Properties(); + + // Generate a unicode key and value + Random generator = new Random(); + + for (int x=0; x<10; x++) { + String aKey; + String aValue; + + // Assumes MAX_KEY_SIZE >> MIN_KEY_SIZE + int keyLen = generator.nextInt(MAX_KEY_SIZE - MIN_KEY_SIZE + 1) + + MIN_KEY_SIZE; + int valLen = generator.nextInt( + MAX_VALUE_SIZE - MIN_VALUE_SIZE + 1) + MIN_VALUE_SIZE; + + StringBuffer aKeyBuffer = new StringBuffer(keyLen); + StringBuffer aValueBuffer = new StringBuffer(valLen); + + for(int y=0; y loggers = new ConcurrentHashMap<>(); + @Override + public boolean addLogger(Logger logger) { + return loggers.putIfAbsent(logger.getName(), logger) == null; + } + + @Override + public Enumeration getLoggerNames() { + return Collections.enumeration(loggers.keySet()); + } + + @Override + public Logger getLogger(String name) { + return loggers.get(name); + } + } + + public static class SystemErr extends OutputStream { + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final OutputStream wrapped; + public SystemErr(OutputStream out) { + this.wrapped = out; + } + + @Override + public void write(int b) throws IOException { + baos.write(b); + wrapped.write(b); + } + + public void close() throws IOException { + flush(); + super.close(); + } + + public void flush() throws IOException { + super.flush(); + wrapped.flush(); + } + + } + + // Uncomment this to run the test on Java 8. Java 8 does not have + // List.of(...) + // static final class List { + // static java.util.List of(T... items) { + // return Collections.unmodifiableList(Arrays.asList(items)); + // } + // } + + public static void main(String[] args) throws IOException { + Path initialProps = SRC_DIR.resolve(CONFIG_FILE); + Path loggingProps = USER_DIR.resolve(CONFIG_FILE); + if (args.length != 1) { + throw new IllegalArgumentException("expected (only) one of " + List.of(TESTS.values())); + } + + TESTS test = TESTS.valueOf(args[0]); + System.setProperty("java.util.logging.config.file", loggingProps.toString()); + if (test == TESTS.CUSTOM) { + System.setProperty("java.util.logging.manager", CustomLogManager.class.getName()); + } + + Files.copy(initialProps, loggingProps, StandardCopyOption.REPLACE_EXISTING); + + SystemErr err = new SystemErr(System.err); + System.setErr(new PrintStream(err)); + + System.out.println("Root level is: " + Logger.getLogger("").getLevel()); + if (Logger.getLogger("").getLevel() != Level.INFO) { + throw new RuntimeException("Expected root level INFO, got: " + + Logger.getLogger("").getLevel()); + } + + Class logManagerClass = + LogManager.getLogManager().getClass(); + Class expectedClass = + test == TESTS.CUSTOM ? CustomLogManager.class : LogManager.class; + if (logManagerClass != expectedClass) { + throw new RuntimeException("Bad class for log manager: " + logManagerClass + + " expected " + expectedClass + " for " + test); + } + + if (test == TESTS.DEFAULT) { + // Verify that we have two handlers. One was configured with + // handlers=custom.Handler, the other with + // .handlers=custom.DotHandler + // Verify that exactly one of the two handlers is a custom.Handler + // Verify that exactly one of the two handlers is a custom.DotHandler + // Verify that the two handlers have an id of '1' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 1L, + custom.Handler.class, + custom.DotHandler.class); + } else { + // Verify that we have one handler, configured with + // handlers=custom.Handler. + // Verify that it is a custom.Handler + // Verify that the handler have an id of '1' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 1L, + custom.Handler.class); + + } + + // DEFAULT: The log message "hi" should appear twice on the console. + // CUSTOM: The log message "hi" should appear twice on the console. + // We don't check that. This is just for log analysis in case + // of test failure. + Logger.getAnonymousLogger().info("hi (" + test +")"); + + // Change the root logger level to FINE in the properties file + // and reload the configuration. + Files.write(loggingProps, + Files.lines(initialProps) + .map((s) -> s.replace("INFO", "FINE")) + .collect(Collectors.toList())); + LogManager.getLogManager().readConfiguration(); + + System.out.println("Root level is: " + Logger.getLogger("").getLevel()); + if (Logger.getLogger("").getLevel() != Level.FINE) { + throw new RuntimeException("Expected root level FINE, got: " + + Logger.getLogger("").getLevel()); + } + + // Verify that we have now only one handler, configured with + // handlers=custom.Handler, and that the other configured with + // .handlers=custom.DotHandler was ignored. + // Verify that the handler is a custom.Handler + // Verify that the handler has an id of '2' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 2L, + custom.Handler.class); + + // The log message "there" should appear only once on the console. + // We don't check that. This is just for log analysis in case + // of test failure. + Logger.getAnonymousLogger().info("there!"); + + // Change the root logger level to FINER in the properties file + // and reload the configuration. + Files.write(loggingProps, + Files.lines(initialProps) + .map((s) -> s.replace("INFO", "FINER")) + .collect(Collectors.toList())); + LogManager.getLogManager().readConfiguration(); + + System.out.println("Root level is: " + Logger.getLogger("").getLevel()); + if (Logger.getLogger("").getLevel() != Level.FINER) { + throw new RuntimeException("Expected root level FINER, got: " + + Logger.getLogger("").getLevel()); + } + + // Verify that we have only one handler, configured with + // handlers=custom.Handler, and that the other configured with + // .handlers=custom.DotHandler was ignored. + // Verify that the handler is a custom.Handler + // Verify that the handler has an id of '3' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 3L, + custom.Handler.class); + + // The log message "done" should appear only once on the console. + // We don't check that. This is just for log analysis in case + // of test failure. + Logger.getAnonymousLogger().info("done!"); + + byte[] errBytes = err.baos.toByteArray(); + String errText = new String(errBytes); + switch(test) { + case CUSTOM: + if (errText.contains("java.lang.ClassNotFoundException: " + + BAD_HANDLER_NAME)) { + throw new RuntimeException("Error message found on System.err"); + } + System.out.println("OK: ClassNotFoundException error message not found for " + test); + break; + case DEFAULT: + if (!errText.contains("java.lang.ClassNotFoundException: " + + BAD_HANDLER_NAME)) { + throw new RuntimeException("Error message not found on System.err"); + } + System.err.println("OK: ClassNotFoundException error message found for " + test); + break; + default: + throw new InternalError("unknown test case: " + test); + } + } + + static void checkHandlers(Logger logger, Handler[] handlers, Long expectedID, Class... clz) { + // Verify that we have the expected number of handlers. + if (Stream.of(handlers).count() != clz.length) { + throw new RuntimeException("Expected " + clz.length + " handlers, got: " + + List.of(logger.getHandlers())); + } + for (Class cl : clz) { + // Verify that the handlers are of the expected class. + // For each class, we should have exactly one handler + // of that class. + if (Stream.of(handlers) + .map(Object::getClass) + .filter(cl::equals) + .count() != 1) { + throw new RuntimeException("Expected one " + cl +", got: " + + List.of(logger.getHandlers())); + } + } + // Verify that all handlers have the expected ID + if (Stream.of(logger.getHandlers()) + .map(BadRootLoggerHandlers::getId) + .filter(expectedID::equals) + .count() != clz.length) { + throw new RuntimeException("Expected ids to be " + expectedID + ", got: " + + List.of(logger.getHandlers())); + } + } + + static long getId(Handler h) { + if (h instanceof custom.Handler) { + return ((custom.Handler)h).id; + } + if (h instanceof custom.DotHandler) { + return ((custom.DotHandler)h).id; + } + if (h instanceof custom.GlobalHandler) { + return ((custom.GlobalHandler)h).id; + } + return -1; + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/RootLoggerHandlers.java --- a/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/RootLoggerHandlers.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/RootLoggerHandlers.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.Arrays; +import java.nio.file.StandardCopyOption; import java.util.Collections; import java.util.List; import java.util.logging.Handler; @@ -39,6 +39,7 @@ * @bug 8191033 * @build custom.DotHandler custom.Handler * @run main/othervm RootLoggerHandlers + * @run main/othervm/java.security.policy==test.policy RootLoggerHandlers * @author danielfuchs */ public class RootLoggerHandlers { @@ -61,7 +62,7 @@ Path initialProps = SRC_DIR.resolve(CONFIG_FILE); Path loggingProps = USER_DIR.resolve(CONFIG_FILE); System.setProperty("java.util.logging.config.file", loggingProps.toString()); - Files.copy(initialProps, loggingProps); + Files.copy(initialProps, loggingProps, StandardCopyOption.REPLACE_EXISTING); System.out.println("Root level is: " + Logger.getLogger("").getLevel()); if (Logger.getLogger("").getLevel() != Level.INFO) { throw new RuntimeException("Expected root level INFO, got: " @@ -73,10 +74,15 @@ // Verify that exactly one of the two handlers is a custom.Handler // Verify that exactly one of the two handlers is a custom.DotHandler // Verify that the two handlers has an id of '1' - checkHandlers(Logger.getLogger("").getHandlers(), + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), 1L, custom.Handler.class, custom.DotHandler.class); + checkHandlers(Logger.getLogger("global"), + Logger.getGlobal().getHandlers(), + 1L, + custom.GlobalHandler.class); // The log message "hi" should appear twice on the console. // We don't check that. This is just for log analysis in case @@ -102,9 +108,13 @@ // .handlers=custom.DotHandler was ignored. // Verify that the handler is a custom.Handler // Verify that the handler has an id of '2' - checkHandlers(Logger.getLogger("").getHandlers(), + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), 2L, custom.Handler.class); + checkHandlers(Logger.getGlobal(), + Logger.getGlobal().getHandlers(), + 1L); // The log message "there" should appear only once on the console. // We don't check that. This is just for log analysis in case @@ -130,9 +140,45 @@ // .handlers=custom.DotHandler was ignored. // Verify that the handler is a custom.Handler // Verify that the handler has an id of '3' - checkHandlers(Logger.getLogger("").getHandlers(), + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), 3L, custom.Handler.class); + checkHandlers(Logger.getGlobal(), + Logger.getGlobal().getHandlers(), + 1L); + + LogManager.getLogManager().reset(); + LogManager.getLogManager().updateConfiguration((s) -> (o,n) -> n); + // Verify that we have only one handler, configured with + // handlers=custom.Handler, and that the other configured with + // .handlers=custom.DotHandler was ignored. + // Verify that the handler is a custom.Handler + // Verify that the handler has an id of '4' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 4L, + custom.Handler.class); + checkHandlers(Logger.getGlobal(), + Logger.getGlobal().getHandlers(), + 2L, + custom.GlobalHandler.class); + + LogManager.getLogManager().updateConfiguration((s) -> (o,n) -> n); + // Verify that we have only one handler, configured with + // handlers=custom.Handler, and that the other configured with + // .handlers=custom.DotHandler was ignored. + // Verify that the handler is a custom.Handler + // Verify that the handler has an id of '4' + checkHandlers(Logger.getLogger(""), + Logger.getLogger("").getHandlers(), + 4L, + custom.Handler.class); + checkHandlers(Logger.getGlobal(), + Logger.getGlobal().getHandlers(), + 2L, + custom.GlobalHandler.class); + // The log message "done" should appear only once on the console. // We don't check that. This is just for log analysis in case @@ -140,11 +186,11 @@ Logger.getAnonymousLogger().info("done!"); } - static void checkHandlers(Handler[] handlers, Long expectedID, Class... clz) { + static void checkHandlers(Logger logger, Handler[] handlers, Long expectedID, Class... clz) { // Verify that we have the expected number of handlers. if (Stream.of(handlers).count() != clz.length) { throw new RuntimeException("Expected " + clz.length + " handlers, got: " - + List.of(Logger.getLogger("").getHandlers())); + + List.of(logger.getHandlers())); } for (Class cl : clz) { // Verify that the handlers are of the expected class. @@ -155,16 +201,16 @@ .filter(cl::equals) .count() != 1) { throw new RuntimeException("Expected one " + cl +", got: " - + List.of(Logger.getLogger("").getHandlers())); + + List.of(logger.getHandlers())); } } // Verify that all handlers have the expected ID - if (Stream.of(Logger.getLogger("").getHandlers()) + if (Stream.of(logger.getHandlers()) .map(RootLoggerHandlers::getId) .filter(expectedID::equals) .count() != clz.length) { throw new RuntimeException("Expected ids to be " + expectedID + ", got: " - + List.of(Logger.getLogger("").getHandlers())); + + List.of(logger.getHandlers())); } } @@ -175,6 +221,9 @@ if (h instanceof custom.DotHandler) { return ((custom.DotHandler)h).id; } + if (h instanceof custom.GlobalHandler) { + return ((custom.GlobalHandler)h).id; + } return -1; } } diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/badglobal.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/badglobal.properties Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,19 @@ +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +#handlers= java.util.logging.ConsoleHandler +handlers= custom.Handler +.handlers= custom.DotHandler +global.handlers = 1custom.GlobalHandler, custom.GlobalHandler + +# Default global logging level. +.level= INFO + +# Other configuration +custom.Handler.level=ALL +custom.DotHandler.level=ALL +java.util.logging.SimpleFormatter.format=%4$s [%1$tc]: %2$s: %5$s%n + diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/badlogging.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/badlogging.properties Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,18 @@ +############################################################ +# Global properties +############################################################ + +# "handlers" specifies a comma separated list of log Handler +# classes. These handlers will be installed during VM startup. +#handlers= java.util.logging.ConsoleHandler +handlers= custom.Handler +.handlers= 1custom.DotHandler,custom.DotHandler + +# Default global logging level. +.level= INFO + +# Other configuration +custom.Handler.level=ALL +custom.DotHandler.level=ALL +java.util.logging.SimpleFormatter.format=%4$s [%1$tc]: %2$s: %5$s%n + diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/custom/GlobalHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/custom/GlobalHandler.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 custom; + +import java.util.concurrent.atomic.AtomicLong; + +/** + * + * @author danielfuchs + */ +public class GlobalHandler extends java.util.logging.ConsoleHandler { + + public static final AtomicLong IDS = new AtomicLong(); + public final long id = IDS.incrementAndGet(); + public GlobalHandler() { + System.out.println("GlobalHandler(" + id + ") created"); + //new Exception("GlobalHandler").printStackTrace(); + } + + @Override + public void close() { + System.out.println("GlobalHandler(" + id + ") closed"); + super.close(); + } + + @Override + public String toString() { + return this.getClass().getName() + '(' + id + ')'; + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/logging.properties --- a/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/logging.properties Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/logging.properties Tue Jan 30 09:03:47 2018 -0800 @@ -7,6 +7,7 @@ #handlers= java.util.logging.ConsoleHandler handlers= custom.Handler .handlers= custom.DotHandler +global.handlers= custom.GlobalHandler # Default global logging level. .level= INFO @@ -14,5 +15,6 @@ # Other configuration custom.Handler.level=ALL custom.DotHandler.level=ALL +custom.GlobalHandler.level=ALL java.util.logging.SimpleFormatter.format=%4$s [%1$tc]: %2$s: %5$s%n diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/test.policy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/jdk/java/util/logging/LogManager/Configuration/rootLoggerHandlers/test.policy Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,13 @@ +grant { + // permissions for RootLoggerHandlers + permission java.util.PropertyPermission "*", "read"; + permission java.util.PropertyPermission "java.util.logging.config.file", "write"; + permission java.io.FilePermission "<>", "read,write,delete"; + permission java.util.logging.LoggingPermission "control"; + + // additional permissions for BadRootLoggerHandlers + permission java.util.PropertyPermission "java.util.logging.manager", "write"; + permission java.lang.RuntimePermission "setIO"; + permission java.lang.RuntimePermission "shutdownHooks"; + permission java.lang.RuntimePermission "setContextClassLoader"; +}; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/AcceptPermissions.java --- a/test/jdk/sun/security/krb5/auto/AcceptPermissions.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/AcceptPermissions.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 9999999 + * @bug 8005447 8194486 * @summary default principal can act as anyone + * @library /test/lib * @compile -XDignore.symbol.file AcceptPermissions.java - * @run main/othervm AcceptPermissions two - * @run main/othervm AcceptPermissions unbound + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptPermissions two + * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptPermissions unbound */ import java.nio.file.Files; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/AcceptorSubKey.java --- a/test/jdk/sun/security/krb5/auto/AcceptorSubKey.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/AcceptorSubKey.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 7077646 + * @bug 7077646 8194486 * @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY + * @library /test/lib * @compile -XDignore.symbol.file AcceptorSubKey.java - * @run main/othervm AcceptorSubKey 0 - * @run main/othervm AcceptorSubKey 4 + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptorSubKey 0 + * @run main/othervm -Djdk.net.hosts.file=TestHosts AcceptorSubKey 4 */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Addresses.java --- a/test/jdk/sun/security/krb5/auto/Addresses.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Addresses.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8031111 + * @bug 8031111 8194486 * @summary fix krb5 caddr + * @library /test/lib * @compile -XDignore.symbol.file Addresses.java - * @run main/othervm Addresses + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Addresses */ import sun.security.krb5.Config; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/AddressesAndNameType.java --- a/test/jdk/sun/security/krb5/auto/AddressesAndNameType.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/AddressesAndNameType.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 4501327 4868379 8039132 - * @run main/othervm AddressesAndNameType 1 - * @run main/othervm AddressesAndNameType 2 - * @run main/othervm AddressesAndNameType 3 + * @bug 4501327 4868379 8039132 8194486 * @summary noaddresses settings and server name type + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts AddressesAndNameType 1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts AddressesAndNameType 2 + * @run main/othervm -Djdk.net.hosts.file=TestHosts AddressesAndNameType 3 */ import java.net.InetAddress; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Basic.java --- a/test/jdk/sun/security/krb5/auto/Basic.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Basic.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7152176 + * @bug 7152176 8194486 * @summary More krb5 tests + * @library /test/lib * @compile -XDignore.symbol.file Basic.java - * @run main/othervm Basic + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Basic */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/BasicKrb5Test.java --- a/test/jdk/sun/security/krb5/auto/BasicKrb5Test.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/BasicKrb5Test.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * 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,44 +23,62 @@ /* * @test - * @bug 6706974 + * @bug 6706974 8014628 8194486 * @summary Add krb5 test infrastructure + * @library /test/lib * @compile -XDignore.symbol.file BasicKrb5Test.java - * @run main/othervm BasicKrb5Test - * @run main/othervm BasicKrb5Test des-cbc-crc - * @run main/othervm BasicKrb5Test des-cbc-md5 - * @run main/othervm BasicKrb5Test des3-cbc-sha1 - * @run main/othervm BasicKrb5Test aes128-cts - * @run main/othervm BasicKrb5Test aes256-cts - * @run main/othervm BasicKrb5Test rc4-hmac - * @run main/othervm BasicKrb5Test -s - * @run main/othervm BasicKrb5Test des-cbc-crc -s - * @run main/othervm BasicKrb5Test des-cbc-md5 -s - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -s - * @run main/othervm BasicKrb5Test aes128-cts -s - * @run main/othervm BasicKrb5Test aes256-cts -s - * @run main/othervm BasicKrb5Test rc4-hmac -s - * @run main/othervm BasicKrb5Test -C - * @run main/othervm BasicKrb5Test des-cbc-crc -C - * @run main/othervm BasicKrb5Test des-cbc-md5 -C - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -C - * @run main/othervm BasicKrb5Test aes128-cts -C - * @run main/othervm BasicKrb5Test aes256-cts -C - * @run main/othervm BasicKrb5Test rc4-hmac -C - * @run main/othervm BasicKrb5Test -s -C - * @run main/othervm BasicKrb5Test des-cbc-crc -s -C - * @run main/othervm BasicKrb5Test des-cbc-md5 -s -C - * @run main/othervm BasicKrb5Test des3-cbc-sha1 -s -C - * @run main/othervm BasicKrb5Test aes128-cts -s -C - * @run main/othervm BasicKrb5Test aes256-cts -s -C - * @run main/othervm BasicKrb5Test rc4-hmac -s -C + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des3-cbc-sha1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2 + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * des3-cbc-sha1 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2 -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac -s + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-crc -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test des-cbc-md5 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * des3-cbc-sha1 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha1 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha1 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes128-sha2 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test aes256-sha2 -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test rc4-hmac -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * des-cbc-crc -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * des-cbc-md5 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * des3-cbc-sha1 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * aes128-sha1 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * aes256-sha1 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * aes128-sha2 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * aes256-sha2 -s -C + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicKrb5Test + * rc4-hmac -s -C */ import org.ietf.jgss.GSSName; import sun.security.jgss.GSSUtil; -import sun.security.krb5.Config; import sun.security.krb5.KrbException; -import sun.security.krb5.internal.crypto.EType; /** * Basic JGSS/krb5 test with 3 parties: client, server, backend server. Each diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/BasicProc.java --- a/test/jdk/sun/security/krb5/auto/BasicProc.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/BasicProc.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +23,13 @@ /* * @test - * @bug 8009977 8186884 + * @bug 8009977 8186884 8194486 * @summary A test to launch multiple Java processes using either Java GSS * or native GSS - * @library ../../../../java/security/testlibrary/ + * @library ../../../../java/security/testlibrary/ /test/lib * @compile -XDignore.symbol.file BasicProc.java - * @run main/othervm BasicProc launcher + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts BasicProc launcher */ import java.nio.file.Files; @@ -304,6 +305,7 @@ */ private static Proc proc(String lib) throws Exception { Proc p = Proc.create("BasicProc") + .inheritProp("jdk.net.hosts.file") .prop("java.security.manager", "") .perm(new javax.security.auth.AuthPermission("doAs")); if (lib != null) { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/BogusKDC.java --- a/test/jdk/sun/security/krb5/auto/BogusKDC.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/BogusKDC.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +33,12 @@ /* * @test - * @bug 4515853 8075297 + * @bug 4515853 8075297 8194486 * @summary Checks that Kerberos client tries slave KDC * if master KDC is not responding - * @run main/othervm BogusKDC + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts BogusKDC */ public class BogusKDC { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/CleanState.java --- a/test/jdk/sun/security/krb5/auto/CleanState.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/CleanState.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 6716534 + * @bug 6716534 8194486 + * @summary Krb5LoginModule has not cleaned temp info between authentication attempts + * @library /test/lib * @compile -XDignore.symbol.file CleanState.java - * @run main/othervm CleanState - * @summary Krb5LoginModule has not cleaned temp info between authentication attempts + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts CleanState */ import com.sun.security.auth.module.Krb5LoginModule; import java.util.HashMap; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/CrossRealm.java --- a/test/jdk/sun/security/krb5/auto/CrossRealm.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/CrossRealm.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 6706974 + * @bug 6706974 8194486 + * @summary Add krb5 test infrastructure + * @library /test/lib * @compile -XDignore.symbol.file CrossRealm.java - * @run main/othervm CrossRealm - * @summary Add krb5 test infrastructure + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts CrossRealm */ import java.io.File; import java.io.FileOutputStream; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/DiffNameSameKey.java --- a/test/jdk/sun/security/krb5/auto/DiffNameSameKey.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/DiffNameSameKey.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 8005447 + * @bug 8005447 8194486 * @summary default principal can act as anyone + * @library /test/lib * @compile -XDignore.symbol.file DiffNameSameKey.java - * @run main/othervm/fail DiffNameSameKey a - * @run main/othervm DiffNameSameKey b + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts DiffNameSameKey a + * @run main/othervm -Djdk.net.hosts.file=TestHosts DiffNameSameKey b */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/DiffSaltParams.java --- a/test/jdk/sun/security/krb5/auto/DiffSaltParams.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/DiffSaltParams.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,13 @@ /* * @test - * @bug 8186831 + * @bug 8186831 8194486 * @summary Kerberos ignores PA-DATA with a non-null s2kparams + * @library /test/lib * @compile -XDignore.symbol.file DiffSaltParams.java - * @run main/othervm -Dsun.security.krb5.debug=true DiffSaltParams + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Dsun.security.krb5.debug=true + * -Djdk.net.hosts.file=TestHosts DiffSaltParams */ public class DiffSaltParams { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/DupEtypes.java --- a/test/jdk/sun/security/krb5/auto/DupEtypes.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/DupEtypes.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,14 +23,16 @@ /* * @test - * @bug 7067974 + * @bug 7067974 8194486 * @summary multiple ETYPE-INFO-ENTRY with same etype and different salt + * @library /test/lib * @compile -XDignore.symbol.file DupEtypes.java - * @run main/othervm DupEtypes 1 - * @run main/othervm DupEtypes 2 - * @run main/othervm/fail DupEtypes 3 - * @run main/othervm DupEtypes 4 - * @run main/othervm DupEtypes 5 + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts DupEtypes 1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts DupEtypes 2 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts DupEtypes 3 + * @run main/othervm -Djdk.net.hosts.file=TestHosts DupEtypes 4 + * @run main/othervm -Djdk.net.hosts.file=TestHosts DupEtypes 5 */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/DynamicKeytab.java --- a/test/jdk/sun/security/krb5/auto/DynamicKeytab.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/DynamicKeytab.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 6894072 + * @bug 6894072 8194486 + * @summary always refresh keytab + * @library /test/lib * @compile -XDignore.symbol.file DynamicKeytab.java - * @run main/othervm DynamicKeytab - * @summary always refresh keytab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts DynamicKeytab */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/EmptyPassword.java --- a/test/jdk/sun/security/krb5/auto/EmptyPassword.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/EmptyPassword.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 6879540 + * @bug 6879540 8194486 * @summary enable empty password for kerberos 5 + * @library /test/lib * @compile -XDignore.symbol.file EmptyPassword.java - * @run main/othervm EmptyPassword + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts EmptyPassword */ public class EmptyPassword { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/FileKeyTab.java --- a/test/jdk/sun/security/krb5/auto/FileKeyTab.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/FileKeyTab.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7152121 + * @bug 7152121 8194486 * @summary Krb5LoginModule no longer handles keyTabNames with "file:" prefix + * @library /test/lib * @compile -XDignore.symbol.file FileKeyTab.java - * @run main/othervm FileKeyTab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts FileKeyTab */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/ForwardableCheck.java --- a/test/jdk/sun/security/krb5/auto/ForwardableCheck.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/ForwardableCheck.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8022582 + * @bug 8022582 8194486 * @summary Relax response flags checking in sun.security.krb5.KrbKdcRep.check. + * @library /test/lib * @compile -XDignore.symbol.file ForwardableCheck.java - * @run main/othervm ForwardableCheck + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts ForwardableCheck */ import org.ietf.jgss.GSSException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Forwarded.java --- a/test/jdk/sun/security/krb5/auto/Forwarded.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Forwarded.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8031111 + * @bug 8031111 8194486 * @summary fix krb5 caddr + * @library /test/lib * @compile -XDignore.symbol.file Forwarded.java - * @run main/othervm Forwarded + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Forwarded */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/GSS.java --- a/test/jdk/sun/security/krb5/auto/GSS.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/GSS.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7152176 + * @bug 7152176 8194486 * @summary More krb5 tests + * @library /test/lib * @compile -XDignore.symbol.file GSS.java - * @run main/othervm GSS + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts GSS */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/GSSUnbound.java --- a/test/jdk/sun/security/krb5/auto/GSSUnbound.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/GSSUnbound.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8001104 + * @bug 8001104 8194486 * @summary Unbound SASL service: the GSSAPI/krb5 mech + * @library /test/lib * @compile -XDignore.symbol.file GSSUnbound.java - * @run main/othervm GSSUnbound + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts GSSUnbound */ import java.security.Security; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java --- a/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/HttpNegotiateServer.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * 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 6578647 6829283 8171340 + * @bug 6578647 6829283 8171340 8194486 * @modules java.base/sun.security.util * java.security.jgss/sun.security.krb5.internal:+open * java.security.jgss/sun.security.jgss @@ -35,11 +35,13 @@ * jdk.security.auth * jdk.security.jgss * jdk.httpserver - * @run main/othervm HttpNegotiateServer * @summary Undefined requesting URL in java.net.Authenticator * .getPasswordAuthentication() * @summary HTTP/Negotiate: Authenticator triggered again when * user cancels the first one + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts HttpNegotiateServer */ import com.sun.net.httpserver.Headers; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/IgnoreChannelBinding.java --- a/test/jdk/sun/security/krb5/auto/IgnoreChannelBinding.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/IgnoreChannelBinding.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6851973 - * @run main/othervm IgnoreChannelBinding + * @bug 6851973 8194486 * @summary ignore incoming channel binding if acceptor does not set one + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts IgnoreChannelBinding */ import java.net.InetAddress; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KDC.java --- a/test/jdk/sun/security/krb5/auto/KDC.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KDC.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -241,14 +241,6 @@ CHECK_ADDRESSES, }; - static { - if (System.getProperty("jdk.net.hosts.file") == null) { - String hostsFileName - = System.getProperty("test.src", ".") + "/TestHosts"; - System.setProperty("jdk.net.hosts.file", hostsFileName); - } - } - /** * A standalone KDC server. */ @@ -604,19 +596,7 @@ */ private static EncryptionKey generateRandomKey(int eType) throws KrbException { - // Is 32 enough for AES256? I should have generated the keys directly - // but different cryptos have different rules on what keys are valid. - char[] pass = randomPassword(); - String algo; - switch (eType) { - case EncryptedData.ETYPE_DES_CBC_MD5: algo = "DES"; break; - case EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD: algo = "DESede"; break; - case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: algo = "AES128"; break; - case EncryptedData.ETYPE_ARCFOUR_HMAC: algo = "ArcFourHMAC"; break; - case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: algo = "AES256"; break; - default: algo = "DES"; break; - } - return new EncryptionKey(pass, "NOTHING", algo); // Silly + return genKey0(randomPassword(), "NOTHING", null, eType, null); } /** @@ -680,6 +660,8 @@ switch (etype) { case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96: case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96: + case EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128: + case EncryptedData.ETYPE_AES256_CTS_HMAC_SHA384_192: String pn = p.toString(); if (p.getRealmString() == null) { pn = pn + "@" + getRealm(); @@ -687,7 +669,11 @@ if (s2kparamses.containsKey(pn)) { return s2kparamses.get(pn); } - return new byte[] {0, 0, 0x10, 0}; + if (etype < EncryptedData.ETYPE_AES128_CTS_HMAC_SHA256_128) { + return new byte[]{0, 0, 0x10, 0}; + } else { + return new byte[]{0, 0, (byte) 0x80, 0}; + } default: return null; } @@ -715,9 +701,8 @@ kvno = pass[pass.length-1] - '0'; } } - return new EncryptionKey(EncryptionKeyDotStringToKey( - getPassword(p, server), getSalt(p), getParams(p, etype), etype), - etype, kvno); + return genKey0(getPassword(p, server), getSalt(p), + getParams(p, etype), etype, kvno); } catch (KrbException ke) { throw ke; } catch (Exception e) { @@ -735,6 +720,17 @@ } /** + * Generates key from password. + */ + private static EncryptionKey genKey0( + char[] pass, String salt, byte[] s2kparams, + int etype, Integer kvno) throws KrbException { + return new EncryptionKey(EncryptionKeyDotStringToKey( + pass, salt, s2kparams, etype), + etype, kvno); + } + + /** * Processes an incoming request and generates a response. * @param in the request * @return the response @@ -1181,8 +1177,8 @@ } boolean allOld = true; for (int i: eTypes) { - if (i == EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96 || - i == EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96) { + if (i >= EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96 && + i != EncryptedData.ETYPE_ARCFOUR_HMAC) { allOld = false; break; } diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KPEquals.java --- a/test/jdk/sun/security/krb5/auto/KPEquals.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KPEquals.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8015669 + * @bug 8015669 8194486 * @summary KerberosPrincipal::equals should ignore name-type + * @library /test/lib * @compile -XDignore.symbol.file KPEquals.java - * @run main/othervm KPEquals + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KPEquals */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KdcPolicy.java --- a/test/jdk/sun/security/krb5/auto/KdcPolicy.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KdcPolicy.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +38,12 @@ /* * @test - * @bug 8164656 8181461 - * @run main/othervm KdcPolicy udp - * @run main/othervm KdcPolicy tcp + * @bug 8164656 8181461 8194486 * @summary krb5.kdc.bad.policy test + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KdcPolicy udp + * @run main/othervm -Djdk.net.hosts.file=TestHosts KdcPolicy tcp */ public class KdcPolicy { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KeyPermissions.java --- a/test/jdk/sun/security/krb5/auto/KeyPermissions.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KeyPermissions.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8004488 + * @bug 8004488 8194486 * @summary wrong permissions checked in krb5 + * @library /test/lib * @compile -XDignore.symbol.file KeyPermissions.java - * @run main/othervm KeyPermissions + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KeyPermissions */ import java.security.AccessControlException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KeyTabCompat.java --- a/test/jdk/sun/security/krb5/auto/KeyTabCompat.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KeyTabCompat.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,12 @@ /* * @test - * @bug 6894072 - * @bug 8004488 + * @bug 6894072 8004488 8194486 + * @summary always refresh keytab + * @library /test/lib * @compile -XDignore.symbol.file KeyTabCompat.java - * @run main/othervm KeyTabCompat - * @summary always refresh keytab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KeyTabCompat */ import javax.security.auth.kerberos.KerberosKey; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KrbTicket.java --- a/test/jdk/sun/security/krb5/auto/KrbTicket.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KrbTicket.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,9 +35,11 @@ /* * @test - * @bug 6857795 8075299 + * @bug 6857795 8075299 8194486 * @summary Checks Kerberos ticket properties - * @run main/othervm KrbTicket + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KrbTicket */ public class KrbTicket { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/KvnoNA.java --- a/test/jdk/sun/security/krb5/auto/KvnoNA.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/KvnoNA.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7197159 + * @bug 7197159 8194486 + * @summary accept different kvno if there no match + * @library /test/lib * @compile -XDignore.symbol.file KvnoNA.java - * @run main/othervm KvnoNA - * @summary accept different kvno if there no match + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts KvnoNA */ import org.ietf.jgss.GSSException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/LifeTimeInSeconds.java --- a/test/jdk/sun/security/krb5/auto/LifeTimeInSeconds.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/LifeTimeInSeconds.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6857802 - * @run main/othervm LifeTimeInSeconds + * @bug 6857802 8194486 * @summary GSS getRemainingInitLifetime method returns milliseconds not seconds + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts LifeTimeInSeconds */ import org.ietf.jgss.GSSCredential; import org.ietf.jgss.GSSManager; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/LoginModuleOptions.java --- a/test/jdk/sun/security/krb5/auto/LoginModuleOptions.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/LoginModuleOptions.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6765491 - * @run main/othervm LoginModuleOptions + * @bug 6765491 8194486 * @summary Krb5LoginModule a little too restrictive, and the doc is not clear. + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts LoginModuleOptions */ import com.sun.security.auth.module.Krb5LoginModule; import java.util.HashMap; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/LoginNoPass.java --- a/test/jdk/sun/security/krb5/auto/LoginNoPass.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/LoginNoPass.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8028351 + * @bug 8028351 8194486 * @summary JWS doesn't get authenticated when using kerberos auth proxy + * @library /test/lib * @compile -XDignore.symbol.file LoginNoPass.java - * @run main/othervm LoginNoPass + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts LoginNoPass */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/LongLife.java --- a/test/jdk/sun/security/krb5/auto/LongLife.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/LongLife.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8131051 + * @bug 8131051 8194486 * @summary KDC might issue a renewable ticket even if not requested + * @library /test/lib * @compile -XDignore.symbol.file LongLife.java - * @run main/othervm LongLife + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts LongLife */ import sun.security.krb5.Config; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/MSOID2.java --- a/test/jdk/sun/security/krb5/auto/MSOID2.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/MSOID2.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8078439 + * @bug 8078439 8194486 * @summary SPNEGO auth fails if client proposes MS krb5 OID + * @library /test/lib * @compile -XDignore.symbol.file MSOID2.java - * @run main/othervm MSOID2 + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts MSOID2 */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/ModuleName.java --- a/test/jdk/sun/security/krb5/auto/ModuleName.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/ModuleName.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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 8164437 + * @bug 8164437 8194486 * @summary GSSContext type when jdk.security.jgss is not available * @library /test/lib * @compile -XDignore.symbol.file ModuleName.java @@ -33,7 +33,8 @@ * jdk.test.lib.JDKToolLauncher * jdk.test.lib.Platform * jdk.test.lib.process.* - * @run main/othervm ModuleName + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts ModuleName */ import jdk.test.lib.process.ProcessTools; @@ -58,6 +59,7 @@ arg.startsWith("--add-opens=")) .forEach(cmd::add); cmd.addAll(List.of( + "-Djdk.net.hosts.file=TestHosts", "-Dtest.src=" + System.getProperty("test.src"), "--add-modules", "java.base,java.security.jgss,jdk.security.auth", diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/MoreKvno.java --- a/test/jdk/sun/security/krb5/auto/MoreKvno.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/MoreKvno.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6893158 6907425 7197159 - * @run main/othervm MoreKvno + * @bug 6893158 6907425 7197159 8194486 * @summary AP_REQ check should use key version number + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts MoreKvno */ import org.ietf.jgss.GSSException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NewInquireTypes.java --- a/test/jdk/sun/security/krb5/auto/NewInquireTypes.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NewInquireTypes.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8043071 + * @bug 8043071 8194486 * @summary Expose session key and KRB_CRED through extended GSS-API + * @library /test/lib * @compile -XDignore.symbol.file NewInquireTypes.java - * @run main/othervm NewInquireTypes + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts NewInquireTypes */ import com.sun.security.jgss.ExtendedGSSContext; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NewSalt.java --- a/test/jdk/sun/security/krb5/auto/NewSalt.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NewSalt.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 6960894 + * @bug 6960894 8194486 * @summary Better AS-REQ creation and processing - * @run main/othervm NewSalt - * @run main/othervm -Dnopreauth NewSalt - * @run main/othervm -Donlyonepreauth NewSalt + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts NewSalt + * @run main/othervm -Dnopreauth -Djdk.net.hosts.file=TestHosts NewSalt + * @run main/othervm -Donlyonepreauth -Djdk.net.hosts.file=TestHosts NewSalt */ import java.util.Locale; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NoInitNoKeytab.java --- a/test/jdk/sun/security/krb5/auto/NoInitNoKeytab.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NoInitNoKeytab.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7089889 + * @bug 7089889 8194486 * @summary Krb5LoginModule.login() throws an exception if used without a keytab + * @library /test/lib * @compile -XDignore.symbol.file NoInitNoKeytab.java - * @run main/othervm NoInitNoKeytab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts NoInitNoKeytab */ import java.io.FileOutputStream; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NonMutualSpnego.java --- a/test/jdk/sun/security/krb5/auto/NonMutualSpnego.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NonMutualSpnego.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6733095 - * @run main/othervm NonMutualSpnego + * @bug 6733095 8194486 * @summary Failure when SPNEGO request non-Mutual + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts NonMutualSpnego */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NoneReplayCacheTest.java --- a/test/jdk/sun/security/krb5/auto/NoneReplayCacheTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NoneReplayCacheTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +23,14 @@ /* * @test - * @bug 8001326 - * @run main/othervm NoneReplayCacheTest + * @bug 8001326 8194486 * @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. + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts NoneReplayCacheTest */ import org.ietf.jgss.GSSException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/NullRenewUntil.java --- a/test/jdk/sun/security/krb5/auto/NullRenewUntil.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/NullRenewUntil.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +23,14 @@ /* * @test - * @bug 8186576 + * @bug 8186576 8194486 * @summary KerberosTicket does not properly handle renewable tickets * at the end of their lifetime * @library /test/lib * @compile -XDignore.symbol.file NullRenewUntil.java - * @run main/othervm -Dtest.set.null.renew NullRenewUntil + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.set.null.renew NullRenewUntil */ import jdk.test.lib.Asserts; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/OkAsDelegate.java --- a/test/jdk/sun/security/krb5/auto/OkAsDelegate.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/OkAsDelegate.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * 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,29 +23,49 @@ /* * @test - * @bug 6853328 7172701 - * @run main/othervm OkAsDelegate false true true false false false + * @bug 6853328 7172701 8194486 + * @summary Support OK-AS-DELEGATE flag + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts OkAsDelegate + * false true true false false false * FORWARDABLE ticket not allowed, always fail - * @run main/othervm OkAsDelegate true false false false false false + * @run main/othervm -Djdk.net.hosts.file=TestHosts OkAsDelegate + * true false false false false false * Service ticket no OK-AS-DELEGATE. Request nothing, gain nothing - * @run main/othervm OkAsDelegate true false true false false false + * @run main/othervm -Djdk.net.hosts.file=TestHosts OkAsDelegate + * true false true false false false * Service ticket no OK-AS-DELEGATE. Request deleg policy, gain nothing - * @run main/othervm OkAsDelegate true true false true false true + * @run main/othervm -Djdk.net.hosts.file=TestHosts OkAsDelegate + * true true false true false true * Service ticket no OK-AS-DELEGATE. Request deleg, granted - * @run main/othervm OkAsDelegate true true true true false true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * OkAsDelegate true true true true false true * Service ticket no OK-AS-DELEGATE. Request deleg and deleg policy, granted, with info not by policy - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.kdc.policy.ok-as-delegate OkAsDelegate + * true false true true true true * Service ticket has OK-AS-DELEGATE. Request deleg policy, granted - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.kdc.policy.ok-as-delegate OkAsDelegate + * true true true true true true * Service ticket has OK-AS-DELEGATE. granted, with info by policy - * @run main/othervm -Dtest.spnego OkAsDelegate false true true false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true false false false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true false true false false false - * @run main/othervm -Dtest.spnego OkAsDelegate true true false true false true - * @run main/othervm -Dtest.spnego OkAsDelegate true true true true false true - * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true false true true true true - * @run main/othervm -Dtest.spnego -Dtest.kdc.policy.ok-as-delegate OkAsDelegate true true true true true true - * @summary Support OK-AS-DELEGATE flag + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * OkAsDelegate false true true false false false + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * OkAsDelegate true false false false false false + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * OkAsDelegate true false true false false false + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * OkAsDelegate true true false true false true + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * OkAsDelegate true true true true false true + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * -Dtest.kdc.policy.ok-as-delegate OkAsDelegate + * true false true true true true + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.spnego + * -Dtest.kdc.policy.ok-as-delegate OkAsDelegate + * true true true true true true */ import com.sun.security.jgss.ExtendedGSSContext; import org.ietf.jgss.GSSContext; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/OkAsDelegateXRealm.java --- a/test/jdk/sun/security/krb5/auto/OkAsDelegateXRealm.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/OkAsDelegateXRealm.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * 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,16 +23,23 @@ /* * @test - * @bug 6853328 7172701 - * @run main/othervm OkAsDelegateXRealm false + * @bug 6853328 7172701 8194486 + * @summary Support OK-AS-DELEGATE flag + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts OkAsDelegateXRealm false * KDC no OK-AS-DELEGATE, fail - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.kdc.policy.ok-as-delegate OkAsDelegateXRealm true * KDC set OK-AS-DELEGATE for all, succeed - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local OkAsDelegateXRealm false + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local + * OkAsDelegateXRealm false * KDC set OK-AS-DELEGATE for host/host.r3.local only, fail - * @run main/othervm -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local,krbtgt/R2,krbtgt/R3 OkAsDelegateXRealm true + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dtest.kdc.policy.ok-as-delegate=host/host.r3.local,krbtgt/R2,krbtgt/R3 + * OkAsDelegateXRealm true * KDC set OK-AS-DELEGATE for all three, succeed - * @summary Support OK-AS-DELEGATE flag */ import java.io.FileOutputStream; import java.io.IOException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/OnlyDesLogin.java --- a/test/jdk/sun/security/krb5/auto/OnlyDesLogin.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/OnlyDesLogin.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,13 @@ /* * @test - * @bug 8014310 - * @summary JAAS/Krb5LoginModule using des encytypes failure with NPE after JDK-8012679 + * @bug 8014310 8194486 + * @summary JAAS/Krb5LoginModule using des encytypes failure with NPE + * after JDK-8012679 + * @library /test/lib * @compile -XDignore.symbol.file OnlyDesLogin.java - * @run main/othervm OnlyDesLogin + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts OnlyDesLogin */ import sun.security.krb5.Config; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/PrincipalNameEquals.java --- a/test/jdk/sun/security/krb5/auto/PrincipalNameEquals.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/PrincipalNameEquals.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7061379 + * @bug 7061379 8194486 * @summary [Kerberos] Cross-realm authentication fails, due to nameType problem + * @library /test/lib * @compile -XDignore.symbol.file PrincipalNameEquals.java - * @run main/othervm PrincipalNameEquals + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts PrincipalNameEquals */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/RRC.java --- a/test/jdk/sun/security/krb5/auto/RRC.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/RRC.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7077640 + * @bug 7077640 8194486 * @summary gss wrap for cfx doesn't handle rrc != 0 + * @library /test/lib * @compile -XDignore.symbol.file RRC.java - * @run main/othervm RRC + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts RRC */ import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/RefreshKrb5Config.java --- a/test/jdk/sun/security/krb5/auto/RefreshKrb5Config.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/RefreshKrb5Config.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +31,12 @@ /* * @test - * @bug 4745056 8075297 + * @bug 4745056 8075297 8194486 * @summary Checks if refreshKrb5Config is set to true for Krb5LoginModule, * then configuration will be refreshed before login() method is called - * @run main/othervm RefreshKrb5Config + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts RefreshKrb5Config */ public class RefreshKrb5Config { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Renew.java --- a/test/jdk/sun/security/krb5/auto/Renew.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Renew.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,13 +23,15 @@ /* * @test - * @bug 8058290 + * @bug 8058290 8194486 * @summary JAAS Krb5LoginModule has suspect ticket-renewal logic, * relies on clockskew grace + * @library /test/lib * @compile -XDignore.symbol.file Renew.java - * @run main/othervm Renew 1 - * @run main/othervm Renew 2 - * @run main/othervm Renew 3 + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Renew 1 + * @run main/othervm -Djdk.net.hosts.file=TestHosts Renew 2 + * @run main/othervm -Djdk.net.hosts.file=TestHosts Renew 3 */ import sun.security.krb5.Config; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Renewal.java --- a/test/jdk/sun/security/krb5/auto/Renewal.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Renewal.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +23,13 @@ /* * @test - * @bug 8044500 + * @bug 8044500 8194486 * @summary Add kinit options and krb5.conf flags that allow users to * obtain renewable tickets and specify ticket lifetimes - * @library ../../../../java/security/testlibrary/ + * @library ../../../../java/security/testlibrary/ /test/lib * @compile -XDignore.symbol.file Renewal.java - * @run main/othervm Renewal + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Renewal */ import sun.security.krb5.Config; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/ReplayCacheTest.java --- a/test/jdk/sun/security/krb5/auto/ReplayCacheTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/ReplayCacheTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7118809 8001326 - * @run main/othervm ReplayCacheTest jvm - * @run main/othervm ReplayCacheTest dfl + * @bug 7118809 8001326 8194486 * @summary rcache deadlock + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts ReplayCacheTest jvm + * @run main/othervm -Djdk.net.hosts.file=TestHosts ReplayCacheTest dfl */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java --- a/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/ReplayCacheTestProc.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 7152176 8168518 8172017 + * @bug 7152176 8168518 8172017 8014628 8194486 * @summary More krb5 tests * @library ../../../../java/security/testlibrary/ /test/lib * @build jdk.test.lib.Platform - * @run main/othervm/timeout=300 ReplayCacheTestProc + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm/timeout=300 -Djdk.net.hosts.file=TestHosts + * ReplayCacheTestProc */ import java.io.*; @@ -132,8 +134,13 @@ kdc.addPrincipalRandKey(service(i)); } + // Native lib might not support aes-sha2 + KDC.saveConfig(OneKDC.KRB5_CONF, kdc, + "default_tkt_enctypes = aes128-cts", + "default_tgs_enctypes = aes128-cts"); + + // Write KTAB after krb5.conf so it contains no aes-sha2 keys kdc.writeKtab(OneKDC.KTAB); - KDC.saveConfig(OneKDC.KRB5_CONF, kdc); // User-provided libs String userLibs = System.getProperty("test.libs"); @@ -155,6 +162,7 @@ } pi = Proc.create("ReplayCacheTestProc").debug("C") + .inheritProp("jdk.net.hosts.file") .args("initiator") .start(); @@ -367,9 +375,11 @@ } if (type.startsWith("J")) { if (lib == null) { - p = Proc.create("ReplayCacheTestProc"); + p = Proc.create("ReplayCacheTestProc") + .inheritProp("jdk.net.hosts.file"); } else { - p = Proc.create("ReplayCacheTestProc", lib); + p = Proc.create("ReplayCacheTestProc", lib) + .inheritProp("jdk.net.hosts.file"); } p.prop("sun.security.krb5.rcache", "dfl") .prop("java.io.tmpdir", cwd); @@ -382,6 +392,7 @@ .env("KRB5_CONFIG", OneKDC.KRB5_CONF) .env("KRB5_KTNAME", OneKDC.KTAB) .env("KRB5RCACHEDIR", cwd) + .inheritProp("jdk.net.hosts.file") .prop("sun.security.jgss.native", "true") .prop("javax.security.auth.useSubjectCredsOnly", "false") .prop("sun.security.nativegss.debug", "true"); diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2proxy.java --- a/test/jdk/sun/security/krb5/auto/S4U2proxy.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2proxy.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 6355584 8044215 + * @bug 6355584 8044215 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2proxy.java - * @run main/othervm S4U2proxy krb5 - * @run main/othervm S4U2proxy spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts S4U2proxy krb5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts S4U2proxy spnego */ import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2proxyGSS.java --- a/test/jdk/sun/security/krb5/auto/S4U2proxyGSS.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2proxyGSS.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,15 @@ /* * @test - * @bug 6355584 + * @bug 6355584 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2proxyGSS.java - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS krb5 - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS krb5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djavax.security.auth.useSubjectCredsOnly=false S4U2proxyGSS spnego */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2self.java --- a/test/jdk/sun/security/krb5/auto/S4U2self.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2self.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,16 +23,25 @@ /* * @test - * @bug 6355584 + * @bug 6355584 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2self.java - * @run main/othervm -Dsun.security.krb5.debug=false S4U2self krb5 0 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 1 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 2 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 3 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 4 - * @run main/othervm/fail -Dsun.security.krb5.debug=false S4U2self krb5 5 - * @run main/othervm -Dsun.security.krb5.debug=false S4U2self spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 0 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 1 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 2 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 3 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 4 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self krb5 5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2self spnego */ import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2selfAsServer.java --- a/test/jdk/sun/security/krb5/auto/S4U2selfAsServer.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2selfAsServer.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 6355584 + * @bug 6355584 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2selfAsServer.java - * @run main/othervm S4U2selfAsServer krb5 - * @run main/othervm S4U2selfAsServer spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts S4U2selfAsServer krb5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts S4U2selfAsServer spnego */ import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2selfAsServerGSS.java --- a/test/jdk/sun/security/krb5/auto/S4U2selfAsServerGSS.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2selfAsServerGSS.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,17 @@ /* * @test - * @bug 6355584 + * @bug 6355584 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2selfAsServerGSS.java - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS krb5 - * @run main/othervm -Djavax.security.auth.useSubjectCredsOnly=false S4U2selfAsServerGSS spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djavax.security.auth.useSubjectCredsOnly=false + * S4U2selfAsServerGSS krb5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Djavax.security.auth.useSubjectCredsOnly=false + * S4U2selfAsServerGSS spnego */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/S4U2selfGSS.java --- a/test/jdk/sun/security/krb5/auto/S4U2selfGSS.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/S4U2selfGSS.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,15 @@ /* * @test - * @bug 6355584 + * @bug 6355584 8194486 * @summary Introduce constrained Kerberos delegation + * @library /test/lib * @compile -XDignore.symbol.file S4U2selfGSS.java - * @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS krb5 - * @run main/othervm -Dsun.security.krb5.debug=false S4U2selfGSS spnego + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2selfGSS krb5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts + * -Dsun.security.krb5.debug=false S4U2selfGSS spnego */ import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SPNEGO.java --- a/test/jdk/sun/security/krb5/auto/SPNEGO.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SPNEGO.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7040151 + * @bug 7040151 8194486 * @summary SPNEGO GSS code does not parse tokens in accordance to RFC 2478 + * @library /test/lib * @compile -XDignore.symbol.file SPNEGO.java - * @run main/othervm SPNEGO + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SPNEGO */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SSL.java --- a/test/jdk/sun/security/krb5/auto/SSL.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SSL.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,19 +23,32 @@ /* * @test - * @bug 6894643 6913636 8005523 8025123 + * @bug 6894643 6913636 8005523 8025123 8194486 * @summary Test JSSE Kerberos ciphersuite - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound - * @run main/othervm SSL TLS_KRB5_WITH_RC4_128_SHA unbound sni - * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_SHA - * @run main/othervm SSL TLS_KRB5_WITH_3DES_EDE_CBC_MD5 - * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_SHA - * @run main/othervm SSL TLS_KRB5_WITH_DES_CBC_MD5 - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_SHA - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_RC4_40_MD5 - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA - * @run main/othervm SSL TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_RC4_128_SHA + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_RC4_128_SHA unbound + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_RC4_128_SHA unbound sni + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_3DES_EDE_CBC_SHA + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_3DES_EDE_CBC_MD5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_DES_CBC_SHA + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_WITH_DES_CBC_MD5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_EXPORT_WITH_RC4_40_SHA + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_EXPORT_WITH_RC4_40_MD5 + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSL + * TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 */ import java.io.*; import java.security.Permission; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SSLwithPerms.java --- a/test/jdk/sun/security/krb5/auto/SSLwithPerms.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SSLwithPerms.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,11 @@ /* * @test - * @bug 8038089 + * @bug 8038089 8194486 * @summary TLS optional support for Kerberos cipher suites needs to be re-examined - * @library ../../../../java/security/testlibrary/ - * @run main/othervm SSLwithPerms + * @library ../../../../java/security/testlibrary/ /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SSLwithPerms */ import java.io.*; import javax.net.ssl.*; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SaslBasic.java --- a/test/jdk/sun/security/krb5/auto/SaslBasic.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SaslBasic.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +23,14 @@ /* * @test - * @bug 7110803 8170732 + * @bug 7110803 8170732 8194486 * @summary SASL service for multiple hostnames + * @library /test/lib * @compile -XDignore.symbol.file SaslBasic.java - * @run main/othervm SaslBasic bound auth-int - * @run main/othervm SaslBasic unbound auth-conf - * @run main/othervm SaslBasic bound auth + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SaslBasic bound auth-int + * @run main/othervm -Djdk.net.hosts.file=TestHosts SaslBasic unbound auth-conf + * @run main/othervm -Djdk.net.hosts.file=TestHosts SaslBasic bound auth */ import java.io.IOException; import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SaslGSS.java --- a/test/jdk/sun/security/krb5/auto/SaslGSS.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SaslGSS.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 8012082 8019267 + * @bug 8012082 8019267 8194486 * @summary SASL: auth-conf negotiated, but unencrypted data is accepted, * reset to unencrypt + * @library /test/lib * @compile -XDignore.symbol.file SaslGSS.java - * @run main/othervm SaslGSS + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SaslGSS */ import javax.security.auth.callback.Callback; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SaslUnbound.java --- a/test/jdk/sun/security/krb5/auto/SaslUnbound.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SaslUnbound.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,14 +23,16 @@ /* * @test - * @bug 8001104 + * @bug 8001104 8194486 * @summary Unbound SASL service: the GSSAPI/krb5 mech + * @library /test/lib * @compile -XDignore.symbol.file SaslUnbound.java - * @run main/othervm SaslUnbound 0 - * @run main/othervm/fail SaslUnbound 1 - * @run main/othervm/fail SaslUnbound 2 - * @run main/othervm/fail SaslUnbound 3 - * @run main/othervm/fail SaslUnbound 4 + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SaslUnbound 0 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts SaslUnbound 1 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts SaslUnbound 2 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts SaslUnbound 3 + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts SaslUnbound 4 */ import java.io.IOException; import java.util.Arrays; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SpnegoLifeTime.java --- a/test/jdk/sun/security/krb5/auto/SpnegoLifeTime.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SpnegoLifeTime.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 8000653 + * @bug 8000653 8194486 * @summary SPNEGO tests fail at context.getDelegCred().getRemainingInitLifetime(mechOid) + * @library /test/lib * @compile -XDignore.symbol.file SpnegoLifeTime.java - * @run main/othervm SpnegoLifeTime + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SpnegoLifeTime */ import org.ietf.jgss.Oid; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/SpnegoReqFlags.java --- a/test/jdk/sun/security/krb5/auto/SpnegoReqFlags.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/SpnegoReqFlags.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6815182 - * @run main/othervm SpnegoReqFlags + * @bug 6815182 8194486 * @summary GSSAPI/SPNEGO does not work with server using MIT Kerberos library + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts SpnegoReqFlags */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Test5653.java --- a/test/jdk/sun/security/krb5/auto/Test5653.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Test5653.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,9 +23,11 @@ /* * @test - * @bug 6895424 - * @run main/othervm Test5653 + * @bug 6895424 8194486 * @summary RFC 5653 + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Test5653 */ import org.ietf.jgss.GSSContext; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/TicketSName.java --- a/test/jdk/sun/security/krb5/auto/TicketSName.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/TicketSName.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,13 @@ /* * @test - * @bug 8178794 + * @bug 8178794 8194486 * @summary krb5 client should ignore sname in incoming tickets + * @library /test/lib * @compile -XDignore.symbol.file TicketSName.java - * @run main/othervm -Dtest.kdc.diff.sname TicketSName + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts -Dtest.kdc.diff.sname + * TicketSName */ import sun.security.jgss.GSSUtil; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/TwoOrThree.java --- a/test/jdk/sun/security/krb5/auto/TwoOrThree.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/TwoOrThree.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,14 +23,16 @@ /* * @test - * @bug 8005447 + * @bug 8005447 8194486 * @summary default principal can act as anyone + * @library /test/lib * @compile -XDignore.symbol.file TwoOrThree.java - * @run main/othervm TwoOrThree first first - * @run main/othervm/fail TwoOrThree first second - * @run main/othervm TwoOrThree - first - * @run main/othervm TwoOrThree - second - * @run main/othervm/fail TwoOrThree - third + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts TwoOrThree first first + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts TwoOrThree first second + * @run main/othervm -Djdk.net.hosts.file=TestHosts TwoOrThree - first + * @run main/othervm -Djdk.net.hosts.file=TestHosts TwoOrThree - second + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts TwoOrThree - third */ import java.nio.file.Files; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/TwoPrinces.java --- a/test/jdk/sun/security/krb5/auto/TwoPrinces.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/TwoPrinces.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 6894072 + * @bug 6894072 8194486 + * @summary always refresh keytab + * @library /test/lib * @compile -XDignore.symbol.file TwoPrinces.java - * @run main/othervm TwoPrinces - * @summary always refresh keytab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts TwoPrinces */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/TwoTab.java --- a/test/jdk/sun/security/krb5/auto/TwoTab.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/TwoTab.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7152176 + * @bug 7152176 8194486 * @summary More krb5 tests + * @library /test/lib * @compile -XDignore.symbol.file TwoTab.java - * @run main/othervm TwoTab + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts TwoTab */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/UnboundSSL.java --- a/test/jdk/sun/security/krb5/auto/UnboundSSL.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/UnboundSSL.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,15 @@ /* * @test - * @bug 8025123 + * @bug 8025123 8194486 * @summary Checks if an unbound server can handle connections * only for allowed service principals - * @run main/othervm/policy=unbound.ssl.policy UnboundSSL - * unbound.ssl.jaas.conf server_star - * @run main/othervm/policy=unbound.ssl.policy UnboundSSL - * unbound.ssl.jaas.conf server_multiple_principals + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm/policy=unbound.ssl.policy -Djdk.net.hosts.file=TestHosts + * UnboundSSL unbound.ssl.jaas.conf server_star + * @run main/othervm/policy=unbound.ssl.policy -Djdk.net.hosts.file=TestHosts + * UnboundSSL unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSL { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/UnboundSSLMultipleKeys.java --- a/test/jdk/sun/security/krb5/auto/UnboundSSLMultipleKeys.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/UnboundSSLMultipleKeys.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,11 +31,13 @@ /* * @test - * @bug 8025123 + * @bug 8025123 8194486 * @summary Checks if an unbound server pick up a correct key from keytab - * @run main/othervm UnboundSSLMultipleKeys + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundSSLMultipleKeys * unbound.ssl.jaas.conf server_star - * @run main/othervm UnboundSSLMultipleKeys + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundSSLMultipleKeys * unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSLMultipleKeys { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/UnboundSSLPrincipalProperty.java --- a/test/jdk/sun/security/krb5/auto/UnboundSSLPrincipalProperty.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/UnboundSSLPrincipalProperty.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,12 +30,14 @@ /* * @test - * @bug 8025123 + * @bug 8025123 8194486 * @summary Checks if an unbound server uses a service principal * from sun.security.krb5.principal system property if specified - * @run main/othervm UnboundSSLPrincipalProperty + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundSSLPrincipalProperty * unbound.ssl.jaas.conf server_star - * @run main/othervm UnboundSSLPrincipalProperty + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundSSLPrincipalProperty * unbound.ssl.jaas.conf server_multiple_principals */ public class UnboundSSLPrincipalProperty { diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/UnboundService.java --- a/test/jdk/sun/security/krb5/auto/UnboundService.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/UnboundService.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,17 +23,26 @@ /* * @test - * @bug 8001104 + * @bug 8001104 8194486 * @summary Unbound SASL service: the GSSAPI/krb5 mech + * @library /test/lib * @compile -XDignore.symbol.file UnboundService.java - * @run main/othervm UnboundService null null - * @run main/othervm UnboundService server/host.rabbit.hole null - * @run main/othervm UnboundService server/host.rabbit.hole@RABBIT.HOLE null - * @run main/othervm/fail UnboundService backend/host.rabbit.hole null - * @run main/othervm UnboundService null server@host.rabbit.hole - * @run main/othervm UnboundService server/host.rabbit.hole server@host.rabbit.hole - * @run main/othervm UnboundService server/host.rabbit.hole@RABBIT.HOLE server@host.rabbit.hole - * @run main/othervm/fail UnboundService backend/host.rabbit.hole server@host.rabbit.hole + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService null null + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService + * server/host.rabbit.hole null + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService + * server/host.rabbit.hole@RABBIT.HOLE null + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts UnboundService + * backend/host.rabbit.hole null + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService + * null server@host.rabbit.hole + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService + * server/host.rabbit.hole server@host.rabbit.hole + * @run main/othervm -Djdk.net.hosts.file=TestHosts UnboundService + * server/host.rabbit.hole@RABBIT.HOLE server@host.rabbit.hole + * @run main/othervm/fail -Djdk.net.hosts.file=TestHosts UnboundService + * backend/host.rabbit.hole server@host.rabbit.hole */ import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/Unreachable.java --- a/test/jdk/sun/security/krb5/auto/Unreachable.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/Unreachable.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +23,12 @@ /* * @test - * @bug 7162687 8015595 + * @bug 7162687 8015595 8194486 * @summary enhance KDC server availability detection + * @library /test/lib * @compile -XDignore.symbol.file Unreachable.java - * @run main/othervm Unreachable + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts Unreachable */ import java.net.PortUnreachableException; import java.net.SocketTimeoutException; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/UseCacheAndStoreKey.java --- a/test/jdk/sun/security/krb5/auto/UseCacheAndStoreKey.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/UseCacheAndStoreKey.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 7201053 + * @bug 7201053 8194486 * @summary Krb5LoginModule shows NPE when both useTicketCache and storeKey * are set to true + * @library /test/lib * @compile -XDignore.symbol.file UseCacheAndStoreKey.java - * @run main/othervm UseCacheAndStoreKey + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -Djdk.net.hosts.file=TestHosts UseCacheAndStoreKey */ import java.io.FileOutputStream; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/W83.java --- a/test/jdk/sun/security/krb5/auto/W83.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/W83.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +23,13 @@ /* * @test - * @bug 6932525 6951366 6959292 + * @bug 6932525 6951366 6959292 8194486 * @summary kerberos login failure on win2008 with AD set to win2000 compat mode * and cannot login if session key and preauth does not use the same etype - * @run main/othervm -D6932525 W83 - * @run main/othervm -D6959292 W83 + * @library /test/lib + * @run main jdk.test.lib.FileInstaller TestHosts TestHosts + * @run main/othervm -D6932525 -Djdk.net.hosts.file=TestHosts W83 + * @run main/othervm -D6959292 -Djdk.net.hosts.file=TestHosts W83 */ import com.sun.security.auth.module.Krb5LoginModule; import java.io.File; diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/principalProperty/TestHosts --- a/test/jdk/sun/security/krb5/auto/principalProperty/TestHosts Tue Jan 30 11:53:00 2018 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -127.0.0.1 localhost diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/auto/rcache_usemd5.sh --- a/test/jdk/sun/security/krb5/auto/rcache_usemd5.sh Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/auto/rcache_usemd5.sh Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,13 @@ # # @test -# @bug 8168518 -# @library ../../../../java/security/testlibrary/ /test/lib -# @build jdk.test.lib.Platform -# @run main/othervm/timeout=300 -Djdk.krb5.rcache.useMD5=true -# -Dtest.service=host ReplayCacheTestProc +# @bug 8168518 8194486 # @summary testing jdk.krb5.rcache.useMD5. This action is put in a separate # test so that ReplayCacheTestProc.java can be launched with special # test.* system properties easily. +# @library ../../../../java/security/testlibrary/ /test/lib +# @build jdk.test.lib.Platform +# @run main jdk.test.lib.FileInstaller TestHosts TestHosts +# @run main/othervm/timeout=300 -Djdk.krb5.rcache.useMD5=true +# -Djdk.net.hosts.file=TestHosts +# -Dtest.service=host ReplayCacheTestProc diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/config/Include.java --- a/test/jdk/sun/security/krb5/config/Include.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/config/Include.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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 8029994 8177085 + * @bug 8029994 8177085 8177398 * @summary Support "include" and "includedir" in krb5.conf * @modules java.security.jgss/sun.security.krb5 * @compile -XDignore.symbol.file Include.java @@ -53,6 +53,7 @@ Path df2 = Paths.get("d/f2"); // another file Path df3 = Paths.get("d/f.3"); // third file bad name Path df4 = Paths.get("d/f4.conf"); // fourth file + Path df5 = Paths.get("d/.f5.conf"); // fifth file is dotfile // OK: The base file can be missing System.setProperty("java.security.krb5.conf", "no-such-file"); @@ -103,6 +104,8 @@ Files.write(ddf, (krb5Conf + "ddf").getBytes()); // fx4 will be loaded Files.write(df4, (krb5Conf + "df4").getBytes()); + // fx5 will be excluded + Files.write(df5, (krb5Conf + "df5").getBytes()); // OK: All good files read tryReload(true); diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/sun/security/krb5/etype/ETypeOrder.java --- a/test/jdk/sun/security/krb5/etype/ETypeOrder.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/sun/security/krb5/etype/ETypeOrder.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -38,7 +38,7 @@ int[] etypes = EType.getBuiltInDefaults(); // Reference order, note that 2 is not implemented in Java - int correct[] = { 18, 17, 16, 23, 1, 3, 2 }; + int correct[] = { 18, 17, 20, 19, 16, 23, 1, 3, 2 }; int match = 0; loopi: for (int i=0; i= 256; + + // Sample results for string-to-key conversion: + char[] pass = "password".toCharArray(); + byte[] salt = cat( + hex("10 DF 9D D7 83 E5 BC 8A CE A1 73 0E 74 35 5F 61"), + "ATHENA.MIT.EDUraeburn".getBytes()); + + check(stringToKey(dk128, pass, salt, null), + hex("08 9B CA 48 B1 05 EA 6E A7 7C A5 D2 F3 9D C5 E7")); + + check(stringToKey(dk256, pass, salt, null), + hex("45 BD 80 6D BF 6A 83 3A 9C FF C1 C9 45 89 A2 22\n" + + "36 7A 79 BC 21 C4 13 71 89 06 E9 F5 78 A7 84 67")); + + // Sample results for key derivation: + byte[] bk16 = hex("37 05 D9 60 80 C1 77 28 A0 E8 00 EA B6 E0 D2 3C"); + + check(deriveKey(dk128, bk16, 2, (byte) 0x99), + hex("B3 1A 01 8A 48 F5 47 76 F4 03 E9 A3 96 32 5D C3")); + check(deriveKey(dk128, bk16, 2, (byte) 0xaa), + hex("9B 19 7D D1 E8 C5 60 9D 6E 67 C3 E3 7C 62 C7 2E")); + check(deriveKey(dk128, bk16, 2, (byte) 0x55), + hex("9F DA 0E 56 AB 2D 85 E1 56 9A 68 86 96 C2 6A 6C")); + + byte[] bk32 = hex( + "6D 40 4D 37 FA F7 9F 9D F0 D3 35 68 D3 20 66 98\n" + + "00 EB 48 36 47 2E A8 A0 26 D1 6B 71 82 46 0C 52"); + + check(deriveKey(dk256, bk32, 2, (byte) 0x99), hex( + "EF 57 18 BE 86 CC 84 96 3D 8B BB 50 31 E9 F5 C4\n" + + "BA 41 F2 8F AF 69 E7 3D")); + check(deriveKey(dk256, bk32, 2, (byte) 0xaa), hex( + "56 AB 22 BE E6 3D 82 D7 BC 52 27 F6 77 3F 8E A7\n" + + "A5 EB 1C 82 51 60 C3 83 12 98 0C 44 2E 5C 7E 49")); + check(deriveKey(dk256, bk32, 2, (byte) 0x55), hex( + "69 B1 65 14 E3 CD 8E 56 B8 20 10 D5 C7 30 12 B6\n" + + "22 C4 D0 0F FC 23 ED 1F")); + + // Sample encryptions (all using the default cipher state): + + check(enc(dk128, hex("7E 58 95 EA F2 67 24 35 BA D8 17 F5 45 A3 71 48"), + bk16, hex("")), + hex("EF 85 FB 89 0B B8 47 2F 4D AB 20 39 4D CA 78 1D\n" + + "AD 87 7E DA 39 D5 0C 87 0C 0D 5A 0A 8E 48 C7 18")); + + check(enc(dk128, hex("7B CA 28 5E 2F D4 13 0F B5 5B 1A 5C 83 BC 5B 24"), + bk16, hex("00 01 02 03 04 05")), + hex("84 D7 F3 07 54 ED 98 7B AB 0B F3 50 6B EB 09 CF\n" + + "B5 54 02 CE F7 E6 87 7C E9 9E 24 7E 52 D1 6E D4\n" + + "42 1D FD F8 97 6C")); + + check(enc(dk128, hex("56 AB 21 71 3F F6 2C 0A 14 57 20 0F 6F A9 94 8F"), + bk16, hex("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F")), + hex("35 17 D6 40 F5 0D DC 8A D3 62 87 22 B3 56 9D 2A\n" + + "E0 74 93 FA 82 63 25 40 80 EA 65 C1 00 8E 8F C2\n" + + "95 FB 48 52 E7 D8 3E 1E 7C 48 C3 7E EB E6 B0 D3")); + + check(enc(dk128, hex("A7 A4 E2 9A 47 28 CE 10 66 4F B6 4E 49 AD 3F AC"), + bk16, hex("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n" + + "10 11 12 13 14")), + hex("72 0F 73 B1 8D 98 59 CD 6C CB 43 46 11 5C D3 36\n" + + "C7 0F 58 ED C0 C4 43 7C 55 73 54 4C 31 C8 13 BC\n" + + "E1 E6 D0 72 C1 86 B3 9A 41 3C 2F 92 CA 9B 83 34\n" + + "A2 87 FF CB FC\n")); + + if (aes256ok) { + check(enc(dk256, hex("F7 64 E9 FA 15 C2 76 47 8B 2C 7D 0C 4E 5F 58 E4"), + bk32, hex("")), + hex("41 F5 3F A5 BF E7 02 6D 91 FA F9 BE 95 91 95 A0\n" + + "58 70 72 73 A9 6A 40 F0 A0 19 60 62 1A C6 12 74\n" + + "8B 9B BF BE 7E B4 CE 3C\n")); + + check(enc(dk256, hex("B8 0D 32 51 C1 F6 47 14 94 25 6F FE 71 2D 0B 9A"), + bk32, hex("00 01 02 03 04 05")), + hex("4E D7 B3 7C 2B CA C8 F7 4F 23 C1 CF 07 E6 2B C7\n" + + "B7 5F B3 F6 37 B9 F5 59 C7 F6 64 F6 9E AB 7B 60\n" + + "92 23 75 26 EA 0D 1F 61 CB 20 D6 9D 10 F2\n")); + + check(enc(dk256, hex("53 BF 8A 0D 10 52 65 D4 E2 76 42 86 24 CE 5E 63"), + bk32, hex("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F")), + hex("BC 47 FF EC 79 98 EB 91 E8 11 5C F8 D1 9D AC 4B\n" + + "BB E2 E1 63 E8 7D D3 7F 49 BE CA 92 02 77 64 F6\n" + + "8C F5 1F 14 D7 98 C2 27 3F 35 DF 57 4D 1F 93 2E\n" + + "40 C4 FF 25 5B 36 A2 66\n")); + + check(enc(dk256, hex("76 3E 65 36 7E 86 4F 02 F5 51 53 C7 E3 B5 8A F1"), + bk32, hex("00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n" + + "10 11 12 13 14")), + hex("40 01 3E 2D F5 8E 87 51 95 7D 28 78 BC D2 D6 FE\n" + + "10 1C CF D5 56 CB 1E AE 79 DB 3C 3E E8 64 29 F2\n" + + "B2 A6 02 AC 86 FE F6 EC B6 47 D6 29 5F AE 07 7A\n" + + "1F EB 51 75 08 D2 C1 6B 41 92 E0 1F 62\n")); + } + + // Sample checksums: + + byte[] msg = hex( + "00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\n" + + "10 11 12 13 14"); + + check(checksum(dk128, bk16, msg), hex( + "D7 83 67 18 66 43 D6 7B 41 1C BA 91 39 FC 1D EE")); + + check(checksum(dk256, bk32, msg), hex( + "45 EE 79 15 67 EE FC A3 7F 4A C1 E0 22 2D E8 0D\n" + + "43 C3 BF A0 66 99 67 2A")); + + // Sample pseudorandom function (PRF) invocations: + // Java does not support PRF. Skipped. + } + + private static byte[] stringToKey(AesSha2DkCrypto dk, + char[] pass, byte[] salt, byte[] params) throws Exception { + Method m = AesSha2DkCrypto.class.getDeclaredMethod("stringToKey", + char[].class, byte[].class, byte[].class); + m.setAccessible(true); + return (byte[])m.invoke(dk, pass, salt, params); + } + + private static byte[] deriveKey(AesSha2DkCrypto dk, byte[] baseKey, + int usage, byte type) throws Exception { + Method m = AesSha2DkCrypto.class.getDeclaredMethod("deriveKey", + byte[].class, int.class, byte.class); + m.setAccessible(true); + return (byte[]) m.invoke(dk, baseKey, usage, type); + } + + private static byte[] cat(byte[] b1, byte[] b2) { + byte[] result = Arrays.copyOf(b1, b1.length + b2.length); + System.arraycopy(b2, 0, result, b1.length, b2.length); + return result; + } + + private static byte[] enc(AesSha2DkCrypto dk, byte[] confounder, + byte[] bk, byte[] text) throws Exception { + return dk.encryptRaw(bk, 2, new byte[16], cat(confounder, text), + 0, confounder.length + text.length); + } + + private static byte[] checksum(AesSha2DkCrypto dk, byte[] baseKey, byte[] text) + throws Exception { + return dk.calculateChecksum(baseKey, 2, text, 0, text.length); + } + + private static byte[] hex(String var) { + var = var.replaceAll("\\s", ""); + byte[] data = new byte[var.length()/2]; + for (int i=0; i + // Version: NSS + // Here, stands for NSS version. static double getNSSInfo(String library) { // look for two types of headers in NSS libraries String nssHeader1 = "$Header: NSS"; @@ -417,7 +423,7 @@ read = 100 + is.read(data, 100, 900); } - s = new String(data, 0, read); + s = new String(data, 0, read, StandardCharsets.US_ASCII); i = s.indexOf(nssHeader1); if (i > 0 || (i = s.indexOf(nssHeader2)) > 0) { found = true; @@ -443,18 +449,13 @@ // the index after whitespace after nssHeader int afterheader = s.indexOf("NSS", i) + 4; - int nextSpaceIndex = s.indexOf(' ', afterheader); - - // If the next space is not found, - // it has to print the content for further investigation. - if (nextSpaceIndex == -1) { - System.out.println("===== Content start ====="); - System.out.println(s); - System.out.println("===== Content end ====="); + String version = String.valueOf(s.charAt(afterheader)); + for (char c = s.charAt(++afterheader); + c == '.' || (c >= '0' && c <= '9'); + c = s.charAt(++afterheader)) { + version += c; } - String version = s.substring(afterheader, nextSpaceIndex); - // If a "dot dot" release, strip the extra dots for double parsing String[] dot = version.split("\\."); if (dot.length > 2) { @@ -468,6 +469,9 @@ try { nss_version = Double.parseDouble(version); } catch (NumberFormatException e) { + System.out.println("===== Content start ====="); + System.out.println(s); + System.out.println("===== Content end ====="); System.out.println("Failed to parse lib" + library + " version. Set to 0.0"); e.printStackTrace(); diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/DefaultProviderTest.java --- a/test/jdk/tools/jlink/DefaultProviderTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/DefaultProviderTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,6 +40,7 @@ * @test * @summary Test plugins enabled by default * @author Jean-Francois Denise + * @requires vm.compMode != "Xcomp" * @library ../lib * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/JLinkPluginsTest.java --- a/test/jdk/tools/jlink/JLinkPluginsTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/JLinkPluginsTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,6 +33,7 @@ * @test * @summary Test image creation * @author Jean-Francois Denise + * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../lib * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/JLinkTest.java --- a/test/jdk/tools/jlink/JLinkTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/JLinkTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * 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,6 +44,7 @@ * @summary Test image creation * @bug 8189777 * @author Jean-Francois Denise + * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../lib * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/JLinkToolProviderTest.java --- a/test/jdk/tools/jlink/JLinkToolProviderTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/JLinkToolProviderTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ /* * @test + * @modules jdk.jlink * @build JLinkToolProviderTest * @run main/othervm/java.security.policy=toolprovider.policy JLinkToolProviderTest */ diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java --- a/test/jdk/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/multireleasejar/JLinkMultiReleaseJarTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,10 @@ * @library /test/lib * @modules java.base/jdk.internal.jimage * java.base/jdk.internal.module + * jdk.compiler + * jdk.jartool + * jdk.jlink + * jdk.zipfs * @build jdk.test.lib.Utils * jdk.test.lib.Asserts * jdk.test.lib.JDKToolFinder diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java --- a/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/jlink/plugins/IncludeLocalesPluginTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ * @bug 8152143 8152704 8155649 8165804 8185841 8176841 8190918 * @summary IncludeLocalesPlugin tests * @author Naoto Sato + * @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) * @library ../../lib * @modules java.base/jdk.internal.jimage * jdk.jdeps/com.sun.tools.classfile diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/launcher/HelpFlagsTest.java --- a/test/jdk/tools/launcher/HelpFlagsTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/launcher/HelpFlagsTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -73,7 +73,13 @@ // mentioned in the help text. "kinit", "klist", - "ktab" + "ktab", + // Oracle proprietary tools without help message. + "javacpl", + "jmc", + "jweblauncher", + "jcontrol", + "ssvagent" }; // Lists which tools support which flags. @@ -113,12 +119,7 @@ // that way. int exitcodeOfWrongFlag; - // Some tools accept the invalid argument and thus hang the test. - // Don't execute these with the wrong flags. - // This actually should be considered a bug in the corresponding tool. - boolean dontExecuteWithWrongFlags; - - ToolHelpSpec(String n, int q, int h, int hp, int ex1, int l, int dl, int ex2, int hangs) { + ToolHelpSpec(String n, int q, int h, int hp, int ex1, int l, int dl, int ex2) { toolname = n; supportsQuestionMark = ( q == 1 ? true : false ); supportsH = ( h == 1 ? true : false ); @@ -128,48 +129,48 @@ supportsLegacyHelp = ( l == 1 ? true : false ); documentsLegacyHelp = ( dl == 1 ? true : false ); exitcodeOfWrongFlag = ex2; - - dontExecuteWithWrongFlags = ( hangs == 1 ? true : false ); } } static ToolHelpSpec[] jdkTools = { - // name -? -h --help exitcode -help -help exitcode Don't - // of help docu of wrong test - // mented flag inv flag - new ToolHelpSpec("jabswitch", 0, 0, 0, 0, 0, 0, 0, 0), // /?, prints help message anyways, win only - new ToolHelpSpec("jaotc", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help - new ToolHelpSpec("jar", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help - new ToolHelpSpec("jarsigner", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("java", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, Documents -help - new ToolHelpSpec("javac", 1, 0, 1, 0, 1, 1, 2, 0), // -?, --help -help, Documents -help, -h is already taken for "native header output directory". - new ToolHelpSpec("javadoc", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, Documents -help - new ToolHelpSpec("javap", 1, 1, 1, 0, 1, 1, 2, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("javaw", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help -help, win only - new ToolHelpSpec("jcmd", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jdb", 1, 1, 1, 0, 1, 1, 0, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jdeprscan", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help - new ToolHelpSpec("jdeps", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jhsdb", 0, 0, 0, 0, 0, 0, 0, 0), // none, prints help message anyways. - new ToolHelpSpec("jimage", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help - new ToolHelpSpec("jinfo", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jjs", 0, 1, 1, 100, 0, 0, 100, 0), // -h, --help, return code 100 - new ToolHelpSpec("jlink", 1, 1, 1, 0, 0, 0, 2, 0), // -?, -h, --help - new ToolHelpSpec("jmap", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jmod", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jps", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jrunscript", 1, 1, 1, 0, 1, 1, 7, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jshell", 1, 1, 1, 0, 1, 0, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jstack", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jstat", 1, 1, 1, 0, 1, 1, 1, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("jstatd", 1, 1, 1, 0, 0, 0, 1, 0), // -?, -h, --help - new ToolHelpSpec("keytool", 1, 1, 1, 0, 1, 0, 1, 0), // none, prints help message anyways. - new ToolHelpSpec("pack200", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented. - new ToolHelpSpec("rmic", 0, 0, 0, 0, 0, 0, 1, 0), // none, pirnts help message anyways. - new ToolHelpSpec("rmid", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways. - new ToolHelpSpec("rmiregistry", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways. - new ToolHelpSpec("serialver", 0, 0, 0, 0, 0, 0, 1, 0), // none, prints help message anyways. - new ToolHelpSpec("unpack200", 1, 1, 1, 0, 1, 0, 2, 0), // -?, -h, --help, -help accepted but not documented. + // name -? -h --help exitcode -help -help exitcode + // of help docu of wrong + // mented flag + new ToolHelpSpec("jabswitch", 0, 0, 0, 0, 0, 0, 0), // /?, prints help message anyways, win only + new ToolHelpSpec("jaotc", 1, 1, 1, 0, 0, 0, 2), // -?, -h, --help + new ToolHelpSpec("jar", 1, 1, 1, 0, 0, 0, 1), // -?, -h, --help + new ToolHelpSpec("jarsigner", 1, 1, 1, 0, 1, 0, 1), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("java", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("javac", 1, 0, 1, 0, 1, 1, 2), // -?, --help -help, Documents -help, -h is already taken for "native header output directory". + new ToolHelpSpec("javadoc", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("javap", 1, 1, 1, 0, 1, 1, 2), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("javaw", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help, win only + new ToolHelpSpec("jcmd", 1, 1, 1, 0, 1, 0, 1), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("jdb", 1, 1, 1, 0, 1, 1, 0), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jdeprscan", 1, 1, 1, 0, 0, 0, 1), // -?, -h, --help + new ToolHelpSpec("jdeps", 1, 1, 1, 0, 1, 0, 2), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("jhsdb", 0, 0, 0, 0, 0, 0, 0), // none, prints help message anyways. + new ToolHelpSpec("jimage", 1, 1, 1, 0, 0, 0, 2), // -?, -h, --help + new ToolHelpSpec("jinfo", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jjs", 0, 1, 1, 100, 0, 0, 100), // -h, --help, return code 100 + new ToolHelpSpec("jlink", 1, 1, 1, 0, 0, 0, 2), // -?, -h, --help + new ToolHelpSpec("jmap", 1, 1, 1, 0, 1, 0, 1), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("jmod", 1, 1, 1, 0, 1, 0, 2), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("jps", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jrunscript", 1, 1, 1, 0, 1, 1, 7), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jshell", 1, 1, 1, 0, 1, 0, 1), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("jstack", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jstat", 1, 1, 1, 0, 1, 1, 1), // -?, -h, --help -help, Documents -help + new ToolHelpSpec("jstatd", 1, 1, 1, 0, 0, 0, 1), // -?, -h, --help + new ToolHelpSpec("keytool", 1, 1, 1, 0, 1, 0, 1), // none, prints help message anyways. + new ToolHelpSpec("pack200", 1, 1, 1, 0, 1, 0, 2), // -?, -h, --help, -help accepted but not documented. + new ToolHelpSpec("rmic", 0, 0, 0, 0, 0, 0, 1), // none, pirnts help message anyways. + new ToolHelpSpec("rmid", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. + new ToolHelpSpec("rmiregistry", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. + new ToolHelpSpec("serialver", 0, 0, 0, 0, 0, 0, 1), // none, prints help message anyways. + new ToolHelpSpec("unpack200", 1, 1, 1, 0, 1, 0, 2), // -?, -h, --help, -help accepted but not documented. + // Oracle proprietary tools: + new ToolHelpSpec("javapackager",0, 0, 0, 0, 1, 0, 255), // -help accepted but not documented. }; // Returns true if the file is not a tool. @@ -400,18 +401,14 @@ // Check that the return code listing in jdkTools[] is // correct for an invalid flag. - if (!tool.dontExecuteWithWrongFlags) { - errorMessage += testInvalidFlag(f, "-asdfxgr", tool.exitcodeOfWrongFlag, tool.documentsLegacyHelp); - } + errorMessage += testInvalidFlag(f, "-asdfxgr", tool.exitcodeOfWrongFlag, tool.documentsLegacyHelp); // Test for legacy -help flag. if (!tool.documentsLegacyHelp) { if (tool.supportsLegacyHelp == true) { errorMessage += testLegacyFlag(f, tool.exitcodeOfHelp); } else { - if (!tool.dontExecuteWithWrongFlags) { - errorMessage += testInvalidFlag(f, "-help", tool.exitcodeOfWrongFlag, false); - } + errorMessage += testInvalidFlag(f, "-help", tool.exitcodeOfWrongFlag, false); } } } diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java --- a/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/launcher/modules/addexports/manifest/AddExportsAndOpensInManifest.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ * manifest of a main application JAR */ +import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -41,6 +42,7 @@ import jdk.testlibrary.OutputAnalyzer; import jdk.testlibrary.ProcessTools; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import static org.testng.Assert.*; @@ -48,6 +50,15 @@ @Test public class AddExportsAndOpensInManifest { + private String testName; + private int testCaseNum; + + @BeforeMethod + public void getTestName(Method m){ + testName = m.getName(); + testCaseNum = 0; + } + /** * Package Test1 and Test2 into a JAR file with the given attributes * in the JAR manifest, then execute the JAR file with `java -jar`. @@ -67,7 +78,7 @@ } // create the JAR file with Test1 and Test2 - Path jarfile = Paths.get("test.jar"); + Path jarfile = Paths.get(String.format("%s-%s.jar", testName, ++testCaseNum)); Files.deleteIfExists(jarfile); Path classes = Paths.get(System.getProperty("test.classes", "")); @@ -172,5 +183,4 @@ attrs = "Main-Class=Test1,Add-Opens=java.base/jdk.internal.DoesNotExit"; runExpectingFail(attrs, "IllegalAccessError"); } - } diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/pack200/ModuleAttributes.java --- a/test/jdk/tools/pack200/ModuleAttributes.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/pack200/ModuleAttributes.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,8 @@ * @test * @bug 8048100 * @summary test the new Module attributes + * @modules jdk.compiler + * jdk.zipfs * @compile -XDignore.symbol.file Utils.java ModuleAttributes.java * @run main ModuleAttributes */ diff -r fb62f481671e -r 2d03ebb72df2 test/jdk/tools/pack200/Pack200Props.java --- a/test/jdk/tools/pack200/Pack200Props.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/jdk/tools/pack200/Pack200Props.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,8 @@ * @test * @bug 6575373 6969063 * @summary verify default properties of the packer/unpacker and segment limit + * @modules jdk.compiler + * jdk.zipfs * @compile -XDignore.symbol.file Utils.java Pack200Props.java * @run main Pack200Props * @author ksrini diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/AccessAsciiArt/AccessAsciiArt.java --- a/test/langtools/jdk/javadoc/doclet/AccessAsciiArt/AccessAsciiArt.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/AccessAsciiArt/AccessAsciiArt.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,9 +48,9 @@ checkOutput("p1/subpkg/SSC.html", true, // Test the top line of the class tree - "

  • p1.C
  • ", + "
  • p1.C
  • ", // Test the second line of the class tree - "
  • p1.SC
  • ", + "
  • p1.SC
  • ", // Test the third line of the class tree "
  • p1.subpkg.SSC
  • "); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java --- a/test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,63 +82,63 @@ // Test some fields checkOutput("pkg1/RegClass.html", true, "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - ""); + ""); checkOutput("pkg1/DeprMemClass.html", true, "", - ""); + ""); // Test constructor checkOutput("pkg1/RegClass.html", true, "", - ""); + ""); // Test some methods checkOutput("pkg1/RegClass.html", true, "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - ""); + ""); checkOutput("pkg1/DeprMemClass.html", true, "", - ""); + ""); // Test enum checkOutput("pkg1/RegClass.Te$t_Enum.html", true, "", - ""); + ""); // Test nested class checkOutput("pkg1/RegClass._NestedClas$.html", true, "", - ""); + ""); // Test class use page checkOutput("pkg1/class-use/DeprMemClass.html", true, - ""); + ""); // Test deprecated list page checkOutput("deprecated-list.html", true, @@ -201,63 +201,63 @@ // Test some fields checkOutput("pkg1/RegClass.html", true, "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - ""); + ""); checkOutput("pkg1/DeprMemClass.html", true, "", - ""); + ""); // Test constructor checkOutput("pkg1/RegClass.html", true, "", - ""); + ""); // Test some methods checkOutput("pkg1/RegClass.html", true, "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - "", + "", "", - ""); + ""); checkOutput("pkg1/DeprMemClass.html", true, "", - ""); + ""); // Test enum checkOutput("pkg1/RegClass.Te$t_Enum.html", true, "", - ""); + ""); // Test nested class checkOutput("pkg1/RegClass._NestedClas$.html", true, "", - ""); + ""); // Test class use page checkOutput("pkg1/class-use/DeprMemClass.html", true, - ""); + ""); // Test deprecated list page checkOutput("deprecated-list.html", true, @@ -320,10 +320,10 @@ ""); checkOutput("p/Ref.html", true, - "àé", - "ÀÉ", - "αβγ", - "ΑΒΓ"); + "àé", + "ÀÉ", + "αβγ", + "ΑΒΓ"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java --- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * 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,8 +56,7 @@ + "field.detail\">Field | ", "", "

    Field Summary

    ", - "DEFAULT_NAME" + "DEFAULT_NAME" + "", "", "

    DEFAULT_NAME

    \n" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java --- a/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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,38 +50,38 @@ checkExit(Exit.OK); checkOutput("p/C1.html", true, - "C2", - "C1()"); + "C2", + "C1()"); checkOutput("p/C2.html", true, - "C3", - "C2()"); + "C3", + "C2()"); checkOutput("p/C3.html", true, - "I1, " - + "I12, " - + "I2, " - + "IT1<T>, " - + "IT2<java.lang.String>", - "C3()"); + "I1, " + + "I12, " + + "I2, " + + "IT1<T>, " + + "IT2<java.lang.String>", + "C3()"); checkOutput("p/I1.html", true, - "C3", - "I12"); + "C3", + "I12"); checkOutput("p/I2.html", true, - "C3", - "I12"); + "C3", + "I12"); checkOutput("p/I12.html", true, - "C3", - "I1, I2"); + "C3", + "I1, I2"); checkOutput("p/IT1.html", true, - "C3"); + "C3"); checkOutput("p/IT2.html", true, - "code>C3
    "); + "code>C3"); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java --- a/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * 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,11 +51,11 @@ checkOutput("pkg/package-tree.html", true, ""); checkOutput("pkg/package-tree.html", false, - "
  • class pkg.class pkg.ParentClass
  • "); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java --- a/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testConstructors/TestConstructors.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,31 +48,31 @@ checkOutput("pkg1/Outer.html", true, "
    See Also:
    \n" - + "
    Inner(), \n" - + "Inner(int), \n" - + "NestedInner(), \n" - + "NestedInner(int), \n" - + "Outer(), \n" - + "Outer(int)", - "Link: Inner(), " - + "Outer(int), " - + "" + + "
    Inner(), \n" + + "Inner(int), \n" + + "NestedInner(), \n" + + "NestedInner(int), \n" + + "Outer(), \n" + + "Outer(int)", + "Link: Inner(), " + + "Outer(int), " + + "" + "NestedInner(int)", - "Outer()", + "Outer()", "", - "Outer​(int i)", + "Outer​(int i)", ""); checkOutput("pkg1/Outer.Inner.html", true, - "Inner()", + "Inner()", "", - "Inner​(int i)", + "Inner​(int i)", ""); checkOutput("pkg1/Outer.Inner.NestedInner.html", true, - "NestedInner()", + "NestedInner()", "", - "NestedInner​(int i)", + "NestedInner​(int i)", ""); checkOutput("pkg1/Outer.Inner.html", false, @@ -84,9 +84,9 @@ "Outer.Inner.NestedInner-int-"); checkOutput("pkg1/Outer.html", false, - "Outer.Inner()", - "Outer.Inner(int)", - "Outer.Inner.NestedInner()", - "Outer.Inner.NestedInner(int)"); + "Outer.Inner()", + "Outer.Inner(int)", + "Outer.Inner.NestedInner()", + "Outer.Inner.NestedInner(int)"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java --- a/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java Tue Jan 30 09:03:47 2018 -0800 @@ -54,18 +54,18 @@ "phi-TOP-phi", // check top navbar "Module", - "Package", + "Package", "Tree", "Deprecated", "Index", "phi-HEADER-phi", "In a named module acme.module and named package " - + "p.", + + "p.", "\"simpleTagLabel\">Since:Module", - "Package", + "Package", "Tree", "Deprecated", "Index", @@ -91,18 +91,18 @@ "phi-TOP-phi", // check top navbar "Module", - "Package", + "Package", "Tree", "Deprecated", "Index", "phi-HEADER-phi", "In a named module acme.module and named package " - + "p.", + + "p.", "\"simpleTagLabel\">Since:Module", - "Package", + "Package", "Tree", "Deprecated", "Index", @@ -116,7 +116,7 @@ "phi-TOP-phi", // check top navbar "Module", - "Package", + "Package", "Tree", "Deprecated", "Index", @@ -124,7 +124,7 @@ "SubSubReadme.html at third level of doc-file directory.", // check bottom navbar "Module", - "Package", + "Package", "Tree", "Deprecated", "Index", @@ -141,7 +141,7 @@ checkExit(Exit.OK); checkOutput("p/doc-files/inpackage.html", true, "In a named module acme.module and named package " - + "p." + + "p." ); } @@ -155,7 +155,7 @@ checkExit(Exit.OK); checkOutput("p/doc-files/inpackage.html", true, "In a named module acme.module and named package " - + "p." + + "p." ); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java --- a/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testDeprecatedDocs/TestDeprecatedDocs.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -158,12 +158,12 @@ "
    \n" + "
    @Deprecated(forRemoval=true)\n"
                     + "public enum TestEnum\n"
    -                + "extends java.lang.Enum<TestEnum>
    \n" + + "extends java.lang.Enum<TestEnum>\n" + "
    Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
    enum_test1 passes.
    \n" + "
    ", "
    @Deprecated(forRemoval=true)\n"
    -                + "public static final TestEnum FOR_REMOVAL
    \n" + + "public static final TestEnum FOR_REMOVAL\n" + "
    Deprecated, for removal: This API element is subject to removal in a future version.\n" + "
    enum_test3 passes.
    \n" + "
    "); diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testDocPaths/TestDocPaths.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/langtools/jdk/javadoc/doclet/testDocPaths/TestDocPaths.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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 8195796 + * @summary Add normalize and relative methods to DocPath + * @library /tools/lib + * @modules jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util + * @build toolbox.TestRunner + * @run main TestDocPaths + */ + +import jdk.javadoc.internal.doclets.toolkit.util.DocPath; +import toolbox.TestRunner; + +public class TestDocPaths extends TestRunner { + + public static void main(String... args) throws Exception { + TestDocPaths tester = new TestDocPaths(); + tester.runTests(); + } + + TestDocPaths() { + super(System.err); + } + + @Test + public void testNormalize() { + testNormalize("", ""); + testNormalize(".", ""); + testNormalize("a/b", "a/b"); + testNormalize("a//b", "a/b"); + testNormalize("./b", "b"); + testNormalize("a/.", "a"); + testNormalize("a/./b", "a/b"); + testNormalize("../b", "../b"); + testNormalize("a/..", ""); + testNormalize("a/../b", "b"); + testNormalize("a/../../b", "../b"); + testNormalize("a/./../b", "b"); + testNormalize("./../b", "../b"); + testNormalize("a/./../b", "b"); + } + + private void testNormalize(String p, String expect) { + out.println("test " + p); + String found = DocPath.create(p).normalize().getPath(); + out.println(" result: " + found); + if (!expect.equals(found)) { + error("Mismatch:\n" + + " expect: " + expect); + } + out.println(); + } + + @Test + public void testRelativize() { + testRelativize("a/b/c/file.html", "file.html", ""); + testRelativize("a/b/c/file.html", "file2.html", "file2.html"); + testRelativize("a/b/c/file.html", "../../../a/b/file.html", "../file.html"); + testRelativize("a/b/c/file.html", "../../../a/b/c/file.html", ""); + testRelativize("a/b/c/file.html", "../../../a/b/c2/file.html", "../c2/file.html"); + testRelativize("a/b/c/file.html", "../../../a/b/c/d/file.html", "d/file.html"); + } + + private void testRelativize(String file, String href, String expect) { + out.println("test " + file + " " + href); + String found = DocPath.create(file) + .relativize(DocPath.create(href)) + .getPath(); + out.println(" result: " + found); + if (!expect.equals(found)) { + error("Mismatch:\n" + + " expect: " + expect); + } + out.println(); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java --- a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * 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,8 +54,8 @@ "", "", "
    Direct Known Subclasses:
    \n" + - "
    " + - "A.VisibleInner, " + + "A.VisibleInner, A.VisibleInnerExtendsInvisibleInner
    "); checkOutput("pkg1/A.html", false, @@ -63,12 +63,12 @@ ""); checkOutput("pkg1/A.VisibleInner.html", true, - "visibleField", - "visibleMethod", + "visibleField", + "visibleMethod", "

    Nested classes/interfaces inherited from class pkg1." + - "A

    \n" + - "" + - "A.VisibleInner, A\n" + + "" + + "A.VisibleInner, A.VisibleInnerExtendsInvisibleInner\n" + ""); @@ -80,9 +80,9 @@ checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", true, "
    public static class " +
                     "A.VisibleInnerExtendsInvisibleInner\n" +
    -                "extends A
    ", - "visibleField", - "visibleMethod"); + "extends A", + "visibleField", + "visibleMethod"); checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false, "invisibleField", diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHref/TestHref.java --- a/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHref/TestHref.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ //External link. "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\"", //Member summary table link. - "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\"", + "href=\"#method-int-int-java.util.ArrayList-\"", //Anchor test. "\n" + "\n" @@ -64,10 +64,10 @@ checkOutput("pkg/C2.html", true, //{@link} test. - "Link: ", + "Link: ", //@see test. "See Also:\n" - + "
    " + + "
    " ); checkOutput("pkg/C4.html", true, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java --- a/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -157,7 +157,7 @@ + "
    Since:
    \n" + "
    JDK1.0
    \n" + "
    See Also:
    \n" - + "
    " + + "
    " + "C2, \n" + "" + "Serialized Form
    \n" @@ -166,7 +166,7 @@ + "
    Since:
    \n" + "
    1.4
    \n" + "
    See Also:
    \n" - + "
    " + + "
    " + "setUndecorated(boolean)
    \n" + "", "
    \n" @@ -193,7 +193,7 @@ + "
    1.4
    \n" + "
    See Also:
    \n" + "
    " - + "readObject()" + + "readObject()" + "
    \n" + "
    ", "
    \n" @@ -201,7 +201,7 @@ + "
    java.io.IOException
    \n" + "
    See Also:" + "
    \n" - + "
    " + + "
    " + "setUndecorated(boolean)
    \n" + "
    "); @@ -277,7 +277,7 @@ "
    JDK1.0
    \n" + "
    See Also:" + "
    \n" + - "
    " + + "
    " + "C2, \n" + "" + "Serialized Form
    \n" + @@ -310,7 +310,7 @@ + "
    Since:
    \n" + "
    1.4
    \n" + "
    See Also:
    \n" - + "
    " + + "
    " + "readObject()
    \n" + "", "
    \n" @@ -319,7 +319,7 @@ + "
    java.io.IOException
    \n" + "
    " + "See Also:
    \n" - + "
    " + + "
    " + "setUndecorated(boolean)
    \n" + "
    "); @@ -381,7 +381,7 @@ checkOutput("pkg1/C1.ModalExclusionType.html", expectFound, "
    public " +
    -                "static final C1.ModalExclusionType " +
                     "APPLICATION_EXCLUDE
    \n" + ""); diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -192,48 +192,48 @@ // Class use documentation checkOutput("pkg1/class-use/I1.html", true, - "Packages that use Packages that use I1" + " "); checkOutput("pkg1/class-use/C1.html", true, "Fields in " - + "pkg2 declared as declared as C1 " + "", "Methods in " - + "pkg2 that return that return C1" + " "); checkOutput("pkg2/class-use/C2.html", true, "Fields in " - + "pkg1 declared as declared as C2" + " ", "Methods in " - + "pkg1 that return that return C2" + " "); checkOutput("pkg2/class-use/C2.ModalExclusionType.html", true, - "Methods in " - + "pkg2 that return Methods in " + + "pkg2 that return C2.ModalExclusionType" + " "); // Package use documentation checkOutput("pkg1/package-use.html", true, - "Packages that use " + "Packages that use " + "pkg1 ", - "Classes in " - + "pkg1 used by pkg1" + "Classes in " + + "pkg1 used by pkg1" + " "); checkOutput("pkg2/package-use.html", true, - "Packages that use " + "Packages that use " + "pkg2 ", - "Classes in " + "Classes in " + "pkg2 used by pkg1" + " "); diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHtmlTag/TestHtmlTag.java --- a/test/langtools/jdk/javadoc/doclet/testHtmlTag/TestHtmlTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTag/TestHtmlTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -119,11 +119,11 @@ + "\n" + "

    \n" + " A new instance of the DatatypeFactory is created through the\n" - + " newInstance() method that uses the following implementation\n" + + " newInstance() method that uses the following implementation\n" + " resolution mechanisms to determine an implementation:

    \n" + "
      \n" + "
    1. \n" - + " If the system property specified by DATATYPEFACTORY_PROPERTY,\n" + + " If the system property specified by DATATYPEFACTORY_PROPERTY,\n" + " \"javax.xml.datatype.DatatypeFactory\", exists, a class with\n" + " the name of the property value is instantiated. Any Exception thrown\n" + " during the instantiation process is wrapped as a\n" @@ -148,7 +148,7 @@ + "
    2. \n" + "
    3. \n" + " The final mechanism is to attempt to instantiate the Class\n" - + " specified by " + + " specified by " + "DATATYPEFACTORY_IMPLEMENTATION_CLASS. Any Exception\n" + " thrown during the instantiation process is wrapped as a\n" + " IllegalStateException.\n" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java --- a/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlVersion/TestHtmlVersion.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -133,7 +133,7 @@ "", "\n" - + "

      pkg

      ", + + "

      pkg

      ", "
      \n" + "

      Interfaces

      ", "
      \n" @@ -598,7 +598,7 @@ "
      \n" + "\n" + "\n" - + "

      Uses of RegClass in pkg

      \n" + + "

      Uses of RegClass in pkg

      \n" + "", "
      \n" + "
      "); // Negated test for main index page @@ -1100,7 +1100,7 @@ "", "\n" - + "

      pkg

      "); + + "

      pkg

      "); // Test for package-summary page checkOutput("pkg/package-summary.html", true, @@ -1486,7 +1486,7 @@ "
    4. \n" + "\n" + "\n" - + "

      Uses of RegClass in pkg

      \n" + + "

      Uses of RegClass in pkg

      \n" + "
    5. "); // Test for main index page @@ -1551,7 +1551,7 @@ "", "\n" - + "

      pkg

      ", + + "

      pkg

      ", "
      \n" + "

      Interfaces

      ", "
      \n" @@ -1988,7 +1988,7 @@ "
      \n" + "\n" + "\n" - + "

      Uses of RegClass in pkg

      \n" + + "

      Uses of RegClass in pkg

      \n" + "\n" + "
      ", "
      \n" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testInlineLinkLabel/TestInlineLinkLabel.java --- a/test/langtools/jdk/javadoc/doclet/testInlineLinkLabel/TestInlineLinkLabel.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testInlineLinkLabel/TestInlineLinkLabel.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ checkOutput("pkg/C1.html", true, //Search for the label to the package link. - "Here is a link to a package", + "Here is a link to a package", //Search for the label to the class link - "Here is a link to a class"); + "Here is a link to a class"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java --- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -70,8 +70,8 @@ // Make sure known implementing class list is correct and omits type parameters. "
      \n" + "
      All Known Implementing Classes:
      \n" - + "
      Child" - + ", Parent" + + "
      Child" + + ", Parent" + "
      \n" + "
      "); @@ -79,7 +79,7 @@ // Make sure "All Implemented Interfaces": has substituted type parameters "
      \n" + "
      All Implemented Interfaces:
      \n" - + "
      " + + "
      " + "Interface<CE>
      \n" + "
      ", //Make sure Class Tree has substituted type parameters. @@ -87,7 +87,7 @@ + "
    6. java.lang.Object
    7. \n" + "
    8. \n" + "
    9. \n" + "\n" + + "m()\n" + "\n", @@ -144,7 +144,7 @@ + "
      public static void staticMethod()
      \n" + "
      " + "Description copied from interface: " - + "" + + "" + "InterfaceWithStaticMembers
      \n" + "
      A static method
      \n"); @@ -165,10 +165,10 @@ checkOutput("pkg1/Child.html", true, // Ensure the correct Overrides in the inheritance hierarchy is reported "Overrides:\n" + - "
      method1" + + "
      method1" + " in class " + - "GrandParent" + - "<CE>"); + "GrandParent" + + "<CE>"); } @Test @@ -182,21 +182,21 @@ checkOutput("pkg2/Spliterator.OfDouble.html", true, // Ensure the correct type parameters are displayed correctly "

      Nested classes/interfaces inherited from interface pkg2." - + "Spliterator

      \n" - + "" - + "Spliterator.OfDouble, Spliterator\n" + + "" + + "Spliterator.OfDouble, Spliterator.OfInt<" - + "" - + "Integer>, " - + "Spliterator.OfPrimitive<T," + + "Integer>, " + + "Spliterator.OfPrimitive<T,T_CONS," - + "" - + "T_SPLITR extends " - + "Spliterator.OfPrimitive<" + + "T_SPLITR extends " + + "Spliterator.OfPrimitive<T," - + "" - + "T_CONS," + + "" + + "T_CONS," + "T_SPLITR>>"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java --- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,8 +51,8 @@ checkOutput("pkg1/C.html", true, "
      See Also:
      \n" - + "
      getRate(), \n" - + "" + + "
      getRate(), \n" + + "" + "setRate(double)
      ", "
      public final void setRate​(double value)
      \n" + "
      Sets the value of the property rate.
      \n" @@ -62,10 +62,10 @@ + "
      Gets the value of the property rate.
      \n" + "
      \n" + "
      Property description:
      ", - "
      \n" + "\n" + + "rate\n" + "", "\n" + + "paused\n" + "
      static void" - + "m()\n" + "
      A hider method
      \n" + "
      C.DoubleProperty" - + "rate\n" + "
      Defines the direction/speed at which the " + "Timeline is expected to\n" @@ -77,14 +77,14 @@ "

      Gets the value of the property Property", "Property description:", "

      " - + "" + + "" + "setTestMethodProperty()" - + "paused\n" + "
      Defines if paused.
      ", "

      paused

      \n" - + "
      public final public final C.BooleanProperty pausedProperty
      \n" + "
      Defines if paused. The second line.
      ", "

      isPaused

      \n" @@ -107,7 +107,7 @@ + "
      Default value:
      \n" + "
      false
      ", "

      rate

      \n" - + "
      public final public final C.DoubleProperty rateProperty
      \n" + "
      Defines the direction/speed at which the " + "Timeline is expected to\n" @@ -138,9 +138,9 @@ + "\n" + "", "\n" - + "\n", + + "\n", "\n" - + "\n"); + + "\n"); checkOutput("pkg1/C.html", false, "A()", @@ -152,9 +152,9 @@ + "Concrete Methods " + "", "\n" - + "\n", + + "\n", "\n" - + "\n"); + + "\n"); checkOutput("index-all.html", true, "
      Gets the value of the property paused.
      ", @@ -162,9 +162,9 @@ checkOutput("pkg1/D.html", true, "

      Properties inherited from class pkg1." - + "C

      \n" - + "" - + "paused, rate"); + + "C\n" + + "" + + "paused, rate"); checkOutput("pkg1/D.html", false, "shouldNotAppear"); } @@ -246,27 +246,27 @@ + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + + "betaProperty()\n" + "\n" + "\n" + "\n" + "\n" + "\n" + + "deltaProperty()\n" + "\n" + "\n" + "\n" + "\n" + "\n" + + "gammaProperty()\n" + "" ); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java --- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -86,7 +86,7 @@ + " title=\"class or interface in java.lang\" class=\"externalLink\">getSystemClassLoader()" + " as the parent class loader.", "
      is equivalent to invoking " - + "" + + "" + "createTempFile(prefix, suffix, null).
      ", "Link-Plain to String Class", diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testLinkTaglet/TestLinkTaglet.java --- a/test/langtools/jdk/javadoc/doclet/testLinkTaglet/TestLinkTaglet.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testLinkTaglet/TestLinkTaglet.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * 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,23 +49,23 @@ checkExit(Exit.OK); checkOutput("pkg/C.html", true, - "Qualified Link: C.InnerC.
      \n" - + " Unqualified Link1: C.InnerC.
      \n" - + " Unqualified Link2: C.InnerC.
      \n" - + " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
      \n" - + " Unqualified Link: method(C.InnerC, C.InnerC2).
      \n" - + " Unqualified Link: method(InnerC, InnerC2).
      \n" - + " Package Link: pkg.
      "); + "Qualified Link: C.InnerC.
      \n" + + " Unqualified Link1: C.InnerC.
      \n" + + " Unqualified Link2: C.InnerC.
      \n" + + " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
      \n" + + " Unqualified Link: method(C.InnerC, C.InnerC2).
      \n" + + " Unqualified Link: method(InnerC, InnerC2).
      \n" + + " Package Link: pkg.
      "); checkOutput("pkg/C.InnerC.html", true, - "Link to member in outer class: C.MEMBER
      \n" - + " Link to member in inner class: C.InnerC2.MEMBER2
      \n" - + " Link to another inner class: C.InnerC2"); + "Link to member in outer class: C.MEMBER
      \n" + + " Link to member in inner class: C.InnerC2.MEMBER2
      \n" + + " Link to another inner class: C.InnerC2"); checkOutput("pkg/C.InnerC2.html", true, "
      \n" + "
      Enclosing class:
      \n" - + "
      C
      \n" + + "
      C
      \n" + "
      "); checkOutput(Output.OUT, false, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java --- a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,56 +50,56 @@ checkOutput("pkg/SubClass.html", true, // Public field should be inherited - "", + "", // Public method should be inherited - "", + "", // Public inner class should be inherited. - "", + "", // Protected field should be inherited - "", + "", // Protected method should be inherited - "", + "", // Protected inner class should be inherited. - "", + "", // New labels as of 1.5.0 "Nested classes/interfaces inherited from class pkg." - + "BaseClass", + + "BaseClass", "Nested classes/interfaces inherited from interface pkg." - + "BaseInterface"); + + "BaseInterface"); checkOutput("pkg/BaseClass.html", true, // Test overriding/implementing methods with generic parameters. "
      \n" + "
      Specified by:
      \n" - + "
      " + + "
      " + "getAnnotation in interface " - + "" + + "" + "BaseInterface
      \n" + "
      "); checkOutput("diamond/Z.html", true, // Test diamond inheritance member summary (6256068) - "aMethod"); + "aMethod"); checkOutput("inheritDist/C.html", true, // Test that doc is inherited from closed parent (6270645) "
      m1-B
      "); checkOutput("pkg/SubClass.html", false, - "staticMethod
      "); + "staticMethod"); checkOutput("pkg1/Implementer.html", true, // ensure the method makes it "\n" + ""); checkOutput("pkg1/Implementer.html", false, - "

      Methods inherited from interface pkg1.Methods inherited from interface pkg1.Interface

      \n" - + "between" ); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java --- a/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testMemberSummary/TestMemberSummary.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,19 +50,19 @@ checkOutput("pkg/PublicChild.html", true, // Check return type in member summary. - "PublicChild\n" - + ""); + + "PublicChild()"); checkOutput("pkg/PrivateParent.html", true, "\n" + ""); // Legacy anchor dimensions (6290760) diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testModules/TestModules.java --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -854,7 +854,7 @@ "
      Module " + "moduleB
      ", "
      " - + "Package testpkgmdlB
      "); + + "Package testpkgmdlB"); checkFiles(found, "moduleA-frame.html", "moduleA-summary.html", diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java --- a/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testNavigation/TestNavigation.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,21 +49,21 @@ checkOutput("pkg/A.html", true, "
    10. Prev Class
    11. ", - "Next Class", + "Next Class", "
    12. Overview
    13. "); checkOutput("pkg/C.html", true, - "Prev Class", - "Next Class", + "Prev Class", + "Next Class", "
    14. Overview
    15. "); checkOutput("pkg/E.html", true, - "Prev Class", - "Next Class", + "Prev Class", + "Next Class", "
    16. Overview
    17. "); checkOutput("pkg/I.html", true, - "Prev Class", + "Prev Class", "
    18. Next Class
    19. ", // Test for 4664607 "\n" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testNestedGenerics/TestNestedGenerics.java --- a/test/langtools/jdk/javadoc/doclet/testNestedGenerics/TestNestedGenerics.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testNestedGenerics/TestNestedGenerics.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ checkOutput("pkg/NestedGenerics.html", true, ""); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java --- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,20 +67,20 @@ // Make sure enum signature is correct. "
      public enum "
                       + "Coin\n"
      -                + "extends java.lang.Enum<Coin>
      ", // Check for enum constant section "
      ", // Detail for enum constant - "Dime", + "Dime", // Automatically insert documentation for values() and valueOf(). "Returns an array containing the constants of this enum type,", "Returns the enum constant of this type with the specified name", "for (Coin c : Coin.values())", "Overloaded valueOf() method has correct documentation.", "Overloaded values method has correct documentation.", - "
      public static Coin" +
      +                "
      public static Coin" +
                       " valueOf​(java.lang.String name)
      \n" + "
      Returns the enum constant of this type with the specified name.\n" + "The string must match exactly an identifier used to declare an\n" + @@ -117,11 +117,11 @@ "
      \n" + "
      See Also:
      \n" + "
      " - + "" + + "" + "TypeParameters
      \n" + "
      ", // Method that uses class type parameter. - "(E param)", // Method type parameter section. "Type Parameters:\n" @@ -133,38 +133,38 @@ "public <T extends java.util.List,V> " + "java.lang.String[] methodThatHasTypeParameters", // Method that returns TypeParameters - "
      \n" + "\n" + "\n" + "", - "", - "", "", - "", - "td class=\"colFirst\">ParamTest" - + "<Foo>" ); checkOutput("pkg2/class-use/ParamTest.html", true, - "", - "" ); checkOutput("pkg2/class-use/Foo2.html", true, - "", - "", - "", "" ); // ClassUseTest2: > checkOutput("pkg2/class-use/ParamTest.html", true, - "", - "", - "", "", - "", - "", - "", "" ); checkOutput("pkg2/class-use/Foo3.html", true, - "", - "", - "", "", - "", - "" ); // ClassUseTest3: >> checkOutput("pkg2/class-use/ParamTest2.html", true, - "", - "", - "", "", "" ); checkOutput("pkg2/class-use/Foo4.html", true, - "", - "", - "", "", - "", "" ); // Type parameters in constructor and method args checkOutput("pkg2/class-use/Foo4.html", true, - "\n" + "\n" @@ -433,13 +433,13 @@ + "\n" + "\n" + "", - "" ); @@ -478,7 +478,7 @@ "(int... i)", "(int[][]... i)", "-int:A...-", - "" + "" + "TypeParameters... t"); } @@ -520,58 +520,58 @@ void checkAnnotationTypeUsage() { checkOutput("pkg/package-summary.html", true, // PACKAGE - "@AnnotationType(optional=\"Package Annotation\",\n" - + " required=1994)"); + "@AnnotationType(optional=\"Package Annotation\",\n" + + " required=1994)"); checkOutput("pkg/AnnotationTypeUsage.html", true, // CLASS - "
      @AnnotationType("
      -                + "optional"
      +                + "optional"
                       + "=\"Class Annotation\",\n"
      -                + "                "
      +                + "                "
                       + "required=1994)\n"
                       + "public class "
                       + "AnnotationTypeUsage\n"
                       + "extends java.lang.Object
      ", // FIELD - "
      @AnnotationType("
      -                + "optional"
      +                + "optional"
                       + "=\"Field Annotation\",\n"
      -                + "                "
      +                + "                "
                       + "required=1994)\n"
                       + "public int field
      ", // CONSTRUCTOR - "
      @AnnotationType("
      -                + "optional"
      +                + "optional"
                       + "=\"Constructor Annotation\",\n"
      -                + "                "
      +                + "                "
                       + "required=1994)\n"
                       + "public AnnotationTypeUsage()
      ", // METHOD - "
      @AnnotationType("
      -                + "optional"
      +                + "optional"
                       + "=\"Method Annotation\",\n"
      -                + "                "
      +                + "                "
                       + "required=1994)\n"
                       + "public void method()
      ", // METHOD PARAMS "
      public void methodWithParams​("
      -                + ""
      -                + "@AnnotationType("
      +                + ""
      +                + "@AnnotationType("
                       + "optional=\"Parameter Annotation\",required=1994)\n"
      +                + "href=\"AnnotationType.html#required--\">required=1994)\n"
                       + "                             int documented,\n"
                       + "                             int undocmented)
      ", // CONSTRUCTOR PARAMS "
      public AnnotationTypeUsage​("
      -                + "@AnnotationType("
      +                + "href=\"AnnotationType.html\" title=\"annotation in pkg\">"
      +                + "@AnnotationType("
                       + "optional=\"Constructor Param Annotation\",required=1994)\n"
      +                + "href=\"AnnotationType.html#required--\">required=1994)\n"
                       + "                           int documented,\n"
                       + "                           int undocmented)
      "); @@ -580,37 +580,37 @@ //================================= checkOutput("pkg/class-use/AnnotationType.html", true, "
      ", - "", - "", - "", - "", - "", - "" ); @@ -620,20 +620,20 @@ //=============================================================== checkOutput("pkg/AnnotationTypeUsage.html", false, // CLASS - "@AnnotationTypeUndocumented(optional=\"Class Annotation\",\n" - + " required=1994)\n" + "@AnnotationTypeUndocumented(optional=\"Class Annotation\",\n" + + " required=1994)\n" + "public class AnnotationTypeUsage
      extends java.lang.Object
      ", // FIELD - "@AnnotationTypeUndocumented(optional=\"Field Annotation\",\n" - + " required=1994)\n" + "@AnnotationTypeUndocumented(optional=\"Field Annotation\",\n" + + " required=1994)\n" + "public int field", // CONSTRUCTOR - "@AnnotationTypeUndocumented(optional=\"Constructor Annotation\",\n" - + " required=1994)\n" + "@AnnotationTypeUndocumented(optional=\"Constructor Annotation\",\n" + + " required=1994)\n" + "public AnnotationTypeUsage()", // METHOD - "@AnnotationTypeUndocumented(optional=\"Method Annotation\",\n" - + " required=1994)\n" + "@AnnotationTypeUndocumented(optional=\"Method Annotation\",\n" + + " required=1994)\n" + "public void method()"); //================================= @@ -648,31 +648,31 @@ //================================= checkOutput("pkg1/B.html", true, // Integer - "d=3.14,", + "d=3.14,", // Double - "d=3.14,", + "d=3.14,", // Boolean - "b=true,", + "b=true,", // String - "s=\"sigh\",", + "s=\"sigh\",", // Class - "c=Foo.class,", + "c=Foo.class,", // Bounded Class - "w=TypeParameterSubClass.class,", + "w=TypeParameterSubClass.class,", // Enum - "e=Penny,", + "e=Penny,", // Annotation Type - "a=@AnnotationType(optional=\"foo\",required=1994),", + "a=@AnnotationType(optional=\"foo\",required=1994),", // String Array - "sa={\"up\",\"down\"},", + "sa={\"up\",\"down\"},", // Primitive - "primitiveClassTest=boolean.class,"); + "primitiveClassTest=boolean.class,"); // XXX: Add array test case after this if fixed: //5020899: Incorrect internal representation of class-valued annotation elements // Make sure that annotations are surrounded by
       and 
      checkOutput("pkg1/B.html", true, - "
      @A",
      +                "
      @A",
                       "public interface B
      "); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -236,10 +236,10 @@ + "public int method() {"); checkOutput("linksource/SomeEnum.html", true, - "
      public static final public static final SomeEnum VALUE1
      ", - "
      public static final public static final SomeEnum VALUE2
      "); diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java --- a/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOrdering/TestOrdering.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -135,42 +135,42 @@ checkClassUseOrdering("pkg1/class-use/UsedClass.html"); tester.checkOrder("pkg1/class-use/UsedClass.html", - "../../pkg1/MethodOrder.html#m--", - "../../pkg1/MethodOrder.html#m-byte:A-", - "../../pkg1/MethodOrder.html#m-double-", - "../../pkg1/MethodOrder.html#m-double-double-", - "../../pkg1/MethodOrder.html#m-double-java.lang.Double-", - "../../pkg1/MethodOrder.html#m-int-", - "../../pkg1/MethodOrder.html#m-int-int-", - "../../pkg1/MethodOrder.html#m-int-java.lang.Integer-", - "../../pkg1/MethodOrder.html#m-long-", - "../../pkg1/MethodOrder.html#m-long-long-", - "../../pkg1/MethodOrder.html#m-long-java.lang.Long-", - "../../pkg1/MethodOrder.html#m-long-java.lang.Long...-", - "../../pkg1/MethodOrder.html#m-java.lang.Double-", - "../../pkg1/MethodOrder.html#m-java.lang.Double-double-", - "../../pkg1/MethodOrder.html#m-java.lang.Double-java.lang.Double-", - "../../pkg1/MethodOrder.html#m-java.lang.Integer-", - "../../pkg1/MethodOrder.html#m-java.lang.Integer-int-", - "../../pkg1/MethodOrder.html#m-java.lang.Integer-java.lang.Integer-", - "../../pkg1/MethodOrder.html#m-java.lang.Object:A-", - "../../pkg1/MethodOrder.html#m-java.util.ArrayList-", - "../../pkg1/MethodOrder.html#m-java.util.Collection-", - "../../pkg1/MethodOrder.html#m-java.util.List-"); + "../MethodOrder.html#m--", + "../MethodOrder.html#m-byte:A-", + "../MethodOrder.html#m-double-", + "../MethodOrder.html#m-double-double-", + "../MethodOrder.html#m-double-java.lang.Double-", + "../MethodOrder.html#m-int-", + "../MethodOrder.html#m-int-int-", + "../MethodOrder.html#m-int-java.lang.Integer-", + "../MethodOrder.html#m-long-", + "../MethodOrder.html#m-long-long-", + "../MethodOrder.html#m-long-java.lang.Long-", + "../MethodOrder.html#m-long-java.lang.Long...-", + "../MethodOrder.html#m-java.lang.Double-", + "../MethodOrder.html#m-java.lang.Double-double-", + "../MethodOrder.html#m-java.lang.Double-java.lang.Double-", + "../MethodOrder.html#m-java.lang.Integer-", + "../MethodOrder.html#m-java.lang.Integer-int-", + "../MethodOrder.html#m-java.lang.Integer-java.lang.Integer-", + "../MethodOrder.html#m-java.lang.Object:A-", + "../MethodOrder.html#m-java.util.ArrayList-", + "../MethodOrder.html#m-java.util.Collection-", + "../MethodOrder.html#m-java.util.List-"); tester.checkOrder("pkg1/class-use/UsedClass.html", - "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-", - "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass-", - "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass:A-", - "../../pkg1/MethodOrder.html#tpm-pkg1.UsedClass-java.lang.String-"); + "../MethodOrder.html#tpm-pkg1.UsedClass-", + "../MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass-", + "../MethodOrder.html#tpm-pkg1.UsedClass-pkg1.UsedClass:A-", + "../MethodOrder.html#tpm-pkg1.UsedClass-java.lang.String-"); tester.checkOrder("pkg1/class-use/UsedClass.html", - "../../pkg1/A.html#A-pkg1.UsedClass-", - "../../pkg1/B.A.html#A-pkg1.UsedClass-", - "../../pkg1/B.html#B-pkg1.UsedClass-", - "../../pkg1/A.C.html#C-pkg1.UsedClass-java.lang.Object:A-", - "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.Collection-", - "../../pkg1/A.C.html#C-pkg1.UsedClass-java.util.List-"); + "../A.html#A-pkg1.UsedClass-", + "../B.A.html#A-pkg1.UsedClass-", + "../B.html#B-pkg1.UsedClass-", + "../A.C.html#C-pkg1.UsedClass-java.lang.Object:A-", + "../A.C.html#C-pkg1.UsedClass-java.util.Collection-", + "../A.C.html#C-pkg1.UsedClass-java.util.List-"); tester.checkOrder("pkg1/ImplementsOrdering.html", "
      close in interface java.lang.AutoCloseable
      ", @@ -211,10 +211,10 @@ } void checkClassUseOrdering(String usePage) { - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass"); - checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#"); + checkClassUseOrdering(usePage, "C#ITERATION#.html#zfield"); + checkClassUseOrdering(usePage, "C#ITERATION#.html#fieldInC#ITERATION#"); + checkClassUseOrdering(usePage, "C#ITERATION#.html#zmethod-pkg1.UsedClass"); + checkClassUseOrdering(usePage, "C#ITERATION#.html#methodInC#ITERATION#"); } void checkClassUseOrdering(String usePage, String searchString) { @@ -405,8 +405,8 @@ tester.checkExit(Exit.OK); tester.checkOrder("index-all.html", composeTestVectors()); tester.checkOrder("add0/add/package-tree.html", - "", - ""); + "", + ""); tester.checkOrder("overview-tree.html", "", "", @@ -593,10 +593,10 @@ tester.checkOrder("pkg5/AnnoOptionalTest.html", "

      Optional Element Summary

      ", - "
      four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Element Detail

      ", "

      one

      ", "

      two

      ", @@ -605,10 +605,10 @@ tester.checkOrder("pkg5/AnnoRequiredTest.html", "

      Required Element Summary

      ", - "four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Element Detail

      ", "

      one

      ", "

      two

      ", @@ -617,10 +617,10 @@ tester.checkOrder("pkg5/CtorTest.html", "

      Constructor Summary

      ", - "Constructor Detail", "", "", @@ -629,10 +629,10 @@ tester.checkOrder("pkg5/EnumTest.html", "

      Enum Constant Summary

      ", - "
      FOUR", - "ONE", - "THREE", - "TWO", + "FOUR", + "ONE", + "THREE", + "TWO", "

      Enum Constant Detail

      ", "

      ONE

      ", "

      TWO

      ", @@ -641,10 +641,10 @@ tester.checkOrder("pkg5/FieldTest.html", "

      Field Summary

      ", - "four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Field Detail

      ", "

      one

      ", "

      two

      ", @@ -653,10 +653,10 @@ tester.checkOrder("pkg5/IntfTest.html", "

      Method Summary

      ", - "four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Method Detail

      ", "

      one

      ", "

      two

      ", @@ -665,10 +665,10 @@ tester.checkOrder("pkg5/MethodTest.html", "

      Method Summary

      ", - "four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Method Detail

      ", "

      one

      ", "

      two

      ", @@ -677,10 +677,10 @@ tester.checkOrder("pkg5/PropertyTest.html", "

      Property Summary

      ", - "four", - "one", - "three", - "two", + "four", + "one", + "three", + "two", "

      Property Detail

      ", "

      oneProperty

      ", "

      twoProperty

      ", diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,30 +51,30 @@ checkOutput("pkg3/I1.html", true, "Methods inherited from interface pkg3." - + "" + + "" + "I2", "Methods inherited from interface pkg3." - + "" + + "" + "I3"); checkOutput("pkg3/I0.html", true, "Methods inherited from interface pkg3." - + "" + + "" + "I2", "Methods inherited from interface pkg3." - + "" + + "" + "I3"); // Method foo() is NOT inherited from I4 because it is overriden by I3. checkOutput("pkg3/I1.html", false, "Methods inherited from interface pkg3." - + "" + + "" + "I4"); checkOutput("pkg3/I0.html", false, "Methods inherited from interface pkg3." - + "" + + "" + "I4"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenMethodDocCopy.java --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenMethodDocCopy.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenMethodDocCopy.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -53,7 +53,7 @@ checkOutput("pkg1/SubClass.html", true, "Description copied from class: " - + "" + + "" + "BaseClass"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethods.java --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethods.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethods.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ // The public method should be overridden checkOutput("pkg1/SubClass.html", true, "
      Overrides:
      \n" - + "
      Overrides:\n" - + "
      " + + "
      " + "publicMethod in class " - + "BaseClass
      "); + + "BaseClass"); // The public method in different package should be overridden checkOutput("pkg2/SubClass.html", true, @@ -66,14 +66,14 @@ // package. checkOutput("pkg1/SubClass.html", true, "
      Overrides:
      \n" - + "
      " + + "
      " + "packagePrivateMethod in class " - + "BaseClass
      "); + + "BaseClass"); // The private method in should not be overridden checkOutput("pkg1/SubClass.html", false, "
      Overrides:
      \n" - + "
      "); + + "
      "); // The private method in different package should not be overridden checkOutput("pkg2/SubClass.html", false, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethodsWithPrivateFlag.java --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethodsWithPrivateFlag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenPrivateMethodsWithPrivateFlag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,13 +51,13 @@ // The public method should be overridden checkOutput("pkg1/SubClass.html", true, "
      Overrides:
      \n" + - "
      Overrides:\n" + - "
      Overrides:\n" + - "
      rate", + "Classes.P.html#rateProperty\">rate", // Check nested classes "Nested classes/interfaces declared in class pkg5.", "Classes.P", - "./pkg5/Classes.P.PN.html", + "Classes.P.PN.html", "Classes.P.PN.html", "type parameter in Classes.P.PN\">K", "type parameter in Classes.P.PN", "V", // Check fields - "Fields declared in class pkg5.field0", + "Classes.P.html#field0\">field0", // Check method summary "Method Summary", "void", - "../pkg5/Classes.C.html#m1--\">m1", + "#m1--\">m1", "A modified method", "void", - "../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-\">m4", + "#m4-java.lang.String-java.lang.String-\">m4", "java.lang.String k,", "java.lang.String", " v)", // Check footnotes - "Methods declared in class pkg5.m0", + "Classes.GP.html#m0--\">m0", // Check method details for override "overrideSpecifyLabel", "Overrides:", - "../pkg5/Classes.GP.html#m7--\">m7", + "Classes.GP.html#m7--\">m7", "in class", - "../pkg5/Classes.GP.html", + "Classes.GP.html", "Classes.GP" ); checkOrder("pkg5/Classes.C.html", // Check footnotes 2 "Methods declared in class pkg5.", - "../pkg5/Classes.P.html#getRate--\">getRate", - "../pkg5/Classes.P.html#m2--\">m2", - "../pkg5/Classes.P.html#m3--\">m3", - "../pkg5/Classes.P.html#m4-K-V-\">m4", - "../pkg5/Classes.P.html#rateProperty--\">rateProperty", - "../pkg5/Classes.P.html#setRate-double-\">setRate", + "Classes.P.html#getRate--\">getRate", + "Classes.P.html#m2--\">m2", + "Classes.P.html#m3--\">m3", + "Classes.P.html#m4-K-V-\">m4", + "Classes.P.html#rateProperty--\">rateProperty", + "Classes.P.html#setRate-double-\">setRate", // Check @link "A test of links to the methods in this class.

      \n", - "../pkg5/Classes.GP.html#m0--", + "Classes.GP.html#m0--", "Classes.GP.m0()", - "../pkg5/Classes.C.html#m1--", + "#m1--", "m1()", - "../pkg5/Classes.P.html#m2--", + "Classes.P.html#m2--", "Classes.P.m2()", - "../pkg5/Classes.P.html#m3--", + "Classes.P.html#m3--", "Classes.P.m3()", "m4(java.lang.String,java.lang.String)", - "../pkg5/Classes.P.html#m5--", + "Classes.P.html#m5--", "Classes.P.m5()", - "../pkg5/Classes.C.html#m6--", + "#m6--", "m6()", - "../pkg5/Classes.C.html#m7--", + "#m7--", "m7()", "End of links", // Check @see "See Also:", - "../pkg5/Classes.GP.html#m0--", + "Classes.GP.html#m0--", "Classes.GP.m0()", - "../pkg5/Classes.C.html#m1--", + "#m1--", "m1()", - "../pkg5/Classes.P.html#m2--", + "Classes.P.html#m2--", "Classes.P.m2()", - "../pkg5/Classes.P.html#m3--", + "Classes.P.html#m3--", "Classes.P.m3()", - "../pkg5/Classes.C.html#m4-java.lang.String-java.lang.String-", + "#m4-java.lang.String-java.lang.String-", "m4(String k, String v)", - "../pkg5/Classes.P.html#m5--\">Classes.P.m5()", - "../pkg5/Classes.C.html#m6--\">m6()", - "../pkg5/Classes.C.html#m7--\">m7()" + "Classes.P.html#m5--\">Classes.P.m5()", + "#m6--\">m6()", + "#m7--\">m7()" ); // Tests for interfaces @@ -172,56 +172,56 @@ checkOrder("pkg5/Interfaces.D.html", "Start of links

      ", - "../pkg5/Interfaces.A.html#m0--\">Interfaces.A.m0()", - "../pkg5/Interfaces.A.html#m1--\">Interfaces.A.m1()", - "../pkg5/Interfaces.A.html#m2--\">Interfaces.A.m2()", - "../pkg5/Interfaces.A.html#m3--\">Interfaces.A.m3()", - "../pkg5/Interfaces.D.html#m--\">m()", - "../pkg5/Interfaces.D.html#n--\">n()", - "../pkg5/Interfaces.C.html#o--\">Interfaces.C.o()", + "Interfaces.A.html#m0--\">Interfaces.A.m0()", + "Interfaces.A.html#m1--\">Interfaces.A.m1()", + "Interfaces.A.html#m2--\">Interfaces.A.m2()", + "Interfaces.A.html#m3--\">Interfaces.A.m3()", + "#m--\">m()", + "#n--\">n()", + "Interfaces.C.html#o--\">Interfaces.C.o()", "End of links", // Check @see links "See Also:", - "../pkg5/Interfaces.A.html#m0--\">Interfaces.A.m0()", - "../pkg5/Interfaces.A.html#m1--\">Interfaces.A.m1()", - "../pkg5/Interfaces.A.html#m2--\">Interfaces.A.m2()", - "../pkg5/Interfaces.A.html#m3--\">Interfaces.A.m3()", - "../pkg5/Interfaces.D.html#m--\">m()", - "../pkg5/Interfaces.D.html#n--\">n()", - "../pkg5/Interfaces.C.html#o--\">Interfaces.C.o()", + "Interfaces.A.html#m0--\">Interfaces.A.m0()", + "Interfaces.A.html#m1--\">Interfaces.A.m1()", + "Interfaces.A.html#m2--\">Interfaces.A.m2()", + "Interfaces.A.html#m3--\">Interfaces.A.m3()", + "#m--\">m()", + "#n--\">n()", + "Interfaces.C.html#o--\">Interfaces.C.o()", // Check properties - "Properties declared in interface pkg5.Interfaces.A", // Check nested classes "Nested classes/interfaces declared in interface pkg5.", "Interfaces.A", - "../pkg5/Interfaces.A.AA.html", + "Interfaces.A.AA.html", "Interfaces.A.AA", // Check Fields - "Fields declared in interface pkg5.QUOTE", - "../pkg5/Interfaces.A.html#rate\">rate", + "Fields declared in interface pkg5.QUOTE", + "Interfaces.A.html#rate\">rate", // Check Method Summary "Method Summary", - "../pkg5/Interfaces.D.html#m--\">m", - "../pkg5/Interfaces.D.html#n--\">n", + "#m--\">m", + "#n--\">n", // Check footnotes - "Methods declared in interface pkg5.getRate", - "../pkg5/Interfaces.A.html#rateProperty--\">rateProperty", - "../pkg5/Interfaces.A.html#setRate-double-", - "Methods declared in interface pkg5.m1", - "../pkg5/Interfaces.B.html#m3--\">m3", - "Methods declared in interface pkg5.o" + "Methods declared in interface pkg5.getRate", + "Interfaces.A.html#rateProperty--\">rateProperty", + "Interfaces.A.html#setRate-double-", + "Methods declared in interface pkg5.m1", + "Interfaces.B.html#m3--\">m3", + "Methods declared in interface pkg5.o" ); // Test synthetic values and valuesof of an enum. diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testPackagePage/TestPackagePage.java --- a/test/langtools/jdk/javadoc/doclet/testPackagePage/TestPackagePage.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testPackagePage/TestPackagePage.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,9 +53,9 @@ // With just one package, all general pages link to the single package page. checkOutput("com/pkg/C.html", true, - "Package"); + "Package"); checkOutput("com/pkg/package-tree.html", true, - "

    20. Package
    21. "); + "
    22. Package
    23. "); checkOutput("deprecated-list.html", true, "
    24. Package
    25. "); checkOutput("index-all.html", true, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java --- a/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testPackageSummary/TestPackageSummary.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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,23 +49,23 @@ checkOutput("pkg/package-summary.html", true, "
      \n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java --- a/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +59,10 @@ checkOutput("pkg/PublicChild.html", true, // Field inheritence from non-public superclass. - "" + "" + "fieldInheritedFromParent", // Method inheritance from non-public superclass. - "" + "" + "methodInheritedFromParent", // private class does not show up in tree "
        \n" @@ -77,7 +77,7 @@ "
        public void methodInheritedFromParent​(int p1)",
                         "
        \n" + "
        All Implemented Interfaces:
        \n" - + "
        " + + "
        " + "PublicInterface
        \n" + "
        "); @@ -95,27 +95,27 @@ checkOutput("pkg/PublicChild.html", false, // Should not document comments from private inherited interfaces "
      ", // and similarly one more "" ); checkOutput("pkg/PublicInterface.html", true, // Field inheritance from non-public superinterface. - "" + "" + "fieldInheritedFromInterface", // Method inheritance from non-public superinterface. - "" + "" + "methodInterface", //Make sure implemented interfaces from private superclass are inherited "
      \n" + "
      All Known Implementing Classes:
      \n" - + "
      " + + "
      " + "PublicChild
      \n" + "
      "); @@ -132,7 +132,7 @@ checkOutput("pkg2/C.html", false, //Do not inherit private interface method with generic parameters. //This method has been implemented. - "hello"); + "hello"); checkOutput("constant-values.html", false, // Make inherited constant are documented correctly. @@ -150,27 +150,27 @@ checkOutput("pkg/PublicChild.html", true, // Field inheritence from non-public superclass. "Fields inherited from class pkg." - + "" + + "" + "PrivateParent", - "" + "" + "fieldInheritedFromParent", // Method inheritence from non-public superclass. "Methods inherited from class pkg." - + "" + + "" + "PrivateParent", - "" + "" + "methodInheritedFromParent", // Should document that a method overrides method from private class. "
      Overrides:
      \n" - + "
      " + + "
      " + "methodOverridenFromParent in class " - + "" + + "" + "PrivateParent
      ", // Should document that a method is specified by private interface. "
      Specified by:
      \n" - + "
      " + + "
      " + "methodInterface in interface " - + "" + + "" + "PrivateInterface
      ", // Should mention that any documentation was copied. "Description copied from", @@ -178,9 +178,9 @@ "extends", "
      \n" + "
      All Implemented Interfaces:
      \n" - + "
      " + + "
      " + "PrivateInterface, " - + "" + + "" + "PublicInterface
      \n" + "
      ", "
      public class PublicChild");
      @@ -188,13 +188,13 @@
               checkOutput("pkg/PublicInterface.html", true,
                       // Field inheritence from non-public superinterface.
                       "Fields inherited from interface pkg."
      -                + ""
      +                + ""
                       + "PrivateInterface",
      -                ""
      +                ""
                       + "fieldInheritedFromInterface",
                       // Method inheritance from non-public superinterface.
                       "Methods inherited from interface pkg."
      -                + ""
      +                + ""
                       + "PrivateInterface",
                       // Extend documented private classes or interfaces
                       "extends",
      @@ -202,14 +202,14 @@
                       //Make sure implemented interfaces from private superclass are inherited
                       "
      \n" + "
      All Known Implementing Classes:
      \n" - + "
      " + + "
      " + "PrivateParent, " - + "PublicChild" + + "PublicChild" + "
      \n" + "
      "); checkOutput("pkg/PrivateInterface.html", true, - "" + "" + "methodInterface" ); @@ -217,11 +217,11 @@ //Since private flag is used, we can document that private interface method //with generic parameters has been implemented. "Description copied from interface: " - + "I", + + "I", "
      Specified by:
      \n" - + "
      hello" + + "
      hello" + " in interface " - + "I" + + "I" + "<java.lang.String>
      "); checkOutput("pkg/PrivateParent.html", true, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java --- a/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testProperty/TestProperty.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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,62 +47,62 @@ checkExit(Exit.OK); checkOutput("pkg/MyClass.html", true, - "
      public final public final ObjectProperty"
      -                + "<MyObj> goodProperty
      \n" + "
      This is an Object property where the " + "Object is a single Object.
      \n" + "
      \n" + "
      See Also:
      \n" - + "
      getGood(), \n" - + "" + + "
      getGood(), \n" + + "" + "setGood(MyObj)
      \n" + "
      ", - "
      public final public final ObjectProperty"
      -                + "<MyObj[]> badProperty
      \n" + "
      This is an Object property where the " + "Object is an array.
      \n" + "
      \n" + "
      See Also:
      \n" - + "
      getBad(), \n" - + "" + + "
      getBad(), \n" + + "" + "setBad(MyObj[])
      \n" + "
      ", // id should not be used in the property table "
      \n" - + "\n" + "", + + "bad", // id should be used in the method table "\n" - + "\n" + "" + + "badProperty()" ); checkOutput("pkg/MyClassT.html", true, - "
      public final public final ObjectProperty"
      -                + "<java.util.List<T>> "
                       + "listProperty
      \n" + "
      This is an Object property where the " + "Object is a single List<T>.
      \n" + "
      \n" + "
      See Also:
      \n" - + "
      " + + "
      " + "getList(), \n" - + "" + + "" + "setList(List)
      \n" + "
      " ); diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java --- a/test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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 4460354 8014636 8043186 + * @bug 4460354 8014636 8043186 8195805 * @summary Test to make sure that relative paths are redirected in the * output so that they are not broken. * @author jamieh @@ -67,7 +67,12 @@ "relative field link", "relative method link", "relative package link", - " relative-multi-line-link.", + " relative-multi-line-link."); + + // This is not a relative path and should not be redirected. + checkOutput("index-all.html", true, + "
      "); + checkOutput("index-all.html", false, "
      "); // PACKAGE USE diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testRepeatedAnnotations/TestRepeatedAnnotations.java --- a/test/langtools/jdk/javadoc/doclet/testRepeatedAnnotations/TestRepeatedAnnotations.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testRepeatedAnnotations/TestRepeatedAnnotations.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. * 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,91 +47,91 @@ checkExit(Exit.OK); checkOutput("pkg/C.html", true, - "@ContaineeSynthDoc " - + "@ContaineeSynthDoc", - "@ContaineeRegDoc " - + "@ContaineeRegDoc", - "@RegContainerDoc" + "({" - + "@RegContaineeNotDoc," - + "@RegContaineeNotDoc})"); checkOutput("pkg/D.html", true, - "@RegDoc" - + "(x=1)", - "@RegArryDoc" - + "(y=1)", - "@RegArryDoc" - + "(y={1,2})", - "@RegDoc" + + "(x=1)", + "@RegArryDoc" + + "(y=1)", + "@RegArryDoc" + + "(y={1,2})", + "@NonSynthDocContainer" + "(" - + "@RegArryDoc" - + "(y=1))"); + + "@RegArryDoc" + + "(y=1))"); checkOutput("pkg1/C.html", true, - "@RegContainerValDoc" - + "(value={" - + "value={" + + "@RegContaineeNotDoc," - + "@RegContaineeNotDoc}," - + "y=3)", - "y=3)", + "@ContainerValDoc" - + "(value={" - + "value={" + + "@ContaineeNotDoc," - + "@ContaineeNotDoc}," - + "x=1)"); + + "x=1)"); checkOutput("pkg/C.html", false, - "@RegContaineeDoc " - + "@RegContaineeDoc", - "@RegContainerNotDoc" - + "(value={" - + "value={" + + "@RegContaineeNotDoc," - + "@RegContaineeNotDoc})"); checkOutput("pkg1/C.html", false, - "@ContaineeSynthDoc " - + "@ContaineeSynthDoc", - "@RegContainerValNotDoc" - + "(value={" - + "value={" + + "@RegContaineeDoc," - + "@RegContaineeDoc}," - + "y=4)", - "y=4)", + "@ContainerValNotDoc" - + "(value={" - + "value={" + + "@ContaineeNotDoc," - + "@ContaineeNotDoc}," - + "x=2)", - "x=2)", + "@ContainerSynthNotDoc(" - + "value=" - + "value=" + + "@ContaineeSynthDoc)"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java --- a/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,10 +50,10 @@ "List", "
      \n" + "
      See Also:
      \n" - + "
      Test.InnerOne.foo(), \n" - + "Test.InnerOne.bar(Object), \n" + + "
      Test.InnerOne.foo(), \n" + + "Test.InnerOne.bar(Object), \n" + "Javadoc, \n" - + "something
      \n" + + "something\n" + "
      "); checkOutput("pkg/Test.html", false, diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java --- a/test/langtools/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ checkOutput("pkg/C.html", true, "
      " + - "Package pkg
      "); + "Package pkg
      "); checkOutput("pkg/package-summary.html", false, "

      \n" + diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testThrowsTag/TestThrowsTag.java --- a/test/langtools/jdk/javadoc/doclet/testThrowsTag/TestThrowsTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testThrowsTag/TestThrowsTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * 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,14 +48,14 @@ checkExit(Exit.OK); checkOutput("pkg/C.html", true, - "

      T1 - the first throws tag.
      \n" + - "
      T2 - the second throws tag.
      \n" + - "
      T3 - the third throws tag.
      \n" + - "
      T4 - the fourth throws tag.
      \n" + - "
      T5 - the first inherited throws tag.
      \n" + - "
      T6 - the second inherited throws tag.
      \n" + - "
      T7 - the third inherited throws tag.
      \n" + - "
      T8 - the fourth inherited throws tag.
      " + "
      T1 - the first throws tag.
      \n" + + "
      T2 - the second throws tag.
      \n" + + "
      T3 - the third throws tag.
      \n" + + "
      T4 - the fourth throws tag.
      \n" + + "
      T5 - the first inherited throws tag.
      \n" + + "
      T6 - the second inherited throws tag.
      \n" + + "
      T7 - the third inherited throws tag.
      \n" + + "
      T8 - the fourth inherited throws tag.
      " ); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java --- a/test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testTitleInHref/TestTitleInHref.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ checkOutput("pkg/Links.html", true, //Test to make sure that the title shows up in a class link. - "", + "", //Test to make sure that the title shows up in an interface link. - "", + "", //Test to make sure that the title shows up in cross link shows up "" diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java --- a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/TestTypeAnnotations.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. * 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,675 +49,675 @@ // Test for type annotations on Class Extends (ClassExtends.java). checkOutput("typeannos/MyClass.html", true, - "extends @ClassExtA @ClassExtA ParameterizedClass<" + + "ClassExtB.html\" title=\"annotation in typeannos\">" + "@ClassExtB java.lang.String>", - "implements @ClassExtB java.lang.CharSequence, " - + "@ClassExtA @ClassExtA ParameterizedInterface<" - + "@ClassExtB java.lang.String>"); checkOutput("typeannos/MyInterface.html", true, - "extends @ClassExtA @ClassExtA " - + "ParameterizedInterface<<@ClassExtA java.lang.String>, " - + "@ClassExtB java.lang.CharSequence"); // Test for type annotations on Class Parameters (ClassParameters.java). checkOutput("typeannos/ExtendsBound.html", true, "class ExtendsBound<K extends @ClassParamA java.lang.String>"); checkOutput("typeannos/ExtendsGeneric.html", true, "
      class ExtendsGeneric<K extends "
      -                + "@ClassParamA @ClassParamA Unannotated<"
      +                + "ClassParamB.html\" title=\"annotation in typeannos\">"
                       + "@ClassParamB java.lang.String>>");
       
               checkOutput("typeannos/TwoBounds.html", true,
                       "
      class TwoBounds<K extends "
      -                + "@ClassParamA java.lang.String,V extends "
      +                + "@ClassParamA java.lang.String,V extends @ClassParamB"
                       + " java.lang.String>");
       
               checkOutput("typeannos/Complex1.html", true,
      -                "class Complex1<K extends "
      +                "class Complex1<K extends "
                       + "@ClassParamA java.lang.String & java.lang.Runnable>");
       
               checkOutput("typeannos/Complex2.html", true,
                       "class Complex2<K extends java.lang."
      -                + "String & @ClassParamB java.lang.Runnable>");
       
               checkOutput("typeannos/ComplexBoth.html", true,
                       "class ComplexBoth<K extends @ClassParamA java.lang.String & @ClassParamA java.lang.String & @ClassParamA"
                       + " java.lang.Runnable>");
       
               // Test for type annotations on fields (Fields.java).
               checkOutput("typeannos/DefaultScope.html", true,
      -                "
      Parameterized<Parameterized<@FldA java.lang.String,"
      +                + "href=\"FldB.html\" title=\"annotation in typeannos\">"
                       + "@FldB java.lang.String> bothTypeArgs
      ", - "
      @FldA java.lang.String @FldA java.lang.String @FldB [] "
                       + "array1Deep
      ", - "
      java.lang.String java.lang.String @FldB [][] array2SecondOld
      ", // When JDK-8068737, we should change the order - "
      "
      +                "
      "
                       + "@FldD java.lang.String "
      -                + "@FldC "
      -                + "@FldB [] "
      -                + "@FldC "
      -                + "@FldA [] "
      +                + "@FldC "
      +                + "@FldB [] "
      +                + "@FldC "
      +                + "@FldA [] "
                       + "array2Deep
      "); checkOutput("typeannos/ModifiedScoped.html", true, - "
      public final Parameterized<@FldA "
      -                + "Parameterized<public final Parameterized<@FldA "
      +                + "Parameterized<@FldA java.lang.String,"
      -                + "@FldB java.lang.String>,"
      +                + "@FldB java.lang.String>,@FldB java.lang.String> "
                       + "nestedParameterized
      ", - "
      public final public final @FldA java.lang.String[][] "
                       + "array2
      "); // Test for type annotations on method return types (MethodReturnType.java). checkOutput("typeannos/MtdDefaultScope.html", true, - "
      public <T> public <T> @MRtnA java.lang.String"
                       + " method()
      ", // When JDK-8068737 is fixed, we should change the order - "
      "
      +                "
      "
                       + "@MRtnA java.lang.String "
      -                + "@MRtnB [] "
      -                + "@MRtnA []"
      +                + "@MRtnB [] "
      +                + "@MRtnA []"
                       + " array2Deep()
      ", - "
      @MRtnA java.lang.String[][] array2()
      "); checkOutput("typeannos/MtdModifiedScoped.html", true, - "
      public final MtdParameterized<@MRtnA "
      -                + "MtdParameterized<public final MtdParameterized<@MRtnA "
      +                + "MtdParameterized<@MRtnA java.lang."
      -                + "String,@MRtnB java.lang.String>,@MRtnB java.lang.String>,@MRtnB java."
                       + "lang.String> nestedMtdParameterized()
      "); // Test for type annotations on method type parameters (MethodTypeParameters.java). checkOutput("typeannos/UnscopedUnmodified.html", true, - "
      <K extends <K extends @MTyParamA java.lang.String>"
                       + " void methodExtends()
      ", - "
      <K extends @MTyParamA <K extends @MTyParamA "
      -                + "MtdTyParameterized<<@MTyParamB java.lang.String"
                       + ">> void nestedExtends()
      "); checkOutput("typeannos/PublicModifiedMethods.html", true, - "
      public final <K extends public final <K extends @MTyParamA "
                       + "java.lang.String> void methodExtends()
      ", - "
      public final <K extends public final <K extends @MTyParamA "
      -                + "java.lang.String,V extends @MTyParamA "
      -                + "MtdTyParameterized<@MTyParamA "
      +                + "MtdTyParameterized<@MTyParamB java.lang.String"
                       + ">> void dual()
      "); // Test for type annotations on parameters (Parameters.java). checkOutput("typeannos/Parameters.html", true, - "
      void unannotated​(void unannotated​("
                       + "ParaParameterized<java.lang.String,java.lang.String>"
                       + " a)
      ", - "
      void nestedParaParameterized​(void nestedParaParameterized​("
      +                + "ParaParameterized<@ParamA "
      -                + "ParaParameterized<@ParamA "
      -                + "ParaParameterized<<@ParamA java.lang.String,"
      -                + "@ParamB java.lang.String>,@ParamB"
      +                + "@ParamB java.lang.String>,@ParamB"
                       + " java.lang.String> a)
      ", // When JDK-8068737 is fixed, we should change the order - "
      void array2Deep​(void array2Deep​(@ParamA java.lang.String "
      -                + ""
      +                + ""
                       + "@ParamB [] "
      -                + ""
      +                + ""
                       + "@ParamA []"
                       + " a)
      "); // Test for type annotations on throws (Throws.java). checkOutput("typeannos/ThrDefaultUnmodified.html", true, "
      void oneException()\n"
      -                + "           throws @ThrA java.lang.Exception
      ", "
      void twoExceptions()\n"
      -                + "            throws @ThrA java.lang.RuntimeException,\n"
      -                + "                   @ThrA java.lang.Exception
      "); checkOutput("typeannos/ThrPublicModified.html", true, "
      public final void oneException​(java.lang.String a)\n"
      -                + "                        throws @ThrA java.lang.Exception
      ", "
      public final void twoExceptions​(java.lang.String a)\n"
      -                + "                         throws @ThrA java.lang.RuntimeException,\n"
      -                + "                                @ThrA java.lang.Exception
      "); checkOutput("typeannos/ThrWithValue.html", true, "
      void oneException()\n"
      -                + "           throws @ThrB("
                       + "\"m\") java.lang.Exception
      ", "
      void twoExceptions()\n"
      -                + "            throws @ThrB("
                       + "\"m\") java.lang.RuntimeException,\n"
      -                + "                   @ThrA java.lang.Exception
      "); // Test for type annotations on type parameters (TypeParameters.java). checkOutput("typeannos/TestMethods.html", true, - "
      <K,"
      -                + "@TyParaA V extends <K,"
      +                + "@TyParaA V extends @TyParaA "
                       + "java.lang.String> void secondAnnotated()
      " ); // Test for type annotations on wildcard type (Wildcards.java). checkOutput("typeannos/BoundTest.html", true, - "
      void wcExtends​(void wcExtends​(MyList<? extends @WldA"
      +                + "WldA.html\" title=\"annotation in typeannos\">@WldA"
                       + " java.lang.String> l)
      ", - "
      MyList<? super MyList<? super @WldA java.lang.String>"
                       + " returnWcSuper()
      "); checkOutput("typeannos/BoundWithValue.html", true, - "
      void wcSuper​(MyList<? super void wcSuper​(MyList<? super @WldB("
                       + "\"m\") java.lang."
                       + "String> l)
      ", - "
      MyList<? extends MyList<? extends @WldB("
                       + "\"m\") java.lang.String"
                       + "> returnWcExtends()
      "); // Test for receiver annotations (Receivers.java). checkOutput("typeannos/DefaultUnmodified.html", true, - "
      void withException​(void withException​(@RcvrA "
                       + "DefaultUnmodified this)\n"
                       + "            throws java."
                       + "lang.Exception
      ", - "
      java.lang.String nonVoid​(@RcvrA @RcvrB"
      +                "
      java.lang.String nonVoid​(@RcvrA @RcvrB"
                       + "(\"m\")"
                       + " DefaultUnmodified this)
      ", "
      <T extends java.lang.Runnable> void accept​("
      -                + "@RcvrA DefaultUnmodified this,\n"
                       + "                                           T r)\n"
                       + "                                    throws java.lang.Exception
      "); checkOutput("typeannos/PublicModified.html", true, "
      public final java.lang.String nonVoid​("
      +                + "RcvrA.html\" title=\"annotation in typeannos\">"
                       + "@RcvrA PublicModified this)
      ", "
      public final <T extends java.lang.Runnable> "
      -                + "void accept​(@RcvrA PublicModified this,\n"
                       + "                                                        T r)\n"
                       + "                                                 throws java.lang.Exception
      "); checkOutput("typeannos/WithValue.html", true, "
      <T extends java.lang.Runnable> void accept​("
      -                + "@RcvrB("
                       + "\"m\") WithValue this,\n"
                       + "                                           T r)\n"
                       + "                                    throws java.lang.Exception
      "); checkOutput("typeannos/WithFinal.html", true, - "
      java.lang.String nonVoid​(java.lang.String nonVoid​(@RcvrB(\"m\") "
      -                + ""
      +                + ""
                       + "WithFinal afield)
      "); checkOutput("typeannos/WithBody.html", true, - "
      void field​(void field​(@RcvrA WithBody this)
      "); checkOutput("typeannos/Generic2.html", true, - "
      void test2​(void test2​(@RcvrA Generic2<X> this)
      "); // Test for repeated type annotations (RepeatedAnnotations.java). checkOutput("typeannos/RepeatingAtClassLevel.html", true, - "
      @RepTypeA @RepTypeA @RepTypeA\n"
      -                + "@RepTypeB "
      +                + "@RepTypeB @RepTypeB\nclass RepeatingAtClassLevel\nextends "
                       + "java.lang.Object
      "); // @ignore 8146008 // checkOutput("typeannos/RepeatingAtClassLevel2.html", true, -// "
      @RepTypeUseA @RepTypeUseA @RepTypeUseA\n@RepTypeUseB @RepTypeUseB @RepTypeUseB\nclass RepeatingAtClassLevel2\nextends "
       //                + "java.lang.Object
      "); // // checkOutput("typeannos/RepeatingAtClassLevel2.html", true, -// "
      @RepAllContextsA @RepAllContextsA @RepAllContextsA\n@RepAllContextsB @RepAllContextsB @RepAllContextsB\n"
       //                + "class RepeatingAtClassLevel3\n"
       //                + "extends java.lang.Object
      "); checkOutput("typeannos/RepeatingOnConstructor.html", true, - "
      @RepConstructorA @RepConstructorA @RepConstructorA\n@RepConstructorB @RepConstructorB @RepConstructorB\n"
                       + "RepeatingOnConstructor()
      ", - "
      @RepConstructorA @RepConstructorA @RepConstructorA\n@RepConstructorB @RepConstructorB @RepConstructorB\n"
                       + "RepeatingOnConstructor​(int i,\n                       int j)
      ", - "
      @RepAllContextsA @RepAllContextsA @RepAllContextsA\n"
      -                + "@RepAllContextsB @RepAllContextsB @RepAllContextsB\n"
                       + "RepeatingOnConstructor​(int i,\n                       int j,\n"
                       + "                       int k)
      ", - "
      RepeatingOnConstructor​(RepeatingOnConstructor​(@RepParameterA @RepParameterA @RepParameterA @RepParameterB "
      -                + "@RepParameterB\n                       java.lang.String parameter,\n"
      -                + "                       @RepParameterA "
      -                + "@RepParameterA "
      +                + "@RepParameterA @RepParameterB "
      +                + "\"RepParameterB.html\" title=\"annotation in typeannos\">"
                       + "@RepParameterB\n                       java.lang.String "
      -                + ""
      -                + "@RepTypeUseA "
      +                + "@RepTypeUseA @RepTypeUseA @RepTypeUseB "
      -                + ""
      +                + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">@RepTypeUseB "
      +                + ""
                       + "@RepTypeUseB ... vararg)
      " ); checkOutput("typeannos/RepeatingOnConstructor.Inner.html", true, - "Inner" + "​(java.lang.String parameter,\n java.lang.String " - + "@RepTypeUseA @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">" + "@RepTypeUseB ... vararg)", - "Inner​(" - + "@RepTypeUseA @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">" + "@RepTypeUseB RepeatingOnConstructor this,\n " - + "@RepParameterA @RepParameterA " + + "@RepParameterA @RepParameterA @RepParameterB " + + "\"RepParameterB.html\" title=\"annotation in typeannos\">" + "@RepParameterB\n java.lang.String parameter,\n" - + " " - + "@RepParameterA @RepParameterA " + + "@RepParameterA @RepParameterA @RepParameterB " - + "@RepParameterB\n java.lang.String " + + "@RepParameterB\n java.lang.String @RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB ... vararg)"); checkOutput("typeannos/RepeatingOnField.html", true, "(package private) java.lang.Integer\n
      \n" ); checkOutput("pkg1/class-use/UsedThrowable.html", true, - "Methods in pkg1 that throw " - + "UsedThrowable", + "Methods in pkg1 that throw " + + "UsedThrowable", "\n" ); } @@ -169,9 +169,9 @@ "-package", "unique"); checkExit(Exit.OK); checkUnique("unique/class-use/UseMe.html", - "", - "", - "", - ""); + "", + "", + "", + ""); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java --- a/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTag.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,19 +52,19 @@ // Base case: using @value on a constant. "Result: \"Test 1 passes\"", // Retrieve value of constant in same class. - "Result: \"Test 2 passes\"", - "Result: \"Test 3 passes\"", - "Result: \"Test 4 passes\"", - "Result: \"Test 5 passes\"", - "Result: \"Test 6 passes\""); + "Result: \"Test 2 passes\"", + "Result: \"Test 3 passes\"", + "Result: \"Test 4 passes\"", + "Result: \"Test 5 passes\"", + "Result: \"Test 6 passes\""); checkOutput("pkg1/Class2.html", true, // Retrieve value of constant in different class. - "Result: \"Test 7 passes\"", - "Result: \"Test 8 passes\"", - "Result: \"Test 9 passes\"", - "Result: \"Test 10 passes\"", - "Result: \"Test 11 passes\"", + "Result: \"Test 7 passes\"", + "Result: \"Test 8 passes\"", + "Result: \"Test 9 passes\"", + "Result: \"Test 10 passes\"", + "Result: \"Test 11 passes\"", // Retrieve value of constant in different package "Result: \"Test 12 passes\"", "Result: \"Test 13 passes\"", @@ -74,7 +74,7 @@ checkOutput("pkg2/package-summary.html", true, // Retrieve value of constant from a package page - "Result: \"Test 17 passes\""); + "Result: \"Test 17 passes\""); checkOutput("pkg1/CustomTagUsage.html", true, // Test @value tag used with custom tag. @@ -104,7 +104,7 @@ checkOutput("pkg1/Class1.html", false, // Base case: using @value on a constant. - "Result: \"Test 12 " + "Result: \"Test 12 " + "generates an error message\""); checkForException(); @@ -141,9 +141,9 @@ checkExit(Exit.OK); checkOrder("pkg3/RT.html", - "The value is \"constant\".", - "The value1 is \"constant\".", - "The value2 is \"constant\".", + "The value is \"constant\".", + "The value1 is \"constant\".", + "The value2 is \"constant\".", "The value3 is " + "\"Test 12 passes\"."); } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testWarnings/TestWarnings.java --- a/test/langtools/jdk/javadoc/doclet/testWarnings/TestWarnings.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testWarnings/TestWarnings.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. * 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,8 +78,8 @@ checkExit(Exit.ERROR); checkOutput("pkg/X.html", true, - "m()
      ", - "X()
      ", - "f
      "); + "m()
      ", + "X()
      ", + "f
      "); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/jshell/VariablesTest.java --- a/test/langtools/jdk/jshell/VariablesTest.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/jshell/VariablesTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -26,6 +26,9 @@ * @bug 8144903 8177466 8191842 * @summary Tests for EvaluationState.variables * @library /tools/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * jdk.jshell * @build Compiler KullaTesting TestingInputStream ExpectedDiagnostic * @run testng VariablesTest */ diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/tools/javac/MethodParameters/DefaultParamNames.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/langtools/tools/javac/MethodParameters/DefaultParamNames.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,77 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8194268 + * @summary Incorrect parameter names for synthetic methods + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.code + * jdk.compiler/com.sun.tools.javac.tree + * jdk.compiler/com.sun.tools.javac.util + * @compile DefaultParamNames.java + * @run main DefaultParamNames + */ + +import static java.util.stream.Collectors.joining; + +import com.sun.tools.javac.api.BasicJavacTask; +import com.sun.tools.javac.code.Flags; +import com.sun.tools.javac.code.Symbol.MethodSymbol; +import com.sun.tools.javac.code.Symtab; +import com.sun.tools.javac.code.Type.MethodType; +import com.sun.tools.javac.util.Assert; +import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.Names; +import java.util.Objects; +import javax.tools.JavaCompiler; +import javax.tools.ToolProvider; + +public class DefaultParamNames { + + public static void main(String[] args) { + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + BasicJavacTask task = (BasicJavacTask) compiler.getTask(null, null, null, null, null, null); + Context context = task.getContext(); + Names names = Names.instance(context); + Symtab symtab = Symtab.instance(context); + MethodType mt = + new MethodType( + List.of(symtab.intType, symtab.stringType, symtab.objectType), + symtab.voidType, + List.nil(), + symtab.methodClass); + MethodSymbol ms = + new MethodSymbol(Flags.SYNTHETIC, names.fromString("test"), mt, symtab.methodClass); + String paramNames = + ms.params().stream().map(p -> p.getSimpleName().toString()).collect(joining(",")); + assertEquals("arg0,arg1,arg2", paramNames); + } + + static void assertEquals(Object expected, Object actual) { + Assert.check( + Objects.equals(expected, actual), + String.format("expected: %s, but was: %s", expected, actual)); + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/tools/javac/jvm/VerboseClassPathTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/langtools/tools/javac/jvm/VerboseClassPathTest.java Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018, Google Inc. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * 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 8179373 + * @summary javac -verbose logs the class path multiple times + * @modules jdk.compiler + * @run main VerboseClassPathTest + */ + +import java.io.BufferedReader; +import java.io.PrintWriter; +import java.io.StringReader; +import java.io.StringWriter; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.spi.ToolProvider; + +public class VerboseClassPathTest { + public static void main(String... args) throws Exception { + new VerboseClassPathTest().run(); + } + + void run() throws Exception { + String className = getClass().getName(); + Path testSrc = Paths.get(System.getProperty("test.src")); + Path file = testSrc.resolve(className + ".java"); + ToolProvider javac = ToolProvider.findFirst("javac").orElseThrow(); + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw, true); + int rc = + javac.run( + pw, + pw, + "-d", + ",", + "-source", + "8", + "-target", + "8", + "-verbose", + file.toString()); + String log = sw.toString(); + System.out.println(log); + if (rc != 0) { + throw new Exception("compilation failed: rc=" + rc); + } + String expect = "[search path for class files:"; + long count = + new BufferedReader(new StringReader(log)) + .lines() + .filter(line -> line.startsWith(expect)) + .count(); + if (count != 1) { + throw new Exception("expected '" + expect + "' to appear once, actual: " + count); + } + } +} diff -r fb62f481671e -r 2d03ebb72df2 test/nashorn/script/basic/JDK-8195829.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/basic/JDK-8195829.js Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +/** + * JDK-8195829 : Parsing a nameless ES6 class results in a thrown NullPointerException. + * + * @test + * @run + */ + +var Parser = Java.type("jdk.nashorn.api.tree.Parser"); +var SimpleTreeVisitor = Java.type("jdk.nashorn.api.tree.SimpleTreeVisitorES6"); +var parser = Parser.create("--language=es6"); +var ast = parser.parse("test.js", "(class {});", print); +var reachedClassExpr = false; +ast.accept(new (Java.extend(SimpleTreeVisitor)) { + visitClassExpression: function(node, extra) { + reachedClassExpr = true; + Assert.assertTrue(node.name === null); + } +}, null); + +Assert.assertTrue(reachedClassExpr); + diff -r fb62f481671e -r 2d03ebb72df2 test/nashorn/script/nosecurity/jjs-option-t.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/nashorn/script/nosecurity/jjs-option-t.js Tue Jan 30 09:03:47 2018 -0800 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * 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-8147614: add jjs test for -t option. + * @test + * @option -scripting + * @run + * @summary Test -t flag and its basic functionality + */ + +load(__DIR__ + "jjs-common.js") + +var timezone = Java.type("java.util.TimeZone") +var currentTimezone = timezone.getDefault().getID() +var msg_flag = "print($OPTIONS._timezone.ID)" +var e_outp = "Asia/Tokyo" +var e_outn = currentTimezone + +var msg_func=<
      Properties 
      C.BooleanPropertyC.BooleanProperty
      C.DoublePropertyC.DoubleProperty
      C.BooleanPropertyC.BooleanProperty
      C.DoublePropertyC.DoubleProperty
      <T> java.lang.Object" - + "alphaProperty" + + "alphaProperty" + "​(java.util.List<T> foo) 
      java.lang.Object" - + "betaProperty() 
      java.util.List<java.util.Set<? super java.lang.Object>>" + "" - + "deltaProperty() 
      java.util.List<java.lang.String>" - + "gammaProperty()  static java.time.Period" - + "" + + "" + "between​(java.time.LocalDate startDateInclusive,\n" + " java.time.LocalDate endDateExclusive)" + "PublicChild\n" + + "" + "returnTypeTest()", // Check return type in member detail. - "
      public "
      +                "
      public "
                       + "PublicChild returnTypeTest()
      ", "
      " - + "PublicChild()private " - + "PrivateParent​(int i)" + + "PrivateParent​(int i)" + "
      Enum Constants" + " 
      E[]" - + "" - + "methodThatReturnsTypeParameterA​(" + + "methodThatReturnsTypeParameterA​(E[] e)", - "
      public public E[] "
      -                + "methodThatReturnsTypeParameterA​(E[] e)
      \n", "
      <T extends java.lang.Object & java.lang.Comparable<? super T>>" + "
      T
      " - + "" + + "" + "methodtThatReturnsTypeParametersB​(java.util.Collection<? extends T> coll)", "
      Returns TypeParameters
      \n", // Method takes a TypeVariable "
      <X extends java.lang.Throwable>
      " - + "E" + + "E" + "
      " - + "" + + "" + "orElseThrow​(java.util.function.Supplier<? extends X> exceptionSupplier)" ); checkOutput("pkg/Wildcards.html", true, // Wildcard testing. - "" + "" + "TypeParameters<? super java.lang.String> a", - "" + "" + "TypeParameters<? extends java.lang.StringBuffer> b", - "" + "" + "TypeParameters c"); checkOutput(Output.OUT, true, @@ -179,7 +179,7 @@ "
      public class TypeParameterSubClass<T extends "
                       + "java.lang.String>\n"
                       + "extends "
      -                + ""
      +                + ""
                       + "TypeParameterSuperClass<T>
      "); // Interface generic parameter substitution @@ -187,21 +187,21 @@ checkOutput("pkg/TypeParameters.html", true, "
      \n" + "
      All Implemented Interfaces:
      \n" - + "
      " - + "SubInterface<E>, " + + "SubInterface<E>, SuperInterface<E>
      \n" + "
      "); checkOutput("pkg/SuperInterface.html", true, "
      \n" + "
      All Known Subinterfaces:
      \n" - + "
      " + + "
      " + "SubInterface<V>
      \n" + "
      "); checkOutput("pkg/SubInterface.html", true, "
      \n" + "
      All Superinterfaces:
      \n" - + "
      " + + "
      " + "SuperInterface<V>
      \n" + "
      "); @@ -216,212 +216,212 @@ //============================================================== // ClassUseTest1: checkOutput("pkg2/class-use/Foo.html", true, - "
      Classes in Classes in pkg2 with type parameters of " - + "type " + + "type " + "Foo 
      ClassUseTest1<T extends " - + "Foo" - + " & " + + "Foo" + + " & " + "Foo2>
      Methods in Methods in pkg2 with type parameters of " - + "type Foo 
      ClassUseTest1." - + "method" + "​(T t)
      Fields in Fields in pkg2 with type parameters of " - + "type " + + "type " + "Foo Fields in Fields in pkg2 declared as ParamTest" + + "ParamTest.html\" title=\"class in pkg2\">ParamTest" + " 
      ParamTest<FooFoo>
      Classes in Classes in pkg2 with type parameters of " - + "type Foo2 " + "
      ClassUseTest1<T extends " - + "Foo" - + " & " + + "Foo" + + " & " + "Foo2>
      Methods in Methods in pkg2 with type parameters of " - + "type Foo2 " + "
      " - + "ClassUseTest1.method" + + "ClassUseTest1.method" + "​(T t)
      Classes in Classes in pkg2 with type parameters of " - + "type ParamTest" + " 
      ClassUseTest2<T extends " - + "" - + "ParamTest<" + + "" + + "ParamTest<" + "Foo3>>
      Methods in Methods in pkg2 with type parameters of " - + "type ParamTest" + " 
      ClassUseTest2." - + "method" + "​(T t)
      Fields in Fields in pkg2 declared as ParamTest" + + "ParamTest.html\" title=\"class in pkg2\">ParamTest" + " 
      ParamTest" - + "<" + + "<" + "Foo>
      Methods in Methods in pkg2 with type parameters of " - + "type ParamTest" + " 
      <T extends ParamTest" - + "<Foo3>>
      ParamTest" + + "<Foo3>>
      ParamTest" - + "<Foo3>
      Classes in Classes in pkg2 with type parameters of " - + "type " + + "type " + "Foo3 
      ClassUseTest2<T extends " - + "" - + "ParamTest<" + + "" + + "ParamTest<" + "Foo3>>
      Methods in Methods in pkg2 with type parameters of " - + "type Foo3 " + "
      ClassUseTest2." - + "method" + "​(T t)
      Methods in Methods in pkg2 that return types with " - + "arguments of type Foo3" + " 
      <T extends ParamTest<" - + "Foo3" - + ">>
      ParamTest<<T extends ParamTest<" + + "Foo3" + + ">>
      ParamTest<Foo3>
      Classes in Classes in pkg2 with type parameters of " - + "type ParamTest2" + " 
      ClassUseTest3<T extends " - + "" + + "" + "ParamTest2<java.util.List<? extends " - + "" + + "" + "Foo4>>>
      Methods in Methods in pkg2 with type parameters of " - + "type ParamTest2" + " 
      ClassUseTest3" - + ".method​(T t)<T extends " + + "ParamTest2.html\" title=\"class in pkg2\">" + "ParamTest2<java.util.List<? extends Foo4>" - + ">>
      Foo4>" + + ">>
      ParamTest2<java.util.List" - + "<? extends Foo4>>
      Classes in Classes in pkg2 with type parameters of " - + "type Foo4 " + "
      ClassUseTest3<T extends " - + "" + + "" + "ParamTest2<java.util.List<? extends " - + "" + + "" + "Foo4>>>
      Methods in Methods in pkg2 with type parameters of " - + "type Foo4 
      ClassUseTest3." - + "method​(T t)" + "
      Methods in Methods in pkg2 that return types with " - + "arguments of type Foo4 
      <T extends " + + "ParamTest2.html\" title=\"class in pkg2\">" + "ParamTest2<java.util.List<? extends Foo4>" - + ">>
      Foo4>" + + ">>
      ParamTest2<java.util.List" - + "<? extends Foo4>>
      Method parameters in Method parameters in pkg2 with type arguments of " - + "type Foo4 " + "
      voidClassUseTest3." - + "method​(java." - + "util.Set<Foo4> p)
      Constructor parameters in pkg2 with type arguments " - + "of type Constructor parameters in pkg2 with type arguments " + + "of type Foo4 " + "Packages with annotations of type " + + "../AnnotationType.html\" title=\"annotation in pkg\">" + "AnnotationType " + "Classes in Classes in pkg with annotations of type " - + "AnnotationType Fields in Fields in pkg with annotations of type " - + "AnnotationType" + " Methods in Methods in pkg with annotations of type " - + "AnnotationType" + " Method parameters in Method parameters in pkg with annotations of type " - + "AnnotationType" + " Constructors in Constructors in pkg with annotations of type " - + "AnnotationType" + " Constructor parameters in pkg with annotations of " - + "type Constructor parameters in pkg with annotations of " + + "type AnnotationType 
      C0C0 
      C1C1 
      C2C2 
      C3C3 
      C4C4 
      " + - "" + + "" + "methodInterface​(int p1)\n" + "
      Comment from interface.
      \n
      " + - "" + + "" + "methodInterface2​(int p1)\n" + "
      Comment from interface.
      \n
      ObjectProperty<ObjectProperty<MyObj[]>" - + "bad
      ObjectProperty<ObjectProperty<MyObj[]>" - + "badProperty()" - + "i1", - "(package private) (package private) @RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.Integer\n" + "i2", + + "\"#i2\">i2", - "(package private) @RepTypeUseA (package private) @RepTypeUseA @RepTypeUseA " - + "@RepTypeUseB " + + "@RepTypeUseB @RepTypeUseB java.lang.Integer" + "\n" - + "i3", + + "i3", - "(package private) @RepAllContextsA (package private) @RepAllContextsA @RepAllContextsA " - + "@RepAllContextsB " + + "@RepAllContextsB @RepAllContextsB java.lang.Integer" + "\n" - + "i4", + + "i4", - "(package private) java.lang.String (package private) java.lang.String @RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB [] " - + "@RepTypeUseA @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">" + "@RepTypeUseB []\nsa", - "
      "
      -                + "@RepFieldA @RepFieldA\n"
      +                + "@RepFieldA @RepFieldA\n@RepFieldB "
      +                + "\"RepFieldB.html\" title=\"annotation in typeannos\">"
                       + "@RepFieldB\njava.lang.Integer i1
      ", - "
      @RepTypeUseA @RepTypeUseA @RepTypeUseA "
      -                + ""
      -                + "@RepTypeUseB "
      +                + "@RepTypeUseB @RepTypeUseB java.lang.Integer i2
      ", - "
      "
      -                + "@RepFieldA @RepFieldA\n"
      +                + "@RepFieldA @RepFieldA\n@RepFieldB "
      -                + "@RepFieldB\n@RepTypeUseA "
      +                + "@RepFieldB\n@RepTypeUseA @RepTypeUseA "
      -                + "@RepTypeUseB "
      +                + "@RepTypeUseB @RepTypeUseB java.lang.Integer i3
      ", - "
      "
      -                + "@RepAllContextsA "
      +                + "@RepAllContextsA @RepAllContextsA\n"
      -                + "@RepAllContextsB "
      +                + "@RepAllContextsB @RepAllContextsB\n"
      -                + ""
      -                + "@RepAllContextsA "
      +                + "@RepAllContextsA @RepAllContextsA "
      -                + "@RepAllContextsB "
      +                + "@RepAllContextsB @RepAllContextsB java.lang.Integer i4
      ", - "
      java.lang.String @RepTypeUseA java.lang.String @RepTypeUseA @RepTypeUseA "
      -                + "@RepTypeUseB "
      +                + "@RepTypeUseB @RepTypeUseB [] "
      -                + "@RepTypeUseA @RepTypeUseA "
      +                + "@RepTypeUseA @RepTypeUseA @RepTypeUseB "
      +                + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">"
                       + "@RepTypeUseB [] sa
      "); checkOutput("typeannos/RepeatingOnMethod.html", true, "(package private) java.lang.String\n
      " + "test1()", + + "\"#test1--\">test1()", - "(package private) (package private) @RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String" + "\n" - + "test2" + + "test2" + "()", - "(package private) (package private) @RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String" + "\n" - + "test3" + + "test3" + "()", - "(package private) (package private) @RepAllContextsA " - + "@RepAllContextsA " + + "@RepAllContextsA @RepAllContextsB " + + "\"RepAllContextsB.html\" title=\"annotation in typeannos\">" + "@RepAllContextsB java.lang.String\n" - + "test4()", - "test5" + "​(java.lang.String parameter,\n java.lang.String " - + "@RepTypeUseA @RepTypeUseA " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "\"RepTypeUseB.html\" title=\"annotation in typeannos\">" + "@RepTypeUseB ... vararg)", - "" - + "@RepMethodA @RepMethodA\n" + + "@RepMethodA @RepMethodA\n@RepMethodB " + + "\"RepMethodB.html\" title=\"annotation in typeannos\">" + "@RepMethodB\njava.lang.String test1()", - "" - + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB java.lang.String test2()", - "" - + "@RepMethodA @RepMethodA\n" + + "@RepMethodA @RepMethodA\n@RepMethodB " - + "@RepMethodB\n@RepTypeUseA " + + "@RepMethodB\n@RepTypeUseA @RepTypeUseA " - + "@RepTypeUseB " + + "@RepTypeUseB @RepTypeUseB java.lang.String test3()", - "" - + "@RepAllContextsA " + + "@RepAllContextsA @RepAllContextsA\n" - + "@RepAllContextsB " + + "@RepAllContextsB @RepAllContextsB\n" - + "@RepAllContextsA " + + "@RepAllContextsA @RepAllContextsA " - + "@RepAllContextsB " + + "@RepAllContextsB @RepAllContextsB java.lang.String test4()", - "java.lang.String test5​(@RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB RepeatingOnMethod " - + "this,\n @RepParameterA " - + "@RepParameterA " + + "@RepParameterA @RepParameterB " + + "\"RepParameterB.html\" title=\"annotation in typeannos\">" + "@RepParameterB\n java.lang.String parameter,\n" - + " @RepParameterA @RepParameterA @RepParameterA " - + "@RepParameterB " + + "@RepParameterB @RepParameterB\n " - + "java.lang.String @RepTypeUseA @RepTypeUseA @RepTypeUseA " - + "@RepTypeUseB " + + "@RepTypeUseB @RepTypeUseB ... vararg)"); checkOutput("typeannos/RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod.html", true, "(package private) <T> java.lang.String\n" + "genericMethod​(T t)", "(package private) <T> java.lang.String\n" + "genericMethod2​(@RepTypeUseA @RepTypeUseA @RepTypeUseB genericMethod2​(@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T t)", "(package private) java.lang.String\n" - + "test()", - "java.lang.String test​(@RepTypeUseA " - + "@RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseB @RepTypeUseB " + "RepeatingOnTypeParametersBoundsTypeArgumentsOnMethod<" - + "@RepTypeUseA @RepTypeUseA @RepTypeUseB " + + "@RepTypeUseA @RepTypeUseA @RepTypeUseB @RepTypeUseB T> this)"); checkOutput("typeannos/RepeatingOnVoidMethodDeclaration.html", true, - "" - + "@RepMethodA @RepMethodA\n" + + "@RepMethodA @RepMethodA\n@RepMethodB " + + "\"RepMethodB.html\" title=\"annotation in typeannos\">" + "@RepMethodB\nvoid test()"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java --- a/test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testTypeParams/TestTypeParameters.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. * 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,14 +57,14 @@ "<T> java.lang.Object"); checkOutput("pkg/package-summary.html", true, - "C<E extends <E extends Parent>"); checkOutput("pkg/class-use/Foo4.html", true, - "" - + "ClassUseTest3<T extends " + + "ClassUseTest3<T extends ParamTest2<java.util.List<? extends " - + "Foo4>>>"); + + "Foo4>>>"); // Nested type parameters checkOutput("pkg/C.html", true, @@ -84,8 +84,8 @@ checkOutput("pkg/ClassUseTest3.html", true, "public class " + - "ClassUseTest3<T extends <T extends ParamTest2<java.util.List<? extends " + - "Foo4>>>"); + "Foo4>>>"); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testTypeVariableLinks/TestTypeVariableLinks.java --- a/test/langtools/jdk/javadoc/doclet/testTypeVariableLinks/TestTypeVariableLinks.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testTypeVariableLinks/TestTypeVariableLinks.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. * 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 @@ checkOutput("pkg1/C.html", true, "
      Linking to List.clear() List.clear()
      "); checkOutput("pkg1/C.html", true, - "
      Linking to Additional.doAction() Additional.doAction()
      "); + "
      Linking to Additional.doAction() Additional.doAction()
      "); checkOutput("pkg1/C.html", true, - "
      Linking to I.abstractAction() I.abstractAction()
      "); + "
      Linking to I.abstractAction() I.abstractAction()
      "); } } diff -r fb62f481671e -r 2d03ebb72df2 test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java --- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Tue Jan 30 11:53:00 2018 +0530 +++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java Tue Jan 30 09:03:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. * 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,56 +84,56 @@ "that return types with arguments of type" ); checkOutput("pkg1/class-use/UsedClass.html", true, - "methodInC1ReturningType" + "methodInC1ReturningType" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "Classes in pkg1 that implement " + - "UsedInterface" + "Classes in pkg1 that implement " + + "UsedInterface" ); checkOutput("pkg1/class-use/UsedInterfaceA.html", true, - "Classes in pkg1 that implement " + - "UsedInterfaceA" + "Classes in pkg1 that implement " + + "UsedInterfaceA" ); checkOutput("pkg1/class-use/UsedClass.html", false, "methodInC1Protected" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "AnAbstract" + "AnAbstract" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "../../pkg1/C10.html#withReturningTypeParameters--" + "../C10.html#withReturningTypeParameters--" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "../../pkg1/C10.html#withTypeParametersOfType-java.lang.Class-" + "../C10.html#withTypeParametersOfType-java.lang.Class-" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "\"../../pkg1/package-summary.html\">pkg1 that return " + - "pkg1 that return " + + "addAll" + "addAll" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "" + + "" + "withTypeParametersOfType" ); checkOutput("pkg1/class-use/UsedInterface.html", true, - "Subinterfaces of " - + "UsedInterface in pkg1", + "Subinterfaces of " + + "UsedInterface in pkg1", "
      interface " - + "SubInterface<T>voidC1." - + "methodInC1ThrowsThrowable" + + "methodInC1ThrowsThrowable" + "()