This commit is contained in:
Phil Race 2018-01-30 09:03:47 -08:00
commit aa1aec4b56
272 changed files with 8071 additions and 2405 deletions

View File

@ -30,9 +30,10 @@ usage() {
}
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 @@ done
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 @@ addSourceFolder() {
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 "^ .* <sourceFolder.*####" > /dev/null ; then
@ -133,9 +147,9 @@ do
done
fi
else
printf "%s\n" "$line" >> $IDEA_IML
printf "%s\n" "$line" >> $IDEA_JDK
fi
done < "$IML_TEMPLATE"
done < "$JDK_TEMPLATE"
MODULE_NAME=" <property name=\"module.name\" value=\"####\" />"

View File

@ -586,69 +586,71 @@ AC_DEFUN([BASIC_EVAL_DEVKIT_VARIABLE],
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])
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
# 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
BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
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
# 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)
BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_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
# 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 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 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
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_CHECK_SRC_PERMS],
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"],

View File

@ -280,6 +280,9 @@ CUSTOM_LATE_HOOK
# 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"

View File

@ -5117,7 +5117,7 @@ TOOLCHAIN_MINIMUM_VERSION_xlc=""
################################################################################
# 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_SDK_INSTALLDIR_2013=
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 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1516225089
DATE_WHEN_GENERATED=1517274450
###############################################################################
#
@ -17113,6 +17137,12 @@ $as_echo "$as_me: Unknown variant(s) specified: $INVALID_VARIANTS" >&6;}
# 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 @@ $as_echo "$as_me: The path of with_devkit, which resolves as \"$path\", is inval
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
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5
{ $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 @@ $as_echo "$DEVKIT_ROOT" >&6; }
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 @@ $as_echo "$DEVKIT_ROOT" >&6; }
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 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 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 @@ $as_echo "$as_me: The following toolchain versions are valid on this platform:"
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 @@ $as_echo "$as_me: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&6;}
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 @@ $as_echo "$as_me: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&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 @@ $as_echo "$as_me: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&6;}
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32417,12 +32467,6 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32464,7 +32531,6 @@ $as_echo "$as_me: directory within the Visual Studio installation" >&6;}
fi
VS_ENV_CMD=""
VS_ENV_ARGS=""
if test "x$VS_COMNTOOLS" != x; then
@ -32473,12 +32539,6 @@ $as_echo "$as_me: directory within the Visual Studio installation" >&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 @@ $as_echo "$as_me: directory within the Visual Studio installation" >&6;}
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32514,12 +32597,6 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32557,12 +32657,6 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32597,12 +32714,6 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
@ -32613,19 +32724,42 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32636,12 +32770,6 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
@ -32652,19 +32780,42 @@ $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studi
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
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;}
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
@ -32917,6 +33068,11 @@ $as_echo "$as_me: Found $VS_DESCRIPTION" >&6;}
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 @@ $as_echo "$as_me: Trying to extract Visual Studio environment variables" >&6;}
# 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 @@ $as_echo "$as_me: or run \"bash.exe -l\" from a VS command prompt and then run c
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 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
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 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
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"
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"
# 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 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
fi
fi
done
fi
fi
@ -57237,7 +57408,6 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
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 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
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"
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"
# 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 @@ $as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE"
fi
fi
done
fi
fi
@ -68900,16 +69083,6 @@ $as_echo "no" >&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 @@ $as_echo "$JVM_FEATURES_TO_TEST" >&6; }
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 @@ fi
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 @@ fi
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.

View File

@ -242,10 +242,7 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
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 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
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],

View File

@ -286,7 +286,7 @@ AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
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=

View File

@ -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_SDK_INSTALLDIR_2013=
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 @@ AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
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
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
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
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])
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}}"
fi
fi
fi
@ -133,7 +175,9 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
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 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
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 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
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 @@ AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
break
fi
done
TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
if test "$TOOLCHAIN_VERSION" -gt 2013; then
UNSUPPORTED_TOOLCHAIN_VERSION=yes
fi
])
################################################################################
@ -320,6 +372,9 @@ AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
# 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 @@ AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
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 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
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 @@ AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
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}])

View File

@ -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" .)

View File

@ -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" .)

View File

@ -20,16 +20,9 @@ else #with SPEC
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)

View File

