This commit is contained in:
Alejandro Murillo 2016-04-28 23:08:16 -07:00
commit 59e339e6ec
1125 changed files with 54143 additions and 11265 deletions

View File

@ -357,3 +357,5 @@ a6614ff7bf09da74be1d0ef3d9755090d244697a jdk-9+111
7359994942f8d8e723b584d66a3a92c2e9e95e5c jdk-9+112
6072af7a98be3922f26bdce71b53bb3646cb2ac9 jdk-9+113
c84d0cce090e161d736de69e941830adf8c2f87a jdk-9+114
8d78fb40648dd221ce4ef19f9d5aa41ee1a3a884 jdk-9+115
84aba7335005a3a47751dcf1f37935f97df9f99a jdk-9+116

View File

@ -357,3 +357,5 @@ f900d5afd9c83a0df8f36161c27c5e4c86a66f4c jdk-9+111
03543a758cd5890f2266e4b9678378a925dde22a jdk-9+112
55b6d550828d1223b364e6ead4a56e56411c56df jdk-9+113
1d992540870ff33fe6cc550443388588df9b9e4f jdk-9+114
09617ce980b99d49abfd54dacfed353c47e2a115 jdk-9+115
6743a8e0cab7b5f6f4a0575f6664892f0ab740af jdk-9+116

View File

@ -749,8 +749,8 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
BASIC_PREPEND_TO_PATH([PATH],$EXTRA_PATH)
if test "x$OPENJDK_BUILD_OS" = "xsolaris"; then
# Add extra search paths on solaris for utilities like ar and as etc...
PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin"
# Add extra search paths on solaris for utilities like ar, as, dtrace etc...
PATH="$PATH:/usr/ccs/bin:/usr/sfw/bin:/opt/csw/bin:/usr/sbin"
fi
AC_MSG_CHECKING([for sysroot])
@ -777,7 +777,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR],
# Create a default ./build/target-variant-debuglevel output root.
if test "x${CONF_NAME}" = x; then
AC_MSG_RESULT([in default location])
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${ANDED_JVM_VARIANTS}-${DEBUG_LEVEL}"
CONF_NAME="${OPENJDK_TARGET_OS}-${OPENJDK_TARGET_CPU}-${JDK_VARIANT}-${JVM_VARIANTS_WITH_AND}-${DEBUG_LEVEL}"
else
AC_MSG_RESULT([in build directory with custom name])
fi
@ -1037,6 +1037,7 @@ AC_DEFUN_ONCE([BASIC_SETUP_COMPLEX_TOOLS],
BASIC_PATH_PROGS(HG, hg)
BASIC_PATH_PROGS(STAT, stat)
BASIC_PATH_PROGS(TIME, time)
BASIC_PATH_PROGS(DTRACE, dtrace)
BASIC_PATH_PROGS(PATCH, [gpatch patch])
# Check if it's GNU time
IS_GNU_TIME=`$TIME --version 2>&1 | $GREP 'GNU time'`

View File

@ -397,6 +397,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
ADD_JVM_ARG_IF_OK([-XX:TieredStopAtLevel=1],boot_jdk_jvmargs_small,[$JAVA])
AC_MSG_RESULT([$boot_jdk_jvmargs_small])

View File

@ -364,6 +364,9 @@ AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
elif test "x$ICECC" != "x"; then
AC_MSG_RESULT([no, does not work effectively with icecc])
USE_PRECOMPILED_HEADER=0
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
AC_MSG_RESULT([no, does not work with Solaris Studio])
USE_PRECOMPILED_HEADER=0
else
AC_MSG_RESULT([yes])
fi

View File

@ -57,6 +57,12 @@ OPENJDK_TARGET_CPU_BITS := @OPENJDK_BUILD_CPU_BITS@
OPENJDK_TARGET_CPU_ENDIAN := @OPENJDK_BUILD_CPU_ENDIAN@
OPENJDK_TARGET_CPU_LEGACY := @OPENJDK_BUILD_CPU_LEGACY@
HOTSPOT_TARGET_OS := @HOTSPOT_BUILD_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_BUILD_OS_TYPE@
HOTSPOT_TARGET_CPU := @HOTSPOT_BUILD_CPU@
HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_BUILD_CPU_ARCH@
HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_BUILD_CPU_DEFINE@
CFLAGS_JDKLIB := @OPENJDK_BUILD_CFLAGS_JDKLIB@
CXXFLAGS_JDKLIB := @OPENJDK_BUILD_CXXFLAGS_JDKLIB@
LDFLAGS_JDKLIB := @OPENJDK_BUILD_LDFLAGS_JDKLIB@
@ -65,6 +71,11 @@ CXXFLAGS_JDKEXE := @OPENJDK_BUILD_CXXFLAGS_JDKEXE@
LDFLAGS_JDKEXE := @OPENJDK_BUILD_LDFLAGS_JDKEXE@
OPENJDK_TARGET_CPU_JLI_CFLAGS := @OPENJDK_BUILD_CPU_JLI_CFLAGS@
JVM_CFLAGS := @OPENJDK_BUILD_JVM_CFLAGS@
JVM_LDFLAGS := @OPENJDK_BUILD_JVM_LDFLAGS@
JVM_ASFLAGS := @OPENJDK_BUILD_JVM_ASFLAGS@
JVM_LIBS := @OPENJDK_BUILD_JVM_LIBS@
# The compiler for the build platform is likely not warning compatible with the official
# compiler.
WARNINGS_AS_ERRORS := false

View File

@ -283,7 +283,7 @@ Additional (non-autoconf) OpenJDK Options:
EOT
# Print additional help, e.g. a list of toolchains.
# Print additional help, e.g. a list of toolchains and JVM features.
# This must be done by the autoconf script.
( CONFIGURE_PRINT_ADDITIONAL_HELP=true . $conf_script_to_run PRINTF=printf )

View File

@ -95,10 +95,8 @@ JDKOPT_SETUP_OPEN_OR_CUSTOM
# These are needed to be able to create a configuration name (and thus the output directory)
JDKOPT_SETUP_JDK_VARIANT
HOTSPOT_SETUP_JVM_INTERPRETER
HOTSPOT_SETUP_JVM_VARIANTS
JDKOPT_SETUP_DEBUG_LEVEL
HOTSPOT_SETUP_DEBUG_LEVEL
HOTSPOT_SETUP_JVM_VARIANTS
# With basic setup done, call the custom early hook.
CUSTOM_EARLY_HOOK
@ -135,7 +133,6 @@ BASIC_SETUP_DEFAULT_MAKE_TARGET
# We need build & target for this.
JDKOPT_SETUP_JDK_OPTIONS
JDKOPT_SETUP_JLINK_OPTIONS
HOTSPOT_SETUP_HOTSPOT_OPTIONS
JDKVER_SETUP_JDK_VERSION_NUMBERS
###############################################################################
@ -207,6 +204,10 @@ FLAGS_SETUP_COMPILER_FLAGS_MISC
JDKOPT_SETUP_DEBUG_SYMBOLS
JDKOPT_SETUP_CODE_COVERAGE
# Need toolchain to setup dtrace
HOTSPOT_SETUP_DTRACE
HOTSPOT_SETUP_JVM_FEATURES
###############################################################################
#
# Check dependencies for external and internal libraries.
@ -225,7 +226,7 @@ LIB_SETUP_LIBRARIES
#
###############################################################################
HOTSPOT_SETUP_BUILD_TWEAKS
HOTSPOT_SETUP_LEGACY_BUILD
JDKOPT_DETECT_INTREE_EC
JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER
@ -268,6 +269,9 @@ BASIC_TEST_USABILITY_ISSUES
# At the end, call the custom hook. (Dummy macro if no custom sources available)
CUSTOM_LATE_HOOK
# This needs to be done after CUSTOM_LATE_HOOK since we can setup custom features.
HOTSPOT_VALIDATE_JVM_FEATURES
# 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"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -119,6 +119,8 @@ apt_help() {
PKGHANDLER_COMMAND="sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev" ;;
ccache)
PKGHANDLER_COMMAND="sudo apt-get install ccache" ;;
dtrace)
PKGHANDLER_COMMAND="sudo apt-get install systemtap-sdt-dev" ;;
esac
}
@ -170,6 +172,13 @@ AC_DEFUN_ONCE([HELP_PRINT_ADDITIONAL_HELP_AND_EXIT],
TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
$PRINTF " %-10s %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
done
$PRINTF "\n"
# Print available jvm features
$PRINTF "The following JVM features are available as arguments to --with-jvm-features.\n"
$PRINTF "Which are valid to use depends on the target platform.\n "
$PRINTF "%s " $VALID_JVM_FEATURES
$PRINTF "\n"
# And now exit directly
exit 0
@ -206,7 +215,7 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
printf "* Debug level: $DEBUG_LEVEL\n"
printf "* HS debug level: $HOTSPOT_DEBUG_LEVEL\n"
printf "* JDK variant: $JDK_VARIANT\n"
printf "* JVM variants: $with_jvm_variants\n"
printf "* JVM variants: $JVM_VARIANTS\n"
printf "* OpenJDK target: OS: $OPENJDK_TARGET_OS, CPU architecture: $OPENJDK_TARGET_CPU_ARCH, address length: $OPENJDK_TARGET_CPU_BITS\n"
printf "* Version string: $VERSION_STRING ($VERSION_SHORT)\n"
@ -232,7 +241,7 @@ AC_DEFUN_ONCE([HELP_PRINT_SUMMARY_AND_WARNINGS],
fi
printf "\n"
if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xyes"; then
if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
printf "NOTE: You have requested to build more than one version of the JVM, which\n"
printf "will result in longer build times.\n"
printf "\n"

View File

@ -38,6 +38,16 @@ include $(BASE_SPEC)
# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
@BUILD_HEADLESS@
JVM_VARIANTS:=@JVM_VARIANTS_COMMA@
JVM_VARIANT_SERVER:=@JVM_VARIANT_SERVER@
JVM_VARIANT_CLIENT:=@JVM_VARIANT_CLIENT@
JVM_VARIANT_MINIMAL1:=@JVM_VARIANT_MINIMAL1@
JVM_VARIANT_CORE:=@JVM_VARIANT_CORE@
JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@
JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@
JVM_VARIANT_CUSTOM:=@JVM_VARIANT_HOTSPOT@
# Legacy setting: OPT or DBG
VARIANT:=@VARIANT@
# Legacy setting: true or false
@ -92,8 +102,7 @@ LLVM_LDFLAGS=@LLVM_LDFLAGS@
ALT_OUTPUTDIR=$(HOTSPOT_OUTPUTDIR)
ALT_EXPORT_PATH=$(HOTSPOT_DIST)
JVM_INTERPRETER:=@JVM_INTERPRETER@
ifeq ($(JVM_INTERPRETER), cpp)
ifeq ($(HOTSPOT_TARGET_CPU), zero)
CC_INTERP=true
endif

View File

@ -23,170 +23,344 @@
# questions.
#
###############################################################################
# Check which interpreter of the JVM we want to build.
# Currently we have:
# template: Template interpreter (the default)
# cpp : C++ interpreter
AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_INTERPRETER],
[
AC_ARG_WITH([jvm-interpreter], [AS_HELP_STRING([--with-jvm-interpreter],
[JVM interpreter to build (template, cpp) @<:@template@:>@])])
# All valid JVM features, regardless of platform
VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \
fprof vm-structs jni-check services management all-gcs nmt cds static-build"
AC_MSG_CHECKING([which interpreter of the JVM to build])
if test "x$with_jvm_interpreter" = x; then
JVM_INTERPRETER="template"
else
JVM_INTERPRETER="$with_jvm_interpreter"
fi
AC_MSG_RESULT([$JVM_INTERPRETER])
if test "x$JVM_INTERPRETER" != xtemplate && test "x$JVM_INTERPRETER" != xcpp; then
AC_MSG_ERROR([The available JVM interpreters are: template, cpp])
fi
AC_SUBST(JVM_INTERPRETER)
])
# All valid JVM variants
VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
###############################################################################
# Check which variants of the JVM that we want to build.
# Currently we have:
# server: normal interpreter and a C2 or tiered C1/C2 compiler
# client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms)
# minimal1: reduced form of client with optional VM services and features stripped out
# zero: no machine code interpreter, no compiler
# zeroshark: zero interpreter and shark/llvm compiler backend
# core: interpreter only, no compiler (only works on some platforms)
# Check if the specified JVM variant should be built. To be used in shell if
# constructs, like this:
# if HOTSPOT_CHECK_JVM_VARIANT(server); then
#
# Only valid to use after HOTSPOT_SETUP_JVM_VARIANTS has setup variants.
# Definition kept in one line to allow inlining in if statements.
# Additional [] needed to keep m4 from mangling shell constructs.
AC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT],
[ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
###############################################################################
# Check if the specified JVM features are explicitly enabled. To be used in
# shell if constructs, like this:
# if HOTSPOT_CHECK_JVM_FEATURE(jvmti); then
#
# Only valid to use after HOTSPOT_SETUP_JVM_FEATURES has setup features.
# Definition kept in one line to allow inlining in if statements.
# Additional [] needed to keep m4 from mangling shell constructs.
AC_DEFUN([HOTSPOT_CHECK_JVM_FEATURE],
[ [ [[ " $JVM_FEATURES " =~ " $1 " ]] ] ])
###############################################################################
# Check which variants of the JVM that we want to build. Available variants are:
# server: normal interpreter, and a tiered C1/C2 compiler
# client: normal interpreter, and C1 (no C2 compiler)
# minimal: reduced form of client with optional features stripped out
# core: normal interpreter only, no compiler
# zero: C++ based interpreter only, no compiler
# zeroshark: C++ based interpreter, and a llvm-based compiler
# custom: baseline JVM with no default features
#
AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
[
AC_MSG_CHECKING([which variants of the JVM to build])
AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
[JVM variants (separated by commas) to build (server, client, minimal1, zero, zeroshark, core) @<:@server@:>@])])
[JVM variants (separated by commas) to build (server,client,minimal,core,zero,zeroshark,custom) @<:@server@:>@])])
if test "x$with_jvm_variants" = x; then
with_jvm_variants="server"
fi
JVM_VARIANTS_OPT="$with_jvm_variants"
JVM_VARIANTS=",$with_jvm_variants,"
TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/minimal1,//' -e 's/zero,//' -e 's/zeroshark,//' -e 's/core,//'`
if test "x$TEST_VARIANTS" != "x,"; then
AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, zero, zeroshark, core])
fi
AC_MSG_RESULT([$with_jvm_variants])
JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'`
JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'`
JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'`
if test "x$JVM_VARIANT_CLIENT" = xtrue; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
fi
fi
if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.])
fi
fi
# Replace the commas with AND for use in the build directory name.
ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'`
COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/' -e 's/core,/1/'`
if test "x$COUNT_VARIANTS" != "x,1"; then
BUILDING_MULTIPLE_JVM_VARIANTS=yes
# Has the user listed more than one variant?
# Additional [] needed to keep m4 from mangling shell constructs.
if [ [[ "$JVM_VARIANTS_OPT" =~ "," ]] ]; then
BUILDING_MULTIPLE_JVM_VARIANTS=true
else
BUILDING_MULTIPLE_JVM_VARIANTS=no
BUILDING_MULTIPLE_JVM_VARIANTS=false
fi
# Replace the commas with AND for use in the build directory name.
JVM_VARIANTS_WITH_AND=`$ECHO "$JVM_VARIANTS_OPT" | $SED -e 's/,/AND/g'`
AC_MSG_CHECKING([which variants of the JVM to build])
# JVM_VARIANTS is a space-separated list.
# Also use minimal, not minimal1 (which is kept for backwards compatibility).
JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'`
AC_MSG_RESULT([$JVM_VARIANTS])
# Check that the selected variants are valid
# grep filter function inspired by a comment to http://stackoverflow.com/a/1617326
INVALID_VARIANTS=`$GREP -Fvx "${VALID_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"`
if test "x$INVALID_VARIANTS" != x; then
AC_MSG_NOTICE([Unknown variant(s) specified: $INVALID_VARIANTS])
AC_MSG_ERROR([The available JVM variants are: $VALID_JVM_VARIANTS])
fi
if test "x$JVM_VARIANT_ZERO" = xtrue && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xyes; then
AC_MSG_ERROR([You cannot build multiple variants with zero.])
# All "special" variants share the same output directory ("server")
VALID_MULTIPLE_JVM_VARIANTS="server client minimal"
INVALID_MULTIPLE_VARIANTS=`$GREP -Fvx "${VALID_MULTIPLE_JVM_VARIANTS// /$'\n'}" <<< "${JVM_VARIANTS// /$'\n'}"`
if test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then
AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.])
fi
AC_SUBST(JVM_VARIANTS)
AC_SUBST(JVM_VARIANT_SERVER)
AC_SUBST(JVM_VARIANT_CLIENT)
AC_SUBST(JVM_VARIANT_MINIMAL1)
AC_SUBST(JVM_VARIANT_ZERO)
AC_SUBST(JVM_VARIANT_ZEROSHARK)
AC_SUBST(JVM_VARIANT_CORE)
AC_SUBST(VALID_JVM_VARIANTS)
if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
# zero behaves as a platform and rewrites these values. This is really weird. :(
# We are guaranteed that we do not build any other variants when building zero.
HOTSPOT_TARGET_CPU=zero
HOTSPOT_TARGET_CPU_ARCH=zero
fi
])
###############################################################################
# Check if dtrace should be enabled and has all prerequisites present.
#
AC_DEFUN_ONCE([HOTSPOT_SETUP_DTRACE],
[
# Test for dtrace dependencies
AC_ARG_ENABLE([dtrace], [AS_HELP_STRING([--enable-dtrace@<:@=yes/no/auto@:>@],
[enable dtrace. Default is auto, where dtrace is enabled if all dependencies
are present.])])
DTRACE_DEP_MISSING=false
AC_MSG_CHECKING([for dtrace tool])
if test "x$DTRACE" != "x" && test -x "$DTRACE"; then
AC_MSG_RESULT([$DTRACE])
else
AC_MSG_RESULT([not found, cannot build dtrace])
DTRACE_DEP_MISSING=true
fi
AC_CHECK_HEADERS([sys/sdt.h], [DTRACE_HEADERS_OK=yes],[DTRACE_HEADERS_OK=no])
if test "x$DTRACE_HEADERS_OK" != "xyes"; then
DTRACE_DEP_MISSING=true
fi
AC_MSG_CHECKING([if dtrace should be built])
if test "x$enable_dtrace" = "xyes"; then
if test "x$DTRACE_DEP_MISSING" = "xtrue"; then
AC_MSG_RESULT([no, missing dependencies])
HELP_MSG_MISSING_DEPENDENCY([dtrace])
AC_MSG_ERROR([Cannot enable dtrace with missing dependencies. See above. $HELP_MSG])
else
INCLUDE_DTRACE=true
AC_MSG_RESULT([yes, forced])
fi
elif test "x$enable_dtrace" = "xno"; then
INCLUDE_DTRACE=false
AC_MSG_RESULT([no, forced])
elif test "x$enable_dtrace" = "xauto" || test "x$enable_dtrace" = "x"; then
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK" != "xtrue"; then
INCLUDE_DTRACE=false
AC_MSG_RESULT([no, non-open linux build])
elif test "x$DTRACE_DEP_MISSING" = "xtrue"; then
INCLUDE_DTRACE=false
AC_MSG_RESULT([no, missing dependencies])
else
INCLUDE_DTRACE=true
AC_MSG_RESULT([yes, dependencies present])
fi
else
AC_MSG_ERROR([Invalid value for --enable-dtrace: $enable_dtrace])
fi
AC_SUBST(INCLUDE_DTRACE)
])
###############################################################################
# Set up all JVM features for each JVM variant.
#
AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
[
# The user can in some cases supply additional jvm features. For the custom
# variant, this defines the entire variant.
AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
[additional JVM features to enable (separated by comma), use '--help' to show possible values @<:@none@:>@])])
if test "x$with_jvm_features" != x; then
AC_MSG_CHECKING([additional JVM features])
JVM_FEATURES=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'`
AC_MSG_RESULT([$JVM_FEATURES])
fi
# Verify that dependencies are met for explicitly set features.
if HOTSPOT_CHECK_JVM_FEATURE(jvmti) && ! HOTSPOT_CHECK_JVM_FEATURE(services); then
AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services'])
fi
if HOTSPOT_CHECK_JVM_FEATURE(management) && ! HOTSPOT_CHECK_JVM_FEATURE(nmt); then
AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
fi
if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! HOTSPOT_CHECK_JVM_FEATURE(compiler2); then
AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2'])
fi
if HOTSPOT_CHECK_JVM_FEATURE(compiler2) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
AC_MSG_ERROR([Specified JVM feature 'compiler2' requires feature 'all-gcs'])
fi
if HOTSPOT_CHECK_JVM_FEATURE(vm-structs) && ! HOTSPOT_CHECK_JVM_FEATURE(all-gcs); then
AC_MSG_ERROR([Specified JVM feature 'vm-structs' requires feature 'all-gcs'])
fi
# Turn on additional features based on other parts of configure
if test "x$INCLUDE_DTRACE" = "xtrue"; then
JVM_FEATURES="$JVM_FEATURES dtrace"
else
if HOTSPOT_CHECK_JVM_FEATURE(dtrace); then
AC_MSG_ERROR([To enable dtrace, you must use --enable-dtrace])
fi
fi
if test "x$STATIC_BUILD" = "xtrue"; then
JVM_FEATURES="$JVM_FEATURES static-build"
else
if HOTSPOT_CHECK_JVM_FEATURE(static-build); then
AC_MSG_ERROR([To enable static-build, you must use --enable-static-build])
fi
fi
if ! HOTSPOT_CHECK_JVM_VARIANT(zero) && ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
if HOTSPOT_CHECK_JVM_FEATURE(zero); then
AC_MSG_ERROR([To enable zero/zeroshark, you must use --with-jvm-variants=zero/zeroshark])
fi
fi
if ! HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
if HOTSPOT_CHECK_JVM_FEATURE(shark); then
AC_MSG_ERROR([To enable shark, you must use --with-jvm-variants=zeroshark])
fi
fi
# Only enable jvmci on x86_64, sparcv9 and aarch64, and only on server.
if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
test "x$OPENJDK_TARGET_CPU" = "xsparcv9" || \
test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
JVM_FEATURES_jvmci="jvmci"
else
JVM_FEATURES_jvmci=""
fi
# All variants but minimal (and custom) get these features
NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds"
# Enable features depending on variant.
JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci"
JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_minimal="compiler1 minimal $JVM_FEATURES"
JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_zeroshark="zero shark $NON_MINIMAL_FEATURES $JVM_FEATURES"
JVM_FEATURES_custom="$JVM_FEATURES"
AC_SUBST(JVM_FEATURES_server)
AC_SUBST(JVM_FEATURES_client)
AC_SUBST(JVM_FEATURES_core)
AC_SUBST(JVM_FEATURES_minimal)
AC_SUBST(JVM_FEATURES_zero)
AC_SUBST(JVM_FEATURES_zeroshark)
AC_SUBST(JVM_FEATURES_custom)
# Used for verification of Makefiles by check-jvm-feature
AC_SUBST(VALID_JVM_FEATURES)
# We don't support --with-jvm-interpreter anymore, use zero instead.
BASIC_DEPRECATED_ARG_WITH(jvm-interpreter)
])
###############################################################################
# Validate JVM features once all setup is complete, including custom setup.
#
AC_DEFUN_ONCE([HOTSPOT_VALIDATE_JVM_FEATURES],
[
# Keep feature lists sorted and free of duplicates
JVM_FEATURES_server="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_server | $SORT -u))"
JVM_FEATURES_client="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_client | $SORT -u))"
JVM_FEATURES_core="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_core | $SORT -u))"
JVM_FEATURES_minimal="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_minimal | $SORT -u))"
JVM_FEATURES_zero="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_zero | $SORT -u))"
JVM_FEATURES_zeroshark="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_zeroshark | $SORT -u))"
JVM_FEATURES_custom="$($ECHO $($PRINTF '%s\n' $JVM_FEATURES_custom | $SORT -u))"
# Validate features
for variant in $JVM_VARIANTS; do
AC_MSG_CHECKING([JVM features for JVM variant '$variant'])
features_var_name=JVM_FEATURES_$variant
JVM_FEATURES_TO_TEST=${!features_var_name}
AC_MSG_RESULT([$JVM_FEATURES_TO_TEST])
INVALID_FEATURES=`$GREP -Fvx "${VALID_JVM_FEATURES// /$'\n'}" <<< "${JVM_FEATURES_TO_TEST// /$'\n'}"`
if test "x$INVALID_FEATURES" != x; then
AC_MSG_ERROR([Invalid JVM feature(s): $INVALID_FEATURES])
fi
done
])
###############################################################################
# Support for old hotspot build. Remove once new hotspot build has proven
# to work satisfactory.
#
AC_DEFUN_ONCE([HOTSPOT_SETUP_LEGACY_BUILD],
[
AC_ARG_ENABLE(new-hotspot-build, [AS_HELP_STRING([--disable-new-hotspot-build],
[disable the new hotspot build system (use the old) @<:@enabled@:>@])])
if test "x$enable_new_hotspot_build" = "x" || test "x$enable_new_hotspot_build" = "xyes"; then
USE_NEW_HOTSPOT_BUILD=true
else
USE_NEW_HOTSPOT_BUILD=false
fi
AC_SUBST(USE_NEW_HOTSPOT_BUILD)
case $HOTSPOT_DEBUG_LEVEL in
product )
VARIANT="OPT"
FASTDEBUG="false"
DEBUG_CLASSFILES="false"
;;
fastdebug )
VARIANT="DBG"
FASTDEBUG="true"
DEBUG_CLASSFILES="true"
;;
debug )
VARIANT="DBG"
FASTDEBUG="false"
DEBUG_CLASSFILES="true"
;;
optimized )
VARIANT="OPT"
FASTDEBUG="false"
DEBUG_CLASSFILES="false"
;;
esac
AC_SUBST(VARIANT)
AC_SUBST(FASTDEBUG)
AC_SUBST(DEBUG_CLASSFILES)
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
MACOSX_UNIVERSAL="true"
fi
AC_SUBST(MACOSX_UNIVERSAL)
])
# Make sure JVM_VARIANTS_COMMA use minimal1 for backwards compatibility
JVM_VARIANTS_COMMA=`$ECHO ,$JVM_VARIANTS_OPT, | $SED -e 's/,minimal,/,minimal1,/'`
###############################################################################
# Setup legacy vars/targets and new vars to deal with different debug levels.
#
# release: no debug information, all optimizations, no asserts.
# optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'.
# fastdebug: debug information (-g), all optimizations, all asserts
# slowdebug: debug information (-g), no optimizations, all asserts
#
AC_DEFUN_ONCE([HOTSPOT_SETUP_DEBUG_LEVEL],
[
case $DEBUG_LEVEL in
release )
VARIANT="OPT"
FASTDEBUG="false"
DEBUG_CLASSFILES="false"
BUILD_VARIANT_RELEASE=""
HOTSPOT_DEBUG_LEVEL="product"
HOTSPOT_EXPORT="product"
;;
fastdebug )
VARIANT="DBG"
FASTDEBUG="true"
DEBUG_CLASSFILES="true"
BUILD_VARIANT_RELEASE="-fastdebug"
HOTSPOT_DEBUG_LEVEL="fastdebug"
HOTSPOT_EXPORT="fastdebug"
;;
slowdebug )
VARIANT="DBG"
FASTDEBUG="false"
DEBUG_CLASSFILES="true"
BUILD_VARIANT_RELEASE="-debug"
HOTSPOT_DEBUG_LEVEL="debug"
HOTSPOT_EXPORT="debug"
;;
optimized )
VARIANT="OPT"
FASTDEBUG="false"
DEBUG_CLASSFILES="false"
BUILD_VARIANT_RELEASE="-optimized"
HOTSPOT_DEBUG_LEVEL="optimized"
HOTSPOT_EXPORT="optimized"
;;
esac
# The debug level 'optimized' is a little special because it is currently only
# applicable to the HotSpot build where it means to build a completely
# optimized version of the VM without any debugging code (like for the
# 'release' debug level which is called 'product' in the HotSpot build) but
# with the exception that it can contain additional code which is otherwise
# protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
# test new and/or experimental features which are not intended for customer
# shipment. Because these new features need to be tested and benchmarked in
# real world scenarios, we want to build the containing JDK at the 'release'
# debug level.
if test "x$DEBUG_LEVEL" = xoptimized; then
DEBUG_LEVEL="release"
fi
JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'`
JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,minimal1\?,/!s/.*/false/g' -e '/,minimal1\?,/s/.*/true/g'`
JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'`
JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
JVM_VARIANT_CUSTOM=`$ECHO "$JVM_VARIANTS_COMMA" | $SED -e '/,custom,/!s/.*/false/g' -e '/,custom,/s/.*/true/g'`
#####
# Generate the legacy makefile targets for hotspot.
# The hotspot api for selecting the build artifacts, really, needs to be improved.
# JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to
# determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc
# But until then ...
HOTSPOT_TARGET=""
if test "x$JVM_VARIANT_SERVER" = xtrue; then
@ -213,27 +387,19 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_DEBUG_LEVEL],
HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core "
fi
HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_DEBUG_LEVEL"
# On Macosx universal binaries are produced, but they only contain
# 64 bit intel. This invalidates control of which jvms are built
# from configure, but only server is valid anyway. Fix this
# when hotspot makefiles are rewritten.
if test "x$MACOSX_UNIVERSAL" = xtrue; then
HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT}
HOTSPOT_TARGET=universal_${HOTSPOT_DEBUG_LEVEL}
fi
#####
HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
AC_SUBST(HOTSPOT_MAKE_ARGS)
AC_SUBST(DEBUG_LEVEL)
AC_SUBST(VARIANT)
AC_SUBST(FASTDEBUG)
AC_SUBST(DEBUG_CLASSFILES)
AC_SUBST(BUILD_VARIANT_RELEASE)
])
AC_DEFUN_ONCE([HOTSPOT_SETUP_HOTSPOT_OPTIONS],
[
# Control wether Hotspot runs Queens test after build.
AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
[run the Queens test after Hotspot build @<:@disabled@:>@])],,
@ -244,10 +410,29 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_HOTSPOT_OPTIONS],
TEST_IN_BUILD=false
fi
AC_SUBST(TEST_IN_BUILD)
])
AC_DEFUN_ONCE([HOTSPOT_SETUP_BUILD_TWEAKS],
[
HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
AC_SUBST(HOTSPOT_MAKE_ARGS)
if test "x$USE_NEW_HOTSPOT_BUILD" = xfalse; then
if test "x$JVM_VARIANT_CLIENT" = xtrue; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
fi
fi
if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.])
fi
fi
if test "x$JVM_VARIANT_CUSTOM" = xtrue; then
AC_MSG_ERROR([You cannot build a custom JVM using the old hotspot build system.])
fi
fi
AC_SUBST(JVM_VARIANTS_COMMA)
AC_SUBST(JVM_VARIANT_SERVER)
AC_SUBST(JVM_VARIANT_CLIENT)
AC_SUBST(JVM_VARIANT_MINIMAL1)
AC_SUBST(JVM_VARIANT_HOTSPOT)
AC_SUBST(JVM_VARIANT_ZERO)
AC_SUBST(JVM_VARIANT_ZEROSHARK)
AC_SUBST(JVM_VARIANT_CORE)
])