@ -3,7 +3,6 @@
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/.idea/build.xml">
<properties>
<property name="boot.java.home" value="$JDKPath$" />
<property name="intellij.ismake" value="$IsMake$" />
<property name="build.target.dir" value="specDir" /> <!-- this will be replaced -->
<property name="module.name" value="java.base" /> <!-- this will be replaced -->

View File

@ -6,32 +6,16 @@
new JdkLogger(project)
</script>
<!-- java.marker is set to a marker file to check for within a Java install dir.
The best file to check for across Solaris/Linux/Windows/MacOS is one of the
executables; regrettably, that is OS-specific. -->
<condition property="java.marker" value="bin/java">
<os family="unix"/>
</condition>
<condition property="java.marker" value="bin/java.exe">
<os family="windows"/>
</condition>
<target name="-check-jtreg.home" depends="-def-check">
<check name="jtreg" property="jtreg.home" marker="lib/jtreg.jar"/>
</target>
<property name="test.dir" value="${basedir}/jdk/test"/>
<macrodef name="call-make">
<attribute name="dir"/>
<attribute name="args"/>
<sequential>
<exec executable="make" dir="@{dir}" failonerror="true">
<arg line="@{args}"/>
<env key="CLASSPATH" value = ""/>
</exec>
</sequential>
</macrodef>
<attribute name="dir"/>
<attribute name="args"/>
<sequential>
<exec executable="make" dir="@{dir}" failonerror="true">
<arg line="@{args}"/>
<env key="CLASSPATH" value = ""/>
</exec>
</sequential>
</macrodef>
<target name="cond-clean" unless="${intellij.ismake}">
<antcall target="clean"/>
@ -43,71 +27,17 @@
**** Global JDK Build Targets
-->
<target name="clean" depends="-do-configure">
<target name="clean">
<echo message="base = ${basedir}"/>
<call-make dir = "${build.target.dir}" args = "reconfigure"/>
<call-make dir = "${build.target.dir}" args = "clean"/>
</target>
<target name="-do-configure">
<echo message="base = ${basedir}"/>
<fail message="Not part of a full JDK forest">
<condition>
<not>
<available file="${basedir}/configure" />
</not>
</condition>
</fail>
<exec executable="sh" dir="${basedir}" failonerror="true">
<arg line="configure --with-boot-jdk=${boot.java.home}"/>
</exec>
</target>
<target name="images">
<call-make dir = "${build.target.dir}" args = "images"/>
</target>
<target name="jimages">
<call-make dir = "${build.target.dir}" args = "jimages"/>
</target>
<target name="check-env">
<exec executable="env" dir="${basedir}"/>
</target>
<target name="build-module">
<call-make dir = "${build.target.dir}" args = "${module.name}"/>
</target>
<target name="-check-boot.java.home" depends="-def-check">
<check name="bootstrap java" property="boot.java.home" marker="${java.marker}"/>
</target>
<target name="-def-check">
<macrodef name="check">
<attribute name="name"/>
<attribute name="property"/>
<attribute name="marker" default=""/>
<sequential>
<fail message="Cannot locate @{name}: please set @{property} to its location">
<condition>
<not>
<isset property="@{property}"/>
</not>
</condition>
</fail>
<fail message="@{name} is not installed in ${@{property}}">
<condition>
<and>
<not>
<equals arg1="@{marker}" arg2=""/>
</not>
<not>
<available file="${@{property}}/@{marker}"/>
</not>
</and>
</condition>
</fail>
</sequential>
</macrodef>
</target>
</project>

View File

@ -4,11 +4,9 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/####" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/src" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/make" />
</content>
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
</component>

View File

@ -963,8 +963,12 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
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 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
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 @@ void MacroAssembler::lookup_interface_method(Register recv_klass,
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 @@ void MacroAssembler::lookup_virtual_method(Register recv_klass,
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));
}
}

View File

@ -875,7 +875,8 @@ public:
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

View File

@ -3279,11 +3279,11 @@ void TemplateTable::invokeinterface(int byte_no) {
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 @@ void TemplateTable::invokeinterface(int byte_no) {
__ 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,

View File

@ -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 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
#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 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
// 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 @@ VtableStub* VtableStubs::create_vtable_stub(int vtable_index) {
}
#endif // PRODUCT
__ lookup_virtual_method(r19, vtable_index, rmethod);
__ lookup_virtual_method(r16, vtable_index, rmethod);
if (DebugVtables) {
Label L;
@ -140,28 +141,44 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
#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();
__ load_klass(recv_klass_reg, j_rarg0);
// Most registers are in use; we'll use r0, rmethod, r10, r11
__ load_klass(r10, j_rarg0);
// 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);
Label throw_icce;
// Get Method* and entrypoint for compiler
// 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 @@ VtableStub* VtableStubs::create_itable_stub(int itable_index) {
__ 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 VtableStub::pd_code_size_limit(bool is_vtable_stub) {
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 @@ int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
// 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
}

View File

@ -1876,14 +1876,15 @@ public abstract class ClassLoader {
* value until the system is fully initialized.
*
* <p> 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. <em>a named module</em>. 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}
*

View File

@ -631,7 +631,8 @@ public final class System {
* <tr><th scope="row"><code>java.class.version</code></th>
* <td>Java class format version number</td></tr>
* <tr><th scope="row"><code>java.class.path</code></th>
* <td>Java class path</td></tr>
* <td>Java class path (refer to
* {@link ClassLoader#getSystemClassLoader()} for details)</td></tr>
* <tr><th scope="row"><code>java.library.path</code></th>
* <td>List of paths to search when loading libraries</td></tr>
* <tr><th scope="row"><code>java.io.tmpdir</code></th>

View File

@ -166,15 +166,8 @@ class VersionProps {
* 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 + "\""

View File

@ -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 @@ class Inet6Address extends InetAddress {
}
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);

View File

@ -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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* 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.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, this method returns month names in the
@ -405,10 +411,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> 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 @@ public class DateFormatSymbols implements Serializable, Cloneable {
/**
* 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.
*
* <p>If the language requires different forms for formatting and
* stand-alone usages, this method returns short month names in
@ -438,10 +449,9 @@ public class DateFormatSymbols implements Serializable, Cloneable {
* Calendar Elements in the Unicode Locale Data Markup Language
* (LDML) specification</a> 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);

View File

@ -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 @@ public final class IsoFields {
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");
}

View File

@ -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 @@ public class LogManager {
// 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 @@ public class LogManager {
}
}
private List<Handler> createLoggerHandlers(final String name, final String handlersPropertyName)
private List<Handler> createLoggerHandlers(final String name,
final String handlersPropertyName)
{
String names[] = parseClassNames(handlersPropertyName);
List<Handler> handlers = new ArrayList<>(names.length);
@ -1198,7 +1193,7 @@ public class LogManager {
}
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 @@ public class LogManager {
}
}
// 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) {

View File

@ -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 @@ class KeyImpl implements SecretKey, Destroyable, Serializable {
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";

View File

@ -40,6 +40,8 @@ import java.security.MessageDigest;
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
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 @@ class CipherHelper {
}
}
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 @@ class CipherHelper {
*/
}
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 @@ class CipherHelper {
}
}
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 @@ class CipherHelper {
}
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

View File

@ -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 class Checksum {
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;

View File

@ -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 @@ public class Config {
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 @@ public class Config {
} 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 @@ public class Config {
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")) {

View File

@ -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 class EncryptedData implements Cloneable {
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() {
}

View File

@ -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 @@ public class EncryptionKey
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 @@ public class EncryptionKey
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");

View File

@ -356,6 +356,8 @@ public class KrbTgsReq {
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;

View File

@ -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;
}
}

View File

@ -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);
}
};

View File

@ -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;
}
}

View File

@ -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);
}
};

View File