View File

@ -81,6 +81,31 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
test "x$DEBUG_LEVEL" != xslowdebug; then
AC_MSG_ERROR([Allowed debug levels are: release, fastdebug, slowdebug and optimized])
fi
# Translate DEBUG_LEVEL to debug level used by Hotspot
HOTSPOT_DEBUG_LEVEL="$DEBUG_LEVEL"
if test "x$DEBUG_LEVEL" = xrelease; then
HOTSPOT_DEBUG_LEVEL="product"
elif test "x$DEBUG_LEVEL" = xslowdebug; then
HOTSPOT_DEBUG_LEVEL="debug"
fi
if test "x$DEBUG_LEVEL" = xoptimized; then
# The debug level 'optimized' is a little special because it is currently only
# applicable to the HotSpot build where it means to build a completely
# optimized version of the VM without any debugging code (like for the
# 'release' debug level which is called 'product' in the HotSpot build) but
# with the exception that it can contain additional code which is otherwise
# protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
# test new and/or experimental features which are not intended for customer
# shipment. Because these new features need to be tested and benchmarked in
# real world scenarios, we want to build the containing JDK at the 'release'
# debug level.
DEBUG_LEVEL="release"
fi
AC_SUBST(HOTSPOT_DEBUG_LEVEL)
AC_SUBST(DEBUG_LEVEL)
])
###############################################################################
@ -178,10 +203,7 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
# Should we build the serviceability agent (SA)?
INCLUDE_SA=true
if test "x$JVM_VARIANT_ZERO" = xtrue ; then
INCLUDE_SA=false
fi
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
INCLUDE_SA=false
fi
if test "x$OPENJDK_TARGET_OS" = xaix ; then

View File

@ -72,6 +72,7 @@ AC_DEFUN_ONCE([JDKVER_SETUP_JDK_VERSION_NUMBERS],
AC_SUBST(PRODUCT_SUFFIX)
AC_SUBST(JDK_RC_PLATFORM_NAME)
AC_SUBST(COMPANY_NAME)
AC_SUBST(HOTSPOT_VM_DISTRO)
AC_SUBST(MACOSX_BUNDLE_NAME_BASE)
AC_SUBST(MACOSX_BUNDLE_ID_BASE)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -88,13 +88,25 @@ AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
# If dynamic was requested, it's available since it would fail above otherwise.
# If dynamic wasn't requested, go with static unless it isn't available.
AC_MSG_CHECKING([how to link with libstdc++])
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
if test "x$with_stdc__lib" = xdynamic || test "x$has_static_libstdcxx" = xno || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
LIBCXX="$LIBCXX -lstdc++"
# To help comparisons with old build, put stdc++ first in JVM_LIBS
JVM_LIBS="-lstdc++ $JVM_LIBS"
# Ideally, we should test stdc++ for the BUILD toolchain separately. For now
# just use the same setting as for the TARGET toolchain.
OPENJDK_BUILD_JVM_LIBS="-lstdc++ $OPENJDK_BUILD_JVM_LIBS"
LDCXX="$CXX"
STATIC_CXX_SETTING="STATIC_CXX=false"
AC_MSG_RESULT([dynamic])
else
LIBCXX="$LIBCXX $STATIC_STDCXX_FLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS -static-libgcc"
# To help comparisons with old build, put stdc++ first in JVM_LIBS
JVM_LIBS="-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic $JVM_LIBS"
# Ideally, we should test stdc++ for the BUILD toolchain separately. For now
# just use the same setting as for the TARGET toolchain.
OPENJDK_BUILD_JVM_LDFLAGS="$OPENJDK_BUILD_JVM_LDFLAGS -static-libgcc"
OPENJDK_BUILD_JVM_LIBS="-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic $OPENJDK_BUILD_JVM_LIBS"
LDCXX="$CC"
STATIC_CXX_SETTING="STATIC_CXX=true"
AC_MSG_RESULT([static])

View File

@ -74,7 +74,7 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
fi
# Check if ffi is needed
if test "x$JVM_VARIANT_ZERO" = xtrue || test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
NEEDS_LIB_FFI=true
else
NEEDS_LIB_FFI=false
@ -102,7 +102,7 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
################################################################################
AC_DEFUN_ONCE([LIB_SETUP_LLVM],
[
if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
if HOTSPOT_CHECK_JVM_VARIANT(zeroshark); then
AC_CHECK_PROG([LLVM_CONFIG], [llvm-config], [llvm-config])
if test "x$LLVM_CONFIG" != xllvm-config; then

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -273,169 +273,173 @@ AC_DEFUN([PLATFORM_SETUP_TARGET_CPU_BITS],
# Setup the legacy variables, for controlling the old makefiles.
#
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS],
[
PLATFORM_SETUP_LEGACY_VARS_HELPER([TARGET])
PLATFORM_SETUP_LEGACY_VARS_HELPER([BUILD])
# ZERO_ARCHDEF is used to enable architecture-specific code.
# This is used in legacy hotspot build.
ZERO_ARCHDEF="$HOTSPOT_TARGET_CPU_DEFINE"
AC_SUBST(ZERO_ARCHDEF)
])
# $1 - Either TARGET or BUILD to setup the variables for.
AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
[
# Also store the legacy naming of the cpu.
# Ie i586 and amd64 instead of x86 and x86_64
OPENJDK_TARGET_CPU_LEGACY="$OPENJDK_TARGET_CPU"
if test "x$OPENJDK_TARGET_CPU" = xx86; then
OPENJDK_TARGET_CPU_LEGACY="i586"
elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_$1_CPU_LEGACY="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_LEGACY="i586"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
# On all platforms except MacOSX replace x86_64 with amd64.
OPENJDK_TARGET_CPU_LEGACY="amd64"
OPENJDK_$1_CPU_LEGACY="amd64"
fi
AC_SUBST(OPENJDK_TARGET_CPU_LEGACY)
AC_SUBST(OPENJDK_$1_CPU_LEGACY)
# And the second legacy naming of the cpu.
# Ie i386 and amd64 instead of x86 and x86_64.
OPENJDK_TARGET_CPU_LEGACY_LIB="$OPENJDK_TARGET_CPU"
if test "x$OPENJDK_TARGET_CPU" = xx86; then
OPENJDK_TARGET_CPU_LEGACY_LIB="i386"
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_TARGET_CPU_LEGACY_LIB="amd64"
OPENJDK_$1_CPU_LEGACY_LIB="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_LEGACY_LIB="i386"
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
OPENJDK_$1_CPU_LEGACY_LIB="amd64"
fi
AC_SUBST(OPENJDK_TARGET_CPU_LEGACY_LIB)
AC_SUBST(OPENJDK_$1_CPU_LEGACY_LIB)
# This is the name of the cpu (but using i386 and amd64 instead of
# x86 and x86_64, respectively), preceeded by a /, to be used when
# locating libraries. On macosx, it's empty, though.
OPENJDK_TARGET_CPU_LIBDIR="/$OPENJDK_TARGET_CPU_LEGACY_LIB"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OPENJDK_TARGET_CPU_LIBDIR=""
OPENJDK_$1_CPU_LIBDIR="/$OPENJDK_$1_CPU_LEGACY_LIB"
if test "x$OPENJDK_$1_OS" = xmacosx; then
OPENJDK_$1_CPU_LIBDIR=""
fi
AC_SUBST(OPENJDK_TARGET_CPU_LIBDIR)
AC_SUBST(OPENJDK_$1_CPU_LIBDIR)
# Now do the same for OPENJDK_BUILD_CPU...
# Also store the legacy naming of the cpu.
# Ie i586 and amd64 instead of x86 and x86_64
OPENJDK_BUILD_CPU_LEGACY="$OPENJDK_BUILD_CPU"
if test "x$OPENJDK_BUILD_CPU" = xx86; then
OPENJDK_BUILD_CPU_LEGACY="i586"
elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
# On all platforms except MacOSX replace x86_64 with amd64.
OPENJDK_BUILD_CPU_LEGACY="amd64"
fi
AC_SUBST(OPENJDK_BUILD_CPU_LEGACY)
# And the second legacy naming of the cpu.
# Ie i386 and amd64 instead of x86 and x86_64.
OPENJDK_BUILD_CPU_LEGACY_LIB="$OPENJDK_BUILD_CPU"
if test "x$OPENJDK_BUILD_CPU" = xx86; then
OPENJDK_BUILD_CPU_LEGACY_LIB="i386"
elif test "x$OPENJDK_BUILD_CPU" = xx86_64; then
OPENJDK_BUILD_CPU_LEGACY_LIB="amd64"
fi
AC_SUBST(OPENJDK_BUILD_CPU_LEGACY_LIB)
# This is the name of the cpu (but using i386 and amd64 instead of
# x86 and x86_64, respectively), preceeded by a /, to be used when
# locating libraries. On macosx, it's empty, though.
OPENJDK_BUILD_CPU_LIBDIR="/$OPENJDK_BUILD_CPU_LEGACY_LIB"
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
OPENJDK_BUILD_CPU_LIBDIR=""
fi
AC_SUBST(OPENJDK_BUILD_CPU_LIBDIR)
# OPENJDK_TARGET_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
# OPENJDK_$1_CPU_ISADIR is normally empty. On 64-bit Solaris systems, it is set to
# /amd64 or /sparcv9. This string is appended to some library paths, like this:
# /usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libexample.so
OPENJDK_TARGET_CPU_ISADIR=""
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_TARGET_CPU_ISADIR="/amd64"
elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
OPENJDK_TARGET_CPU_ISADIR="/sparcv9"
# /usr/lib${OPENJDK_$1_CPU_ISADIR}/libexample.so
OPENJDK_$1_CPU_ISADIR=""
if test "x$OPENJDK_$1_OS" = xsolaris; then
if test "x$OPENJDK_$1_CPU" = xx86_64; then
OPENJDK_$1_CPU_ISADIR="/amd64"
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
OPENJDK_$1_CPU_ISADIR="/sparcv9"
fi
fi
AC_SUBST(OPENJDK_TARGET_CPU_ISADIR)
AC_SUBST(OPENJDK_$1_CPU_ISADIR)
# Setup OPENJDK_TARGET_CPU_OSARCH, which is used to set the os.arch Java system property
OPENJDK_TARGET_CPU_OSARCH="$OPENJDK_TARGET_CPU"
if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$OPENJDK_TARGET_CPU" = xx86; then
# Setup OPENJDK_$1_CPU_OSARCH, which is used to set the os.arch Java system property
OPENJDK_$1_CPU_OSARCH="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_OS" = xlinux && test "x$OPENJDK_$1_CPU" = xx86; then
# On linux only, we replace x86 with i386.
OPENJDK_TARGET_CPU_OSARCH="i386"
elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_$1_CPU_OSARCH="i386"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
# On all platforms except macosx, we replace x86_64 with amd64.
OPENJDK_TARGET_CPU_OSARCH="amd64"
OPENJDK_$1_CPU_OSARCH="amd64"
fi
AC_SUBST(OPENJDK_TARGET_CPU_OSARCH)
AC_SUBST(OPENJDK_$1_CPU_OSARCH)
OPENJDK_TARGET_CPU_JLI="$OPENJDK_TARGET_CPU"
if test "x$OPENJDK_TARGET_CPU" = xx86; then
OPENJDK_TARGET_CPU_JLI="i386"
elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
OPENJDK_$1_CPU_JLI="$OPENJDK_$1_CPU"
if test "x$OPENJDK_$1_CPU" = xx86; then
OPENJDK_$1_CPU_JLI="i386"
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
# On all platforms except macosx, we replace x86_64 with amd64.
OPENJDK_TARGET_CPU_JLI="amd64"
OPENJDK_$1_CPU_JLI="amd64"
fi
# Now setup the -D flags for building libjli.
OPENJDK_TARGET_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_TARGET_CPU_JLI\"'"
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
if test "x$OPENJDK_TARGET_CPU_ARCH" = xsparc; then
OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
elif test "x$OPENJDK_TARGET_CPU_ARCH" = xx86; then
OPENJDK_TARGET_CPU_JLI_CFLAGS="$OPENJDK_TARGET_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
OPENJDK_$1_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_$1_CPU_JLI\"'"
if test "x$OPENJDK_$1_OS" = xsolaris; then
if test "x$OPENJDK_$1_CPU_ARCH" = xsparc; then
OPENJDK_$1_CPU_JLI_CFLAGS="$OPENJDK_$1_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
elif test "x$OPENJDK_$1_CPU_ARCH" = xx86; then
OPENJDK_$1_CPU_JLI_CFLAGS="$OPENJDK_$1_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
fi
fi
AC_SUBST(OPENJDK_TARGET_CPU_JLI_CFLAGS)
AC_SUBST(OPENJDK_$1_CPU_JLI_CFLAGS)
OPENJDK_BUILD_CPU_JLI="$OPENJDK_BUILD_CPU"
if test "x$OPENJDK_BUILD_CPU" = xx86; then
OPENJDK_BUILD_CPU_JLI="i386"
elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
# On all platforms except macosx, we replace x86_64 with amd64.
OPENJDK_BUILD_CPU_JLI="amd64"
fi
# Now setup the -D flags for building libjli.
OPENJDK_BUILD_CPU_JLI_CFLAGS="-DLIBARCHNAME='\"$OPENJDK_BUILD_CPU_JLI\"'"
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
if test "x$OPENJDK_BUILD_CPU_ARCH" = xsparc; then
OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"sparc\"' -DLIBARCH64NAME='\"sparcv9\"'"
elif test "x$OPENJDK_BUILD_CPU_ARCH" = xx86; then
OPENJDK_BUILD_CPU_JLI_CFLAGS="$OPENJDK_BUILD_CPU_JLI_CFLAGS -DLIBARCH32NAME='\"i386\"' -DLIBARCH64NAME='\"amd64\"'"
fi
fi
AC_SUBST(OPENJDK_BUILD_CPU_JLI_CFLAGS)
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OPENJDK_TARGET_OS_EXPORT_DIR=macosx
if test "x$OPENJDK_$1_OS" = xmacosx; then
OPENJDK_$1_OS_EXPORT_DIR=macosx
else
OPENJDK_TARGET_OS_EXPORT_DIR=${OPENJDK_TARGET_OS_TYPE}
OPENJDK_$1_OS_EXPORT_DIR=${OPENJDK_$1_OS_TYPE}
fi
AC_SUBST(OPENJDK_TARGET_OS_EXPORT_DIR)
AC_SUBST(OPENJDK_$1_OS_EXPORT_DIR)
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
if test "x$OPENJDK_$1_CPU_BITS" = x64; then
A_LP64="LP64:="
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
# unpack200.exe
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xmacosx; then
ADD_LP64="-D_LP64=1"
if test "x$OPENJDK_$1_OS" = xlinux || test "x$OPENJDK_$1_OS" = xmacosx; then
OPENJDK_$1_ADD_LP64="-D_LP64=1"
fi
fi
AC_SUBST(LP64,$A_LP64)
if test "x$OPENJDK_BUILD_CPU_BITS" = x64; then
if test "x$OPENJDK_BUILD_OS" = xlinux || test "x$OPENJDK_BUILD_OS" = xmacosx; then
OPENJDK_BUILD_ADD_LP64="-D_LP64=1"
fi
fi
if test "x$COMPILE_TYPE" = "xcross"; then
# FIXME: ... or should this include reduced builds..?
DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_TARGET_CPU_LEGACY"
DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
else
DEFINE_CROSS_COMPILE_ARCH=""
fi
AC_SUBST(DEFINE_CROSS_COMPILE_ARCH)
# ZERO_ARCHDEF is used to enable architecture-specific code
case "${OPENJDK_TARGET_CPU}" in
ppc) ZERO_ARCHDEF=PPC32 ;;
ppc64) ZERO_ARCHDEF=PPC64 ;;
s390*) ZERO_ARCHDEF=S390 ;;
sparc*) ZERO_ARCHDEF=SPARC ;;
x86_64*) ZERO_ARCHDEF=AMD64 ;;
x86) ZERO_ARCHDEF=IA32 ;;
*) ZERO_ARCHDEF=$(echo "${OPENJDK_TARGET_CPU_LEGACY_LIB}" | tr a-z A-Z)
esac
AC_SUBST(ZERO_ARCHDEF)
# Convert openjdk platform names to hotspot names
HOTSPOT_$1_OS=${OPENJDK_$1_OS}
if test "x$OPENJDK_$1_OS" = xmacosx; then
HOTSPOT_$1_OS=bsd
fi
AC_SUBST(HOTSPOT_$1_OS)
HOTSPOT_$1_OS_TYPE=${OPENJDK_$1_OS_TYPE}
if test "x$OPENJDK_$1_OS_TYPE" = xunix; then
HOTSPOT_$1_OS_TYPE=posix
fi
AC_SUBST(HOTSPOT_$1_OS_TYPE)
HOTSPOT_$1_CPU=${OPENJDK_$1_CPU}
if test "x$OPENJDK_$1_CPU" = xx86; then
HOTSPOT_$1_CPU=x86_32
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
HOTSPOT_$1_CPU=sparc
elif test "x$OPENJDK_$1_CPU" = xppc64; then
HOTSPOT_$1_CPU=ppc_64
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
HOTSPOT_$1_CPU=ppc_64
fi
AC_SUBST(HOTSPOT_$1_CPU)
# This is identical with OPENJDK_*, but define anyway for consistency.
HOTSPOT_$1_CPU_ARCH=${OPENJDK_$1_CPU_ARCH}
AC_SUBST(HOTSPOT_$1_CPU_ARCH)
# Setup HOTSPOT_$1_CPU_DEFINE
if test "x$OPENJDK_$1_CPU" = xx86; then
HOTSPOT_$1_CPU_DEFINE=IA32
elif test "x$OPENJDK_$1_CPU" = xx86_64; then
HOTSPOT_$1_CPU_DEFINE=AMD64
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xaarch64; then
HOTSPOT_$1_CPU_DEFINE=AARCH64
elif test "x$OPENJDK_$1_CPU" = xppc64; then
HOTSPOT_$1_CPU_DEFINE=PPC64
elif test "x$OPENJDK_$1_CPU" = xppc64le; then
HOTSPOT_$1_CPU_DEFINE=PPC64
# The cpu defines below are for zero, we don't support them directly.
elif test "x$OPENJDK_$1_CPU" = xsparc; then
HOTSPOT_$1_CPU_DEFINE=SPARC
elif test "x$OPENJDK_$1_CPU" = xppc; then
HOTSPOT_$1_CPU_DEFINE=PPC32
elif test "x$OPENJDK_$1_CPU" = xs390; then
HOTSPOT_$1_CPU_DEFINE=S390
elif test "x$OPENJDK_$1_CPU" = xs390x; then
HOTSPOT_$1_CPU_DEFINE=S390
fi
AC_SUBST(HOTSPOT_$1_CPU_DEFINE)
])
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
@ -521,6 +525,10 @@ AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
JVM_CFLAGS="$JVM_CFLAGS $ADDED_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $ADDED_LDFLAGS"
JVM_ASFLAGS="$JVM_ASFLAGS $ADDED_CFLAGS"
])
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
@ -542,6 +550,11 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
fi
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
JVM_CFLAGS="$JVM_CFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
JVM_LDFLAGS="$JVM_LDFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
JVM_ASFLAGS="$JVM_ASFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
fi
# Make compilation sanity check
AC_CHECK_HEADERS([stdio.h], , [

View File

@ -82,6 +82,13 @@ OPENJDK_TARGET_CPU_OSARCH:=@OPENJDK_TARGET_CPU_OSARCH@
OPENJDK_TARGET_CPU_JLI_CFLAGS:=@OPENJDK_TARGET_CPU_JLI_CFLAGS@
OPENJDK_TARGET_OS_EXPORT_DIR:=@OPENJDK_TARGET_OS_EXPORT_DIR@
HOTSPOT_TARGET_OS := @HOTSPOT_TARGET_OS@
HOTSPOT_TARGET_OS_TYPE := @HOTSPOT_TARGET_OS_TYPE@
HOTSPOT_TARGET_CPU := @HOTSPOT_TARGET_CPU@
HOTSPOT_TARGET_CPU_ARCH := @HOTSPOT_TARGET_CPU_ARCH@
HOTSPOT_TARGET_CPU_DEFINE := @HOTSPOT_TARGET_CPU_DEFINE@
# We are building on this build system.
# When not cross-compiling, it is the same as the target.
OPENJDK_BUILD_OS:=@OPENJDK_BUILD_OS@
@ -192,6 +199,7 @@ PRODUCT_NAME:=@PRODUCT_NAME@
PRODUCT_SUFFIX:=@PRODUCT_SUFFIX@
JDK_RC_PLATFORM_NAME:=@JDK_RC_PLATFORM_NAME@
COMPANY_NAME:=@COMPANY_NAME@
HOTSPOT_VM_DISTRO:=@HOTSPOT_VM_DISTRO@
MACOSX_BUNDLE_NAME_BASE=@MACOSX_BUNDLE_NAME_BASE@
MACOSX_BUNDLE_ID_BASE=@MACOSX_BUNDLE_ID_BASE@
USERNAME:=@USERNAME@
@ -201,11 +209,32 @@ RUNTIME_NAME=$(PRODUCT_NAME) $(PRODUCT_SUFFIX)
# How to compile the code: release, fastdebug or slowdebug
DEBUG_LEVEL:=@DEBUG_LEVEL@
HOTSPOT_DEBUG_LEVEL:=@HOTSPOT_DEBUG_LEVEL@
# This is the JDK variant to build.
# The JDK variant is a name for a specific set of modules to be compiled for the JDK.
JDK_VARIANT:=@JDK_VARIANT@
# Which JVM variants to build (space-separated list)
JVM_VARIANTS := @JVM_VARIANTS@
# Lists of features per variant. Only relevant for the variants listed in
# JVM_VARIANTS.
JVM_FEATURES_server := @JVM_FEATURES_server@
JVM_FEATURES_client := @JVM_FEATURES_client@
JVM_FEATURES_core := @JVM_FEATURES_core@
JVM_FEATURES_minimal := @JVM_FEATURES_minimal@
JVM_FEATURES_zero := @JVM_FEATURES_zero@
JVM_FEATURES_zeroshark := @JVM_FEATURES_zeroshark@
JVM_FEATURES_custom := @JVM_FEATURES_custom@
# Used for make-time verifications
VALID_JVM_FEATURES := @VALID_JVM_FEATURES@
VALID_JVM_VARIANTS := @VALID_JVM_VARIANTS@
# Control use of precompiled header in hotspot libjvm build
USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@
# Should we compile support for running with a graphical UI? (ie headful)
# Should we compile support for running without? (ie headless)
SUPPORT_HEADFUL:=@SUPPORT_HEADFUL@
@ -213,25 +242,11 @@ SUPPORT_HEADLESS:=@SUPPORT_HEADLESS@
# Legacy defines controlled by the SUPPORT_HEADLESS and SUPPORT_HEADFUL options.
@BUILD_HEADLESS@
# These are the libjvms that we want to build.
# The java launcher uses the default.
# The others can be selected by specifying -client -server -minimal1 -zero or -zeroshark
# on the java launcher command line.
JVM_VARIANTS:=@JVM_VARIANTS@
JVM_VARIANT_SERVER:=@JVM_VARIANT_SERVER@
JVM_VARIANT_CLIENT:=@JVM_VARIANT_CLIENT@
JVM_VARIANT_MINIMAL1:=@JVM_VARIANT_MINIMAL1@
JVM_VARIANT_ZERO:=@JVM_VARIANT_ZERO@
JVM_VARIANT_ZEROSHARK:=@JVM_VARIANT_ZEROSHARK@
JVM_VARIANT_CORE:=@JVM_VARIANT_CORE@
# Legacy support
USE_NEW_HOTSPOT_BUILD:=@USE_NEW_HOTSPOT_BUILD@
# Universal binaries on macosx
MACOSX_UNIVERSAL=@MACOSX_UNIVERSAL@
# Legacy setting: -debug or -fastdebug
# Still used in version string...
BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
# JDK_OUTPUTDIR specifies where a working jvm is built.
# You can run $(JDK_OUTPUTDIR)/bin/java
# Though the layout of the contents of $(JDK_OUTPUTDIR) is not
@ -320,6 +335,11 @@ MACOSX_VERSION_MIN=@MACOSX_VERSION_MIN@
# Toolchain type: gcc, clang, solstudio, lxc, microsoft...
TOOLCHAIN_TYPE:=@TOOLCHAIN_TYPE@
TOOLCHAIN_VERSION := @TOOLCHAIN_VERSION@
CC_VERSION_NUMBER := @CC_VERSION_NUMBER@
CXX_VERSION_NUMBER := @CXX_VERSION_NUMBER@
# Legacy support
HOTSPOT_TOOLCHAIN_TYPE := @HOTSPOT_TOOLCHAIN_TYPE@
# Option used to tell the compiler whether to create 32- or 64-bit executables
COMPILER_TARGET_BITS_FLAG:=@COMPILER_TARGET_BITS_FLAG@
@ -338,14 +358,18 @@ LD_OUT_OPTION:=@LD_OUT_OPTION@
AR_OUT_OPTION:=@AR_OUT_OPTION@
# Flags used for overriding the default opt setting for a C/C++ source file.
C_O_FLAG_HIGHEST_JVM:=@C_O_FLAG_HIGHEST_JVM@
C_O_FLAG_HIGHEST:=@C_O_FLAG_HIGHEST@
C_O_FLAG_HI:=@C_O_FLAG_HI@
C_O_FLAG_NORM:=@C_O_FLAG_NORM@
C_O_FLAG_NONE:=@C_O_FLAG_NONE@
C_O_FLAG_SIZE:=@C_O_FLAG_SIZE@
CXX_O_FLAG_HIGHEST_JVM:=@CXX_O_FLAG_HIGHEST_JVM@
CXX_O_FLAG_HIGHEST:=@CXX_O_FLAG_HIGHEST@
CXX_O_FLAG_HI:=@CXX_O_FLAG_HI@
CXX_O_FLAG_NORM:=@CXX_O_FLAG_NORM@
CXX_O_FLAG_NONE:=@CXX_O_FLAG_NONE@
CXX_O_FLAG_SIZE:=@CXX_O_FLAG_SIZE@
C_FLAG_DEPS:=@C_FLAG_DEPS@
CXX_FLAG_DEPS:=@CXX_FLAG_DEPS@
@ -374,6 +398,23 @@ CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@
JVM_CFLAGS := @JVM_CFLAGS@
JVM_CFLAGS_SYMBOLS := @JVM_CFLAGS_SYMBOLS@
JVM_LDFLAGS := @JVM_LDFLAGS@
JVM_ASFLAGS := @JVM_ASFLAGS@
JVM_LIBS := @JVM_LIBS@
JVM_RCFLAGS := @JVM_RCFLAGS@
# Flags for zeroshark
LLVM_CFLAGS := @LLVM_CFLAGS@
LLVM_LIBS := @LLVM_LIBS@
LLVM_LDFLAGS := @LLVM_LDFLAGS@
# These flags might contain variables set by a custom extension that is included later.
EXTRA_CFLAGS = @EXTRA_CFLAGS@
EXTRA_CXXFLAGS = @EXTRA_CXXFLAGS@
EXTRA_LDFLAGS = @EXTRA_LDFLAGS@
CXX:=@FIXPATH@ @CCACHE@ @ICECC@ @CXX@
CPP:=@FIXPATH@ @CPP@
@ -630,6 +671,7 @@ XATTR:=@XATTR@
JT_HOME:=@JT_HOME@
JTREGEXE:=@JTREGEXE@
XCODEBUILD=@XCODEBUILD@
DTRACE := @DTRACE@
FIXPATH:=@FIXPATH@
# Build setup

View File

@ -930,6 +930,17 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
rm -rf version-script.map main.c a.out
fi
AC_SUBST(USING_BROKEN_SUSE_LD)
# Setup hotspot lecagy names for toolchains
HOTSPOT_TOOLCHAIN_TYPE=$TOOLCHAIN_TYPE
if test "x$TOOLCHAIN_TYPE" = xclang; then
HOTSPOT_TOOLCHAIN_TYPE=gcc
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
HOTSPOT_TOOLCHAIN_TYPE=sparcWorks
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
HOTSPOT_TOOLCHAIN_TYPE=visCPP
fi
AC_SUBST(HOTSPOT_TOOLCHAIN_TYPE)
])
# Setup the JTReg Regression Test Harness.