@ -106,7 +106,19 @@ public abstract class EType {
"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 @@ public abstract class EType {
// 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 @@ public abstract class EType {
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 + ")";
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -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 @@ public abstract class DkCrypto {
*
* 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 @@ public abstract class DkCrypto {
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) {
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -633,6 +633,7 @@ public class ClassFinder {
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) {

View File

@ -1889,7 +1889,7 @@ public abstract class Symbol extends AnnoConstruct implements Element {
Name paramName = name.table.fromString("arg" + i);
VarSymbol param = new VarSymbol(PARAMETER, paramName, t, this);
newParams.append(param);
i++;
}
params = newParams.toList();
}

View File

@ -2107,9 +2107,8 @@ public abstract class Type extends AnnoConstruct implements TypeMirror {
List<Type> 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);

View File

@ -1291,12 +1291,9 @@ public class Types {
* lists are of different length, return false.
*/
public boolean isSameTypes(List<Type> ts, List<Type> ss) {
return isSameTypes(ts, ss, false);
}
public boolean isSameTypes(List<Type> ts, List<Type> 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 @@ public class Types {
* 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 @@ public class Types {
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 @@ public class Types {
}
}
abstract boolean sameTypeVars(TypeVar tv1, TypeVar tv2);
@Override
public Boolean visitWildcardType(WildcardType t, Type s) {
if (!s.hasTag(WILDCARD)) {
@ -1374,7 +1369,7 @@ public class Types {
} 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,11 +1406,9 @@ public class Types {
}
return t.tsym == s.tsym
&& visit(t.getEnclosingType(), s.getEnclosingType())
&& containsTypes(t.getTypeArguments(), s.getTypeArguments());
&& containsTypeEquivalent(t.getTypeArguments(), s.getTypeArguments());
}
abstract protected boolean containsTypes(List<Type> ts1, List<Type> ts2);
@Override
public Boolean visitArrayType(ArrayType t, Type s) {
if (t == s)
@ -1471,70 +1464,6 @@ public class Types {
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<TypePair> cache = new HashSet<>();
@Override
boolean sameTypeVars(TypeVar tv1, TypeVar tv2) {
return tv1.tsym == tv2.tsym && checkSameBounds(tv1, tv2);
}
@Override
protected boolean containsTypes(List<Type> ts1, List<Type> 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<Type> ts1, List<Type> 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);
}
}
};
// </editor-fold>
@ -3848,17 +3777,11 @@ public class Types {
// 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 @@ public class Types {
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<TypePair> mergeCache = new HashSet<>();
@ -4460,7 +4383,7 @@ public class Types {
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;
}
}

View File

@ -565,7 +565,7 @@ public class Infer {
List<Type> 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 @@ public class Infer {
} 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);
}
}

View File

@ -788,7 +788,7 @@ public class TransTypes extends TreeTranslator {
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;
}

View File

@ -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 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
}
}
buf.append(")");
return foundTypeVariable ? configuration.links.getName(buf.toString()) : null;
return foundTypeVariable ? writer.links.getName(buf.toString()) : null;
}
}

View File

@ -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 @@ public abstract class AbstractMemberWriter implements MemberSummaryWriter {
this.utils = configuration.utils;
this.contents = configuration.contents;
this.resources = configuration.resources;
this.links = configuration.links;
this.links = writer.links;
}
public AbstractMemberWriter(SubWriterHolderWriter writer) {

View File

@ -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 @@ package jdk.javadoc.internal.doclets.formats.html;
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 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
*/
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 @@ public class AnnotationTypeFieldWriterImpl extends AbstractMemberWriter
*/
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 {

View File

@ -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 @@ public class AnnotationTypeOptionalMemberWriterImpl extends
@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 {

View File

@ -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 @@ package jdk.javadoc.internal.doclets.formats.html;
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 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
*/
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 @@ public class AnnotationTypeRequiredMemberWriterImpl extends AbstractMemberWriter
*/
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 {

View File

@ -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 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
*/
@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 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
*/
@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 @@ public class AnnotationTypeWriterImpl extends SubWriterHolderWriter
*/
@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;

View File

@ -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 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/
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 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/
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;
}

View File

@ -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 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
*/
@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 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
*/
@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 @@ public class ClassWriterImpl extends SubWriterHolderWriter implements ClassWrite
*/
@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;

View File

@ -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 @@ public class ConstantsSummaryWriterImpl extends HtmlDocletWriter implements Cons
//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);

View File

@ -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 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
@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 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
@Override
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
liNav.addContent(Links.createLink(
liNav.addContent(links.createLink(
SectionName.CONSTRUCTOR_DETAIL,
contents.navConstructor));
} else {

View File

@ -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 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
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 @@ public class EnumConstantWriterImpl extends AbstractMemberWriter
@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 {

View File

@ -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 @@ public class FieldWriterImpl extends AbstractMemberWriter
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 @@ public class FieldWriterImpl extends AbstractMemberWriter
@Override
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
liNav.addContent(Links.createLink(
liNav.addContent(links.createLink(
SectionName.FIELD_DETAIL,
contents.navField));
} else {

View File

@ -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.HtmlConstants;
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 @@ public class HelpWriter extends HtmlDocletWriter {
/**
* Constructor to construct HelpWriter object.
* @param configuration the configuration
* @param filename File to be generated.
*/
public HelpWriter(HtmlConfiguration configuration,
@ -67,6 +67,7 @@ public class HelpWriter extends HtmlDocletWriter {
* 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 @@ public class HelpWriter extends HtmlDocletWriter {
? 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 @@ public class HelpWriter extends HtmlDocletWriter {
? 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 @@ public class HelpWriter extends HtmlDocletWriter {
? 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 @@ public class HelpWriter extends HtmlDocletWriter {
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 @@ public class HelpWriter extends HtmlDocletWriter {
? 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 @@ public class HelpWriter extends HtmlDocletWriter {
? 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);

View File

@ -245,8 +245,6 @@ public class HtmlConfiguration extends BaseConfiguration {
protected final Messages messages;
protected Links links;
/**
* Creates an object to hold the configuration for a doclet.
*
@ -363,7 +361,6 @@ public class HtmlConfiguration extends BaseConfiguration {
setTopFile(docEnv);
workArounds.initDocLint(doclintOpts.values(), tagletManager.getCustomTagNames(),
Utils.toLowerCase(htmlVersion.name()));
links = new Links(htmlVersion);
return true;
}

View File

@ -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 @@ public class HtmlDocletWriter {
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 class HtmlDocletWriter {
*/
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 class HtmlDocletWriter {
*/
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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
//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 @@ public class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
* @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 class HtmlDocletWriter {
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 class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
*/
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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
* @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 @@ public class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
}
}
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 class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
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 @@ public class HtmlDocletWriter {
*/
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 @@ public class HtmlDocletWriter {
? 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 @@ public class HtmlDocletWriter {
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);

View File

@ -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.element.TypeElement;
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 @@ public class LinkFactoryImpl extends LinkFactory {
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,

View File

@ -432,7 +432,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
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 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
@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);

View File

@ -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 @@ public class ModuleFrameWriter extends HtmlDocletWriter {
? 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);

View File

@ -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 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
* @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 @@ public class ModuleIndexFrameWriter extends AbstractModuleIndexWriter {
* @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);

View File

@ -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 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
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("<unnamed package>");
packageLinkContent = Links.createLink(DocPaths.PACKAGE_FRAME,
packageLinkContent = links.createLink(DocPaths.PACKAGE_FRAME,
pkgLabel, "", "packageFrame");
}
Content li = HtmlTree.LI(packageLinkContent);
@ -189,7 +189,7 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @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 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @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 @@ public class ModulePackageIndexFrameWriter extends AbstractModuleIndexWriter {
* @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);

View File

@ -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 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
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 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
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 @@ public class ModuleWriterImpl extends HtmlDocletWriter implements ModuleSummaryW
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;

View File

@ -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 @@ public class NestedClassWriterImpl extends AbstractMemberWriter
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 {

View File

@ -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 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
Content packageLabel;
if (pe.isUnnamed()) {
packageLabel = new StringContent("<unnamed package>");
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 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
*/
@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 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
*/
@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);

View File

@ -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 @@ public class PackageTreeWriter extends AbstractTreeWriter {
*/
@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;

View File

@ -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 @@ public class PackageUseWriter extends SubWriterHolderWriter {
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 @@ public class PackageUseWriter extends SubWriterHolderWriter {
*/
@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 @@ public class PackageUseWriter extends SubWriterHolderWriter {
*/
@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;

View File

@ -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 @@ public class PackageWriterImpl extends HtmlDocletWriter
*/
@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 @@ public class PackageWriterImpl extends HtmlDocletWriter
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 @@ public class PackageWriterImpl extends HtmlDocletWriter
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 @@ public class PackageWriterImpl extends HtmlDocletWriter
*/
@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;

View File

@ -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 @@ public class PropertyWriterImpl extends AbstractMemberWriter
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 @@ public class PropertyWriterImpl extends AbstractMemberWriter
@Override
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
liNav.addContent(Links.createLink(
liNav.addContent(links.createLink(
SectionName.PROPERTY_DETAIL,
contents.navProperty));
} else {

View File

@ -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 @@ public class SplitIndexWriter extends AbstractIndexWriter {
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 @@ public class SplitIndexWriter extends AbstractIndexWriter {
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 @@ public class SplitIndexWriter extends AbstractIndexWriter {
return HtmlTree.LI(nextletterLabel);
}
else {
Content nextLink = Links.createLink(DocPaths.indexN(next),
Content nextLink = links.createLink(DocPaths.indexN(next),
nextletterLabel);
return HtmlTree.LI(nextLink);
}

View File

@ -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 @@ public class TagletWriterImpl extends TagletWriter {
}
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 @@ public class TagletWriterImpl extends TagletWriter {
((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 @@ public class TagletWriterImpl extends TagletWriter {
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"))));
}
}

View File

@ -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 @@ public class TreeWriter extends AbstractTreeWriter {
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(", ");

View File

@ -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 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
*/
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 class Links {
*/
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 @@ public class Links {
* @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 class Links {
*/
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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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 @@ public class Links {
* @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.

View File

@ -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 @@ package jdk.javadoc.internal.doclets.toolkit.util;
*
*/
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) {
this(path, null, null);
}
/**
* 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(DocPath path, String query, String fragment) {
this(path.getPath(), query, fragment);
}
/**
* Create a DocLink representing the URI {@code path?query#fragment}.
* Any of the component parts may be null.
*/
public DocLink(String 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 <letters>://
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))

View File

@ -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 class DocPath {
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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
}
/**
* 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 @@ public class DocPath {
/**
* 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<String> normalize(String path) {
return normalize(Arrays.asList(path.split("/")));
}
private static List<String> normalize(List<String> parts) {
if (parts.stream().noneMatch(s -> s.isEmpty() || s.equals(".") || s.equals(".."))) {
return parts;
}
List<String> 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<String> originParts = normalize(path);
int sep = path.lastIndexOf("/");
List<String> 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<String> 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.

View File

@ -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 @@ public class Extern {
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);
}

View File

@ -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 @@ abstract class InvokableTypeImpl extends ReferenceTypeImpl {
* 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

View File

@ -473,9 +473,9 @@ final class IRTranslator extends SimpleNodeVisitor {
@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()));

View File

@ -332,9 +332,45 @@ ifdef TESTDIRS
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

View File

@ -38,47 +38,6 @@ LIMIT_JTREG_VM_MEMORY := false
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

View File

@ -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");
}
}
}

View File

@ -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 static org.testng.Assert.assertTrue;
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 @@ public class TestLocalDate extends AbstractTest {
}
}
@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);
}
}

View File

@ -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) {}
}
}

View File

@ -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*/ }
}
}

View File

@ -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");
}
}

View File

@ -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);
}
}

View File

@ -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 + ".");
}
}

View File

@ -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"
};
}

View File

@ -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);
}
}
}

View File

@ -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<spacesToAdd; i++)
paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " +
(failCount==0 ? "Passed":"Failed("+failCount+")"));
if (failCount > 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<maxPropsNum; x++) {
for(int y=0; y<maxKeyLen; y++) {
achar = generator.nextInt();
char test;
if(achar < 99999) {
test = (char)(achar);
}
else {
int zz = achar % 10;
test = keyValueSeparators.charAt(zz);
}
if (Character.isHighSurrogate(test)) {
aKeyBuffer.append(test);
aKeyBuffer.append('\udc00');
y++;
} else if (Character.isLowSurrogate(test)) {
aKeyBuffer.append('\ud800');
aKeyBuffer.append(test);
y++;
} else
aKeyBuffer.append(test);
}
aKey = aKeyBuffer.toString();
for(int y=0; y<maxValueLen; y++) {
achar = generator.nextInt();
char test = (char)(achar);
if (Character.isHighSurrogate(test)) {
aKeyBuffer.append(test);
aKeyBuffer.append('\udc00');
y++;
} else if (Character.isLowSurrogate(test)) {
aKeyBuffer.append('\ud800');
aKeyBuffer.append(test);
y++;
} else {
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);
}
// Store(OutputStream)/Load(InputStream)
ByteArrayOutputStream baos = new ByteArrayOutputStream();
originalProps.store(baos, "test properties");
loadedProps.load(getInputStream(baos.toByteArray()));
check(loadedProps, originalProps);
// Store(Writer)/Load(Reader)
baos = new ByteArrayOutputStream();
originalProps.store(new OutputStreamWriter(baos, "UTF-8"),
"test properties");
loadedProps.load(getReader(baos.toByteArray(), "UTF-8"));
check(loadedProps, originalProps);
report("SaveLoadBasher");
}
/* Note: this regression test only detects incorrect line
* separator on platform running the test
*/
private static void SaveSeparator() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Properties props = new Properties();
props.store(baos, "A test");
// Examine the result to verify that line.separator was used
String theSeparator = System.getProperty("line.separator");
String content = baos.toString();
if (!content.endsWith(theSeparator))
failCount++;
// store(Writer)
baos = new ByteArrayOutputStream();
props.store(new OutputStreamWriter(baos, "UTF-8"), "A test");
content = baos.toString();
if (!content.endsWith(theSeparator))
failCount++;
report("SaveSeparator");
}
// Ensure that the save method doesn't close its output stream
private static void SaveClose() throws Exception {
Properties p = new Properties();
p.put("Foo", "Bar");
class MyOS extends ByteArrayOutputStream {
boolean closed = false;
public void close() throws IOException {
this.closed = true;
}
}
MyOS myos = new MyOS();
p.store(myos, "Test");
if (myos.closed)
failCount++;
p.store(new OutputStreamWriter(myos, "UTF-8"), "Test");
if (myos.closed)
failCount++;
report ("SaveClose");
}
private static void UnicodeEscape() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(baos);
osw.write("a=b\nb=\\u0\n");
osw.close();
Properties props = new Properties();
boolean failed = true;
try {
props.load(getInputStream(baos.toByteArray()));
} catch (IllegalArgumentException iae) {
failed = false;
}
if (failed)
failCount++;
failed = true;
props = new Properties();
try {
props.load(getReader(baos.toByteArray(), "UTF-8"));
} catch (IllegalArgumentException iae) {
failed = false;
}
if (failed)
failCount++;
report("UnicodeEscape");
}
private static void SaveComments() throws Exception {
String ls = System.getProperty("line.separator");
String[] input = new String[] {
"Comments with \u4e2d\u6587\u6c49\u5b57 included",
"Comments with \n Second comments line",
"Comments with \n# Second comments line",
"Comments with \n! Second comments line",
"Comments with last character is \n",
"Comments with last character is \r\n",
"Comments with last two characters are \n\n",
"Comments with last four characters are \r\n\r\n",
"Comments with \nkey4=value4",
"Comments with \n#key4=value4"};
String[] output = new String[] {
"#Comments with \\u4E2D\\u6587\\u6C49\\u5B57 included" + ls,
"#Comments with " + ls + "# Second comments line" + ls,
"#Comments with " + ls + "# Second comments line" + ls,
"#Comments with " + ls + "! Second comments line" + ls,
"#Comments with last character is " + ls+"#"+ls,
"#Comments with last character is " + ls+"#"+ls,
"#Comments with last two characters are " + ls+"#"+ls+"#"+ls,
"#Comments with last four characters are " + ls+"#"+ls+"#"+ls};
Properties props = new Properties();
ByteArrayOutputStream baos;
int i = 0;
for (i = 0; i < output.length; i++) {
baos = new ByteArrayOutputStream();
props.store(baos, input[i]);
String result = baos.toString("iso8859-1");
if (result.indexOf(output[i]) == -1) {
failCount++;
}
}
props.put("key1", "value1");
props.put("key2", "value2");
props.put("key3", "value3");
for (; i < input.length; i++) {
baos = new ByteArrayOutputStream();
props.store(baos, input[i]);
Properties propsNew = new Properties();
propsNew.load(getInputStream(baos.toByteArray()));
check(propsNew, props);
baos = new ByteArrayOutputStream();
props.store(new OutputStreamWriter(baos, "UTF-8"),
input[i]);
propsNew = new Properties();
propsNew.load(getReader(baos.toByteArray(), "UTF-8"));
check(propsNew, props);
}
report("SaveComments");
}
}

View File

@ -0,0 +1,74 @@
/*
* 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 4034428
* @summary Test for leading space in values output from properties
*/
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
/**
* This class tests to see if the properties object saves
* leading space in the value of a property as it should
* do according to the JLS
*/
public class Save {
public static void main(String argv[]) {
int testSucceeded=0;
FileOutputStream myOutput;
// create a properties object to save
Properties myProperties = new Properties();
String value = " spacesfirst";
myProperties.put("atest", value);
try {
// save the object and check output
myOutput = new FileOutputStream("testout");
myProperties.store(myOutput,"A test");
myOutput.close();
//load the properties set
FileInputStream myIn = new FileInputStream("testout");
Properties myNewProps = new Properties();
try {
myNewProps.load(myIn);
} finally {
myIn.close();
}
//check the results
String newValue = (String) myNewProps.get("atest");
if (!newValue.equals(value))
throw new RuntimeException(
"Properties does not save leading spaces in values correctly.");
} catch (IOException e) { //do nothing
}
}
}

Some files were not shown because too many files have changed in this diff Show More