View File

@ -32,6 +32,7 @@ PRODUCT_NAME=OpenJDK
PRODUCT_SUFFIX="Runtime Environment"
JDK_RC_PLATFORM_NAME=Platform
COMPANY_NAME=N/A
HOTSPOT_VM_DISTRO="OpenJDK"
# Might need better names for these
MACOSX_BUNDLE_NAME_BASE="OpenJDK"

View File

@ -212,14 +212,17 @@ var getJibProfiles = function (input) {
* @returns Common values
*/
var getJibProfilesCommon = function (input) {
var common = {
dependencies: ["boot_jdk", "gnumake", "jtreg"],
configure_args: ["--with-default-make-target=all", "--enable-jtreg-failure-handler"],
configure_args_32bit: ["--with-target-bits=32", "--with-jvm-variants=client,server"],
configure_args_debug: ["--enable-debug"],
configure_args_slowdebug: ["--with-debug-level=slowdebug"],
organization: "jpg.infra.builddeps"
};
var common = {};
common.dependencies = ["boot_jdk", "gnumake", "jtreg"],
common.default_make_targets = ["product-images", "test-image"],
common.default_make_targets_debug = common.default_make_targets;
common.default_make_targets_slowdebug = common.default_make_targets;
common.configure_args = ["--enable-jtreg-failure-handler"],
common.configure_args_32bit = ["--with-target-bits=32", "--with-jvm-variants=client,server"],
common.configure_args_debug = ["--enable-debug"],
common.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
common.organization = "jpg.infra.builddeps"
return common;
};
@ -242,7 +245,7 @@ var getJibProfilesProfiles = function (input, common) {
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
make_args: common.make_args
default_make_targets: concat(common.default_make_targets, "docs-image")
},
"linux-x86": {
@ -252,7 +255,7 @@ var getJibProfilesProfiles = function (input, common) {
dependencies: concat(common.dependencies, "devkit"),
configure_args: concat(common.configure_args, common.configure_args_32bit,
"--with-zlib=system"),
make_args: common.make_args
default_make_targets: common.default_make_targets
},
"macosx-x64": {
@ -260,7 +263,7 @@ var getJibProfilesProfiles = function (input, common) {
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
make_args: common.make_args
default_make_targets: common.default_make_targets
},
"solaris-x64": {
@ -268,7 +271,7 @@ var getJibProfilesProfiles = function (input, common) {
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "cups"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
make_args: common.make_args
default_make_targets: common.default_make_targets
},
"solaris-sparcv9": {
@ -276,15 +279,15 @@ var getJibProfilesProfiles = function (input, common) {
target_cpu: "sparcv9",
dependencies: concat(common.dependencies, "devkit", "cups"),
configure_args: concat(common.configure_args, "--with-zlib=system"),
make_args: common.make_args
default_make_targets: common.default_make_targets
},
"windows-x64": {
target_os: "windows",
target_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "freetype"),
configure_args: common.configure_args,
make_args: common.make_args
configure_args: concat(common.configure_args),
default_make_targets: common.default_make_targets
},
"windows-x86": {
@ -293,7 +296,7 @@ var getJibProfilesProfiles = function (input, common) {
build_cpu: "x64",
dependencies: concat(common.dependencies, "devkit", "freetype"),
configure_args: concat(common.configure_args, common.configure_args_32bit),
make_args: common.make_args
default_make_targets: common.default_make_targets
}
};
profiles = concatObjects(profiles, mainProfiles);
@ -306,14 +309,15 @@ var getJibProfilesProfiles = function (input, common) {
// implementation builds.
var openOnlyProfiles = generateOpenOnlyProfiles(common, mainProfiles);
// The open only profiles on linux are used for reference builds and should
// produce the compact profile images by default.
// produce the compact profile images by default. This adds "profiles" as an
// extra default target.
var openOnlyProfilesExtra = {
"linux-x64-open": {
configure_args: ["--with-default-make-target=all profiles"],
default_make_targets: "profiles"
},
"linux-x86-open": {
configure_args: ["--with-default-make-target=all profiles"],
default_make_targets: "profiles"
}
};
var openOnlyProfiles = concatObjects(openOnlyProfiles, openOnlyProfilesExtra);
@ -336,6 +340,7 @@ var getJibProfilesProfiles = function (input, common) {
// Generate the missing platform attributes
profiles = generatePlatformAttributes(profiles);
profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
return profiles;
};
@ -469,6 +474,8 @@ var generateDebugProfiles = function (common, profiles) {
var debugProfile = profile + "-debug";
newProfiles[debugProfile] = clone(profiles[profile]);
newProfiles[debugProfile].debug_level = "fastdebug";
newProfiles[debugProfile].default_make_targets
= common.default_make_targets_debug;
newProfiles[debugProfile].labels
= concat(newProfiles[debugProfile].labels || [], "debug"),
newProfiles[debugProfile].configure_args
@ -492,6 +499,8 @@ var generateSlowdebugProfiles = function (common, profiles) {
var debugProfile = profile + "-slowdebug";
newProfiles[debugProfile] = clone(profiles[profile]);
newProfiles[debugProfile].debug_level = "slowdebug";
newProfiles[debugProfile].default_make_targets
= common.default_make_targets_slowdebug;
newProfiles[debugProfile].labels
= concat(newProfiles[debugProfile].labels || [], "slowdebug"),
newProfiles[debugProfile].configure_args
@ -523,6 +532,39 @@ var generateOpenOnlyProfiles = function (common, profiles) {
return newProfiles;
};
/**
* The default_make_targets attribute on a profile is not a real Jib attribute.
* This function rewrites that attribute into the corresponding configure arg.
* Calling this function multiple times on the same profiles object is safe.
*
* @param common Common values
* @param profiles Profiles map to rewrite profiles for
* @returns {{}} New map of profiles with the make targets converted
*/
var generateDefaultMakeTargetsConfigureArg = function (common, profiles) {
var ret = concatObjects(profiles, {});
for (var profile in ret) {
if (ret[profile]["default_make_targets"] != null) {
var targetsString = concat(ret[profile].default_make_targets).join(" ");
// Iterate over all configure args and see if --with-default-make-target
// is already there and change it, otherwise add it.
var found = false;
for (var arg in ret[profile].configure_args) {
if (arg.startsWith("--with-default-make-target")) {
found = true;
arg.replace(/=.*/, "=" + targetsString);
}
}
if (!found) {
ret[profile].configure_args = concat(
ret[profile].configure_args,
"--with-default-make-target=" + targetsString);
}
}
}
return ret;
}
/**
* Deep clones an object tree.
*

View File

@ -357,3 +357,5 @@ b75afa17aefe480c23c616a6a2497063312f7189 jdk-9+109
780d0620add32bf545471cf65038c9ac6d9c036d jdk-9+112
cc30faa2da498c478e89ab062ff160653ca1b170 jdk-9+113
10d175b0368c30f54350fc648adc41b94ce357ee jdk-9+114
7bab1b1b36824924b1c657a8419369ba93d198d3 jdk-9+115
7dfa7377a5e601b8f740741a9a80e04c72dd04d6 jdk-9+116

View File

@ -255,7 +255,7 @@ public class RequestImpl
public synchronized void send_deferred()
{
AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false);
new sun.misc.ManagedLocalsThread(invokeObject).start();
new Thread(null, invokeObject, "Async-Request-Invoker-Thread", 0, false).start();
}
public synchronized boolean poll_response()

View File

@ -751,12 +751,13 @@ public class Util implements javax.rmi.CORBA.UtilDelegate
}
}
class KeepAlive extends sun.misc.ManagedLocalsThread
class KeepAlive extends Thread
{
boolean quit = false;
public KeepAlive ()
{
super(null, null, "Servant-KeepAlive-Thread", 0, false);
setDaemon(false);
}

View File

@ -516,7 +516,7 @@ public class POAImpl extends ObjectAdapterBase implements POA
// Converted from anonymous class to local class
// so that we can call performDestroy() directly.
static class DestroyThread extends sun.misc.ManagedLocalsThread {
static class DestroyThread extends Thread {
private boolean wait ;
private boolean etherealize ;
private boolean debug ;
@ -524,6 +524,7 @@ public class POAImpl extends ObjectAdapterBase implements POA
public DestroyThread( boolean etherealize, boolean debug )
{
super(null, null, "POA-Destroy-Thread", 0, false);
this.etherealize = etherealize ;
this.debug = debug ;
}

View File

@ -357,7 +357,7 @@ public class POAManagerImpl extends org.omg.CORBA.LocalObject implements
if (wait_for_completion)
deactivator.run() ;
else {
Thread thr = new sun.misc.ManagedLocalsThread(deactivator) ;
Thread thr = new Thread(null, deactivator, "POA-Deactivator-Thread", 0, false) ;
thr.start() ;
}
} finally {

View File

@ -302,7 +302,7 @@ public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
throw new WrongPolicy();
}
class Etherealizer extends sun.misc.ManagedLocalsThread {
class Etherealizer extends Thread {
private POAPolicyMediatorImpl_R_USM mediator ;
private ActiveObjectMap.Key key ;
private AOMEntry entry ;
@ -314,6 +314,7 @@ public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
boolean debug )
{
super(null, null, "PAO-Etherealizer-Thread", 0, false);
this.mediator = mediator ;
this.key = key ;
this.entry = entry;

View File

@ -691,7 +691,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
for (int i = 0; i < req.length; i++) {
AsynchInvoke invokeObject = new AsynchInvoke( this,
(com.sun.corba.se.impl.corba.RequestImpl)req[i], true);
new sun.misc.ManagedLocalsThread(invokeObject).start();
new Thread(null, invokeObject, "ORB-Request-Thread", 0, false).start();
}
}

View File

@ -459,7 +459,7 @@ public class ThreadPoolImpl implements ThreadPool
}
private class WorkerThread extends sun.misc.ManagedLocalsThread implements Closeable
private class WorkerThread extends Thread implements Closeable
{
private Work currentWork;
private int threadId = 0; // unique id for the thread
@ -469,7 +469,7 @@ public class ThreadPoolImpl implements ThreadPool
private StringBuffer workerThreadName = new StringBuffer();
WorkerThread(ThreadGroup tg, String threadPoolName) {
super(tg, "Idle");
super(tg, null, "Idle", 0, false);
this.threadId = ThreadPoolImpl.getUniqueThreadId();
this.threadPoolName = threadPoolName;
setName(composeWorkerThreadName(threadPoolName, "Idle"));

View File

@ -61,7 +61,7 @@ import com.sun.corba.se.impl.orbutil.ORBUtility;
*/
class SelectorImpl
extends
sun.misc.ManagedLocalsThread
Thread
implements
com.sun.corba.se.pept.transport.Selector
{
@ -79,6 +79,7 @@ class SelectorImpl
public SelectorImpl(ORB orb)
{
super(null, null, "ORB-Selector-Thread", 0, false);
this.orb = orb;
selector = null;
selectorStarted = false;
@ -277,7 +278,6 @@ class SelectorImpl
public void run()
{
setName("SelectorThread");
while (!closed) {
try {
int n = 0;

View File

@ -29,8 +29,6 @@ module java.corba {
requires java.logging;
requires java.naming;
requires java.transaction;
// 8148863
requires jdk.unsupported;
exports javax.activity;
exports javax.rmi;

View File

@ -518,3 +518,4 @@ c558850fac5750d8ca98a45180121980f57cdd28 jdk-9+111
c569f8d89269fb6205b90f727581eb8cc04132f9 jdk-9+113
b64432bae5271735fd53300b2005b713e98ef411 jdk-9+114
88dd08d7be0fe7fb9f1914b1628f0aae9bf56e25 jdk-9+115
61a214186dae6811dd989e9165e42f7dbf02acde jdk-9+116

View File

@ -360,7 +360,7 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
length.set_instruction(x->length());
length.load_item();
}
if (needs_store_check) {
if (needs_store_check || x->check_boolean()) {
value.load_item();
} else {
value.load_for_store(x->elt_type());
@ -407,7 +407,8 @@ void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
true /* do_load */, false /* patch */, NULL);
}
__ move(value.result(), array_addr, null_check_info);
LIR_Opr result = maybe_mask_boolean(x, array.result(), value.result(), null_check_info);
__ move(result, array_addr, null_check_info);
if (obj_store) {
// Precise card mark.
post_barrier(LIR_OprFact::address(array_addr), value.result());

View File

@ -169,6 +169,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state, Register Rsc
case ltos: ld(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
break;
case btos: // fall through
case ztos: // fall through
case ctos: // fall through
case stos: // fall through
case itos: lwz(R17_tos, in_bytes(JvmtiThreadState::earlyret_value_offset()), RjvmtiState);
@ -294,6 +295,7 @@ void InterpreterMacroAssembler::push(TosState state) {
switch (state) {
case atos: push_ptr(); break;
case btos:
case ztos:
case ctos:
case stos:
case itos: push_i(); break;
@ -309,6 +311,7 @@ void InterpreterMacroAssembler::pop(TosState state) {
switch (state) {
case atos: pop_ptr(); break;
case btos:
case ztos:
case ctos:
case stos:
case itos: pop_i(); break;
@ -749,6 +752,43 @@ void InterpreterMacroAssembler::merge_frames(Register Rsender_sp, Register retur
stdux(Rscratch2, R1_SP, Rscratch1); // atomically set *(SP = top_frame_sp) = **SP
}
void InterpreterMacroAssembler::narrow(Register result) {
Register ret_type = R11_scratch1;
ld(R11_scratch1, in_bytes(Method::const_offset()), R19_method);
lbz(ret_type, in_bytes(ConstMethod::result_type_offset()), R11_scratch1);
Label notBool, notByte, notChar, done;
// common case first
cmpwi(CCR0, ret_type, T_INT);
beq(CCR0, done);
cmpwi(CCR0, ret_type, T_BOOLEAN);
bne(CCR0, notBool);
andi(result, result, 0x1);
b(done);
bind(notBool);
cmpwi(CCR0, ret_type, T_BYTE);
bne(CCR0, notByte);
extsb(result, result);
b(done);
bind(notByte);
cmpwi(CCR0, ret_type, T_CHAR);
bne(CCR0, notChar);
andi(result, result, 0xffff);
b(done);
bind(notChar);
// cmpwi(CCR0, ret_type, T_SHORT); // all that's left
// bne(CCR0, done);
extsh(result, result);
// Nothing to do for T_INT
bind(done);
}
// Remove activation.
//
// Unlock the receiver if this is a synchronized method.

View File

@ -140,6 +140,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
void get_cpool_and_tags(Register Rcpool, Register Rtags);
void is_a(Label& L);
void narrow(Register result);
// Java Call Helpers
void call_from_interpreter(Register Rtarget_method, Register Rret_addr, Register Rscratch1, Register Rscratch2);

View File

@ -655,6 +655,7 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
switch (state) {
case ltos:
case btos:
case ztos:
case ctos:
case stos:
case atos:
@ -701,6 +702,7 @@ address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, i
switch (state) {
case ltos:
case btos:
case ztos:
case ctos:
case stos:
case atos:
@ -2082,12 +2084,14 @@ address TemplateInterpreterGenerator::generate_earlyret_entry_for(TosState state
// Copied from TemplateTable::_return.
// Restoration of lr done by remove_activation.
switch (state) {
// Narrow result if state is itos but result type is smaller.
case itos: __ narrow(R17_tos); /* fall through */
case ltos:
case btos:
case ztos:
case ctos:
case stos:
case atos:
case itos: __ mr(R3_RET, R17_tos); break;
case atos: __ mr(R3_RET, R17_tos); break;
case ftos:
case dtos: __ fmr(F1_RET, F15_ftos); break;
case vtos: // This might be a constructor. Final fields (and volatile fields on PPC64) need
@ -2147,6 +2151,10 @@ address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
bname = "trace_code_btos {";
tsize = 2;
break;
case ztos:
bname = "trace_code_ztos {";
tsize = 2;
break;
case ctos:
bname = "trace_code_ctos {";
tsize = 2;

View File

@ -170,6 +170,7 @@ void TemplateTable::patch_bytecode(Bytecodes::Code new_bc, Register Rnew_bc, Reg
switch (new_bc) {
case Bytecodes::_fast_aputfield:
case Bytecodes::_fast_bputfield:
case Bytecodes::_fast_zputfield:
case Bytecodes::_fast_cputfield:
case Bytecodes::_fast_dputfield:
case Bytecodes::_fast_fputfield:
@ -981,9 +982,21 @@ void TemplateTable::bastore() {
Rarray = R12_scratch2,
Rscratch = R3_ARG1;
__ pop_i(Rindex);
__ pop_ptr(Rarray);
// tos: val
// Rarray: array ptr (popped by index_check)
__ index_check(Rarray, Rindex, 0, Rscratch, Rarray);
// Need to check whether array is boolean or byte
// since both types share the bastore bytecode.
__ load_klass(Rscratch, Rarray);
__ lwz(Rscratch, in_bytes(Klass::layout_helper_offset()), Rscratch);
int diffbit = exact_log2(Klass::layout_helper_boolean_diffbit());
__ testbitdi(CCR0, R0, Rscratch, diffbit);
Label L_skip;
__ bfalse(CCR0, L_skip);
__ andi(R17_tos, R17_tos, 1); // if it is a T_BOOLEAN array, mask the stored value to 0/1
__ bind(L_skip);
__ index_check_without_pop(Rarray, Rindex, 0, Rscratch, Rarray);
__ stb(R17_tos, arrayOopDesc::base_offset_in_bytes(T_BYTE), Rarray);
}
@ -2108,12 +2121,16 @@ void TemplateTable::_return(TosState state) {
__ remove_activation(state, /* throw_monitor_exception */ true);
// Restoration of lr done by remove_activation.
switch (state) {
// Narrow result if state is itos but result type is smaller.
// Need to narrow in the return bytecode rather than in generate_return_entry
// since compiled code callers expect the result to already be narrowed.
case itos: __ narrow(R17_tos); /* fall through */
case ltos:
case btos:
case ztos:
case ctos:
case stos:
case atos:
case itos: __ mr(R3_RET, R17_tos); break;
case atos: __ mr(R3_RET, R17_tos); break;
case ftos:
case dtos: __ fmr(F1_RET, F15_ftos); break;
case vtos: // This might be a constructor. Final fields (and volatile fields on PPC64) need
@ -2518,6 +2535,21 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ beq(CCR6, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
// __ bind(Lztos); (same code as btos)
__ fence(); // Volatile entry point (one instruction before non-volatile_entry point).
assert(branch_table[ztos] == 0, "can't compute twice");
branch_table[ztos] = __ pc(); // non-volatile_entry point
__ lbzx(R17_tos, Rclass_or_obj, Roffset);
__ extsb(R17_tos, R17_tos);
__ push(ztos);
if (!is_static) {
// use btos rewriting, no truncating to t/f bit is needed for getfield.
patch_bytecode(Bytecodes::_fast_bgetfield, Rbc, Rscratch);
}
__ beq(CCR6, Lacquire); // Volatile?
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align load.
// __ bind(Lctos);
__ fence(); // Volatile entry point (one instruction before non-volatile_entry point).
@ -2618,6 +2650,7 @@ void TemplateTable::jvmti_post_field_mod(Register Rcache, Register Rscratch, boo
case Bytecodes::_fast_aputfield: __ push_ptr(); offs+= Interpreter::stackElementSize; break;
case Bytecodes::_fast_iputfield: // Fall through
case Bytecodes::_fast_bputfield: // Fall through
case Bytecodes::_fast_zputfield: // Fall through
case Bytecodes::_fast_cputfield: // Fall through
case Bytecodes::_fast_sputfield: __ push_i(); offs+= Interpreter::stackElementSize; break;
case Bytecodes::_fast_lputfield: __ push_l(); offs+=2*Interpreter::stackElementSize; break;
@ -2658,6 +2691,7 @@ void TemplateTable::jvmti_post_field_mod(Register Rcache, Register Rscratch, boo
case Bytecodes::_fast_aputfield: __ pop_ptr(); break;
case Bytecodes::_fast_iputfield: // Fall through
case Bytecodes::_fast_bputfield: // Fall through
case Bytecodes::_fast_zputfield: // Fall through
case Bytecodes::_fast_cputfield: // Fall through
case Bytecodes::_fast_sputfield: __ pop_i(); break;
case Bytecodes::_fast_lputfield: __ pop_l(); break;
@ -2824,6 +2858,21 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
}
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align pop.
// __ bind(Lztos);
__ release(); // Volatile entry point (one instruction before non-volatile_entry point).
assert(branch_table[ztos] == 0, "can't compute twice");
branch_table[ztos] = __ pc(); // non-volatile_entry point
__ pop(ztos);
if (!is_static) { pop_and_check_object(Rclass_or_obj); } // Kills R11_scratch1.
__ andi(R17_tos, R17_tos, 0x1);
__ stbx(R17_tos, Rclass_or_obj, Roffset);
if (!is_static) { patch_bytecode(Bytecodes::_fast_zputfield, Rbc, Rscratch, true, byte_no); }
if (!support_IRIW_for_not_multiple_copy_atomic_cpu) {
__ beq(CR_is_vol, Lvolatile); // Volatile?
}
__ dispatch_epilog(vtos, Bytecodes::length_for(bytecode()));
__ align(32, 28, 28); // Align pop.
// __ bind(Lctos);
__ release(); // Volatile entry point (one instruction before non-volatile_entry point).
@ -2949,6 +2998,9 @@ void TemplateTable::fast_storefield(TosState state) {
__ stdx(R17_tos, Rclass_or_obj, Roffset);
break;
case Bytecodes::_fast_zputfield:
__ andi(R17_tos, R17_tos, 0x1); // boolean is true if LSB is 1
// fall through to bputfield
case Bytecodes::_fast_bputfield:
__ stbx(R17_tos, Rclass_or_obj, Roffset);
break;

View File

@ -98,12 +98,13 @@ static Crc32_t Crc32 = NULL;
// Entry points for jimage.dll for loading jimage file entries
static JImageOpen_t JImageOpen = NULL;
static JImageClose_t JImageClose = NULL;
static JImagePackageToModule_t JImagePackageToModule = NULL;
static JImageFindResource_t JImageFindResource = NULL;
static JImageGetResource_t JImageGetResource = NULL;
static JImageResourceIterator_t JImageResourceIterator = NULL;
static JImageOpen_t JImageOpen = NULL;
static JImageClose_t JImageClose = NULL;
static JImagePackageToModule_t JImagePackageToModule = NULL;
static JImageFindResource_t JImageFindResource = NULL;
static JImageGetResource_t JImageGetResource = NULL;
static JImageResourceIterator_t JImageResourceIterator = NULL;
static JImage_ResourcePath_t JImageResourcePath = NULL;
// Globals
@ -925,6 +926,8 @@ void ClassLoader::load_jimage_library() {
guarantee(JImageGetResource != NULL, "function JIMAGE_GetResource not found");
JImageResourceIterator = CAST_TO_FN_PTR(JImageResourceIterator_t, os::dll_lookup(handle, "JIMAGE_ResourceIterator"));
guarantee(JImageResourceIterator != NULL, "function JIMAGE_ResourceIterator not found");
JImageResourcePath = CAST_TO_FN_PTR(JImage_ResourcePath_t, os::dll_lookup(handle, "JIMAGE_ResourcePath"));
guarantee(JImageResourcePath != NULL, "function JIMAGE_ResourcePath not found");
}
jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {

View File

@ -30,7 +30,7 @@ class JImageFile;
typedef jlong JImageLocationRef;
// Max path length limit independent of platform. Windows max path is 1024,
// other platforms use 4096. The JCK fails several tests when 1024 is used.
// other platforms use 4096.
#define JIMAGE_MAX_PATH 4096
// JImage Error Codes
@ -113,7 +113,8 @@ typedef const char* (*JImagePackageToModule_t)(JImageFile* jimage, const char* p
*
* Ex.
* jlong size;
* JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
* JImageLocationRef location = (*JImageFindResource)(image,
* "java.base", "9.0", "java/lang/String.class", &size);
*/
extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* jimage,
const char* module_name, const char* version, const char* name,
@ -134,7 +135,8 @@ typedef JImageLocationRef(*JImageFindResource_t)(JImageFile* jimage,
*
* Ex.
* jlong size;
* JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size);
* JImageLocationRef location = (*JImageFindResource)(image,
* "java.base", "9.0", "java/lang/String.class", &size);
* char* buffer = new char[size];
* (*JImageGetResource)(image, location, buffer, size);
*/
@ -154,7 +156,8 @@ typedef jlong(*JImageGetResource_t)(JImageFile* jimage, JImageLocationRef locati
* required. All strings are utf-8, zero byte terminated.file.
*
* Ex.
* bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) {
* bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version,
* const char* package, const char* name, const char* extension, void* arg) {
* if (strcmp(extension, class) == 0) {
* char path[JIMAGE_MAX_PATH];
* Thread* THREAD = Thread::current();
@ -176,3 +179,20 @@ extern "C" void JIMAGE_ResourceIterator(JImageFile* jimage,
typedef void (*JImageResourceIterator_t)(JImageFile* jimage,
JImageResourceVisitor_t visitor, void* arg);
/*
* JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer
* and a maximum buffer size, copy the path of the resource into the buffer.
* Returns false if not a valid location reference.
*
* Ex.
* JImageLocationRef location = ...
* char path[JIMAGE_MAX_PATH];
* (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH);
*/
extern "C" bool JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef,
char* path, size_t max);
typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location,
char* buffer, jlong size);

View File

@ -357,3 +357,5 @@ bdbf2342b21bd8ecad1b4e6499a0dfb314952bd7 jdk-9+103
36326537f929d20cc5885b93939f90c0efcc4681 jdk-9+112
28626780e245fccbfb9bad8e3b05f62357958038 jdk-9+113
147114dd0641cd7c9fe6e81642eb993a7b9c6f0b jdk-9+114
1902a5bda18e794b31fc5f520f5e7d827714b50d jdk-9+115
9d71d20e614777cd23c1a43b38b5c08a9094d27a jdk-9+116

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -24,7 +25,6 @@ import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.util.XML11Char;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLString;
@ -815,7 +815,7 @@ public class XML11EntityScanner
load(0, true, true);
}
else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
load(1, false, false);
fCurrentEntity.position = 0;
@ -960,7 +960,7 @@ public class XML11EntityScanner
load(0, true, true);
}
else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
load(1, false, false);
fCurrentEntity.startPosition = 0;
@ -1397,7 +1397,7 @@ public class XML11EntityScanner
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = (char)c;
entityChanged = load(1, true, false);
if (!entityChanged) {
@ -1446,8 +1446,9 @@ public class XML11EntityScanner
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(1);
fCurrentEntity.ch[0] = (char)c;
entityChanged = load(1, true, true);
entityChanged = load(1, true, false);
if (!entityChanged) {
// the load change the position to be 1,
// need to restore it when entity not changed

View File

@ -3,13 +3,14 @@
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -19,17 +20,17 @@
*/
package com.sun.org.apache.xerces.internal.impl;
import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
import java.io.EOFException;
import java.io.IOException;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLStringBuffer;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@ -41,11 +42,9 @@ import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.utils.XMLLimitAnalyzer;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.xml.internal.stream.dtd.nonvalidating.DTDGrammar;
import java.io.EOFException;
import java.io.IOException;
/**
* This class is responsible for scanning the declarations found
@ -387,15 +386,25 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
*/
@Override
public boolean skipDTD(boolean supportDTD) throws IOException {
if (!supportDTD) {
fStringBuffer.clear();
if (!fEntityScanner.scanData("]", fStringBuffer)) {
fEntityScanner.fCurrentEntity.position--;
}
if (supportDTD)
return false;
return true;
fStringBuffer.clear();
while (fEntityScanner.scanData("]", fStringBuffer)) {
int c = fEntityScanner.peekChar();
if (c != -1) {
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(fStringBuffer);
}
if (isInvalidLiteral(c)) {
reportFatalError("InvalidCharInDTD",
new Object[] { Integer.toHexString(c) });
fEntityScanner.scanChar();
}
}
}
return false;
fEntityScanner.fCurrentEntity.position--;
return true;
}
//

View File

@ -3,13 +3,14 @@
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -18,7 +19,6 @@
* limitations under the License.
*/
package com.sun.org.apache.xerces.internal.impl;
import com.sun.xml.internal.stream.XMLBufferListener;

View File

@ -3,13 +3,14 @@
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -20,7 +21,6 @@
package com.sun.org.apache.xerces.internal.impl;
import com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDDescription;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
@ -1106,8 +1106,7 @@ public class XMLDocumentScannerImpl
if (!moreToScan) {
// end doctype declaration
if (!fEntityScanner.skipChar(']')) {
reportFatalError("EXPECTED_SQUARE_BRACKET_TO_CLOSE_INTERNAL_SUBSET",
null);
reportFatalError("DoctypedeclNotClosed", new Object[]{fDoctypeName});
}
fEntityScanner.skipSpaces();
if (!fEntityScanner.skipChar('>')) {

View File

@ -1,15 +1,16 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -20,8 +21,6 @@
package com.sun.org.apache.xerces.internal.impl;
import com.sun.org.apache.xerces.internal.impl.io.ASCIIReader;
import com.sun.org.apache.xerces.internal.impl.io.UCSReader;
import com.sun.org.apache.xerces.internal.impl.io.UTF8Reader;
@ -44,8 +43,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Vector;
/**
* Implements the entity scanner methods.
@ -58,11 +57,10 @@ import java.util.Vector;
*/
public class XMLEntityScanner implements XMLLocator {
protected Entity.ScannedEntity fCurrentEntity = null ;
protected Entity.ScannedEntity fCurrentEntity = null;
protected int fBufferSize = XMLEntityManager.DEFAULT_BUFFER_SIZE;
protected XMLEntityManager fEntityManager ;
protected XMLEntityManager fEntityManager;
/** Security manager. */
protected XMLSecurityManager fSecurityManager = null;
@ -72,8 +70,9 @@ public class XMLEntityScanner implements XMLLocator {
/** Debug switching readers for encodings. */
private static final boolean DEBUG_ENCODINGS = false;
/** Listeners which should know when load is being called */
private Vector listeners = new Vector();
private ArrayList<XMLBufferListener> listeners = new ArrayList<>();
private static final boolean [] VALID_NAMES = new boolean[127];
@ -140,9 +139,11 @@ public class XMLEntityScanner implements XMLLocator {
VALID_NAMES[58]=true;
VALID_NAMES[95]=true;
}
// SAPJVM: Remember, that the XML version has explicitly been set,
// Remember, that the XML version has explicitly been set,
// so that XMLStreamReader.getVersion() can find that out.
boolean xmlVersionSetExplicitly = false;
protected boolean xmlVersionSetExplicitly = false;
//
// Constructors
//
@ -257,7 +258,7 @@ public class XMLEntityScanner implements XMLLocator {
* @param xmlVersion the XML version of the current entity
*/
public final void setXMLVersion(String xmlVersion) {
xmlVersionSetExplicitly = true; // SAPJVM
xmlVersionSetExplicitly = true;
fCurrentEntity.xmlVersion = xmlVersion;
} // setXMLVersion(String)
@ -546,8 +547,7 @@ public class XMLEntityScanner implements XMLLocator {
// scan character
int c = fCurrentEntity.ch[fCurrentEntity.position++];
if (c == '\n' ||
(c == '\r' && isExternal)) {
if (c == '\n' || (c == '\r' && isExternal)) {
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
@ -953,7 +953,7 @@ public class XMLEntityScanner implements XMLLocator {
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true, true);
} else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
load(1, false, false);
fCurrentEntity.position = 0;
@ -1105,7 +1105,7 @@ public class XMLEntityScanner implements XMLLocator {
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true, true);
} else if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = fCurrentEntity.ch[fCurrentEntity.count - 1];
load(1, false, false);
fCurrentEntity.position = 0;
@ -1256,8 +1256,8 @@ public class XMLEntityScanner implements XMLLocator {
* <p>
* <strong>Note:</strong> The characters are consumed.
* <p>
* <strong>Note:</strong> This assumes that the length of the delimiter
* and that the delimiter contains at least one character.
* <strong>Note:</strong> This assumes that the delimiter contains at
* least one character.
* <p>
* <strong>Note:</strong> This method does not guarantee to return
* the longest run of character data. This method may return before
@ -1436,7 +1436,7 @@ public class XMLEntityScanner implements XMLLocator {
} while (!done);
return !done;
} // scanData(String,XMLString)
} // scanData(String, XMLStringBuffer)
/**
* Skips a character appearing immediately on the input.
@ -1558,7 +1558,7 @@ public class XMLEntityScanner implements XMLLocator {
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count - 1) {
invokeListeners(0);
invokeListeners(1);
fCurrentEntity.ch[0] = (char)c;
entityChanged = load(1, true, false);
if (!entityChanged){
@ -1727,8 +1727,7 @@ public class XMLEntityScanner implements XMLLocator {
final int length = s.length;
//first make sure that required capacity is avaible
if(arrangeCapacity(length, false)){
int beforeSkip = fCurrentEntity.position ;
int afterSkip = fCurrentEntity.position + length ;
int beforeSkip = fCurrentEntity.position;
if(DEBUG_SKIP_STRING){
System.out.println("skipString,length = " + new String(s) + "," + length);
@ -2107,8 +2106,9 @@ public class XMLEntityScanner implements XMLLocator {
* is being changed.
*/
public void registerListener(XMLBufferListener listener) {
if(!listeners.contains(listener))
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
/**
@ -2116,9 +2116,8 @@ public class XMLEntityScanner implements XMLLocator {
* @param loadPos Starting position from which new data is being loaded into scanner buffer.
*/
public void invokeListeners(int loadPos){
for(int i=0;i<listeners.size();i++){
XMLBufferListener listener =(XMLBufferListener) listeners.get(i);
listener.refresh(loadPos);
for (int i=0; i<listeners.size(); i++) {
listeners.get(i).refresh(loadPos);
}
}

View File

@ -3,13 +3,14 @@
*/
/*
* Copyright 2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -20,7 +21,6 @@
package com.sun.org.apache.xerces.internal.impl;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.xml.internal.stream.XMLEntityStorage;
import java.io.IOException;

View File

@ -145,6 +145,7 @@
MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = White space is required after \"<!DOCTYPE\" in the document type declaration.
MSG_ROOT_ELEMENT_TYPE_REQUIRED = The root element type must appear after \"<!DOCTYPE\" in the document type declaration.
DoctypedeclUnterminated = The document type declaration for root element type \"{0}\" must end with ''>''.
DoctypedeclNotClosed = The document type declaration for root element type \"{0}\" must be closed with '']''.
PEReferenceWithinMarkup = The parameter entity reference \"%{0};\" cannot occur within markup in the internal subset of the DTD.
MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = The markup declarations contained or pointed to by the document type declaration must be well-formed.
# 2.10 White Space Handling

View File

@ -145,6 +145,7 @@
MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Leerstelle nach "<!DOCTYPE" in der Dokumenttypdeklaration erforderlich.
MSG_ROOT_ELEMENT_TYPE_REQUIRED = Root-Elementtyp muss nach "<!DOCTYPE" in der Dokumenttypdeklaration enthalten sein.
DoctypedeclUnterminated = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit ">" enden.
DoctypedeclNotClosed = Dokumenttypdeklaration f\u00FCr Root-Elementtyp "{0}" muss mit "]" abgeschlossen werden.
PEReferenceWithinMarkup = Parameterentit\u00E4tsreferenz "%{0};" darf nicht in Markup in der internen Teilmenge der DTD vorkommen.
MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Die Markup-Deklarationen, die in der Dokumenttypdeklaration enthalten sind bzw. auf die von der Dokumenttypdeklaration verwiesen wird, m\u00FCssen ordnungsgem\u00E4\u00DF formatiert sein.
# 2.10 White Space Handling

View File

@ -145,6 +145,7 @@
MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Es necesario un espacio en blanco despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento.
MSG_ROOT_ELEMENT_TYPE_REQUIRED = El tipo de elemento ra\u00EDz debe aparecer despu\u00E9s de "<!DOCTYPE" en la declaraci\u00F3n de tipo de documento.
DoctypedeclUnterminated = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe finalizar en ''>''.
DoctypedeclNotClosed = La declaraci\u00F3n de tipo de documento para el tipo de elemento ra\u00EDz "{0}" debe cerrar en '']''.
PEReferenceWithinMarkup = La referencia de entidad del par\u00E1metro "%{0};" no puede producirse en el marcador en el subconjunto interno del DTD.
MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Las declaraciones de marcador que se incluyen o a las que apunta la declaraci\u00F3n de tipo de documento deben tener el formato correcto.
# 2.10 White Space Handling

View File

@ -145,6 +145,7 @@
MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = Un espace est obligatoire apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document.
MSG_ROOT_ELEMENT_TYPE_REQUIRED = Le type d'\u00E9l\u00E9ment racine doit figurer apr\u00E8s "<!DOCTYPE" dans la d\u00E9claration de type de document.
DoctypedeclUnterminated = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se terminer par ''>''.
DoctypedeclNotClosed = La d\u00E9claration de type de document pour le type d''\u00E9l\u00E9ment racine "{0}" doit se conclure par '']''.
PEReferenceWithinMarkup = La r\u00E9f\u00E9rence d''entit\u00E9 de param\u00E8tre "%{0};" ne peut pas survenir dans le balisage du sous-ensemble interne de la DTD.
MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Les d\u00E9clarations de balisage contenues dans la d\u00E9claration de type de document ou sur lesquelles pointe cette derni\u00E8re doivent avoir un format correct.
# 2.10 White Space Handling

View File

@ -145,6 +145,7 @@
MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL = \u00C8 richiesto uno spazio dopo "<!DOCTYPE" nella dichiarazione del tipo di documento.
MSG_ROOT_ELEMENT_TYPE_REQUIRED = Il tipo di elemento radice deve comparire dopo "<!DOCTYPE" nella dichiarazione del tipo di documento.
DoctypedeclUnterminated = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve terminare con ''>''.
DoctypedeclNotClosed = La dichiarazione del tipo di documento per il tipo di elemento radice "{0}" deve chiudere con '']''.
PEReferenceWithinMarkup = Il riferimento di entit\u00E0 di parametro "%{0};" non pu\u00F2 essere presente nel markup del set secondario interno del DTD.
MSG_MARKUP_NOT_RECOGNIZED_IN_DTD = Le dichiarazioni di markup contenute o indicate dalla dichiarazione del tipo di documento devono avere un formato corretto.
# 2.10 White Space Handling

View File

@ -1,15 +1,16 @@
/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
* Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Copyright 2004,2005 The Apache Software Foundation.
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@ -17,17 +18,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xerces.internal.util;
import java.io.InputStream;
import java.io.Reader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import java.io.InputStream;
import java.io.Reader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* This class represents an input source for an XML resource

View File

@ -444,13 +444,15 @@ public class CatalogFeatures {
}
} else if (index == Feature.FILES.ordinal()) {
try {
if (Util.verifyAndGetURI(value, null) == null) {
CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null);
String[] catalogFile = value.split(";[ ]*");
for (String temp : catalogFile) {
if (Util.verifyAndGetURI(temp, null) == null) {
CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, null);
}
}
}catch (MalformedURLException | URISyntaxException | IllegalArgumentException ex) {
CatalogMessages.reportIAE(new Object[]{value, Feature.FILES.name()}, ex);
}
}
if (states[index] == null || state.compareTo(states[index]) >= 0) {
values[index] = value;

View File

@ -91,6 +91,7 @@ public class TestPolicy extends Policy {
permissions.add(new PropertyPermission("line.separator", "read"));
permissions.add(new PropertyPermission("fileStringBuffer", "read"));
permissions.add(new PropertyPermission("dataproviderthreadcount", "read"));
permissions.add(new RuntimePermission("charsetProvider"));
}
/*

View File

@ -0,0 +1,566 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.util.Objects;
/**
* Asserts that can be used for verifying assumptions in tests.
*
* An assertion will throw a {@link RuntimeException} if the assertion isn't true.
* All the asserts can be imported into a test by using a static import:
*
* <pre>
* {@code
* import static jdk.testlibrary.Asserts.*;
* }
*
* Always provide a message describing the assumption if the line number of the
* failing assertion isn't enough to understand why the assumption failed. For
* example, if the assertion is in a loop or in a method that is called
* multiple times, then the line number won't provide enough context to
* understand the failure.
* </pre>
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public class Asserts {
/**
* Shorthand for {@link #assertLessThan(Comparable, Comparable)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertLessThan(Comparable, Comparable)
*/
public static <T extends Comparable<T>> void assertLT(T lhs, T rhs) {
assertLessThan(lhs, rhs);
}
/**
* Shorthand for {@link #assertLessThan(Comparable, Comparable, String)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertLessThan(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertLT(T lhs, T rhs, String msg) {
assertLessThan(lhs, rhs, msg);
}
/**
* Calls {@link #assertLessThan(Comparable, Comparable, String)} with a default message.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertLessThan(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertLessThan(T lhs, T rhs) {
assertLessThan(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is less than {@code rhs}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static <T extends Comparable<T>>void assertLessThan(T lhs, T rhs, String msg) {
if (!(compare(lhs, rhs, msg) < 0)) {
msg = Objects.toString(msg, "assertLessThan")
+ ": expected that " + Objects.toString(lhs)
+ " < " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Shorthand for {@link #assertLessThanOrEqual(Comparable, Comparable)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertLessThanOrEqual(Comparable, Comparable)
*/
public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs) {
assertLessThanOrEqual(lhs, rhs);
}
/**
* Shorthand for {@link #assertLessThanOrEqual(Comparable, Comparable, String)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertLessThanOrEqual(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertLTE(T lhs, T rhs, String msg) {
assertLessThanOrEqual(lhs, rhs, msg);
}
/**
* Calls {@link #assertLessThanOrEqual(Comparable, Comparable, String)} with a default message.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertLessThanOrEqual(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs) {
assertLessThanOrEqual(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is less than or equal to {@code rhs}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs, String msg) {
if (!(compare(lhs, rhs, msg) <= 0)) {
msg = Objects.toString(msg, "assertLessThanOrEqual")
+ ": expected that " + Objects.toString(lhs)
+ " <= " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Shorthand for {@link #assertEquals(Object, Object)}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertEquals(Object, Object)
*/
public static void assertEQ(Object lhs, Object rhs) {
assertEquals(lhs, rhs);
}
/**
* Shorthand for {@link #assertEquals(Object, Object, String)}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertEquals(Object, Object, String)
*/
public static void assertEQ(Object lhs, Object rhs, String msg) {
assertEquals(lhs, rhs, msg);
}
/**
* Calls {@link #assertEquals(java.lang.Object, java.lang.Object, java.lang.String)} with a default message.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertEquals(Object, Object, String)
*/
public static void assertEquals(Object lhs, Object rhs) {
assertEquals(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is equal to {@code rhs}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertEquals(Object lhs, Object rhs, String msg) {
if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) {
msg = Objects.toString(msg, "assertEquals")
+ ": expected " + Objects.toString(lhs)
+ " to equal " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Calls {@link #assertSame(java.lang.Object, java.lang.Object, java.lang.String)} with a default message.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertSame(Object, Object, String)
*/
public static void assertSame(Object lhs, Object rhs) {
assertSame(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is the same as {@code rhs}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertSame(Object lhs, Object rhs, String msg) {
if (lhs != rhs) {
msg = Objects.toString(msg, "assertSame")
+ ": expected " + Objects.toString(lhs)
+ " to equal " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Shorthand for {@link #assertGreaterThanOrEqual(Comparable, Comparable)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertGreaterThanOrEqual(Comparable, Comparable)
*/
public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs) {
assertGreaterThanOrEqual(lhs, rhs);
}
/**
* Shorthand for {@link #assertGreaterThanOrEqual(Comparable, Comparable, String)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertGreaterThanOrEqual(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertGTE(T lhs, T rhs, String msg) {
assertGreaterThanOrEqual(lhs, rhs, msg);
}
/**
* Calls {@link #assertGreaterThanOrEqual(Comparable, Comparable, String)} with a default message.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertGreaterThanOrEqual(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs) {
assertGreaterThanOrEqual(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is greater than or equal to {@code rhs}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs, String msg) {
if (!(compare(lhs, rhs, msg) >= 0)) {
msg = Objects.toString(msg, "assertGreaterThanOrEqual")
+ ": expected " + Objects.toString(lhs)
+ " >= " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Shorthand for {@link #assertGreaterThan(Comparable, Comparable)}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertGreaterThan(Comparable, Comparable)
*/
public static <T extends Comparable<T>> void assertGT(T lhs, T rhs) {
assertGreaterThan(lhs, rhs);
}
/**
* Shorthand for {@link #assertGreaterThan(Comparable, Comparable, String)}.
*
* @param <T> a type
* @param lhs the left hand value
* @param rhs the right hand value
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertGreaterThan(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertGT(T lhs, T rhs, String msg) {
assertGreaterThan(lhs, rhs, msg);
}
/**
* Calls {@link #assertGreaterThan(Comparable, Comparable, String)} with a default message.
*
* @param <T> a type
* @param lhs the left hand value
* @param rhs the right hand value
* @see #assertGreaterThan(Comparable, Comparable, String)
*/
public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs) {
assertGreaterThan(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is greater than {@code rhs}.
*
* @param <T> a type
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs, String msg) {
if (!(compare(lhs, rhs, msg) > 0)) {
msg = Objects.toString(msg, "assertGreaterThan")
+ ": expected " + Objects.toString(lhs)
+ " > " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Shorthand for {@link #assertNotEquals(Object, Object)}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertNotEquals(Object, Object)
*/
public static void assertNE(Object lhs, Object rhs) {
assertNotEquals(lhs, rhs);
}
/**
* Shorthand for {@link #assertNotEquals(Object, Object, String)}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @see #assertNotEquals(Object, Object, String)
*/
public static void assertNE(Object lhs, Object rhs, String msg) {
assertNotEquals(lhs, rhs, msg);
}
/**
* Calls {@link #assertNotEquals(Object, Object, String)} with a default message.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @see #assertNotEquals(Object, Object, String)
*/
public static void assertNotEquals(Object lhs, Object rhs) {
assertNotEquals(lhs, rhs, null);
}
/**
* Asserts that {@code lhs} is not equal to {@code rhs}.
*
* @param lhs The left hand side of the comparison.
* @param rhs The right hand side of the comparison.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertNotEquals(Object lhs, Object rhs, String msg) {
if ((lhs == rhs) || (lhs != null && lhs.equals(rhs))) {
msg = Objects.toString(msg, "assertNotEquals")
+ ": expected " + Objects.toString(lhs)
+ " to not equal " + Objects.toString(rhs);
fail(msg);
}
}
/**
* Calls {@link #assertNull(Object, String)} with a default message.
*
* @param o The reference assumed to be null.
* @see #assertNull(Object, String)
*/
public static void assertNull(Object o) {
assertNull(o, null);
}
/**
* Asserts that {@code o} is null.
*
* @param o The reference assumed to be null.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertNull(Object o, String msg) {
assertEquals(o, null, msg);
}
/**
* Calls {@link #assertNotNull(Object, String)} with a default message.
*
* @param o The reference assumed <i>not</i> to be null,
* @see #assertNotNull(Object, String)
*/
public static void assertNotNull(Object o) {
assertNotNull(o, null);
}
/**
* Asserts that {@code o} is <i>not</i> null.
*
* @param o The reference assumed <i>not</i> to be null,
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertNotNull(Object o, String msg) {
assertNotEquals(o, null, msg);
}
/**
* Calls {@link #assertFalse(boolean, String)} with a default message.
*
* @param value The value assumed to be false.
* @see #assertFalse(boolean, String)
*/
public static void assertFalse(boolean value) {
assertFalse(value, null);
}
/**
* Asserts that {@code value} is {@code false}.
*
* @param value The value assumed to be false.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertFalse(boolean value, String msg) {
if (value) {
msg = Objects.toString(msg, "assertFalse")
+ ": expected false, was true";
fail(msg);
}
}
/**
* Calls {@link #assertTrue(boolean, String)} with a default message.
*
* @param value The value assumed to be true.
* @see #assertTrue(boolean, String)
*/
public static void assertTrue(boolean value) {
assertTrue(value, null);
}
/**
* Asserts that {@code value} is {@code true}.
*
* @param value The value assumed to be true.
* @param msg A description of the assumption; {@code null} for a default message.
* @throws RuntimeException if the assertion is not true.
*/
public static void assertTrue(boolean value, String msg) {
if (!value) {
msg = Objects.toString(msg, "assertTrue")
+ ": expected true, was false";
fail(msg);
}
}
private static <T extends Comparable<T>> int compare(T lhs, T rhs, String msg) {
if (lhs == null || rhs == null) {
fail(lhs, rhs, msg + ": values must be non-null:", ",");
}
return lhs.compareTo(rhs);
}
/**
* Returns a string formatted with a message and expected and actual values.
* @param lhs the actual value
* @param rhs the expected value
* @param message the actual value
* @param relation the asserted relationship between lhs and rhs
* @return a formatted string
*/
public static String format(Object lhs, Object rhs, String message, String relation) {
StringBuilder sb = new StringBuilder(80);
if (message != null) {
sb.append(message);
sb.append(' ');
}
sb.append("<");
sb.append(Objects.toString(lhs));
sb.append("> ");
sb.append(Objects.toString(relation, ","));
sb.append(" <");
sb.append(Objects.toString(rhs));
sb.append(">");
return sb.toString();
}
/**
* Fail reports a failure with message fail.
*
* @throws RuntimeException always
*/
public static void fail() {
fail("fail");
}
/**
* Fail reports a failure with a message.
* @param message for the failure
* @throws RuntimeException always
*/
public static void fail(String message) {
throw new RuntimeException(message);
}
/**
* Fail reports a failure with a formatted message.
*
* @param lhs the actual value
* @param rhs the expected value
* @param message to be format before the expected and actual values
* @param relation the asserted relationship between lhs and rhs
* @throws RuntimeException always
*/
public static void fail(Object lhs, Object rhs, String message, String relation) {
throw new RuntimeException(format(lhs, rhs, message, relation));
}
/**
* Fail reports a failure with a message and a cause.
* @param message to be format before the expected and actual values
* @param cause the exception that caused this failure
* @throws RuntimeException always
*/
public static void fail(String message, Throwable cause) {
throw new RuntimeException(message, cause);
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import javax.tools.JavaCompiler;
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* This class consists exclusively of static utility methods for invoking the
* java compiler.
*/
public final class CompilerUtils {
private CompilerUtils() { }
/**
* Compile all the java sources in {@code <source>/**} to
* {@code <destination>/**}. The destination directory will be created if
* it doesn't exist.
*
* All warnings/errors emitted by the compiler are output to System.out/err.
*
* @return true if the compilation is successful
*
* @throws IOException if there is an I/O error scanning the source tree or
* creating the destination directory
*/
public static boolean compile(Path source, Path destination, String ... options)
throws IOException
{
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
List<Path> sources
= Files.find(source, Integer.MAX_VALUE,
(file, attrs) -> (file.toString().endsWith(".java")))
.collect(Collectors.toList());
Files.createDirectories(destination);
jfm.setLocation(StandardLocation.CLASS_PATH, Collections.EMPTY_LIST);
jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
Arrays.asList(destination));
List<String> opts = Arrays.asList(options);
JavaCompiler.CompilationTask task
= compiler.getTask(null, jfm, null, opts, null,
jfm.getJavaFileObjectsFromPaths(sources));
return task.call();
}
}

View File

@ -0,0 +1,111 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public final class JDKToolFinder {
private JDKToolFinder() {
}
/**
* Returns the full path to an executable in jdk/bin based on System
* property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite)
*
* @return Full path to an executable in jdk/bin
*/
public static String getJDKTool(String tool) {
// First try to find the executable in test.jdk
try {
return getTool(tool, "test.jdk");
} catch (FileNotFoundException e) {
}
// Now see if it's available in compile.jdk
try {
return getTool(tool, "compile.jdk");
} catch (FileNotFoundException e) {
throw new RuntimeException("Failed to find " + tool +
", looked in test.jdk (" + System.getProperty("test.jdk") +
") and compile.jdk (" + System.getProperty("compile.jdk") + ")");
}
}
/**
* Returns the full path to an executable in jdk/bin based on System
* property {@code compile.jdk}
*
* @return Full path to an executable in jdk/bin
*/
public static String getCompileJDKTool(String tool) {
try {
return getTool(tool, "compile.jdk");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
/**
* Returns the full path to an executable in jdk/bin based on System
* property {@code test.jdk}
*
* @return Full path to an executable in jdk/bin
*/
public static String getTestJDKTool(String tool) {
try {
return getTool(tool, "test.jdk");
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
private static String getTool(String tool, String property) throws FileNotFoundException {
String jdkPath = System.getProperty(property);
if (jdkPath == null) {
throw new RuntimeException(
"System property '" + property + "' not set. This property is normally set by jtreg. "
+ "When running test separately, set this property using '-D" + property + "=/path/to/jdk'.");
}
Path toolName = Paths.get("bin", tool + (Platform.isWindows() ? ".exe" : ""));
Path jdkTool = Paths.get(jdkPath, toolName.toString());
if (!jdkTool.toFile().exists()) {
throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath());
}
return jdkTool.toAbsolutePath().toString();
}
}

View File

@ -0,0 +1,136 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* A utility for constructing command lines for starting JDK tool processes.
*
* The JDKToolLauncher can in particular be combined with a
* java.lang.ProcessBuilder to easily run a JDK tool. For example, the following
* code run {@code jmap -heap} against a process with GC logging turned on for
* the {@code jmap} process:
*
* <pre>
* {@code
* JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
* .addVMArg("-Xlog:gc*=debug")
* .addToolArg("-heap")
* .addToolArg(pid);
* ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
* Process p = pb.start();
* }
* </pre>
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public class JDKToolLauncher {
private final String executable;
private final List<String> vmArgs = new ArrayList<String>();
private final List<String> toolArgs = new ArrayList<String>();
private JDKToolLauncher(String tool, boolean useCompilerJDK) {
if (useCompilerJDK) {
executable = JDKToolFinder.getJDKTool(tool);
} else {
executable = JDKToolFinder.getTestJDKTool(tool);
}
vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
}
/**
* Creates a new JDKToolLauncher for the specified tool. Using tools path
* from the compiler JDK.
*
* @param tool
* The name of the tool
* @return A new JDKToolLauncher
*/
public static JDKToolLauncher create(String tool) {
return new JDKToolLauncher(tool, true);
}
/**
* Creates a new JDKToolLauncher for the specified tool in the Tested JDK.
*
* @param tool
* The name of the tool
*
* @return A new JDKToolLauncher
*/
public static JDKToolLauncher createUsingTestJDK(String tool) {
return new JDKToolLauncher(tool, false);
}
/**
* Adds an argument to the JVM running the tool.
*
* The JVM arguments are passed to the underlying JVM running the tool.
* Arguments will automatically be prepended with "-J".
*
* Any platform specific arguments required for running the tool are
* automatically added.
*
*
* @param arg
* The argument to VM running the tool
* @return The JDKToolLauncher instance
*/
public JDKToolLauncher addVMArg(String arg) {
vmArgs.add(arg);
return this;
}
/**
* Adds an argument to the tool.
*
* @param arg
* The argument to the tool
* @return The JDKToolLauncher instance
*/
public JDKToolLauncher addToolArg(String arg) {
toolArgs.add(arg);
return this;
}
/**
* Returns the command that can be used for running the tool.
*
* @return An array whose elements are the arguments of the command.
*/
public String[] getCommand() {
List<String> command = new ArrayList<String>();
command.add(executable);
// Add -J in front of all vmArgs
for (String arg : vmArgs) {
command.add("-J" + arg);
}
command.addAll(toolArgs);
return command.toArray(new String[command.size()]);
}
}

View File

@ -0,0 +1,576 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import static jdk.testlibrary.Asserts.*;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Utility class for verifying output and exit value from a {@code Process}.
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*
*/
@Deprecated
public final class OutputAnalyzer {
private final OutputBuffer output;
private final String stdout;
private final String stderr;
private final int exitValue; // useless now. output contains exit value.
/**
* Create an OutputAnalyzer, a utility class for verifying output and exit
* value from a Process.
* <p>
* OutputAnalyzer should never be instantiated directly -
* use {@linkplain ProcessTools#executeProcess(ProcessBuilder)} instead
*
* @param process
* Process to analyze
* @throws IOException
* If an I/O error occurs.
*/
OutputAnalyzer(Process process) throws IOException {
output = new OutputBuffer(process);
exitValue = -1;
this.stdout = null;
this.stderr = null;
}
/**
* Create an OutputAnalyzer, a utility class for verifying output.
*
* @param buf
* String buffer to analyze
*/
OutputAnalyzer(String buf) {
this(buf, buf);
}
/**
* Create an OutputAnalyzer, a utility class for verifying output
*
* @param stdout
* stdout buffer to analyze
* @param stderr
* stderr buffer to analyze
*/
OutputAnalyzer(String stdout, String stderr) {
this.output = null;
this.stdout = stdout;
this.stderr = stderr;
exitValue = -1;
}
/**
* Verify that the stdout and stderr contents of output buffer contains the
* string
*
* @param expectedString
* String that buffer should contain
* @throws RuntimeException
* If the string was not found
*/
public OutputAnalyzer shouldContain(String expectedString) {
if (!getStdout().contains(expectedString)
&& !getStderr().contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString
+ "' missing from stdout/stderr \n");
}
return this;
}
/**
* Verify that the stdout contents of output buffer contains the string
*
* @param expectedString
* String that buffer should contain
* @throws RuntimeException
* If the string was not found
*/
public OutputAnalyzer stdoutShouldContain(String expectedString) {
if (!getStdout().contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString
+ "' missing from stdout \n");
}
return this;
}
/**
* Verify that the stderr contents of output buffer contains the string
*
* @param expectedString
* String that buffer should contain
* @throws RuntimeException
* If the string was not found
*/
public OutputAnalyzer stderrShouldContain(String expectedString) {
if (!getStderr().contains(expectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString
+ "' missing from stderr \n");
}
return this;
}
/**
* Verify that the stdout and stderr contents of output buffer does not
* contain the string
*
* @param notExpectedString
* String that the buffer should not contain
* @throws RuntimeException
* If the string was found
*/
public OutputAnalyzer shouldNotContain(String notExpectedString) {
if (getStdout().contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString
+ "' found in stdout \n");
}
if (getStderr().contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString
+ "' found in stderr \n");
}
return this;
}
/**
* Verify that the stdout contents of output buffer does not contain the
* string
*
* @param notExpectedString
* String that the buffer should not contain
* @throws RuntimeException
* If the string was found
*/
public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
if (getStdout().contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString
+ "' found in stdout \n");
}
return this;
}
/**
* Verify that the stderr contents of output buffer does not contain the
* string
*
* @param notExpectedString
* String that the buffer should not contain
* @throws RuntimeException
* If the string was found
*/
public OutputAnalyzer stderrShouldNotContain(String notExpectedString) {
if (getStderr().contains(notExpectedString)) {
reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString
+ "' found in stderr \n");
}
return this;
}
/**
* Verify that the stdout and stderr contents of output buffer matches the
* pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was not found
*/
public OutputAnalyzer shouldMatch(String pattern) {
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
.matcher(getStdout());
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
.matcher(getStderr());
if (!stdoutMatcher.find() && !stderrMatcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
+ "' missing from stdout/stderr \n");
}
return this;
}
/**
* Verify that the stdout contents of output buffer matches the pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was not found
*/
public OutputAnalyzer stdoutShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
getStdout());
if (!matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
+ "' missing from stdout \n");
}
return this;
}
/**
* Verify that the stderr contents of output buffer matches the pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was not found
*/
public OutputAnalyzer stderrShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
getStderr());
if (!matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern
+ "' missing from stderr \n");
}
return this;
}
/**
* Verify that the stdout and stderr contents of output buffer does not
* match the pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was found
*/
public OutputAnalyzer shouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
getStdout());
if (matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stdout: '"
+ matcher.group() + "' \n");
}
matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(getStderr());
if (matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stderr: '"
+ matcher.group() + "' \n");
}
return this;
}
/**
* Verify that the stdout contents of output buffer does not match the
* pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was found
*/
public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
getStdout());
if (matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stdout \n");
}
return this;
}
/**
* Verify that the stderr contents of output buffer does not match the
* pattern
*
* @param pattern
* @throws RuntimeException
* If the pattern was found
*/
public OutputAnalyzer stderrShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
getStderr());
if (matcher.find()) {
reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stderr \n");
}
return this;
}
/**
* Get the captured group of the first string matching the pattern. stderr
* is searched before stdout.
*
* @param pattern
* The multi-line pattern to match
* @param group
* The group to capture
* @return The matched string or null if no match was found
*/
public String firstMatch(String pattern, int group) {
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
.matcher(getStderr());
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
.matcher(getStdout());
if (stderrMatcher.find()) {
return stderrMatcher.group(group);
}
if (stdoutMatcher.find()) {
return stdoutMatcher.group(group);
}
return null;
}
/**
* Get the first string matching the pattern. stderr is searched before
* stdout.
*
* @param pattern
* The multi-line pattern to match
* @return The matched string or null if no match was found
*/
public String firstMatch(String pattern) {
return firstMatch(pattern, 0);
}
/**
* Verify the exit value of the process
*
* @param expectedExitValue
* Expected exit value from process
* @throws RuntimeException
* If the exit value from the process did not match the expected
* value
*/
public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
if (getExitValue() != expectedExitValue) {
reportDiagnosticSummary();
throw new RuntimeException("Expected to get exit value of ["
+ expectedExitValue + "]\n");
}
return this;
}
/**
* Report summary that will help to diagnose the problem Currently includes:
* - standard input produced by the process under test - standard output -
* exit code Note: the command line is printed by the ProcessTools
*/
private OutputAnalyzer reportDiagnosticSummary() {
String msg = " stdout: [" + getStdout() + "];\n" + " stderr: [" + getStderr()
+ "]\n" + " exitValue = " + getExitValue() + "\n";
System.err.println(msg);
return this;
}
/**
* Get the contents of the output buffer (stdout and stderr)
*
* @return Content of the output buffer
*/
public String getOutput() {
return getStdout() + getStderr();
}
/**
* Get the contents of the stdout buffer
*
* @return Content of the stdout buffer
*/
public String getStdout() {
return output == null ? stdout : output.getStdout();
}
/**
* Get the contents of the stderr buffer
*
* @return Content of the stderr buffer
*/
public String getStderr() {
return output == null ? stderr : output.getStderr();
}
/**
* Get the process exit value
*
* @return Process exit value
*/
public int getExitValue() {
return output == null ? exitValue : output.getExitValue();
}
/**
* Print the stdout buffer to the given {@code PrintStream}.
*
* @return this OutputAnalyzer
*/
public OutputAnalyzer outputTo(PrintStream out) {
out.println(getStdout());
return this;
}
/**
* Print the stderr buffer to the given {@code PrintStream}.
*
* @return this OutputAnalyzer
*/
public OutputAnalyzer errorTo(PrintStream out) {
out.println(getStderr());
return this;
}
/**
* Get the contents of the output buffer (stdout and stderr) as list of strings.
* Output will be split by system property 'line.separator'.
*
* @return Contents of the output buffer as list of strings
*/
public List<String> asLines() {
return asLines(getOutput());
}
private List<String> asLines(String buffer) {
List<String> l = new ArrayList<>();
String[] a = buffer.split(Utils.NEW_LINE);
for (String string : a) {
l.add(string);
}
return l;
}
/**
* Check if there is a line matching {@code pattern} and return its index
*
* @param pattern Matching pattern
* @return Index of first matching line
*/
private int indexOf(List<String> lines, String pattern) {
for (int i = 0; i < lines.size(); i++) {
if (lines.get(i).matches(pattern)) {
return i;
}
}
return -1;
}
/**
* @see #shouldMatchByLine(String, String, String)
*/
public int shouldMatchByLine(String pattern) {
return shouldMatchByLine(null, null, pattern);
}
/**
* @see #stdoutShouldMatchByLine(String, String, String)
*/
public int stdoutShouldMatchByLine(String pattern) {
return stdoutShouldMatchByLine(null, null, pattern);
}
/**
* @see #shouldMatchByLine(String, String, String)
*/
public int shouldMatchByLineFrom(String from, String pattern) {
return shouldMatchByLine(from, null, pattern);
}
/**
* @see #shouldMatchByLine(String, String, String)
*/
public int shouldMatchByLineTo(String to, String pattern) {
return shouldMatchByLine(null, to, pattern);
}
/**
* Verify that the stdout and stderr contents of output buffer match the
* {@code pattern} line by line. The whole output could be matched or
* just a subset of it.
*
* @param from
* The line from where output will be matched.
* Set {@code from} to null for matching from the first line.
* @param to
* The line until where output will be matched.
* Set {@code to} to null for matching until the last line.
* @param pattern
* Matching pattern
* @return Count of lines which match the {@code pattern}
*/
public int shouldMatchByLine(String from, String to, String pattern) {
return shouldMatchByLine(getOutput(), from, to, pattern);
}
/**
* Verify that the stdout contents of output buffer matches the
* {@code pattern} line by line. The whole stdout could be matched or
* just a subset of it.
*
* @param from
* The line from where stdout will be matched.
* Set {@code from} to null for matching from the first line.
* @param to
* The line until where stdout will be matched.
* Set {@code to} to null for matching until the last line.
* @param pattern
* Matching pattern
* @return Count of lines which match the {@code pattern}
*/
public int stdoutShouldMatchByLine(String from, String to, String pattern) {
return shouldMatchByLine(getStdout(), from, to, pattern);
}
private int shouldMatchByLine(String buffer, String from, String to, String pattern) {
List<String> lines = asLines(buffer);
int fromIndex = 0;
if (from != null) {
fromIndex = indexOf(lines, from);
assertGreaterThan(fromIndex, -1,
"The line/pattern '" + from + "' from where the output should match can not be found");
}
int toIndex = lines.size();
if (to != null) {
toIndex = indexOf(lines, to);
assertGreaterThan(toIndex, -1,
"The line/pattern '" + to + "' until where the output should match can not be found");
}
List<String> subList = lines.subList(fromIndex, toIndex);
int matchedCount = 0;
for (String line : subList) {
assertTrue(line.matches(pattern),
"The line '" + line + "' does not match pattern '" + pattern + "'");
matchedCount++;
}
return matchedCount;
}
}

View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.io.ByteArrayOutputStream;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
class OutputBuffer {
private static class OutputBufferException extends RuntimeException {
private static final long serialVersionUID = 8528687792643129571L;
public OutputBufferException(Throwable cause) {
super(cause);
}
}
private final Process p;
private final Future<Void> outTask;
private final Future<Void> errTask;
private final ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
private final ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
/**
* Create an OutputBuffer, a class for storing and managing stdout and
* stderr results separately
*
* @param stdout
* stdout result
* @param stderr
* stderr result
*/
OutputBuffer(Process p) {
this.p = p;
StreamPumper outPumper = new StreamPumper(p.getInputStream(),
stdoutBuffer);
StreamPumper errPumper = new StreamPumper(p.getErrorStream(),
stderrBuffer);
outTask = outPumper.process();
errTask = errPumper.process();
}
/**
* Returns the stdout result
*
* @return stdout result
*/
public String getStdout() {
try {
outTask.get();
return stdoutBuffer.toString();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OutputBufferException(e);
} catch (ExecutionException | CancellationException e) {
throw new OutputBufferException(e);
}
}
/**
* Returns the stderr result
*
* @return stderr result
*/
public String getStderr() {
try {
errTask.get();
return stderrBuffer.toString();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OutputBufferException(e);
} catch (ExecutionException | CancellationException e) {
throw new OutputBufferException(e);
}
}
public int getExitValue() {
try {
return p.waitFor();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OutputBufferException(e);
}
}
}

View File

@ -0,0 +1,213 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.util.regex.Pattern;
import java.io.RandomAccessFile;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public class Platform {
private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model");
private static final String vmVersion = System.getProperty("java.vm.version");
private static final String jdkDebug = System.getProperty("jdk.debug");
private static final String osArch = System.getProperty("os.arch");
private static final String vmName = System.getProperty("java.vm.name");
private static final String userName = System.getProperty("user.name");
private static final String compiler = System.getProperty("sun.management.compiler");
public static boolean isClient() {
return vmName.endsWith(" Client VM");
}
public static boolean isServer() {
return vmName.endsWith(" Server VM");
}
public static boolean isGraal() {
return vmName.endsWith(" Graal VM");
}
public static boolean isMinimal() {
return vmName.endsWith(" Minimal VM");
}
public static boolean isEmbedded() {
return vmName.contains("Embedded");
}
public static boolean isTieredSupported() {
return compiler.contains("Tiered Compilers");
}
public static boolean is32bit() {
return dataModel.equals("32");
}
public static boolean is64bit() {
return dataModel.equals("64");
}
public static boolean isAix() {
return isOs("aix");
}
public static boolean isLinux() {
return isOs("linux");
}
public static boolean isOSX() {
return isOs("mac");
}
public static boolean isSolaris() {
return isOs("sunos");
}
public static boolean isWindows() {
return isOs("win");
}
private static boolean isOs(String osname) {
return osName.toLowerCase().startsWith(osname.toLowerCase());
}
public static String getOsName() {
return osName;
}
public static boolean isDebugBuild() {
return (jdkDebug.toLowerCase().contains("debug"));
}
public static String getVMVersion() {
return vmVersion;
}
// Returns true for sparc and sparcv9.
public static boolean isSparc() {
return isArch("sparc.*");
}
public static boolean isARM() {
return isArch("arm.*");
}
public static boolean isPPC() {
return isArch("ppc.*");
}
public static boolean isX86() {
// On Linux it's 'i386', Windows 'x86' without '_64' suffix.
return isArch("(i386)|(x86(?!_64))");
}
public static boolean isX64() {
// On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
return isArch("(amd64)|(x86_64)");
}
private static boolean isArch(String archnameRE) {
return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
.matcher(osArch)
.matches();
}
public static String getOsArch() {
return osArch;
}
/**
* Return a boolean for whether we expect to be able to attach
* the SA to our own processes on this system.
*/
public static boolean shouldSAAttach()
throws IOException {
if (isAix()) {
return false; // SA not implemented.
} else if (isLinux()) {
return canPtraceAttachLinux();
} else if (isOSX()) {
return canAttachOSX();
} else {
// Other platforms expected to work:
return true;
}
}
/**
* On Linux, first check the SELinux boolean "deny_ptrace" and return false
* as we expect to be denied if that is "1".
*/
public static boolean canPtraceAttachLinux()
throws IOException {
// SELinux deny_ptrace:
try(RandomAccessFile file = new RandomAccessFile("/sys/fs/selinux/booleans/deny_ptrace", "r")) {
if (file.readByte() != '0') {
return false;
}
}
catch(FileNotFoundException ex) {
// Ignored
}
// YAMA enhanced security ptrace_scope:
// 0 - a process can PTRACE_ATTACH to any other process running under the same uid
// 1 - restricted ptrace: a process must be a children of the inferior or user is root
// 2 - only processes with CAP_SYS_PTRACE may use ptrace or user is root
// 3 - no attach: no processes may use ptrace with PTRACE_ATTACH
try(RandomAccessFile file = new RandomAccessFile("/proc/sys/kernel/yama/ptrace_scope", "r")) {
byte yama_scope = file.readByte();
if (yama_scope == '3') {
return false;
}
if (!userName.equals("root") && yama_scope != '0') {
return false;
}
}
catch(FileNotFoundException ex) {
// Ignored
}
// Otherwise expect to be permitted:
return true;
}
/**
* On OSX, expect permission to attach only if we are root.
*/
public static boolean canAttachOSX() {
return userName.equals("root");
}
}

View File

@ -0,0 +1,579 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.CountDownLatch;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.function.Predicate;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
public final class ProcessTools {
private static final class LineForwarder extends StreamPumper.LinePump {
private final PrintStream ps;
private final String prefix;
LineForwarder(String prefix, PrintStream os) {
this.ps = os;
this.prefix = prefix;
}
@Override
protected void processLine(String line) {
ps.println("[" + prefix + "] " + line);
}
}
private ProcessTools() {
}
/**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* @param name The process name
* @param processBuilder The process builder
* @return Returns the initialized process
* @throws IOException
*/
public static Process startProcess(String name,
ProcessBuilder processBuilder)
throws IOException {
return startProcess(name, processBuilder, (Consumer<String>)null);
}
/**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>It is possible to monitor the in-streams via the provided {@code consumer}
* @param name The process name
* @param consumer {@linkplain Consumer} instance to process the in-streams
* @param processBuilder The process builder
* @return Returns the initialized process
* @throws IOException
*/
@SuppressWarnings("overloads")
public static Process startProcess(String name,
ProcessBuilder processBuilder,
Consumer<String> consumer)
throws IOException {
try {
return startProcess(name, processBuilder, consumer, null, -1, TimeUnit.NANOSECONDS);
} catch (InterruptedException | TimeoutException e) {
// will never happen
throw new RuntimeException(e);
}
}
/**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT
* </p>
* @param name The process name
* @param processBuilder The process builder
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.
* @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
* @param unit The timeout {@linkplain TimeUnit}
* @return Returns the initialized {@linkplain Process}
* @throws IOException
* @throws InterruptedException
* @throws TimeoutException
*/
public static Process startProcess(String name,
ProcessBuilder processBuilder,
final Predicate<String> linePredicate,
long timeout,
TimeUnit unit)
throws IOException, InterruptedException, TimeoutException {
return startProcess(name, processBuilder, null, linePredicate, timeout, unit);
}
/**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT and monitor the
* in-streams via the provided {@linkplain Consumer}
* </p>
* @param name The process name
* @param processBuilder The process builder
* @param lineConsumer The {@linkplain Consumer} the lines will be forwarded to
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.
* @param timeout The timeout for the warmup waiting; -1 = no wait; 0 = wait forever
* @param unit The timeout {@linkplain TimeUnit}
* @return Returns the initialized {@linkplain Process}
* @throws IOException
* @throws InterruptedException
* @throws TimeoutException
*/
public static Process startProcess(String name,
ProcessBuilder processBuilder,
final Consumer<String> lineConsumer,
final Predicate<String> linePredicate,
long timeout,
TimeUnit unit)
throws IOException, InterruptedException, TimeoutException {
System.out.println("["+name+"]:" + processBuilder.command().stream().collect(Collectors.joining(" ")));
Process p = processBuilder.start();
StreamPumper stdout = new StreamPumper(p.getInputStream());
StreamPumper stderr = new StreamPumper(p.getErrorStream());
stdout.addPump(new LineForwarder(name, System.out));
stderr.addPump(new LineForwarder(name, System.err));
if (lineConsumer != null) {
StreamPumper.LinePump pump = new StreamPumper.LinePump() {
@Override
protected void processLine(String line) {
lineConsumer.accept(line);
}
};
stdout.addPump(pump);
stderr.addPump(pump);
}
CountDownLatch latch = new CountDownLatch(1);
if (linePredicate != null) {
StreamPumper.LinePump pump = new StreamPumper.LinePump() {
@Override
protected void processLine(String line) {
if (latch.getCount() > 0 && linePredicate.test(line)) {
latch.countDown();
}
}
};
stdout.addPump(pump);
stderr.addPump(pump);
} else {
latch.countDown();
}
final Future<Void> stdoutTask = stdout.process();
final Future<Void> stderrTask = stderr.process();
try {
if (timeout > -1) {
if (timeout == 0) {
latch.await();
} else {
if (!latch.await(Utils.adjustTimeout(timeout), unit)) {
throw new TimeoutException();
}
}
}
} catch (TimeoutException | InterruptedException e) {
System.err.println("Failed to start a process (thread dump follows)");
for(Map.Entry<Thread, StackTraceElement[]> s : Thread.getAllStackTraces().entrySet()) {
printStack(s.getKey(), s.getValue());
}
if (p.isAlive()) {
p.destroyForcibly();
}
stdoutTask.cancel(true);
stderrTask.cancel(true);
throw e;
}
return new ProcessImpl(p, stdoutTask, stderrTask);
}
/**
* <p>Starts a process from its builder.</p>
* <span>The default redirects of STDOUT and STDERR are started</span>
* <p>
* It is possible to wait for the process to get to a warmed-up state
* via {@linkplain Predicate} condition on the STDOUT. The warm-up will
* wait indefinitely.
* </p>
* @param name The process name
* @param processBuilder The process builder
* @param linePredicate The {@linkplain Predicate} to use on the STDOUT
* Used to determine the moment the target app is
* properly warmed-up.
* It can be null - in that case the warmup is skipped.
* @return Returns the initialized {@linkplain Process}
* @throws IOException
* @throws InterruptedException
* @throws TimeoutException
*/
@SuppressWarnings("overloads")
public static Process startProcess(String name,
ProcessBuilder processBuilder,
final Predicate<String> linePredicate)
throws IOException, InterruptedException, TimeoutException {
return startProcess(name, processBuilder, linePredicate, 0, TimeUnit.SECONDS);
}
/**
* Get the process id of the current running Java process
*
* @return Process id
*/
public static long getProcessId() {
return ProcessHandle.current().getPid();
}
/**
* Get platform specific VM arguments (e.g. -d64 on 64bit Solaris)
*
* @return String[] with platform specific arguments, empty if there are
* none
*/
public static String[] getPlatformSpecificVMArgs() {
String osName = System.getProperty("os.name");
String dataModel = System.getProperty("sun.arch.data.model");
if (osName.equals("SunOS") && dataModel.equals("64")) {
return new String[] { "-d64" };
}
return new String[] {};
}
/**
* Create ProcessBuilder using the java launcher from the jdk to be tested,
* and with any platform specific arguments prepended.
*
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
public static ProcessBuilder createJavaProcessBuilder(String... command)
throws Exception {
return createJavaProcessBuilder(false, command);
}
/**
* Create ProcessBuilder using the java launcher from the jdk to be tested,
* and with any platform specific arguments prepended.
*
* @param addTestVmAndJavaOptions If true, adds test.vm.opts and test.java.opts
* to the java arguments.
* @param command Arguments to pass to the java command.
* @return The ProcessBuilder instance representing the java command.
*/
public static ProcessBuilder createJavaProcessBuilder(boolean addTestVmAndJavaOptions, String... command) throws Exception {
String javapath = JDKToolFinder.getJDKTool("java");
ArrayList<String> args = new ArrayList<>();
args.add(javapath);
Collections.addAll(args, getPlatformSpecificVMArgs());
if (addTestVmAndJavaOptions) {
// -cp is needed to make sure the same classpath is used whether the test is
// run in AgentVM mode or OtherVM mode. It was added to the hotspot version
// of this API as part of 8077608. However, for the jdk version it is only
// added when addTestVmAndJavaOptions is true in order to minimize
// disruption to existing JDK tests, which have yet to be tested with -cp
// being added. At some point -cp should always be added to be consistent
// with what the hotspot version does.
args.add("-cp");
args.add(System.getProperty("java.class.path"));
Collections.addAll(args, Utils.getTestJavaOpts());
}
Collections.addAll(args, command);
// Reporting
StringBuilder cmdLine = new StringBuilder();
for (String cmd : args)
cmdLine.append(cmd).append(' ');
System.out.println("Command line: [" + cmdLine.toString() + "]");
return new ProcessBuilder(args.toArray(new String[args.size()]));
}
private static void printStack(Thread t, StackTraceElement[] stack) {
System.out.println("\t" + t +
" stack: (length = " + stack.length + ")");
if (t != null) {
for (StackTraceElement stack1 : stack) {
System.out.println("\t" + stack1);
}
System.out.println();
}
}
/**
* Executes a test java process, waits for it to finish and returns the process output.
* The default options from jtreg, test.vm.opts and test.java.opts, are added.
* The java from the test.jdk is used to execute the command.
*
* The command line will be like:
* {test.jdk}/bin/java {test.vm.opts} {test.java.opts} cmds
*
* The java process will have exited before this method returns.
*
* @param cmds User specifed arguments.
* @return The output from the process.
*/
public static OutputAnalyzer executeTestJava(String... options) throws Exception {
ProcessBuilder pb = createJavaProcessBuilder(Utils.addTestJavaOpts(options));
return executeProcess(pb);
}
/**
* @deprecated Use executeTestJava instead
*/
public static OutputAnalyzer executeTestJvm(String... options) throws Exception {
return executeTestJava(options);
}
/**
* Executes a process, waits for it to finish and returns the process output.
* The process will have exited before this method returns.
* @param pb The ProcessBuilder to execute.
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
*/
public static OutputAnalyzer executeProcess(ProcessBuilder pb) throws Exception {
return executeProcess(pb, null);
}
/**
* Executes a process, pipe some text into its STDIN, waits for it
* to finish and returns the process output. The process will have exited
* before this method returns.
* @param pb The ProcessBuilder to execute.
* @param input The text to pipe into STDIN. Can be null.
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
*/
public static OutputAnalyzer executeProcess(ProcessBuilder pb, String input)
throws Exception {
OutputAnalyzer output = null;
Process p = null;
boolean failed = false;
try {
p = pb.start();
if (input != null) {
try (OutputStream os = p.getOutputStream();
PrintStream ps = new PrintStream(os)) {
ps.print(input);
ps.flush();
}
}
output = new OutputAnalyzer(p);
p.waitFor();
return output;
} catch (Throwable t) {
if (p != null) {
p.destroyForcibly().waitFor();
}
failed = true;
System.out.println("executeProcess() failed: " + t);
throw t;
} finally {
if (failed) {
System.err.println(getProcessLog(pb, output));
}
}
}
/**
* Executes a process, waits for it to finish and returns the process output.
*
* The process will have exited before this method returns.
*
* @param cmds The command line to execute.
* @return The output from the process.
*/
public static OutputAnalyzer executeProcess(String... cmds) throws Throwable {
return executeProcess(new ProcessBuilder(cmds));
}
/**
* Used to log command line, stdout, stderr and exit code from an executed process.
* @param pb The executed process.
* @param output The output from the process.
*/
public static String getProcessLog(ProcessBuilder pb, OutputAnalyzer output) {
String stderr = output == null ? "null" : output.getStderr();
String stdout = output == null ? "null" : output.getStdout();
String exitValue = output == null ? "null": Integer.toString(output.getExitValue());
StringBuilder logMsg = new StringBuilder();
final String nl = System.getProperty("line.separator");
logMsg.append("--- ProcessLog ---" + nl);
logMsg.append("cmd: " + getCommandLine(pb) + nl);
logMsg.append("exitvalue: " + exitValue + nl);
logMsg.append("stderr: " + stderr + nl);
logMsg.append("stdout: " + stdout + nl);
return logMsg.toString();
}
/**
* @return The full command line for the ProcessBuilder.
*/
public static String getCommandLine(ProcessBuilder pb) {
if (pb == null) {
return "null";
}
StringBuilder cmd = new StringBuilder();
for (String s : pb.command()) {
cmd.append(s).append(" ");
}
return cmd.toString().trim();
}
/**
* Executes a process, waits for it to finish, prints the process output
* to stdout, and returns the process output.
*
* The process will have exited before this method returns.
*
* @param cmds The command line to execute.
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
*/
public static OutputAnalyzer executeCommand(String... cmds)
throws Throwable {
String cmdLine = Arrays.stream(cmds).collect(Collectors.joining(" "));
System.out.println("Command line: [" + cmdLine + "]");
OutputAnalyzer analyzer = ProcessTools.executeProcess(cmds);
System.out.println(analyzer.getOutput());
return analyzer;
}
/**
* Executes a process, waits for it to finish, prints the process output
* to stdout and returns the process output.
*
* The process will have exited before this method returns.
*
* @param pb The ProcessBuilder to execute.
* @return The {@linkplain OutputAnalyzer} instance wrapping the process.
*/
public static OutputAnalyzer executeCommand(ProcessBuilder pb)
throws Throwable {
String cmdLine = pb.command().stream().collect(Collectors.joining(" "));
System.out.println("Command line: [" + cmdLine + "]");
OutputAnalyzer analyzer = ProcessTools.executeProcess(pb);
System.out.println(analyzer.getOutput());
return analyzer;
}
private static class ProcessImpl extends Process {
private final Process p;
private final Future<Void> stdoutTask;
private final Future<Void> stderrTask;
public ProcessImpl(Process p, Future<Void> stdoutTask, Future<Void> stderrTask) {
this.p = p;
this.stdoutTask = stdoutTask;
this.stderrTask = stderrTask;
}
@Override
public OutputStream getOutputStream() {
return p.getOutputStream();
}
@Override
public InputStream getInputStream() {
return p.getInputStream();
}
@Override
public InputStream getErrorStream() {
return p.getErrorStream();
}
@Override
public int waitFor() throws InterruptedException {
int rslt = p.waitFor();
waitForStreams();
return rslt;
}
@Override
public int exitValue() {
return p.exitValue();
}
@Override
public void destroy() {
p.destroy();
}
@Override
public long getPid() {
return p.getPid();
}
@Override
public boolean isAlive() {
return p.isAlive();
}
@Override
public Process destroyForcibly() {
return p.destroyForcibly();
}
@Override
public boolean waitFor(long timeout, TimeUnit unit) throws InterruptedException {
boolean rslt = p.waitFor(timeout, unit);
if (rslt) {
waitForStreams();
}
return rslt;
}
private void waitForStreams() throws InterruptedException {
try {
stdoutTask.get();
} catch (ExecutionException e) {
}
try {
stderrTask.get();
} catch (ExecutionException e) {
}
}
}
}

View File

@ -0,0 +1 @@
These files are copies of the corresponding files in test/lib/testlibrary/ from jdk repo.

View File

@ -0,0 +1,204 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib/process}
*/
@Deprecated
public final class StreamPumper implements Runnable {
private static final int BUF_SIZE = 256;
/**
* Pump will be called by the StreamPumper to process the incoming data
*/
abstract public static class Pump {
abstract void register(StreamPumper d);
}
/**
* OutputStream -> Pump adapter
*/
final public static class StreamPump extends Pump {
private final OutputStream out;
public StreamPump(OutputStream out) {
this.out = out;
}
@Override
void register(StreamPumper sp) {
sp.addOutputStream(out);
}
}
/**
* Used to process the incoming data line-by-line
*/
abstract public static class LinePump extends Pump {
@Override
final void register(StreamPumper sp) {
sp.addLineProcessor(this);
}
abstract protected void processLine(String line);
}
private final InputStream in;
private final Set<OutputStream> outStreams = new HashSet<>();
private final Set<LinePump> linePumps = new HashSet<>();
private final AtomicBoolean processing = new AtomicBoolean(false);
private final FutureTask<Void> processingTask = new FutureTask<>(this, null);
public StreamPumper(InputStream in) {
this.in = in;
}
/**
* Create a StreamPumper that reads from in and writes to out.
*
* @param in
* The stream to read from.
* @param out
* The stream to write to.
*/
public StreamPumper(InputStream in, OutputStream out) {
this(in);
this.addOutputStream(out);
}
/**
* Implements Thread.run(). Continuously read from {@code in} and write to
* {@code out} until {@code in} has reached end of stream. Abort on
* interruption. Abort on IOExceptions.
*/
@Override
public void run() {
try (BufferedInputStream is = new BufferedInputStream(in)) {
ByteArrayOutputStream lineBos = new ByteArrayOutputStream();
byte[] buf = new byte[BUF_SIZE];
int len = 0;
int linelen = 0;
while ((len = is.read(buf)) > 0 && !Thread.interrupted()) {
for(OutputStream out : outStreams) {
out.write(buf, 0, len);
}
if (!linePumps.isEmpty()) {
int i = 0;
int lastcrlf = -1;
while (i < len) {
if (buf[i] == '\n' || buf[i] == '\r') {
int bufLinelen = i - lastcrlf - 1;
if (bufLinelen > 0) {
lineBos.write(buf, lastcrlf + 1, bufLinelen);
}
linelen += bufLinelen;
if (linelen > 0) {
lineBos.flush();
final String line = lineBos.toString();
linePumps.stream().forEach((lp) -> {
lp.processLine(line);
});
lineBos.reset();
linelen = 0;
}
lastcrlf = i;
}
i++;
}
if (lastcrlf == -1) {
lineBos.write(buf, 0, len);
linelen += len;
} else if (lastcrlf < len - 1) {
lineBos.write(buf, lastcrlf + 1, len - lastcrlf - 1);
linelen += len - lastcrlf - 1;
}
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
for(OutputStream out : outStreams) {
try {
out.flush();
} catch (IOException e) {}
}
try {
in.close();
} catch (IOException e) {}
}
}
final void addOutputStream(OutputStream out) {
outStreams.add(out);
}
final void addLineProcessor(LinePump lp) {
linePumps.add(lp);
}
final public StreamPumper addPump(Pump ... pump) {
if (processing.get()) {
throw new IllegalStateException("Can not modify pumper while " +
"processing is in progress");
}
for(Pump p : pump) {
p.register(this);
}
return this;
}
final public Future<Void> process() {
if (!processing.compareAndSet(false, true)) {
throw new IllegalStateException("Can not re-run the processing");
}
Thread t = new Thread(new Runnable() {
@Override
public void run() {
processingTask.run();
}
});
t.setDaemon(true);
t.start();
return processingTask;
}
}

View File

@ -0,0 +1,365 @@
/*
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.testlibrary;
import static jdk.testlibrary.Asserts.assertTrue;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.concurrent.TimeUnit;
import java.util.function.BooleanSupplier;
import java.util.function.Function;
/**
* Common library for various test helper functions.
*
* @deprecated This class is deprecated. Use the one from
* {@code <root>/test/lib/share/classes/jdk/test/lib}
*/
@Deprecated
public final class Utils {
/**
* Returns the sequence used by operating system to separate lines.
*/
public static final String NEW_LINE = System.getProperty("line.separator");
/**
* Returns the value of 'test.vm.opts'system property.
*/
public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
/**
* Returns the value of 'test.java.opts'system property.
*/
public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
/**
* Returns the value of 'test.timeout.factor' system property
* converted to {@code double}.
*/
public static final double TIMEOUT_FACTOR;
static {
String toFactor = System.getProperty("test.timeout.factor", "1.0");
TIMEOUT_FACTOR = Double.parseDouble(toFactor);
}
/**
* Returns the value of JTREG default test timeout in milliseconds
* converted to {@code long}.
*/
public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
private Utils() {
// Private constructor to prevent class instantiation
}
/**
* Returns the list of VM options.
*
* @return List of VM options
*/
public static List<String> getVmOptions() {
return Arrays.asList(safeSplitString(VM_OPTIONS));
}
/**
* Returns the list of VM options with -J prefix.
*
* @return The list of VM options with -J prefix
*/
public static List<String> getForwardVmOptions() {
String[] opts = safeSplitString(VM_OPTIONS);
for (int i = 0; i < opts.length; i++) {
opts[i] = "-J" + opts[i];
}
return Arrays.asList(opts);
}
/**
* Returns the default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts.
* @return An array of options, or an empty array if no opptions.
*/
public static String[] getTestJavaOpts() {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, safeSplitString(VM_OPTIONS));
Collections.addAll(opts, safeSplitString(JAVA_OPTIONS));
return opts.toArray(new String[0]);
}
/**
* Combines given arguments with default JTReg arguments for a jvm running a test.
* This is the combination of JTReg arguments test.vm.opts and test.java.opts
* @return The combination of JTReg test java options and user args.
*/
public static String[] addTestJavaOpts(String... userArgs) {
List<String> opts = new ArrayList<String>();
Collections.addAll(opts, getTestJavaOpts());
Collections.addAll(opts, userArgs);
return opts.toArray(new String[0]);
}
/**
* Removes any options specifying which GC to use, for example "-XX:+UseG1GC".
* Removes any options matching: -XX:(+/-)Use*GC
* Used when a test need to set its own GC version. Then any
* GC specified by the framework must first be removed.
* @return A copy of given opts with all GC options removed.
*/
private static final Pattern useGcPattern = Pattern.compile(
"(?:\\-XX\\:[\\+\\-]Use.+GC)"
+ "|(?:\\-Xconcgc)");
public static List<String> removeGcOpts(List<String> opts) {
List<String> optsWithoutGC = new ArrayList<String>();
for (String opt : opts) {
if (useGcPattern.matcher(opt).matches()) {
System.out.println("removeGcOpts: removed " + opt);
} else {
optsWithoutGC.add(opt);
}
}
return optsWithoutGC;
}
/**
* Splits a string by white space.
* Works like String.split(), but returns an empty array
* if the string is null or empty.
*/
private static String[] safeSplitString(String s) {
if (s == null || s.trim().isEmpty()) {
return new String[] {};
}
return s.trim().split("\\s+");
}
/**
* @return The full command line for the ProcessBuilder.
*/
public static String getCommandLine(ProcessBuilder pb) {
StringBuilder cmd = new StringBuilder();
for (String s : pb.command()) {
cmd.append(s).append(" ");
}
return cmd.toString();
}
/**
* Returns the free port on the local host.
* The function will spin until a valid port number is found.
*
* @return The port number
* @throws InterruptedException if any thread has interrupted the current thread
* @throws IOException if an I/O error occurs when opening the socket
*/
public static int getFreePort() throws InterruptedException, IOException {
int port = -1;
while (port <= 0) {
Thread.sleep(100);
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(0);
port = serverSocket.getLocalPort();
} finally {
serverSocket.close();
}
}
return port;
}
/**
* Returns the name of the local host.
*
* @return The host name
* @throws UnknownHostException if IP address of a host could not be determined
*/
public static String getHostname() throws UnknownHostException {
InetAddress inetAddress = InetAddress.getLocalHost();
String hostName = inetAddress.getHostName();
assertTrue((hostName != null && !hostName.isEmpty()),
"Cannot get hostname");
return hostName;
}
/**
* Uses "jcmd -l" to search for a jvm pid. This function will wait
* forever (until jtreg timeout) for the pid to be found.
* @param key Regular expression to search for
* @return The found pid.
*/
public static int waitForJvmPid(String key) throws Throwable {
final long iterationSleepMillis = 250;
System.out.println("waitForJvmPid: Waiting for key '" + key + "'");
System.out.flush();
while (true) {
int pid = tryFindJvmPid(key);
if (pid >= 0) {
return pid;
}
Thread.sleep(iterationSleepMillis);
}
}
/**
* Searches for a jvm pid in the output from "jcmd -l".
*
* Example output from jcmd is:
* 12498 sun.tools.jcmd.JCmd -l
* 12254 /tmp/jdk8/tl/jdk/JTwork/classes/com/sun/tools/attach/Application.jar
*
* @param key A regular expression to search for.
* @return The found pid, or -1 if Enot found.
* @throws Exception If multiple matching jvms are found.
*/
public static int tryFindJvmPid(String key) throws Throwable {
OutputAnalyzer output = null;
try {
JDKToolLauncher jcmdLauncher = JDKToolLauncher.create("jcmd");
jcmdLauncher.addToolArg("-l");
output = ProcessTools.executeProcess(jcmdLauncher.getCommand());
output.shouldHaveExitValue(0);
// Search for a line starting with numbers (pid), follwed by the key.
Pattern pattern = Pattern.compile("([0-9]+)\\s.*(" + key + ").*\\r?\\n");
Matcher matcher = pattern.matcher(output.getStdout());
int pid = -1;
if (matcher.find()) {
pid = Integer.parseInt(matcher.group(1));
System.out.println("findJvmPid.pid: " + pid);
if (matcher.find()) {
throw new Exception("Found multiple JVM pids for key: " + key);
}
}
return pid;
} catch (Throwable t) {
System.out.println(String.format("Utils.findJvmPid(%s) failed: %s", key, t));
throw t;
}
}
/**
* Adjusts the provided timeout value for the TIMEOUT_FACTOR
* @param tOut the timeout value to be adjusted
* @return The timeout value adjusted for the value of "test.timeout.factor"
* system property
*/
public static long adjustTimeout(long tOut) {
return Math.round(tOut * Utils.TIMEOUT_FACTOR);
}
/**
* Wait for condition to be true
*
* @param condition, a condition to wait for
*/
public static final void waitForCondition(BooleanSupplier condition) {
waitForCondition(condition, -1L, 100L);
}
/**
* Wait until timeout for condition to be true
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true
* specifying -1 will wait forever
* @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout) {
return waitForCondition(condition, timeout, 100L);
}
/**
* Wait until timeout for condition to be true for specified time
*
* @param condition, a condition to wait for
* @param timeout a time in milliseconds to wait for condition to be true,
* specifying -1 will wait forever
* @param sleepTime a time to sleep value in milliseconds
* @return condition value, to determine if wait was successfull
*/
public static final boolean waitForCondition(BooleanSupplier condition,
long timeout, long sleepTime) {
long startTime = System.currentTimeMillis();
while (!(condition.getAsBoolean() || (timeout != -1L
&& ((System.currentTimeMillis() - startTime) > timeout)))) {
try {
Thread.sleep(sleepTime);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new Error(e);
}
}
return condition.getAsBoolean();
}
/**
* Interface same as java.lang.Runnable but with
* method {@code run()} able to throw any Throwable.
*/
public static interface ThrowingRunnable {
void run() throws Throwable;
}
/**
* Filters out an exception that may be thrown by the given
* test according to the given filter.
*
* @param test - method that is invoked and checked for exception.
* @param filter - function that checks if the thrown exception matches
* criteria given in the filter's implementation.
* @return - exception that matches the filter if it has been thrown or
* {@code null} otherwise.
* @throws Throwable - if test has thrown an exception that does not
* match the filter.
*/
public static Throwable filterException(ThrowingRunnable test,
Function<Throwable, Boolean> filter) throws Throwable {
try {
test.run();
} catch (Throwable t) {
if (filter.apply(t)) {
return t;
} else {
throw t;
}
}
return null;
}
}

View File

@ -0,0 +1,120 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import static org.testng.Assert.assertTrue;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import static jdk.testlibrary.ProcessTools.executeTestJava;
import jdk.testlibrary.CompilerUtils;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
/*
* @test
* @library /javax/xml/jaxp/libs
* @build jdk.testlibrary.*
* @run testng BasicModularXMLParserTest
* @bug 8078820
* @summary Tests JAXP lib can instantiate the following interfaces
* with customized provider module on boot layer
*
* javax.xml.datatype.DatatypeFactory
* javax.xml.parsers.DocumentBuilderFactory
* javax.xml.parsers.SAXParserFactory
* javax.xml.stream.XMLEventFactory
* javax.xml.stream.XMLInputFactory
* javax.xml.stream.XMLOutputFactory
* javax.xml.transform.TransformerFactory
* javax.xml.validation.SchemaFactory
* javax.xml.xpath.XPathFactory
*/
@Test
public class BasicModularXMLParserTest {
private static final String TEST_SRC = System.getProperty("test.src");
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
private static final Path MOD_DIR1 = Paths.get("mod1");
private static final Path MOD_DIR2 = Paths.get("mod2");
private static final Path CLASSES_DIR = Paths.get("classes");
/*
* Compiles all modules used by the test
*/
@BeforeTest
public void compileAll() throws Exception {
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("xmlprovider1"), MOD_DIR1.resolve("xmlprovider1")));
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("xmlprovider2"), MOD_DIR2.resolve("xmlprovider2")));
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("unnamed"), CLASSES_DIR));
}
/*
* test the default JAXP implementation
*/
public void testDefault() throws Exception {
int exitValue
= executeTestJava("-cp", CLASSES_DIR.toString(),
"Main")
.outputTo(System.out)
.errorTo(System.out)
.getExitValue();
assertTrue(exitValue == 0);
}
/*
* test loading one provider module
*/
public void testWithOneProvider() throws Exception {
int exitValue
= executeTestJava("-mp", MOD_DIR1.toString(),
"-cp", CLASSES_DIR.toString(),
"Main", "xmlprovider1")
.outputTo(System.out)
.errorTo(System.out)
.getExitValue();
assertTrue(exitValue == 0);
}
/*
* test loading both provider modules
*/
public void testWithTwoProvider() throws Exception {
int exitValue
= executeTestJava("-mp", MOD_DIR1.toString() + File.pathSeparator + MOD_DIR2.toString(),
"-cp", CLASSES_DIR.toString(),
"Main", "xmlprovider1", "xmlprovider2")
.outputTo(System.out)
.errorTo(System.out)
.getExitValue();
assertTrue(exitValue == 0);
}
}

View File

@ -0,0 +1,187 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import static java.lang.module.ModuleFinder.empty;
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
import java.lang.ClassLoader;
import java.lang.String;
import java.lang.System;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
import java.lang.reflect.Layer;
import java.lang.reflect.Method;
import java.lang.reflect.Module;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.Set;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import jdk.testlibrary.CompilerUtils;
/*
* @test
* @library /javax/xml/jaxp/libs
* @build jdk.testlibrary.*
* @run testng LayerModularXMLParserTest
* @bug 8078820
* @summary Tests JAXP lib works with layer and TCCL
*/
@Test
public class LayerModularXMLParserTest {
private static final String TEST_SRC = System.getProperty("test.src");
private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
private static final Path MOD_DIR1 = Paths.get("mod1");
private static final Path MOD_DIR2 = Paths.get("mod2");
/*
* services provided by provider1
*/
private static final String[] services1 = { "javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.SAXParserFactory", "javax.xml.stream.XMLInputFactory",
"javax.xml.stream.XMLOutputFactory", "javax.xml.transform.TransformerFactory",
"javax.xml.validation.SchemaFactory", "javax.xml.xpath.XPathFactory" };
/*
* services provided by provider2
*/
private static final String[] services2 = { "javax.xml.datatype.DatatypeFactory",
"javax.xml.stream.XMLEventFactory" };
/*
* Compiles all modules used by the test
*/
@BeforeTest
public void compileAll() throws Exception {
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("xmlprovider1"), MOD_DIR1.resolve("xmlprovider1")));
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("xmlprovider2"), MOD_DIR2.resolve("xmlprovider2")));
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("test"), MOD_DIR1.resolve("test")));
assertTrue(CompilerUtils.compile(SRC_DIR.resolve("test"), MOD_DIR2.resolve("test")));
}
/*
* layer 1 is created on top of boot layer, layer1 includes module provider1.
*
* Instantiate each XML service, verify the services provided by provider1
* are loaded from layer 1, the other services are loaded from boot layer
*/
public void testOneLayer() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
Configuration cf1 = Layer.boot().configuration()
.resolveRequiresAndUses(finder1, empty(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
ClassLoader cl1 = layer1.findLoader("test");
Method m = cl1.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, Layer.boot());
}
}
/*
* layer 1 is created on top of boot layer, layer 1 includes module provider1.
* layer 2 is created on top of layer 1, layer 2 includes module provider2.
*
* Instantiate each XML service, verify the services provided by provider1
* are loaded from layer 1, the services provided by provider2 are loaded from layer 2
*/
public void testTwoLayer() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1);
Configuration cf1 = Layer.boot().configuration()
.resolveRequiresAndUses(finder1, empty(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
Configuration cf2 = cf1.resolveRequiresAndUses(finder2, empty(), Set.of("test"));
Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
ClassLoader cl2 = layer2.findLoader("test");
Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer2);
}
}
/*
* layer 1 is created on top of boot layer, layer 1 includes module provider1 and provider2.
* layer 2 is created on top of layer 1, layer 2 includes module provider2.
*
* Instantiate each XML service, verify the services provided by provider1
* are loaded from layer 1, the services provided by provider2 are loaded from layer 2
*/
public void testTwoLayerWithDuplicate() throws Exception {
ModuleFinder finder1 = ModuleFinder.of(MOD_DIR1, MOD_DIR2);
Configuration cf1 = Layer.boot().configuration()
.resolveRequiresAndUses(finder1, empty(), Set.of("test"));
ClassLoader scl = ClassLoader.getSystemClassLoader();
Layer layer1 = Layer.boot().defineModulesWithManyLoaders(cf1, scl);
ModuleFinder finder2 = ModuleFinder.of(MOD_DIR2);
Configuration cf2 = cf1.resolveRequiresAndUses(finder2, empty(), Set.of("test"));
Layer layer2 = layer1.defineModulesWithOneLoader(cf2, layer1.findLoader("test"));
ClassLoader cl2 = layer2.findLoader("test");
Method m = cl2.loadClass("test.XMLFactoryHelper").getMethod("instantiateXMLService", String.class);
for (String service : services1) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer1);
}
for (String service : services2) {
Object o = m.invoke(null, service);
Layer providerLayer = o.getClass().getModule().getLayer();
assertSame(providerLayer, layer2);
}
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
module test {
requires java.xml;
exports test;
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package test;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import java.lang.Class;
import java.lang.String;
import java.lang.System;
import java.util.Iterator;
import java.util.ServiceLoader;
public class XMLFactoryHelper {
/*
* instantiate a xml factory by reflection e.g.
* DocumentBuilderFactory.newInstance()
*/
public static Object instantiateXMLService(String serviceName) throws Exception {
ClassLoader backup = Thread.currentThread().getContextClassLoader();
try {
// set thread context class loader to module class loader
Thread.currentThread().setContextClassLoader(XMLFactoryHelper.class.getClassLoader());
if (serviceName.equals("javax.xml.validation.SchemaFactory"))
return Class.forName(serviceName).getMethod("newInstance", String.class)
.invoke(null, W3C_XML_SCHEMA_NS_URI);
else
return Class.forName(serviceName).getMethod("newInstance").invoke(null);
} finally {
Thread.currentThread().setContextClassLoader(backup);
}
}
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import java.lang.reflect.Layer;
import java.lang.reflect.Module;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Stream;
public class Main {
/*
* @param args, the names of provider modules, which have been loaded
*/
public static void main(String[] args) throws Exception {
Module xml = Layer.boot().findModule("java.xml").get();
Set<String> allServices = new HashSet<>(Arrays.asList(expectedAllServices));
if (!allServices.equals(xml.getDescriptor().uses()))
throw new AssertionError("Expect xml module uses: " + allServices + " But actually uses: "
+ xml.getDescriptor().uses());
long violationCount = Stream.of(args)
.map(xmlProviderName -> Layer.boot().findModule(xmlProviderName).get())
.mapToLong(
// services provided by the implementation in provider module
provider -> provider.getDescriptor().provides().keySet().stream()
.filter(serviceName -> {
allServices.remove(serviceName); // remove service provided by
// customized module from allServices
return !belongToModule(serviceName, instantiateXMLService(serviceName), provider);
}).count())
.sum();
// the remaining services should be provided by the default implementation
violationCount += allServices.stream()
.filter(serviceName -> !belongToModule(serviceName, instantiateXMLService(serviceName), xml))
.count();
if (violationCount > 0)
throw new AssertionError(violationCount + " services are not provided by expected module");
}
/*
* instantiate a xml factory by reflection e.g.
* DocumentBuilderFactory.newInstance()
*/
private static Object instantiateXMLService(String serviceName) {
try {
if (serviceName.equals("javax.xml.validation.SchemaFactory"))
return Class.forName(serviceName).getMethod("newInstance", String.class)
.invoke(null, W3C_XML_SCHEMA_NS_URI);
else
return Class.forName(serviceName).getMethod("newInstance").invoke(null);
} catch (Exception e) {
e.printStackTrace(System.err);
throw new RuntimeException(e);
}
}
/*
* verify which module provides the xml factory
*/
private static boolean belongToModule(String factoryName, Object factory, Module expected) {
Module actual = factory.getClass().getModule();
if (!actual.equals(expected)) {
System.err.println("Expect " + factoryName + " is provided by " + expected
+ ", but actual implementation " + factory.getClass() + " is provided by " + actual);
return false;
} else {
System.out.println(factory.getClass() + " is provided by " + expected);
return true;
}
}
/*
* This list equals the declarations in java.xml module-info.java
*/
private static final String[] expectedAllServices = { "javax.xml.datatype.DatatypeFactory",
"javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.SAXParserFactory",
"javax.xml.stream.XMLEventFactory", "javax.xml.stream.XMLInputFactory",
"javax.xml.stream.XMLOutputFactory", "javax.xml.transform.TransformerFactory",
"javax.xml.validation.SchemaFactory", "javax.xml.xpath.XPathFactory" };
}

View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
module xmlprovider1 {
requires java.xml;
provides javax.xml.parsers.DocumentBuilderFactory with xp1.DocumentBuilderFactoryImpl;
provides javax.xml.parsers.SAXParserFactory with xp1.SAXParserFactoryImpl;
provides javax.xml.stream.XMLInputFactory with xp1.XMLInputFactoryImpl;
provides javax.xml.stream.XMLOutputFactory with xp1.XMLOutputFactoryImpl;
provides javax.xml.transform.TransformerFactory with xp1.TransformerFactoryImpl;
provides javax.xml.validation.SchemaFactory with xp1.SchemaFactoryImpl;
provides javax.xml.xpath.XPathFactory with xp1.XPathFactoryImpl;
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
@Override
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
return null;
}
@Override
public void setAttribute(String name, Object value) throws IllegalArgumentException {
}
@Override
public Object getAttribute(String name) throws IllegalArgumentException {
return null;
}
@Override
public void setFeature(String name, boolean value) throws ParserConfigurationException {
}
@Override
public boolean getFeature(String name) throws ParserConfigurationException {
return false;
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
public class SAXParserFactoryImpl extends SAXParserFactory {
@Override
public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
return null;
}
@Override
public void setFeature(String name, boolean value) throws ParserConfigurationException,
SAXNotRecognizedException, SAXNotSupportedException {
}
@Override
public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException {
return false;
}
}

View File

@ -0,0 +1,77 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
import javax.xml.transform.Source;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
public class SchemaFactoryImpl extends SchemaFactory {
@Override
public boolean isSchemaLanguageSupported(String schemaLanguage) {
// must be true, otherwise JAXP library will deny this impl
if (schemaLanguage.equals(W3C_XML_SCHEMA_NS_URI))
return true;
else
return false;
}
@Override
public void setErrorHandler(ErrorHandler errorHandler) {
}
@Override
public ErrorHandler getErrorHandler() {
return null;
}
@Override
public void setResourceResolver(LSResourceResolver resourceResolver) {
}
@Override
public LSResourceResolver getResourceResolver() {
return null;
}
@Override
public Schema newSchema(Source[] schemas) throws SAXException {
return null;
}
@Override
public Schema newSchema() throws SAXException {
return null;
}
}

View File

@ -0,0 +1,97 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import javax.xml.transform.ErrorListener;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
public class TransformerFactoryImpl extends TransformerFactory {
@Override
public Transformer newTransformer(Source source) throws TransformerConfigurationException {
return null;
}
@Override
public Transformer newTransformer() throws TransformerConfigurationException {
return null;
}
@Override
public Templates newTemplates(Source source) throws TransformerConfigurationException {
return null;
}
@Override
public Source getAssociatedStylesheet(Source source, String media, String title, String charset)
throws TransformerConfigurationException {
return null;
}
@Override
public void setURIResolver(URIResolver resolver) {
}
@Override
public URIResolver getURIResolver() {
return null;
}
@Override
public void setFeature(String name, boolean value) throws TransformerConfigurationException {
}
@Override
public boolean getFeature(String name) {
return false;
}
@Override
public void setAttribute(String name, Object value) {
}
@Override
public Object getAttribute(String name) {
return null;
}
@Override
public void setErrorListener(ErrorListener listener) {
}
@Override
public ErrorListener getErrorListener() {
return null;
}
}

View File

@ -0,0 +1,166 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import java.io.InputStream;
import java.io.Reader;
import javax.xml.stream.EventFilter;
import javax.xml.stream.StreamFilter;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLReporter;
import javax.xml.stream.XMLResolver;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.util.XMLEventAllocator;
import javax.xml.transform.Source;
public class XMLInputFactoryImpl extends XMLInputFactory {
@Override
public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException {
return null;
}
@Override
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
throws XMLStreamException {
return null;
}
@Override
public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
throws XMLStreamException {
return null;
}
@Override
public XMLResolver getXMLResolver() {
return null;
}
@Override
public void setXMLResolver(XMLResolver resolver) {
}
@Override
public XMLReporter getXMLReporter() {
return null;
}
@Override
public void setXMLReporter(XMLReporter reporter) {
}
@Override
public void setProperty(String name, Object value) throws IllegalArgumentException {
}
@Override
public Object getProperty(String name) throws IllegalArgumentException {
return null;
}
@Override
public boolean isPropertySupported(String name) {
return false;
}
@Override
public void setEventAllocator(XMLEventAllocator allocator) {
}
@Override
public XMLEventAllocator getEventAllocator() {
return null;
}
}

View File

@ -0,0 +1,94 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp1;
import java.io.OutputStream;
import java.io.Writer;
import javax.xml.stream.XMLEventWriter;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Result;
public class XMLOutputFactoryImpl extends XMLOutputFactory {
@Override
public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException {
return null;
}
@Override
public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException {
return null;
}
@Override
public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding)
throws XMLStreamException {
return null;
}
@Override
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
return null;
}
@Override
public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
return null;
}
@Override
public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException {
return null;
}
@Override
public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding)
throws XMLStreamException {
return null;
}
@Override
public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException {
return null;
}
@Override
public void setProperty(String name, Object value) throws IllegalArgumentException {
}
@Override
public Object getProperty(String name) throws IllegalArgumentException {
return null;
}
@Override
public boolean isPropertySupported(String name) {
return false;
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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 xp1;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathFactoryConfigurationException;
import javax.xml.xpath.XPathFunctionResolver;
import javax.xml.xpath.XPathVariableResolver;
public class XPathFactoryImpl extends XPathFactory {
@Override
public boolean isObjectModelSupported(String objectModel) {
// must be true, otherwise JAXP library will deny this impl
return true;
}
@Override
public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException {
}
@Override
public boolean getFeature(String name) throws XPathFactoryConfigurationException {
return false;
}
@Override
public void setXPathVariableResolver(XPathVariableResolver resolver) {
}
@Override
public void setXPathFunctionResolver(XPathFunctionResolver resolver) {
}
@Override
public XPath newXPath() {
return null;
}
}

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
module xmlprovider2 {
requires java.xml;
provides javax.xml.datatype.DatatypeFactory with xp2.DatatypeFactoryImpl;
provides javax.xml.stream.XMLEventFactory with xp2.XMLEventFactoryImpl;
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp2;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.GregorianCalendar;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.Duration;
import javax.xml.datatype.XMLGregorianCalendar;
public class DatatypeFactoryImpl extends DatatypeFactory {
@Override
public Duration newDuration(String lexicalRepresentation) {
return null;
}
@Override
public Duration newDuration(long durationInMilliSeconds) {
return null;
}
@Override
public Duration newDuration(boolean isPositive, BigInteger years, BigInteger months, BigInteger days,
BigInteger hours, BigInteger minutes, BigDecimal seconds) {
return null;
}
@Override
public XMLGregorianCalendar newXMLGregorianCalendar() {
return null;
}
@Override
public XMLGregorianCalendar newXMLGregorianCalendar(String lexicalRepresentation) {
return null;
}
@Override
public XMLGregorianCalendar newXMLGregorianCalendar(GregorianCalendar cal) {
return null;
}
@Override
public XMLGregorianCalendar newXMLGregorianCalendar(BigInteger year, int month, int day, int hour,
int minute, int second, BigDecimal fractionalSecond, int timezone) {
return null;
}
}

View File

@ -0,0 +1,180 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package xp2;
import java.util.Iterator;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
import javax.xml.stream.XMLEventFactory;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.Comment;
import javax.xml.stream.events.DTD;
import javax.xml.stream.events.EndDocument;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.EntityDeclaration;
import javax.xml.stream.events.EntityReference;
import javax.xml.stream.events.Namespace;
import javax.xml.stream.events.ProcessingInstruction;
import javax.xml.stream.events.StartDocument;
import javax.xml.stream.events.StartElement;
public class XMLEventFactoryImpl extends XMLEventFactory {
@Override
public void setLocation(Location location) {
}
@Override
public Attribute createAttribute(String prefix, String namespaceURI, String localName, String value) {
return null;
}
@Override
public Attribute createAttribute(String localName, String value) {
return null;
}
@Override
public Attribute createAttribute(QName name, String value) {
return null;
}
@Override
public Namespace createNamespace(String namespaceURI) {
return null;
}
@Override
public Namespace createNamespace(String prefix, String namespaceUri) {
return null;
}
@Override
public StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces) {
return null;
}
@Override
public StartElement createStartElement(String prefix, String namespaceUri, String localName) {
return null;
}
@Override
public StartElement createStartElement(String prefix, String namespaceUri, String localName,
Iterator attributes, Iterator namespaces) {
return null;
}
@Override
public StartElement createStartElement(String prefix, String namespaceUri, String localName,
Iterator attributes, Iterator namespaces, NamespaceContext context) {
return null;
}
@Override
public EndElement createEndElement(QName name, Iterator namespaces) {
return null;
}
@Override
public EndElement createEndElement(String prefix, String namespaceUri, String localName) {
return null;
}
@Override
public EndElement createEndElement(String prefix, String namespaceUri, String localName,
Iterator namespaces) {
return null;
}
@Override
public Characters createCharacters(String content) {
return null;
}
@Override
public Characters createCData(String content) {
return null;
}
@Override
public Characters createSpace(String content) {
return null;
}
@Override
public Characters createIgnorableSpace(String content) {
return null;
}
@Override
public StartDocument createStartDocument() {
return null;
}
@Override
public StartDocument createStartDocument(String encoding, String version, boolean standalone) {
return null;
}
@Override
public StartDocument createStartDocument(String encoding, String version) {
return null;
}
@Override
public StartDocument createStartDocument(String encoding) {
return null;
}
@Override
public EndDocument createEndDocument() {
return null;
}
@Override
public EntityReference createEntityReference(String name, EntityDeclaration declaration) {
return null;
}
@Override
public Comment createComment(String text) {
return null;
}
@Override
public ProcessingInstruction createProcessingInstruction(String target, String data) {
return null;
}
@Override
public DTD createDTD(String dtd) {
return null;
}
}

View File

@ -0,0 +1,5 @@
# Tests that must run in othervm mode
othervm.dirs= .
# Declare module dependency
modules=java.xml

View File

@ -4,5 +4,6 @@ TestNG.dirs = .
lib.dirs = /javax/xml/jaxp/libs
# Declare module dependency
modules=java.xml/com.sun.org.apache.xerces.internal.jaxp \
modules=java.xml/com.sun.org.apache.xerces.internal.impl \
java.xml/com.sun.org.apache.xerces.internal.jaxp \
java.xml/com.sun.org.apache.xml.internal.serialize

View File

@ -23,6 +23,7 @@
package catalog;
import java.io.IOException;
import java.nio.file.Paths;
import javax.xml.catalog.Catalog;
import javax.xml.catalog.CatalogException;
import javax.xml.catalog.CatalogFeatures;
@ -34,6 +35,7 @@ import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.xml.sax.Attributes;
@ -44,10 +46,49 @@ import org.xml.sax.XMLReader;
import org.xml.sax.ext.DefaultHandler2;
/*
* @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527
* @bug 8081248, 8144966, 8146606, 8146237, 8151154, 8150969, 8151162, 8152527, 8154220
* @summary Tests basic Catalog functions.
*/
public class CatalogTest {
static final String KEY_FILES = "javax.xml.catalog.files";
public String filepath;
/*
* Initializing fields
*/
@BeforeClass
public void setUpClass() throws Exception {
String file1 = getClass().getResource("first_cat.xml").getFile();
if (System.getProperty("os.name").contains("Windows")) {
filepath = file1.substring(1, file1.lastIndexOf("/") + 1);
} else {
filepath = file1.substring(0, file1.lastIndexOf("/") + 1);
}
}
/*
* @bug 8154220
* Verifies that the file input is validated properly. Valid input includes
* multiple file paths separated by semicolon.
*/
@Test(dataProvider = "hierarchyOfCatFilesData")
public void hierarchyOfCatFiles2(String systemId, String expectedUri) {
String file1 = getClass().getResource("first_cat.xml").getFile();
String file2 = getClass().getResource("second_cat.xml").getFile();
String files = file1 + ";" + file2;
try {
System.setProperty(KEY_FILES, files);
CatalogResolver catalogResolver = CatalogManager.catalogResolver(CatalogFeatures.defaults());
String sysId = catalogResolver.resolveEntity(null, systemId).getSystemId();
Assert.assertEquals(sysId, Paths.get(filepath + expectedUri).toUri().toString().replace("///", "/"), "System ID match not right");
} finally {
System.clearProperty(KEY_FILES);
}
}
/*
* @bug 8152527
* This test is the same as the JDK test ResolveEntityTests:testMatch1.
@ -288,6 +329,19 @@ public class CatalogTest {
}
}
/*
DataProvider: used to verify hierarchical catalogs. Refer to JCK test
hierarchyOfCatFiles2.
*/
@DataProvider(name = "hierarchyOfCatFilesData")
Object[][] getHierarchyOfCatFilesData() {
return new Object[][]{
{"http://www.oracle.com/sequence.dtd", "first.dtd"},
{"http://www.oracle.com/sequence_next.dtd", "next.dtd"},
{"http://www.oracle.com/sequence_second.dtd", "second.dtd"}
};
}
/*
DataProvider: used to verify CatalogResolver's resolveEntity function.
Data columns:
@ -300,6 +354,7 @@ public class CatalogTest {
{"rewriteSystem_id.xml", "system", "http://www.sys00test.com/rewrite.dtd", "PUB-404", expected, expected, "Relative rewriteSystem with xml:base at group level failed"},
};
}
static String id = "http://openjdk.java.net/xml/catalog/dtd/system.dtd";
/*
DataProvider: used to verify how prefer settings affect the result of the

View File

@ -0,0 +1,6 @@
<catalog prefer="system" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="http://www.oracle.com/sequence.dtd" uri="first.dtd"/>
<nextCatalog catalog="next_cat.xml"/>
</catalog>

View File

@ -0,0 +1,6 @@
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="http://www.oracle.com/sequence.dtd" uri="next.dtd"/>
<system systemId="http://www.oracle.com/sequence_next.dtd" uri="next.dtd"/>
</catalog>

View File

@ -0,0 +1,7 @@
<catalog prefer="public" xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="http://www.oracle.com/sequence.dtd" uri="second.dtd"/>
<system systemId="http://www.oracle.com/sequence_next.dtd" uri="second.dtd"/>
<system systemId="http://www.oracle.com/sequence_second.dtd" uri="second.dtd"/>
</catalog>

View File

@ -28,7 +28,6 @@ import java.io.File;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
import org.testng.annotations.Test;
@ -74,7 +73,7 @@ public class Bug6668115Test {
er.nextTag();
er.nextTag();
XMLEvent event = er.peek();
er.peek();
System.out.println(er.getElementText());
er.nextTag();
System.out.println(er.getElementText());

View File

@ -0,0 +1,90 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package stream.XMLEventReaderTest;
import java.io.StringReader;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.XMLEvent;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.sun.org.apache.xerces.internal.impl.XMLEntityManager;
/*
* @bug 8153781
* @summary Test if method skipDTD of class XMLDTDScannerImpl will correctly skip the DTD section,
* even if a call to XMLEntityScanner.scanData for skipping to the closing ']' returns true.
*/
public class Bug8153781 {
public static int DOCTYPE_SECTION_LENGTH = XMLEntityManager.DEFAULT_BUFFER_SIZE * 2;
public static int DOCUMENT_LENGTH = DOCTYPE_SECTION_LENGTH + 4096;
public String createXMLDocument(int doctypeoffset) {
StringBuilder xmlcontentbuilder = new StringBuilder(DOCUMENT_LENGTH);
xmlcontentbuilder.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n");
xmlcontentbuilder.append("<!DOCTYPE dummy [\r\n");
xmlcontentbuilder.append(" <!ELEMENT dummy EMPTY>\r\n");
xmlcontentbuilder.append(" <!--\r\n");
int doctypelines = DOCTYPE_SECTION_LENGTH / 3;
for (int i = 0; i < doctypeoffset; i++)
xmlcontentbuilder.append('a');
for (int i = 0; i < doctypelines; i++)
xmlcontentbuilder.append("a\r\n");
xmlcontentbuilder.append(" -->\r\n");
xmlcontentbuilder.append(" ]\r\n");
xmlcontentbuilder.append(">\r\n");
xmlcontentbuilder.append("<dummy>\r\n");
xmlcontentbuilder.append("</dummy>\r\n");
System.out.println("Document length:" + xmlcontentbuilder.length());
return xmlcontentbuilder.toString();
}
public void runReader(XMLInputFactory factory, int offset) throws XMLStreamException {
StringReader stringReader = new StringReader(createXMLDocument(offset));
XMLEventReader reader = factory.createXMLEventReader(stringReader);
while (reader.hasNext()) {
XMLEvent event = reader.nextEvent();
System.out.println("Event Type: " + event.getEventType());
}
}
@Test
public void test() {
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
for (int i = 0; i < 3; i++) {
runReader(factory, i);
}
} catch (XMLStreamException xe) {
xe.printStackTrace();
Assert.fail(xe.getMessage());
}
}
}

View File

@ -360,3 +360,5 @@ fafd694e801f0f5a7c737fb08630ced3ca8f772c jdk-9+107
21274e7937bae291658d68143aca0e3ee9296db0 jdk-9+112
e980062475c10d21137051045bf95ee229db9b27 jdk-9+113
b314bb02182b9ca94708a91f312c377f5435f740 jdk-9+114
4ff86e5489e4c0513dadfa69def8601c110ca5cd jdk-9+115
529f0bf896e58525614d863e283ad155531941cb jdk-9+116

View File

@ -357,3 +357,5 @@ b2a69d66dc65ad1d3aeb3bd362cf5bb0deba040e jdk-9+111
1565a0efe6f0ca411a6df277df1e069431c60988 jdk-9+112
68f8be44b6a6b33dfa841ec671c0ba6e4056b372 jdk-9+113
bb8379287f3736f38c52b2d1418784e2592461d1 jdk-9+114
35225b837d66582037eeadeb471c13235dfd793d jdk-9+115
baeb5edb38939cdb78ae0ac6f4fd368465cbf188 jdk-9+116

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -83,20 +83,20 @@ ifneq ($(STATIC_BUILD), true)
endif
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(JVM_VARIANT_SERVER), true)
ifeq ($(call check-jvm-variant, server), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifeq ($(JVM_VARIANT_CLIENT), true)
ifeq ($(call check-jvm-variant, client), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
ifeq ($(call check-jvm-variant, minimal), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (,$(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -88,7 +88,7 @@ endif
#
# How to install jvm.cfg.
#
ifeq ($(JVM_VARIANT_ZERO), true)
ifeq ($(call check-jvm-variant, zero zeroshark), true)
JVMCFG_ARCH := zero
else
JVMCFG_ARCH := $(OPENJDK_TARGET_CPU_LEGACY)
@ -99,7 +99,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
else
JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
# Allow override by ALT_JVMCFG_SRC if it exists
JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC))
JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC))
endif
JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
JVMCFG := $(JVMCFG_DIR)/jvm.cfg
@ -117,12 +117,12 @@ else
# The main problem is deciding whether to use aliases for the VMs that are not
# present and the current position is that we add aliases for client and server, but
# not for minimal.
CLIENT_AND_SERVER := $(and $(findstring true, $(JVM_VARIANT_SERVER)), $(findstring true, $(JVM_VARIANT_CLIENT)))
ifeq ($(CLIENT_AND_SERVER), true)
CLIENT_AND_SERVER := $(call check-jvm-variant, client)+$(call check-jvm-variant, server)
ifeq ($(CLIENT_AND_SERVER), true+true)
COPY_JVM_CFG_FILE := true
else
# For zero, the default jvm.cfg file is sufficient
ifeq ($(JVM_VARIANT_ZERO), true)
ifeq ($(call check-jvm-variant, zero zeroshark), true)
COPY_JVM_CFG_FILE := true
endif
endif
@ -136,21 +136,21 @@ else
$(MKDIR) -p $(@D)
$(RM) $(@)
# Now check for other permutations
ifeq ($(JVM_VARIANT_SERVER), true)
ifeq ($(call check-jvm-variant, server), true)
$(PRINTF) "-server KNOWN\n">>$(@)
$(PRINTF) "-client ALIASED_TO -server\n">>$(@)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
ifeq ($(call check-jvm-variant, minimal), true)
$(PRINTF) "-minimal KNOWN\n">>$(@)
endif
else
ifeq ($(JVM_VARIANT_CLIENT), true)
ifeq ($(call check-jvm-variant, client), true)
$(PRINTF) "-client KNOWN\n">>$(@)
$(PRINTF) "-server ALIASED_TO -client\n">>$(@)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
ifeq ($(call check-jvm-variant, minimal), true)
$(PRINTF) "-minimal KNOWN\n">>$(@)
endif
else
ifeq ($(JVM_VARIANT_MINIMAL1), true)
ifeq ($(call check-jvm-variant, minimal), true)
$(PRINTF) "-minimal KNOWN\n">>$(@)
$(PRINTF) "-server ALIASED_TO -minimal\n">>$(@)
$(PRINTF) "-client ALIASED_TO -minimal\n">>$(@)

View File

@ -37,6 +37,7 @@ allfonts.chinese-gb18030-extb=SimSun-ExtB
allfonts.chinese-hkscs=MingLiU_HKSCS
allfonts.chinese-ms950-extb=MingLiU-ExtB
allfonts.devanagari=Mangal
allfonts.kannada=Tunga
allfonts.dingbats=Wingdings
allfonts.lucida=Lucida Sans Regular
allfonts.symbol=Symbol
@ -239,11 +240,11 @@ sequence.allfonts.x-windows-874=alphabetic,thai,dingbats,symbol
sequence.fallback=lucida,symbols,\
chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian
japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian,kannada
# Exclusion Ranges
exclusion.alphabetic=0700-1e9f,1f00-20ab,20ad-f8ff
exclusion.alphabetic=0700-1e9f,1f00-2017,2020-20ab,20ad-20b8,20bb-20bc,20be-f8ff
exclusion.chinese-gb18030=0390-03d6,2200-22ef,2701-27be
exclusion.hebrew=0041-005a,0060-007a,007f-00ff,20ac-20ac
@ -295,6 +296,7 @@ filename.GulimChe=gulim.TTC
filename.Lucida_Sans_Regular=LucidaSansRegular.ttf
filename.Mangal=MANGAL.TTF
filename.Tunga=TUNGA.TTF
filename.Symbol=SYMBOL.TTF
filename.Wingdings=WINGDING.TTF

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -41,7 +41,7 @@ include GendataPolicyJars.gmk
GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat
$(GENDATA_UNINAME): $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D)
$(call MakeDir, $(@D))
$(TOOL_CHARACTERNAME) $< $@
TARGETS += $(GENDATA_UNINAME)
@ -51,7 +51,7 @@ TARGETS += $(GENDATA_UNINAME)
GENDATA_CURDATA := $(JDK_OUTPUTDIR)/modules/java.base/java/util/currency.data
$(GENDATA_CURDATA): $(JDK_TOPDIR)/make/data/currency/CurrencyData.properties $(BUILD_TOOLS_JDK)
$(MKDIR) -p $(@D)
$(call MakeDir, $(@D))
$(RM) $@
$(TOOL_GENERATECURRENCYDATA) -o $@.tmp < $<
$(MV) $@.tmp $@
@ -67,10 +67,10 @@ GENDATA_JAVA_SECURITY := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/ja
# RESTRICTED_PKGS_SRC is optionally set in custom extension for this makefile
$(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS) $(GENDATA_JAVA_SECURITY_SRC) $(RESTRICTED_PKGS_SRC)
$(ECHO) "Generating java.security"
$(MKDIR) -p $(@D)
$(call LogInfo, Generating java.security)
$(call MakeDir, $(@D))
$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
$(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC) || exit 1
$(OPENJDK_TARGET_CPU_ARCH) $(RESTRICTED_PKGS_SRC)
TARGETS += $(GENDATA_JAVA_SECURITY)
@ -78,7 +78,7 @@ TARGETS += $(GENDATA_JAVA_SECURITY)
$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist: \
$(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS)
$(MKDIR) -p $(@D)
$(call MakeDir, $(@D))
$(RM) $@ $@.tmp
$(TOOL_ADDJSUM) $< $@.tmp
$(MV) $@.tmp $@

View File

@ -375,6 +375,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
$(X_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := type-limits pointer-to-int-cast \
deprecated-declarations unused-result maybe-uninitialized format \
format-security int-to-pointer-cast parentheses, \
@ -587,6 +588,7 @@ ifeq ($(BUILD_HEADLESS), true)
$(CUPS_CFLAGS) \
$(X_CFLAGS) \
$(LIBAWT_HEADLESS_CFLAGS), \
DISABLED_WARNINGS_xlc := 1506-356, \
DISABLED_WARNINGS_gcc := maybe-uninitialized int-to-pointer-cast, \
DISABLED_WARNINGS_solstudio := E_DECLARATION_IN_CODE \
E_EMPTY_TRANSLATION_UNIT, \
@ -603,6 +605,10 @@ ifeq ($(BUILD_HEADLESS), true)
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
))
# AIX warning explanation:
# 1506-356 : (W) Compilation unit is empty.
# This happens during the headless build
$(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
TARGETS += $(BUILD_LIBAWT_HEADLESS)
@ -700,6 +706,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
CFLAGS_windows = -DCC_NOEX, \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
type-limits missing-field-initializers, \
DISABLED_WARNINGS_CXX_gcc := reorder delete-non-virtual-dtor strict-overflow \

View File

@ -146,6 +146,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
$(LIBJAVA_CFLAGS), \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := unused-result, \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(LIBJAVA_MAPFILE), \
@ -266,7 +267,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \
LDFLAGS_windows := -export:JIMAGE_Open -export:JIMAGE_Close \
-export:JIMAGE_PackageToModule \
-export:JIMAGE_FindResource -export:JIMAGE_GetResource \
-export:JIMAGE_ResourceIterator, \
-export:JIMAGE_ResourceIterator -export:JIMAGE_ResourcePath, \
LIBS_unix := -ljvm -ldl $(LIBCXX), \
LIBS_solaris := -lc, \
LIBS_macosx := -lc++, \
@ -289,7 +290,7 @@ LIBJLI_SRC_DIRS := $(call FindSrcDirsForLib, java.base, jli)
LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
ifeq ($(JVM_VARIANT_ZERO), true)
ifeq ($(call check-jvm-variant, zero zeroshark), true)
ERGO_FAMILY := zero
else
ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)

View File

@ -0,0 +1,51 @@
#
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include LibCommon.gmk
################################################################################
ifeq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupNativeCompilation, BUILD_LIBEXTNET, \
LIBRARY := extnet, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
SRC := $(JDK_TOPDIR)/src/jdk.net/solaris/native/libextnet, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libextnet/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LIBS := -lsocket -lc -ljava, \
OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libextnet, \
))
$(BUILD_LIBEXTNET): $(call FindLib, java.base, java)
TARGETS += $(BUILD_LIBEXTNET)
endif
################################################################################

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