--- a/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
af9a674e12a16da1a4bd53e4990ddb1121a21ef1 jdk8-b109
b5d2bf482a3ea1cca08c994512804ffbc73de0a1 jdk8-b110
b9a0f6c693f347a6f4b9bb994957f4eaa05bdedd jdk8-b111
+ad67c34f79c28a8e755f4a49f313868619d6702c jdk8-b112
--- a/.hgtags-top-repo Mon Oct 28 10:52:07 2013 +0100
+++ b/.hgtags-top-repo Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
91f47e8da5c60de58ed195e9b57f3bf192a18f83 jdk8-b109
4faa09c7fe555de086dd9048d3c5cc92317d6f45 jdk8-b110
d086227bfc45d124f09b3bd72a07956b4073bf71 jdk8-b111
+547316ea137d83d9c63083a9b83db64198fe0c81 jdk8-b112
--- a/NewMakefile.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/NewMakefile.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,8 @@
TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
# Assume we have GNU make, but check version.
-ifeq (,$(findstring 3.81,$(MAKE_VERSION)))
- ifeq (,$(findstring 3.82,$(MAKE_VERSION)))
- $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
- endif
+ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
+ $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
endif
# Locate this Makefile
--- a/common/autoconf/basics.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/basics.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -212,6 +212,18 @@
[AC_MSG_WARN([Option --with-$1 is deprecated and will be ignored.])])
])
+# Register a --enable argument but mark it as deprecated
+# $1: The name of the with argument to deprecate, not including --enable-
+# $2: The name of the argument to deprecate, in shell variable style (i.e. with _ instead of -)
+AC_DEFUN([BASIC_DEPRECATED_ARG_ENABLE],
+[
+ AC_ARG_ENABLE($1, [AS_HELP_STRING([--enable-$1],
+ [Deprecated. Option is kept for backwards compatibility and is ignored])])
+ if test "x$enable_$2" != x; then
+ AC_MSG_WARN([Option --enable-$1 is deprecated and will be ignored.])
+ fi
+])
+
AC_DEFUN_ONCE([BASIC_INIT],
[
# Save the original command line. This is passed to us by the wrapper configure script.
@@ -502,7 +514,7 @@
if test "x$IS_GNU_MAKE" = x; then
AC_MSG_NOTICE([Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring.])
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[[12346789]]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[[12]]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
AC_MSG_NOTICE([Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring.])
else
@@ -644,6 +656,7 @@
fi
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ BASIC_REQUIRE_PROG(DSYMUTIL, dsymutil)
BASIC_REQUIRE_PROG(XATTR, xattr)
AC_PATH_PROG(CODESIGN, codesign)
if test "x$CODESIGN" != "x"; then
--- a/common/autoconf/configure.ac Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/configure.ac Mon Oct 28 12:28:57 2013 -0700
@@ -177,6 +177,9 @@
#
###############################################################################
+# After we have toolchain, we can compile fixpath. It's needed by the lib checks.
+BASIC_COMPILE_FIXPATH
+
LIB_SETUP_INIT
LIB_SETUP_X11
LIB_SETUP_CUPS
@@ -185,8 +188,6 @@
LIB_SETUP_MISC_LIBS
LIB_SETUP_STATIC_LINK_LIBSTDCPP
-# After we have toolchain and the paths to all libraries (needed by msys), we can compile the fixpath helper
-BASIC_COMPILE_FIXPATH
###############################################################################
#
--- a/common/autoconf/generated-configure.sh Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/generated-configure.sh Mon Oct 28 12:28:57 2013 -0700
@@ -634,7 +634,6 @@
ENABLE_INTREE_EC
SALIB_NAME
HOTSPOT_MAKE_ARGS
-FIXPATH
LIBCXX
LLVM_LIBS
LLVM_LDFLAGS
@@ -651,10 +650,9 @@
USE_EXTERNAL_LIBJPEG
ALSA_LIBS
ALSA_CFLAGS
-FREETYPE2_LIB_PATH
-USING_SYSTEM_FT_LIB
-FREETYPE2_LIBS
-FREETYPE2_CFLAGS
+FREETYPE_BUNDLE_LIB_PATH
+FREETYPE_LIBS
+FREETYPE_CFLAGS
CUPS_CFLAGS
OPENWIN_HOME
X_EXTRA_LIBS
@@ -662,6 +660,7 @@
X_PRE_LIBS
X_CFLAGS
XMKMF
+FIXPATH
CXXFLAGS_DEBUG_SYMBOLS
CFLAGS_DEBUG_SYMBOLS
ZIP_DEBUGINFO_FILES
@@ -825,6 +824,7 @@
PKG_CONFIG
CODESIGN
XATTR
+DSYMUTIL
IS_GNU_TIME
TIME
STAT
@@ -1046,6 +1046,9 @@
with_cups
with_cups_include
with_freetype
+with_freetype_include
+with_freetype_lib
+enable_freetype_bundling
with_alsa
with_alsa_include
with_alsa_lib
@@ -1078,8 +1081,8 @@
CPP
CXXCPP
XMKMF
-FREETYPE2_CFLAGS
-FREETYPE2_LIBS
+FREETYPE_CFLAGS
+FREETYPE_LIBS
ALSA_CFLAGS
ALSA_LIBS
LIBFFI_CFLAGS
@@ -1715,9 +1718,13 @@
--disable-debug-symbols disable generation of debug symbols [enabled]
--disable-zip-debug-info
disable zipping of debug-info files [enabled]
- --disable-macosx-runtime-support
- disable the use of MacOSX Java runtime support
- framework [enabled]
+ --enable-macosx-runtime-support
+ Deprecated. Option is kept for backwards
+ compatibility and is ignored
+ --disable-freetype-bundling
+ disable bundling of the freetype library with the
+ build result [enabled on Windows or when using
+ --with-freetype, disabled otherwise]
--enable-sjavac use sjavac to do fast incremental compiles
[disabled]
--disable-precompiled-headers
@@ -1803,9 +1810,11 @@
--with-cups specify prefix directory for the cups package
(expecting the headers under PATH/include)
--with-cups-include specify directory for the cups include files
- --with-freetype specify prefix directory for the freetype2 package
+ --with-freetype specify prefix directory for the freetype package
(expecting the libraries under PATH/lib and the
headers under PATH/include)
+ --with-freetype-include specify directory for the freetype include files
+ --with-freetype-lib specify directory for the freetype library
--with-alsa specify prefix directory for the alsa package
(expecting the libraries under PATH/lib and the
headers under PATH/include)
@@ -1846,10 +1855,10 @@
CPP C preprocessor
CXXCPP C++ preprocessor
XMKMF Path to xmkmf, Makefile generator for X Window System
- FREETYPE2_CFLAGS
- C compiler flags for FREETYPE2, overriding pkg-config
- FREETYPE2_LIBS
- linker flags for FREETYPE2, overriding pkg-config
+ FREETYPE_CFLAGS
+ C compiler flags for FREETYPE, overriding pkg-config
+ FREETYPE_LIBS
+ linker flags for FREETYPE, overriding pkg-config
ALSA_CFLAGS C compiler flags for ALSA, overriding pkg-config
ALSA_LIBS linker flags for ALSA, overriding pkg-config
LIBFFI_CFLAGS
@@ -3148,6 +3157,11 @@
# $1: The name of the with argument to deprecate, not including --with-
+# Register a --enable argument but mark it as deprecated
+# $1: The name of the with argument to deprecate, not including --enable-
+# $2: The name of the argument to deprecate, in shell variable style (i.e. with _ instead of -)
+
+
# Test that variable $1 denoting a program is not empty. If empty, exit with an error.
@@ -3443,16 +3457,42 @@
cygwin_help() {
case $1 in
unzip)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
zip)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P zip" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P zip )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
make)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P make" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P make )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
+ freetype)
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ HELP_MSG="To install freetype, run:
+wget \"http://gnuwin32.sourceforge.net/downlinks/freetype.php\" -O /tmp/freetype-setup.exe
+chmod +x /tmp/freetype-setup.exe
+/tmp/freetype-setup.exe
+Follow GUI prompts, and install to default directory \"C:\Program Files (x86)\GnuWin32\".
+After installation, locate lib/libfreetype.dll.a and make a copy with the name freetype.dll."
+ else
+ HELP_MSG="You need to build a 64-bit version of freetype.
+This is not readily available.
+You can find source code and build instructions on
+http://www.freetype.org/
+If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be found automatically."
+ fi
+ ;;
* )
break ;;
esac
}
+msys_help() {
+ PKGHANDLER_COMMAND=""
+}
+
apt_help() {
case $1 in
devkit)
@@ -3463,7 +3503,7 @@
PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
cups)
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
- freetype2)
+ freetype)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
@@ -3486,7 +3526,7 @@
PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
cups)
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
- freetype2)
+ freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
pulse)
PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
@@ -3614,6 +3654,8 @@
+
+
#
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -3812,13 +3854,17 @@
+
+
+
+
# This line needs to be here, verbatim, after all includes and the dummy hook
# definitions. It is replaced with custom functionality when building
# custom sources.
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1381407169
+DATE_WHEN_GENERATED=1382540536
###############################################################################
#
@@ -8269,7 +8315,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -8626,7 +8672,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -8980,7 +9026,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9339,7 +9385,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -9692,7 +9738,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&5
$as_echo "$as_me: Found potential make at $MAKE_CANDIDATE, however, this is not GNU Make. Ignoring." >&6;}
else
- IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '3.8[12346789]'`
+ IS_MODERN_MAKE=`$ECHO $MAKE_VERSION_STRING | $GREP '\(3\.8[12]\)\|\(4\.\)'`
if test "x$IS_MODERN_MAKE" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&5
$as_echo "$as_me: Found GNU make at $MAKE_CANDIDATE, however this is not version 3.81 or later. (it is: $MAKE_VERSION_STRING). Ignoring." >&6;}
@@ -10478,6 +10524,65 @@
if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
+ for ac_prog in dsymutil
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_DSYMUTIL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $DSYMUTIL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_DSYMUTIL="$DSYMUTIL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_DSYMUTIL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+DSYMUTIL=$ac_cv_path_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DSYMUTIL" && break
+done
+
+
+ if test "x$DSYMUTIL" = x; then
+ if test "xdsymutil" = x; then
+ PROG_NAME=dsymutil
+ else
+ PROG_NAME=dsymutil
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $PROG_NAME!" >&5
+$as_echo "$as_me: Could not find $PROG_NAME!" >&6;}
+ as_fn_error $? "Cannot continue" "$LINENO" 5
+ fi
+
+
+
for ac_prog in xattr
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -15717,27 +15822,34 @@
if test "x$BOOT_JDK_FOUND" = xno; then
# Print a helpful message on how to acquire the necessary build dependency.
- # openjdk is the help tag: freetyp2, cups, pulse, alsa etc
+ # openjdk is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=openjdk
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: Could not find a valid Boot JDK. $HELP_MSG" >&5
@@ -17415,63 +17527,303 @@
as_fn_error $? "Cannot continue" "$LINENO" 5
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
-$as_echo_n "checking for msvcr100.dll... " >&6; }
+
# Check whether --with-msvcr-dll was given.
if test "${with_msvcr_dll+set}" = set; then :
withval=$with_msvcr_dll;
fi
+
if test "x$with_msvcr_dll" != x; then
- MSVCR_DLL="$with_msvcr_dll"
- else
- if test "x$VCINSTALLDIR" != x; then
- if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
- else
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
- if test "x$MSVCR_DLL" = x; then
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
- fi
- fi
- if test "x$MSVCR_DLL" != x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR" >&5
-$as_echo "$as_me: msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR" >&6;}
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR" >&5
-$as_echo "$as_me: Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR" >&6;}
- fi
- fi
- # Try some fallback alternatives
+ # If given explicitely by user, do not probe. If not present, fail directly.
+
+ POSSIBLE_MSVCR_DLL="$with_msvcr_dll"
+ METHOD="--with-msvcr-dll"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
if test "x$MSVCR_DLL" = x; then
- # If visual studio express is installed, there is usually one with the debugger
- if test "x$VS100COMNTOOLS" != x; then
- if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
- MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
- { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS.." >&5
-$as_echo "$as_me: msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS.." >&6;}
- fi
- fi
- fi
- if test "x$MSVCR_DLL" = x; then
- if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
- # Fallback for 32bit builds, look in the windows directory.
- if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: msvcr100.dll found in $SYSTEMROOT/system32" >&5
-$as_echo "$as_me: msvcr100.dll found in $SYSTEMROOT/system32" >&6;}
- MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
- fi
- fi
- fi
- fi
+ as_fn_error $? "Could not find a proper msvcr100.dll as specified by --with-msvcr-dll" "$LINENO" 5
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Using well-known location from Visual Studio 10.0
+ if test "x$VCINSTALLDIR" != x; then
+ CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
+
+ windows_path="$CYGWIN_VC_INSTALL_DIR"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ CYGWIN_VC_INSTALL_DIR="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ CYGWIN_VC_INSTALL_DIR="$unix_path"
+ fi
+
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
+ else
+ POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
+ fi
+
+ POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ METHOD="well-known location in VCINSTALLDIR"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Check in the Boot JDK directory.
+ POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
+
+ POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ METHOD="well-known location in Boot JDK"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
+ fi
+
if test "x$MSVCR_DLL" = x; then
+ # Probe: Look in the Windows system32 directory
+ CYGWIN_SYSTEMROOT="$SYSTEMROOT"
+
+ windows_path="$CYGWIN_SYSTEMROOT"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ CYGWIN_SYSTEMROOT="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ CYGWIN_SYSTEMROOT="$unix_path"
+ fi
+
+ POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
+
+ POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ METHOD="well-known location in SYSTEMROOT"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: If Visual Studio Express is installed, there is usually one with the debugger
+ if test "x$VS100COMNTOOLS" != x; then
+ CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
+
+ windows_path="$CYGWIN_VS_TOOLS_DIR"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ CYGWIN_VS_TOOLS_DIR="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ CYGWIN_VS_TOOLS_DIR="$unix_path"
+ fi
+
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
+ else
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
+ fi
+
+ POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ METHOD="search of VS100COMNTOOLS"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
+ # (This was the original behaviour; kept since it might turn up something)
+ if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
+ else
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
+ if test "x$POSSIBLE_MSVCR_DLL" = x; then
+ # We're grasping at straws now...
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
+ fi
+ fi
+
+
+ POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ METHOD="search of VCINSTALLDIR"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
+$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
+
+ # Need to check if the found msvcr is correct architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
+$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
+$as_echo "$MSVCR_DLL" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
+$as_echo "incorrect, ignoring" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
+$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
+ fi
+ fi
+
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
+$as_echo_n "checking for msvcr100.dll... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- as_fn_error $? "Could not find msvcr100.dll !" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
-$as_echo "$MSVCR_DLL" >&6; }
+ as_fn_error $? "Could not find msvcr100.dll. Please specify using --with-msvcr-dll." "$LINENO" 5
+ fi
+
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -18874,27 +19226,34 @@
if test "x$CC" = x; then
# Print a helpful message on how to acquire the necessary build dependency.
- # devkit is the help tag: freetyp2, cups, pulse, alsa etc
+ # devkit is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=devkit
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find a $COMPILER_NAME compiler. $HELP_MSG" "$LINENO" 5
@@ -20446,27 +20805,34 @@
if test "x$CXX" = x; then
# Print a helpful message on how to acquire the necessary build dependency.
- # devkit is the help tag: freetyp2, cups, pulse, alsa etc
+ # devkit is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=devkit
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find a $COMPILER_NAME compiler. $HELP_MSG" "$LINENO" 5
@@ -29539,11 +29905,11 @@
elif test "x$enable_debug_symbols" = "xno"; then
ENABLE_DEBUG_SYMBOLS=false
else
- # default on macosx is false
- if test "x$OPENJDK_TARGET_OS" = xmacosx; then
- ENABLE_DEBUG_SYMBOLS=false
- # Default is on if objcopy is found, otherwise off
- elif test "x$OBJCOPY" != x || test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # Default is on if objcopy is found
+ if test "x$OBJCOPY" != x; then
+ ENABLE_DEBUG_SYMBOLS=true
+ # MacOS X and Windows don't use objcopy but default is on for those OSes
+ elif test "x$OPENJDK_TARGET_OS" = xmacosx || test "x$OPENJDK_TARGET_OS" = xwindows; then
ENABLE_DEBUG_SYMBOLS=true
else
ENABLE_DEBUG_SYMBOLS=false
@@ -29586,6 +29952,66 @@
#
###############################################################################
+# After we have toolchain, we can compile fixpath. It's needed by the lib checks.
+
+ # When using cygwin or msys, we need a wrapper binary that renames
+ # /cygdrive/c/ arguments into c:/ arguments and peeks into
+ # @files and rewrites these too! This wrapper binary is
+ # called fixpath.
+ FIXPATH=
+ if test "x$OPENJDK_BUILD_OS" = xwindows; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5
+$as_echo_n "checking if fixpath can be created... " >&6; }
+ FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
+ FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
+ if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
+ FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
+ FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
+ # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
+ FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
+ FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
+ FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
+
+ # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
+ # @ was chosen as separator to minimize risk of other tools messing around with it
+ all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
+ fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
+
+ FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
+ fi
+ rm -f $OUTPUT_ROOT/fixpath*
+ cd $OUTPUT_ROOT
+ $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
+ cd $CURDIR
+
+ if test ! -x $OUTPUT_ROOT/fixpath.exe; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ cat $OUTPUT_ROOT/fixpath1.log
+ as_fn_error $? "Could not create $OUTPUT_ROOT/fixpath.exe" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath.exe works" >&5
+$as_echo_n "checking if fixpath.exe works... " >&6; }
+ cd $OUTPUT_ROOT
+ $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
+ cd $CURDIR
+ if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ cat $OUTPUT_ROOT/fixpath2.log
+ as_fn_error $? "fixpath did not work!" "$LINENO" 5
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
+ fi
+
+
+
+
###############################################################################
@@ -29626,7 +30052,6 @@
ALSA_NOT_NEEDED=yes
PULSE_NOT_NEEDED=yes
X11_NOT_NEEDED=yes
- FREETYPE2_NOT_NEEDED=yes
# If the java runtime framework is disabled, then we need X11.
# This will be adjusted below.
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: alsa pulse x11" >&5
@@ -29642,7 +30067,7 @@
fi
if test "x$OPENJDK" = "xfalse"; then
- FREETYPE2_NOT_NEEDED=yes
+ FREETYPE_NOT_NEEDED=yes
fi
if test "x$SUPPORT_HEADFUL" = xno; then
@@ -29651,44 +30076,31 @@
###############################################################################
#
- # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
- # that uses this API.
- #
+ # Check for MacOSX support for OpenJDK.
+ #
+
+
# Check whether --enable-macosx-runtime-support was given.
if test "${enable_macosx_runtime_support+set}" = set; then :
- enableval=$enable_macosx_runtime_support; MACOSX_RUNTIME_SUPPORT="${enableval}"
-else
- MACOSX_RUNTIME_SUPPORT="no"
-fi
-
-
- USE_MACOSX_RUNTIME_SUPPORT=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for explicit Java runtime support in the OS" >&5
-$as_echo_n "checking for explicit Java runtime support in the OS... " >&6; }
+ enableval=$enable_macosx_runtime_support;
+fi
+
+ if test "x$enable_macosx_runtime_support" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&5
+$as_echo "$as_me: WARNING: Option --enable-macosx-runtime-support is deprecated and will be ignored." >&2;}
+ fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mac OS X Java Framework" >&5
+$as_echo_n "checking for Mac OS X Java Framework... " >&6; }
if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
- if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
- MACOSX_RUNTIME_SUPPORT=yes
- USE_MACOSX_RUNTIME_SUPPORT=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, does not need alsa freetype2 pulse and X11" >&5
-$as_echo "yes, does not need alsa freetype2 pulse and X11" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, but explicitly disabled." >&5
-$as_echo "yes, but explicitly disabled." >&6; }
- fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: /System/Library/Frameworks/JavaVM.framework" >&5
+$as_echo "/System/Library/Frameworks/JavaVM.framework" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
- if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking what is not needed on an X11 build on MacOSX?" >&5
-$as_echo_n "checking what is not needed on an X11 build on MacOSX?... " >&6; }
- X11_NOT_NEEDED=
- FREETYPE2_NOT_NEEDED=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: alsa pulse" >&5
-$as_echo "alsa pulse" >&6; }
- fi
-
###############################################################################
@@ -30412,42 +30824,39 @@
if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then
# Print a helpful message on how to acquire the necessary build dependency.
- # x11 is the help tag: freetyp2, cups, pulse, alsa etc
+ # x11 is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=x11
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find X11 libraries. $HELP_MSG" "$LINENO" 5
fi
- # Some of the old makefiles require a setting of OPENWIN_HOME
- # Since the X11R6 directory has disappeared on later Linuxes,
- # we need to probe for it.
- if test "x$OPENJDK_TARGET_OS" = xlinux; then
- if test -d "$SYS_ROOT/usr/X11R6"; then
- OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
- elif test -d "$SYS_ROOT/usr/include/X11"; then
- OPENWIN_HOME="$SYS_ROOT/usr"
- fi
- fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
fi
@@ -30507,27 +30916,34 @@
if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then
# Print a helpful message on how to acquire the necessary build dependency.
- # x11 is the help tag: freetyp2, cups, pulse, alsa etc
+ # x11 is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=x11
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG" "$LINENO" 5
@@ -30762,27 +31178,34 @@
if test "x$CUPS_FOUND" = xno; then
# Print a helpful message on how to acquire the necessary build dependency.
- # cups is the help tag: freetyp2, cups, pulse, alsa etc
+ # cups is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=cups
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find cups! $HELP_MSG " "$LINENO" 5
@@ -30796,7 +31219,7 @@
###############################################################################
#
- # The ubiquitous freetype2 library is used to render fonts.
+ # The ubiquitous freetype library is used to render fonts.
#
# Check whether --with-freetype was given.
@@ -30805,174 +31228,383 @@
fi
- # If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
- USING_SYSTEM_FT_LIB=false
-
- if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
+# Check whether --with-freetype-include was given.
+if test "${with_freetype_include+set}" = set; then :
+ withval=$with_freetype_include;
+fi
+
+
+# Check whether --with-freetype-lib was given.
+if test "${with_freetype_lib+set}" = set; then :
+ withval=$with_freetype_lib;
+fi
+
+ # Check whether --enable-freetype-bundling was given.
+if test "${enable_freetype_bundling+set}" = set; then :
+ enableval=$enable_freetype_bundling;
+fi
+
+
+ FREETYPE_CFLAGS=
+ FREETYPE_LIBS=
+ FREETYPE_BUNDLE_LIB_PATH=
+
+ if test "x$FREETYPE_NOT_NEEDED" = xyes; then
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: freetype not used, so --with-freetype is ignored" >&5
$as_echo "$as_me: WARNING: freetype not used, so --with-freetype is ignored" >&2;}
fi
- FREETYPE2_CFLAGS=
- FREETYPE2_LIBS=
- FREETYPE2_LIB_PATH=
- else
- FREETYPE2_FOUND=no
-
- if test "x$with_freetype" != x; then
-
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
- # Input might be given as Windows format, start by converting to
- # unix format.
- path="$with_freetype"
- new_path=`$CYGPATH -u "$path"`
-
- # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
- # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
- # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
- # "foo.exe" is OK but "foo" is an error.
- #
- # This test is therefore slightly more accurate than "test -f" to check for file precense.
- # It is also a way to make sure we got the proper file name for the real test later on.
- test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
- if test "x$test_shortpath" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_freetype, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of with_freetype, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Cannot locate the the path of with_freetype" "$LINENO" 5
- fi
-
- # Call helper function which possibly converts this using DOS-style short mode.
- # If so, the updated path is stored in $new_path.
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- shortmode_path=`$CYGPATH -s -m -a "$input_path"`
- path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
- if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
- # Going to short mode and back again did indeed matter. Since short mode is
- # case insensitive, let's make it lowercase to improve readability.
- shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Now convert it back to Unix-stile (cygpath)
- input_path=`$CYGPATH -u "$shortmode_path"`
- new_path="$input_path"
- fi
- fi
-
- test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
- if test "x$test_cygdrive_prefix" = x; then
- # As a simple fix, exclude /usr/bin since it's not a real path.
- if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
- # The path is in a Cygwin special directory (e.g. /home). We need this converted to
- # a path prefixed by /cygdrive for fixpath to work.
- new_path="$CYGWIN_ROOT_PATH$input_path"
- fi
- fi
-
-
- if test "x$path" != "x$new_path"; then
- with_freetype="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_freetype to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting with_freetype to \"$new_path\"" >&6;}
- fi
-
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
- path="$with_freetype"
- has_colon=`$ECHO $path | $GREP ^.:`
- new_path="$path"
- if test "x$has_colon" = x; then
- # Not in mixed or Windows style, start by that.
- new_path=`cmd //c echo $path`
- fi
-
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- fi
-
-
- windows_path="$new_path"
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- unix_path=`$CYGPATH -u "$windows_path"`
- new_path="$unix_path"
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
- unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
- new_path="$unix_path"
- fi
-
- if test "x$path" != "x$new_path"; then
- with_freetype="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting with_freetype to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting with_freetype to \"$new_path\"" >&6;}
- fi
-
- # Save the first 10 bytes of this path to the storage, so fixpath can work.
- all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
- else
- # We're on a posix platform. Hooray! :)
- path="$with_freetype"
- has_space=`$ECHO "$path" | $GREP " "`
- if test "x$has_space" != x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of with_freetype, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of with_freetype, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
- fi
-
- # Use eval to expand a potential ~
- eval path="$path"
- if test ! -f "$path" && test ! -d "$path"; then
- as_fn_error $? "The path of with_freetype, which resolves as \"$path\", is not found." "$LINENO" 5
- fi
-
- with_freetype="`cd "$path"; $THEPWDCMD -L`"
- fi
-
- FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
- FREETYPE2_LIB_PATH="$with_freetype/lib"
- if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
- FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
- FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
- fi
+ if test "x$enable_freetype_bundling" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: freetype not used, so --enable-freetype-bundling is ignored" >&5
+$as_echo "$as_me: WARNING: freetype not used, so --enable-freetype-bundling is ignored" >&2;}
+ fi
+ else
+ # freetype is needed to build; go get it!
+
+ BUNDLE_FREETYPE="$enable_freetype_bundling"
+
+ if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
+ # User has specified settings
+
+ if test "x$BUNDLE_FREETYPE" = x; then
+ # If not specified, default is to bundle freetype
+ BUNDLE_FREETYPE=yes
+ fi
+
+ if test "x$with_freetype" != x; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
+ fi
+
+ # Allow --with-freetype-lib and --with-freetype-include to override
+ if test "x$with_freetype_include" != x; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
+ fi
+ if test "x$with_freetype_lib" != x; then
+ POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
+ fi
+
+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
+ # Okay, we got it. Check that it works.
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ METHOD="--with-freetype"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
if test "x$OPENJDK_TARGET_OS" = xwindows; then
- FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
- fi
- FREETYPE2_CFLAGS="-I$with_freetype/include"
- if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
- FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
- fi
- FREETYPE2_FOUND=yes
- if test "x$FREETYPE2_FOUND" = xyes; then
- # Verify that the directories exist
- if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
- as_fn_error $? "Could not find the expected directories $with_freetype/lib and $with_freetype/include" "$LINENO" 5
- fi
- # List the contents of the lib.
- FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
- if test "x$FREETYPELIB" = x; then
- as_fn_error $? "Could not find libfreetype.so nor freetype.dll in $with_freetype/lib" "$LINENO" 5
- fi
- # Check one h-file
- if ! test -s "$with_freetype/include/ft2build.h"; then
- as_fn_error $? "Could not find $with_freetype/include/ft2build.h" "$LINENO" 5
- fi
- fi
- fi
- if test "x$FREETYPE2_FOUND" = xno; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ as_fn_error $? "Can not find or use freetype at location given by --with-freetype" "$LINENO" 5
+ fi
+ else
+ # User specified only one of lib or include. This is an error.
+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: User specified --with-freetype-lib but not --with-freetype-include" >&5
+$as_echo "$as_me: User specified --with-freetype-lib but not --with-freetype-include" >&6;}
+ as_fn_error $? "Need both freetype lib and include paths. Consider using --with-freetype instead." "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: User specified --with-freetype-include but not --with-freetype-lib" >&5
+$as_echo "$as_me: User specified --with-freetype-include but not --with-freetype-lib" >&6;}
+ as_fn_error $? "Need both freetype lib and include paths. Consider using --with-freetype instead." "$LINENO" 5
+ fi
+ fi
+ else
+ # User did not specify settings, but we need freetype. Try to locate it.
+
+ if test "x$BUNDLE_FREETYPE" = x; then
+ # If not specified, default is to bundle freetype only on windows
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ BUNDLE_FREETYPE=yes
+ else
+ BUNDLE_FREETYPE=no
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check builddeps
if test "x$with_builddeps_server" != x || test "x$with_builddeps_conf" != x; then
@@ -31100,176 +31732,49 @@
if test "x$depdir" = x; then
as_fn_error $? "Could not download build dependency freetype2" "$LINENO" 5
fi
- FREETYPE2=$depdir
+ FREETYPE=$depdir
if test "x$theroot" != x; then
- FREETYPE2="$theroot"
+ FREETYPE="$theroot"
fi
if test "x$thecflags" != x; then
- FREETYPE2_CFLAGS="$thecflags"
+ FREETYPE_CFLAGS="$thecflags"
fi
if test "x$thelibs" != x; then
- FREETYPE2_LIBS="$thelibs"
- fi
- FREETYPE2_FOUND=yes
- else FREETYPE2_FOUND=no
-
- fi
- else FREETYPE2_FOUND=no
-
- fi
-
- USING_SYSTEM_FT_LIB=true
- fi
- if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
- FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
-
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
-
- # Input might be given as Windows format, start by converting to
- # unix format.
- path="$FREETYPELOCATION"
- new_path=`$CYGPATH -u "$path"`
-
- # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
- # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
- # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
- # "foo.exe" is OK but "foo" is an error.
- #
- # This test is therefore slightly more accurate than "test -f" to check for file precense.
- # It is also a way to make sure we got the proper file name for the real test later on.
- test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
- if test "x$test_shortpath" = x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPELOCATION, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of FREETYPELOCATION, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Cannot locate the the path of FREETYPELOCATION" "$LINENO" 5
- fi
-
- # Call helper function which possibly converts this using DOS-style short mode.
- # If so, the updated path is stored in $new_path.
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- shortmode_path=`$CYGPATH -s -m -a "$input_path"`
- path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
- if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
- # Going to short mode and back again did indeed matter. Since short mode is
- # case insensitive, let's make it lowercase to improve readability.
- shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Now convert it back to Unix-stile (cygpath)
- input_path=`$CYGPATH -u "$shortmode_path"`
- new_path="$input_path"
- fi
- fi
-
- test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
- if test "x$test_cygdrive_prefix" = x; then
- # As a simple fix, exclude /usr/bin since it's not a real path.
- if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
- # The path is in a Cygwin special directory (e.g. /home). We need this converted to
- # a path prefixed by /cygdrive for fixpath to work.
- new_path="$CYGWIN_ROOT_PATH$input_path"
- fi
- fi
-
-
- if test "x$path" != "x$new_path"; then
- FREETYPELOCATION="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPELOCATION to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting FREETYPELOCATION to \"$new_path\"" >&6;}
- fi
-
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
-
- path="$FREETYPELOCATION"
- has_colon=`$ECHO $path | $GREP ^.:`
- new_path="$path"
- if test "x$has_colon" = x; then
- # Not in mixed or Windows style, start by that.
- new_path=`cmd //c echo $path`
- fi
-
-
- input_path="$new_path"
- # Check if we need to convert this using DOS-style short mode. If the path
- # contains just simple characters, use it. Otherwise (spaces, weird characters),
- # take no chances and rewrite it.
- # Note: m4 eats our [], so we need to use [ and ] instead.
- has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
- if test "x$has_forbidden_chars" != x; then
- # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
- new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- fi
-
-
- windows_path="$new_path"
- if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
- unix_path=`$CYGPATH -u "$windows_path"`
- new_path="$unix_path"
- elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
- unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
- new_path="$unix_path"
- fi
-
- if test "x$path" != "x$new_path"; then
- FREETYPELOCATION="$new_path"
- { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPELOCATION to \"$new_path\"" >&5
-$as_echo "$as_me: Rewriting FREETYPELOCATION to \"$new_path\"" >&6;}
- fi
-
- # Save the first 10 bytes of this path to the storage, so fixpath can work.
- all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
-
- else
- # We're on a posix platform. Hooray! :)
- path="$FREETYPELOCATION"
- has_space=`$ECHO "$path" | $GREP " "`
- if test "x$has_space" != x; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPELOCATION, which resolves as \"$path\", is invalid." >&5
-$as_echo "$as_me: The path of FREETYPELOCATION, which resolves as \"$path\", is invalid." >&6;}
- as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
- fi
-
- # Use eval to expand a potential ~
- eval path="$path"
- if test ! -f "$path" && test ! -d "$path"; then
- as_fn_error $? "The path of FREETYPELOCATION, which resolves as \"$path\", is not found." "$LINENO" 5
- fi
-
- FREETYPELOCATION="`cd "$path"; $THEPWDCMD -L`"
- fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype in some standard windows locations" >&5
-$as_echo_n "checking for freetype in some standard windows locations... " >&6; }
- if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
- FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
- FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
- FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
- if ! test -s "$FREETYPE2_LIBS"; then
- as_fn_error $? "Could not find $FREETYPE2_LIBS" "$LINENO" 5
- fi
- if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
- as_fn_error $? "Could not find $FREETYPE2_LIB_PATH/freetype.dll" "$LINENO" 5
- fi
- USING_SYSTEM_FT_LIB=true
- FREETYPE2_FOUND=yes
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE2_FOUND" >&5
-$as_echo "$FREETYPE2_FOUND" >&6; }
- fi
- if test "x$FREETYPE2_FOUND" = xno; then
+ FREETYPE_LIBS="$thelibs"
+ fi
+ FOUND_FREETYPE=yes
+ else FOUND_FREETYPE=no
+
+ fi
+ else FOUND_FREETYPE=no
+
+ fi
+
+ # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
+ if test "x$FOUND_FREETYPE" = xyes; then
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using builddeps, but ignoring since we can not bundle that" >&5
+$as_echo "$as_me: Found freetype using builddeps, but ignoring since we can not bundle that" >&6;}
+ FOUND_FREETYPE=no
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5
+$as_echo_n "checking for freetype... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using builddeps)" >&5
+$as_echo "yes (using builddeps)" >&6; }
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
+ if test "x$PKG_CONFIG" != x; then
pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE2" >&5
-$as_echo_n "checking for FREETYPE2... " >&6; }
-
-if test -n "$FREETYPE2_CFLAGS"; then
- pkg_cv_FREETYPE2_CFLAGS="$FREETYPE2_CFLAGS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FREETYPE" >&5
+$as_echo_n "checking for FREETYPE... " >&6; }
+
+if test -n "$FREETYPE_CFLAGS"; then
+ pkg_cv_FREETYPE_CFLAGS="$FREETYPE_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
@@ -31277,15 +31782,15 @@
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_FREETYPE2_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null`
+ pkg_cv_FREETYPE_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>/dev/null`
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
-if test -n "$FREETYPE2_LIBS"; then
- pkg_cv_FREETYPE2_LIBS="$FREETYPE2_LIBS"
+if test -n "$FREETYPE_LIBS"; then
+ pkg_cv_FREETYPE_LIBS="$FREETYPE_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"freetype2\""; } >&5
@@ -31293,7 +31798,7 @@
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
- pkg_cv_FREETYPE2_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null`
+ pkg_cv_FREETYPE_LIBS=`$PKG_CONFIG --libs "freetype2" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -31311,158 +31816,2523 @@
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- FREETYPE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "freetype2" 2>&1`
- else
- FREETYPE2_PKG_ERRORS=`$PKG_CONFIG --print-errors "freetype2" 2>&1`
+ FREETYPE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "freetype2" 2>&1`
+ else
+ FREETYPE_PKG_ERRORS=`$PKG_CONFIG --print-errors "freetype2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$FREETYPE2_PKG_ERRORS" >&5
+ echo "$FREETYPE_PKG_ERRORS" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
- FREETYPE2_FOUND=no
+ FOUND_FREETYPE=no
elif test $pkg_failed = untried; then
- FREETYPE2_FOUND=no
-else
- FREETYPE2_CFLAGS=$pkg_cv_FREETYPE2_CFLAGS
- FREETYPE2_LIBS=$pkg_cv_FREETYPE2_LIBS
+ FOUND_FREETYPE=no
+else
+ FREETYPE_CFLAGS=$pkg_cv_FREETYPE_CFLAGS
+ FREETYPE_LIBS=$pkg_cv_FREETYPE_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- FREETYPE2_FOUND=yes
-fi
- # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
- FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
- USING_SYSTEM_FT_LIB=true
- # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
- if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
- FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
- fi
- fi
- if test "x$FREETYPE2_FOUND" = xno; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype in some standard locations" >&5
-$as_echo_n "checking for freetype in some standard locations... " >&6; }
-
- if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then
- DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include"
- DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype"
- fi
- if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then
- DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2"
- DEFAULT_FREETYPE_LIBS="-lfreetype"
- fi
-
- PREV_CXXCFLAGS="$CXXFLAGS"
- PREV_LDFLAGS="$LDFLAGS"
- CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
- LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include<ft2build.h>
- #include FT_FREETYPE_H
- int main() { return 0; }
+ FOUND_FREETYPE=yes
+fi
+ if test "x$FOUND_FREETYPE" = xyes; then
+ # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
+ FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
+ # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
+ if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+ FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
+ fi
+ # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype using pkg-config, but ignoring since we can not bundle that" >&5
+$as_echo "$as_me: Found freetype using pkg-config, but ignoring since we can not bundle that" >&6;}
+ FOUND_FREETYPE=no
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype" >&5
+$as_echo_n "checking for freetype... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (using pkg-config)" >&5
+$as_echo "yes (using pkg-config)" >&6; }
+ fi
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check in well-known locations
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
+
+ windows_path="$FREETYPE_BASE_DIR"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ FREETYPE_BASE_DIR="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ FREETYPE_BASE_DIR="$unix_path"
+ fi
+
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
+
+ windows_path="$FREETYPE_BASE_DIR"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ FREETYPE_BASE_DIR="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ FREETYPE_BASE_DIR="$unix_path"
+ fi
+
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ fi
+ else
+ if test "x$SYS_ROOT" = "x/"; then
+ FREETYPE_ROOT=
+ else
+ FREETYPE_ROOT="$SYS_ROOT"
+ fi
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ else
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib/i386-linux-gnu"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$FREETYPE_BASE_DIR/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$FREETYPE_BASE_DIR/lib32"
+ METHOD="well-known location"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&5
+$as_echo "$as_me: Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD" >&6;}
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&5
+$as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of POTENTIAL_FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ POTENTIAL_FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting POTENTIAL_FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$POTENTIAL_FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of POTENTIAL_FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ POTENTIAL_FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype includes" >&5
+$as_echo_n "checking for freetype includes... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_INCLUDE_PATH" >&5
+$as_echo "$FREETYPE_INCLUDE_PATH" >&6; }
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype libraries" >&5
+$as_echo_n "checking for freetype libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIB_PATH" >&5
+$as_echo "$FREETYPE_LIB_PATH" >&6; }
+ fi
+
+ fi
+ fi
+ fi
+ fi
+ fi # end check in well-known locations
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+
+ # Print a helpful message on how to acquire the necessary build dependency.
+ # freetype is the help tag: freetype, cups, pulse, alsa etc
+ MISSING_DEPENDENCY=freetype
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
+ fi
+
+ as_fn_error $? "Could not find freetype! $HELP_MSG " "$LINENO" 5
+ fi
+ fi # end user specified settings
+
+ # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
+ if test "x$FREETYPE_CFLAGS" = x; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$FREETYPE_INCLUDE_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of FREETYPE_INCLUDE_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$FREETYPE_INCLUDE_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_INCLUDE_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_INCLUDE_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$FREETYPE_INCLUDE_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of FREETYPE_INCLUDE_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ FREETYPE_INCLUDE_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
+ FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
+ else
+ FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
+ fi
+ fi
+
+ if test "x$FREETYPE_LIBS" = x; then
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+
+ # Input might be given as Windows format, start by converting to
+ # unix format.
+ path="$FREETYPE_LIB_PATH"
+ new_path=`$CYGPATH -u "$path"`
+
+ # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
+ # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
+ # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
+ # "foo.exe" is OK but "foo" is an error.
+ #
+ # This test is therefore slightly more accurate than "test -f" to check for file precense.
+ # It is also a way to make sure we got the proper file name for the real test later on.
+ test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
+ if test "x$test_shortpath" = x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Cannot locate the the path of FREETYPE_LIB_PATH" "$LINENO" 5
+ fi
+
+ # Call helper function which possibly converts this using DOS-style short mode.
+ # If so, the updated path is stored in $new_path.
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ shortmode_path=`$CYGPATH -s -m -a "$input_path"`
+ path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
+ if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
+ # Going to short mode and back again did indeed matter. Since short mode is
+ # case insensitive, let's make it lowercase to improve readability.
+ shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Now convert it back to Unix-stile (cygpath)
+ input_path=`$CYGPATH -u "$shortmode_path"`
+ new_path="$input_path"
+ fi
+ fi
+
+ test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
+ if test "x$test_cygdrive_prefix" = x; then
+ # As a simple fix, exclude /usr/bin since it's not a real path.
+ if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
+ # The path is in a Cygwin special directory (e.g. /home). We need this converted to
+ # a path prefixed by /cygdrive for fixpath to work.
+ new_path="$CYGWIN_ROOT_PATH$input_path"
+ fi
+ fi
+
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+
+ path="$FREETYPE_LIB_PATH"
+ has_colon=`$ECHO $path | $GREP ^.:`
+ new_path="$path"
+ if test "x$has_colon" = x; then
+ # Not in mixed or Windows style, start by that.
+ new_path=`cmd //c echo $path`
+ fi
+
+
+ input_path="$new_path"
+ # Check if we need to convert this using DOS-style short mode. If the path
+ # contains just simple characters, use it. Otherwise (spaces, weird characters),
+ # take no chances and rewrite it.
+ # Note: m4 eats our [], so we need to use [ and ] instead.
+ has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
+ if test "x$has_forbidden_chars" != x; then
+ # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
+ new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ fi
+
+
+ windows_path="$new_path"
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ unix_path=`$CYGPATH -u "$windows_path"`
+ new_path="$unix_path"
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
+ new_path="$unix_path"
+ fi
+
+ if test "x$path" != "x$new_path"; then
+ FREETYPE_LIB_PATH="$new_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&5
+$as_echo "$as_me: Rewriting FREETYPE_LIB_PATH to \"$new_path\"" >&6;}
+ fi
+
+ # Save the first 10 bytes of this path to the storage, so fixpath can work.
+ all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
+
+ else
+ # We're on a posix platform. Hooray! :)
+ path="$FREETYPE_LIB_PATH"
+ has_space=`$ECHO "$path" | $GREP " "`
+ if test "x$has_space" != x; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&5
+$as_echo "$as_me: The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is invalid." >&6;}
+ as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
+ fi
+
+ # Use eval to expand a potential ~
+ eval path="$path"
+ if test ! -f "$path" && test ! -d "$path"; then
+ as_fn_error $? "The path of FREETYPE_LIB_PATH, which resolves as \"$path\", is not found." "$LINENO" 5
+ fi
+
+ FREETYPE_LIB_PATH="`cd "$path"; $THEPWDCMD -L`"
+ fi
+
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
+ else
+ FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
+ fi
+ fi
+
+ # Try to compile it
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can compile and link with freetype" >&5
+$as_echo_n "checking if we can compile and link with freetype... " >&6; }
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ PREV_CXXCFLAGS="$CXXFLAGS"
+ PREV_LDFLAGS="$LDFLAGS"
+ PREV_CXX="$CXX"
+ CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
+ LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
+ CXX="$FIXPATH $CXX"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include<ft2build.h>
+ #include FT_FREETYPE_H
+ int main () {
+ FT_Init_FreeType(NULL);
+ return 0;
+ }
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
- # Yes, the default cflags and libs did the trick.
- FREETYPE2_FOUND=yes
- FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
- FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
-
-else
-
- FREETYPE2_FOUND=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Could not compile and link with freetype. This might be a 32/64-bit mismatch." >&5
+$as_echo "$as_me: Could not compile and link with freetype. This might be a 32/64-bit mismatch." >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS" >&5
+$as_echo "$as_me: Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS" >&6;}
+
+
+ # Print a helpful message on how to acquire the necessary build dependency.
+ # freetype is the help tag: freetype, cups, pulse, alsa etc
+ MISSING_DEPENDENCY=freetype
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
+ fi
+
+
+ as_fn_error $? "Can not continue without freetype. $HELP_MSG" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
- CXXCFLAGS="$PREV_CXXFLAGS"
- LDFLAGS="$PREV_LDFLAGS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE2_FOUND" >&5
-$as_echo "$FREETYPE2_FOUND" >&6; }
- USING_SYSTEM_FT_LIB=true
- fi
- if test "x$FREETYPE2_FOUND" = xno; then
-
- # Print a helpful message on how to acquire the necessary build dependency.
- # freetype2 is the help tag: freetyp2, cups, pulse, alsa etc
- MISSING_DEPENDENCY=freetype2
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
- fi
-
- as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5
- fi
-
- if test "x$OPENJDK_TARGET_OS" != xwindows; then
- # AC_CHECK_LIB does not support use of cl.exe
- PREV_LDFLAGS="$LDFLAGS"
- LDFLAGS="$FREETYPE2_LIBS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FT_Init_FreeType in -lfreetype" >&5
-$as_echo_n "checking for FT_Init_FreeType in -lfreetype... " >&6; }
-if ${ac_cv_lib_freetype_FT_Init_FreeType+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfreetype $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char FT_Init_FreeType ();
-int
-main ()
-{
-return FT_Init_FreeType ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
- ac_cv_lib_freetype_FT_Init_FreeType=yes
-else
- ac_cv_lib_freetype_FT_Init_FreeType=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_freetype_FT_Init_FreeType" >&5
-$as_echo "$ac_cv_lib_freetype_FT_Init_FreeType" >&6; }
-if test "x$ac_cv_lib_freetype_FT_Init_FreeType" = xyes; then :
- FREETYPE2_FOUND=true
-else
- as_fn_error $? "Could not find freetype2! $HELP_MSG " "$LINENO" 5
-fi
-
- LDFLAGS="$PREV_LDFLAGS"
- fi
- fi
-
+ CXXCFLAGS="$PREV_CXXFLAGS"
+ LDFLAGS="$PREV_LDFLAGS"
+ CXX="$PREV_CXX"
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we should bundle freetype" >&5
+$as_echo_n "checking if we should bundle freetype... " >&6; }
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUNDLE_FREETYPE" >&5
+$as_echo "$BUNDLE_FREETYPE" >&6; }
+
+ fi # end freetype needed
@@ -31760,27 +34630,34 @@
if test "x$ALSA_FOUND" = xno; then
# Print a helpful message on how to acquire the necessary build dependency.
- # alsa is the help tag: freetyp2, cups, pulse, alsa etc
+ # alsa is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=alsa
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
as_fn_error $? "Could not find alsa! $HELP_MSG " "$LINENO" 5
@@ -32508,65 +35385,6 @@
-# After we have toolchain and the paths to all libraries (needed by msys), we can compile the fixpath helper
-
- # When using cygwin or msys, we need a wrapper binary that renames
- # /cygdrive/c/ arguments into c:/ arguments and peeks into
- # @files and rewrites these too! This wrapper binary is
- # called fixpath.
- FIXPATH=
- if test "x$OPENJDK_BUILD_OS" = xwindows; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath can be created" >&5
-$as_echo_n "checking if fixpath can be created... " >&6; }
- FIXPATH_SRC="$SRC_ROOT/common/src/fixpath.c"
- FIXPATH_BIN="$OUTPUT_ROOT/fixpath.exe"
- if test "x$OPENJDK_BUILD_OS_ENV" = xwindows.cygwin; then
- FIXPATH_SRC=`$CYGPATH -m $FIXPATH_SRC`
- FIXPATH_BIN=`$CYGPATH -m $FIXPATH_BIN`
- # Important to keep the .exe suffix on Cygwin for Hotspot makefiles
- FIXPATH="$OUTPUT_ROOT/fixpath.exe -c"
- elif test "x$OPENJDK_BUILD_OS_ENV" = xwindows.msys; then
- FIXPATH_SRC=`cmd //c echo $FIXPATH_SRC`
- FIXPATH_BIN=`cmd //c echo $FIXPATH_BIN`
-
- # Take all collected prefixes and turn them into a -m/c/foo@/c/bar@... command line
- # @ was chosen as separator to minimize risk of other tools messing around with it
- all_unique_prefixes=`echo "${all_fixpath_prefixes[@]}" | tr ' ' '\n' | grep '^/./' | sort | uniq`
- fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
-
- FIXPATH="$OUTPUT_ROOT/fixpath -m$fixpath_argument_list"
- fi
- rm -f $OUTPUT_ROOT/fixpath*
- cd $OUTPUT_ROOT
- $CC $FIXPATH_SRC -Fe$FIXPATH_BIN > $OUTPUT_ROOT/fixpath1.log 2>&1
- cd $CURDIR
-
- if test ! -x $OUTPUT_ROOT/fixpath.exe; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- cat $OUTPUT_ROOT/fixpath1.log
- as_fn_error $? "Could not create $OUTPUT_ROOT/fixpath.exe" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if fixpath.exe works" >&5
-$as_echo_n "checking if fixpath.exe works... " >&6; }
- cd $OUTPUT_ROOT
- $FIXPATH $CC $SRC_ROOT/common/src/fixpath.c -Fe$OUTPUT_ROOT/fixpath2.exe > $OUTPUT_ROOT/fixpath2.log 2>&1
- cd $CURDIR
- if test ! -x $OUTPUT_ROOT/fixpath2.exe; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- cat $OUTPUT_ROOT/fixpath2.log
- as_fn_error $? "fixpath did not work!" "$LINENO" 5
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- rm -f $OUTPUT_ROOT/fixpath?.??? $OUTPUT_ROOT/fixpath.obj
- fi
-
-
-
###############################################################################
#
@@ -34572,27 +37390,34 @@
printf "$CCACHE_HELP_MSG\n"
# Print a helpful message on how to acquire the necessary build dependency.
- # ccache is the help tag: freetyp2, cups, pulse, alsa etc
+ # ccache is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=ccache
- PKGHANDLER_COMMAND=
-
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
-
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
+
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
+
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
printf "$HELP_MSG\n"
--- a/common/autoconf/help.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/help.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -31,43 +31,76 @@
AC_DEFUN([HELP_MSG_MISSING_DEPENDENCY],
[
# Print a helpful message on how to acquire the necessary build dependency.
- # $1 is the help tag: freetyp2, cups, pulse, alsa etc
+ # $1 is the help tag: freetype, cups, pulse, alsa etc
MISSING_DEPENDENCY=$1
- PKGHANDLER_COMMAND=
+
+ if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
+ cygwin_help $MISSING_DEPENDENCY
+ elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
+ msys_help $MISSING_DEPENDENCY
+ else
+ PKGHANDLER_COMMAND=
- case $PKGHANDLER in
- apt-get)
- apt_help $MISSING_DEPENDENCY ;;
- yum)
- yum_help $MISSING_DEPENDENCY ;;
- port)
- port_help $MISSING_DEPENDENCY ;;
- pkgutil)
- pkgutil_help $MISSING_DEPENDENCY ;;
- pkgadd)
- pkgadd_help $MISSING_DEPENDENCY ;;
- * )
- break ;;
- esac
+ case $PKGHANDLER in
+ apt-get)
+ apt_help $MISSING_DEPENDENCY ;;
+ yum)
+ yum_help $MISSING_DEPENDENCY ;;
+ port)
+ port_help $MISSING_DEPENDENCY ;;
+ pkgutil)
+ pkgutil_help $MISSING_DEPENDENCY ;;
+ pkgadd)
+ pkgadd_help $MISSING_DEPENDENCY ;;
+ * )
+ break ;;
+ esac
- if test "x$PKGHANDLER_COMMAND" != x; then
- HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ if test "x$PKGHANDLER_COMMAND" != x; then
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ fi
fi
])
cygwin_help() {
case $1 in
unzip)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P unzip )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
zip)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P zip" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P zip )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
make)
- PKGHANDLER_COMMAND="cd <location of cygwin setup.exe> && cmd /c setup -q -P make" ;;
+ PKGHANDLER_COMMAND="( cd <location of cygwin setup.exe> && cmd /c setup -q -P make )"
+ HELP_MSG="You might be able to fix this by running '$PKGHANDLER_COMMAND'."
+ ;;
+ freetype)
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ HELP_MSG="To install freetype, run:
+wget \"http://gnuwin32.sourceforge.net/downlinks/freetype.php\" -O /tmp/freetype-setup.exe
+chmod +x /tmp/freetype-setup.exe
+/tmp/freetype-setup.exe
+Follow GUI prompts, and install to default directory \"C:\Program Files (x86)\GnuWin32\".
+After installation, locate lib/libfreetype.dll.a and make a copy with the name freetype.dll."
+ else
+ HELP_MSG="You need to build a 64-bit version of freetype.
+This is not readily available.
+You can find source code and build instructions on
+http://www.freetype.org/
+If you put the resulting build in \"C:\Program Files\GnuWin32\", it will be found automatically."
+ fi
+ ;;
* )
break ;;
esac
}
+msys_help() {
+ PKGHANDLER_COMMAND=""
+}
+
apt_help() {
case $1 in
devkit)
@@ -78,7 +111,7 @@
PKGHANDLER_COMMAND="sudo apt-get install libasound2-dev" ;;
cups)
PKGHANDLER_COMMAND="sudo apt-get install libcups2-dev" ;;
- freetype2)
+ freetype)
PKGHANDLER_COMMAND="sudo apt-get install libfreetype6-dev" ;;
pulse)
PKGHANDLER_COMMAND="sudo apt-get install libpulse-dev" ;;
@@ -101,7 +134,7 @@
PKGHANDLER_COMMAND="sudo yum install alsa-lib-devel" ;;
cups)
PKGHANDLER_COMMAND="sudo yum install cups-devel" ;;
- freetype2)
+ freetype)
PKGHANDLER_COMMAND="sudo yum install freetype-devel" ;;
pulse)
PKGHANDLER_COMMAND="sudo yum install pulseaudio-libs-devel" ;;
--- a/common/autoconf/hotspot-spec.gmk.in Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/hotspot-spec.gmk.in Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -123,8 +123,7 @@
# Hotspot expects the variable ZIP_DEBUGINFO_FILES=1/0 and not true/false.
ifeq ($(ZIP_DEBUGINFO_FILES)$(ENABLE_DEBUG_SYMBOLS), truetrue)
ZIP_DEBUGINFO_FILES:=1
-endif
-ifeq ($(ZIP_DEBUGINFO_FILES), false)
+else
ZIP_DEBUGINFO_FILES:=0
endif
--- a/common/autoconf/jdk-options.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/jdk-options.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -516,11 +516,11 @@
elif test "x$enable_debug_symbols" = "xno"; then
ENABLE_DEBUG_SYMBOLS=false
else
- # default on macosx is false
- if test "x$OPENJDK_TARGET_OS" = xmacosx; then
- ENABLE_DEBUG_SYMBOLS=false
- # Default is on if objcopy is found, otherwise off
- elif test "x$OBJCOPY" != x || test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # Default is on if objcopy is found
+ if test "x$OBJCOPY" != x; then
+ ENABLE_DEBUG_SYMBOLS=true
+ # MacOS X and Windows don't use objcopy but default is on for those OSes
+ elif test "x$OPENJDK_TARGET_OS" = xmacosx || test "x$OPENJDK_TARGET_OS" = xwindows; then
ENABLE_DEBUG_SYMBOLS=true
else
ENABLE_DEBUG_SYMBOLS=false
--- a/common/autoconf/libraries.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/libraries.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -57,7 +57,6 @@
ALSA_NOT_NEEDED=yes
PULSE_NOT_NEEDED=yes
X11_NOT_NEEDED=yes
- FREETYPE2_NOT_NEEDED=yes
# If the java runtime framework is disabled, then we need X11.
# This will be adjusted below.
AC_MSG_RESULT([alsa pulse x11])
@@ -70,7 +69,7 @@
fi
if test "x$OPENJDK" = "xfalse"; then
- FREETYPE2_NOT_NEEDED=yes
+ FREETYPE_NOT_NEEDED=yes
fi
if test "x$SUPPORT_HEADFUL" = xno; then
@@ -79,33 +78,17 @@
###############################################################################
#
- # Check for MacOSX support for OpenJDK. If this exists, try to build a JVM
- # that uses this API.
+ # Check for MacOSX support for OpenJDK.
#
- AC_ARG_ENABLE([macosx-runtime-support], [AS_HELP_STRING([--disable-macosx-runtime-support],
- [disable the use of MacOSX Java runtime support framework @<:@enabled@:>@])],
- [MACOSX_RUNTIME_SUPPORT="${enableval}"],[MACOSX_RUNTIME_SUPPORT="no"])
- USE_MACOSX_RUNTIME_SUPPORT=no
- AC_MSG_CHECKING([for explicit Java runtime support in the OS])
+ BASIC_DEPRECATED_ARG_ENABLE(macosx-runtime-support, macosx_runtime_support)
+
+ AC_MSG_CHECKING([for Mac OS X Java Framework])
if test -f /System/Library/Frameworks/JavaVM.framework/Frameworks/JavaRuntimeSupport.framework/Headers/JavaRuntimeSupport.h; then
- if test "x$MACOSX_RUNTIME_SUPPORT" != xno; then
- MACOSX_RUNTIME_SUPPORT=yes
- USE_MACOSX_RUNTIME_SUPPORT=yes
- AC_MSG_RESULT([yes, does not need alsa freetype2 pulse and X11])
- else
- AC_MSG_RESULT([yes, but explicitly disabled.])
- fi
+ AC_MSG_RESULT([/System/Library/Frameworks/JavaVM.framework])
else
AC_MSG_RESULT([no])
fi
-
- if test "x$OPENJDK_TARGET_OS" = xmacosx && test "x$USE_MACOSX_RUNTIME_SUPPORT" = xno; then
- AC_MSG_CHECKING([what is not needed on an X11 build on MacOSX?])
- X11_NOT_NEEDED=
- FREETYPE2_NOT_NEEDED=
- AC_MSG_RESULT([alsa pulse])
- fi
])
AC_DEFUN_ONCE([LIB_SETUP_X11],
@@ -153,16 +136,6 @@
AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG])
fi
- # Some of the old makefiles require a setting of OPENWIN_HOME
- # Since the X11R6 directory has disappeared on later Linuxes,
- # we need to probe for it.
- if test "x$OPENJDK_TARGET_OS" = xlinux; then
- if test -d "$SYS_ROOT/usr/X11R6"; then
- OPENWIN_HOME="$SYS_ROOT/usr/X11R6"
- elif test -d "$SYS_ROOT/usr/include/X11"; then
- OPENWIN_HOME="$SYS_ROOT/usr"
- fi
- fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
OPENWIN_HOME="/usr/openwin"
fi
@@ -277,151 +250,279 @@
])
+AC_DEFUN([LIB_CHECK_POTENTIAL_FREETYPE],
+[
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$1"
+ POTENTIAL_FREETYPE_LIB_PATH="$2"
+ METHOD="$3"
+
+ # First check if the files exists.
+ if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
+ # We found an arbitrary include file. That's a good sign.
+ AC_MSG_NOTICE([Found freetype include files at $POTENTIAL_FREETYPE_INCLUDE_PATH using $METHOD])
+ FOUND_FREETYPE=yes
+
+ FREETYPE_LIB_NAME="${LIBRARY_PREFIX}freetype${SHARED_LIBRARY_SUFFIX}"
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME"; then
+ AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/$FREETYPE_LIB_NAME. Ignoring location.])
+ FOUND_FREETYPE=no
+ else
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ # On Windows, we will need both .lib and .dll file.
+ if ! test -s "$POTENTIAL_FREETYPE_LIB_PATH/freetype.lib"; then
+ AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
+ FOUND_FREETYPE=no
+ fi
+ elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
+ # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
+ POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+ fi
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" = xyes; then
+ BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_INCLUDE_PATH)
+ BASIC_FIXUP_PATH(POTENTIAL_FREETYPE_LIB_PATH)
+
+ FREETYPE_INCLUDE_PATH="$POTENTIAL_FREETYPE_INCLUDE_PATH"
+ AC_MSG_CHECKING([for freetype includes])
+ AC_MSG_RESULT([$FREETYPE_INCLUDE_PATH])
+ FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH"
+ AC_MSG_CHECKING([for freetype libraries])
+ AC_MSG_RESULT([$FREETYPE_LIB_PATH])
+ fi
+])
+
AC_DEFUN_ONCE([LIB_SETUP_FREETYPE],
[
###############################################################################
#
- # The ubiquitous freetype2 library is used to render fonts.
+ # The ubiquitous freetype library is used to render fonts.
#
AC_ARG_WITH(freetype, [AS_HELP_STRING([--with-freetype],
- [specify prefix directory for the freetype2 package
+ [specify prefix directory for the freetype package
(expecting the libraries under PATH/lib and the headers under PATH/include)])])
+ AC_ARG_WITH(freetype-include, [AS_HELP_STRING([--with-freetype-include],
+ [specify directory for the freetype include files])])
+ AC_ARG_WITH(freetype-lib, [AS_HELP_STRING([--with-freetype-lib],
+ [specify directory for the freetype library])])
+ AC_ARG_ENABLE(freetype-bundling, [AS_HELP_STRING([--disable-freetype-bundling],
+ [disable bundling of the freetype library with the build result @<:@enabled on Windows or when using --with-freetype, disabled otherwise@:>@])])
- # If we are using the OS installed system lib for freetype, then we do not need to copy it to the build tree
- USING_SYSTEM_FT_LIB=false
+ FREETYPE_CFLAGS=
+ FREETYPE_LIBS=
+ FREETYPE_BUNDLE_LIB_PATH=
- if test "x$FREETYPE2_NOT_NEEDED" = xyes; then
+ if test "x$FREETYPE_NOT_NEEDED" = xyes; then
if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
AC_MSG_WARN([freetype not used, so --with-freetype is ignored])
fi
- FREETYPE2_CFLAGS=
- FREETYPE2_LIBS=
- FREETYPE2_LIB_PATH=
+ if test "x$enable_freetype_bundling" != x; then
+ AC_MSG_WARN([freetype not used, so --enable-freetype-bundling is ignored])
+ fi
else
- FREETYPE2_FOUND=no
+ # freetype is needed to build; go get it!
+
+ BUNDLE_FREETYPE="$enable_freetype_bundling"
+
+ if test "x$with_freetype" != x || test "x$with_freetype_include" != x || test "x$with_freetype_lib" != x; then
+ # User has specified settings
+
+ if test "x$BUNDLE_FREETYPE" = x; then
+ # If not specified, default is to bundle freetype
+ BUNDLE_FREETYPE=yes
+ fi
+
+ if test "x$with_freetype" != x; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype/include"
+ POTENTIAL_FREETYPE_LIB_PATH="$with_freetype/lib"
+ fi
+
+ # Allow --with-freetype-lib and --with-freetype-include to override
+ if test "x$with_freetype_include" != x; then
+ POTENTIAL_FREETYPE_INCLUDE_PATH="$with_freetype_include"
+ fi
+ if test "x$with_freetype_lib" != x; then
+ POTENTIAL_FREETYPE_LIB_PATH="$with_freetype_lib"
+ fi
- if test "x$with_freetype" != x; then
- BASIC_FIXUP_PATH(with_freetype)
- FREETYPE2_LIBS="-L$with_freetype/lib -lfreetype"
- FREETYPE2_LIB_PATH="$with_freetype/lib"
- if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -d "$with_freetype/lib/amd64"; then
- FREETYPE2_LIBS="-L$with_freetype/lib/amd64 -lfreetype"
- FREETYPE2_LIB_PATH="$with_freetype/lib/amd64"
+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" != x && test "x$POTENTIAL_FREETYPE_LIB_PATH" != x; then
+ # Okay, we got it. Check that it works.
+ LIB_CHECK_POTENTIAL_FREETYPE($POTENTIAL_FREETYPE_INCLUDE_PATH, $POTENTIAL_FREETYPE_LIB_PATH, [--with-freetype])
+ if test "x$FOUND_FREETYPE" != xyes; then
+ AC_MSG_ERROR([Can not find or use freetype at location given by --with-freetype])
+ fi
+ else
+ # User specified only one of lib or include. This is an error.
+ if test "x$POTENTIAL_FREETYPE_INCLUDE_PATH" = x ; then
+ AC_MSG_NOTICE([User specified --with-freetype-lib but not --with-freetype-include])
+ AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
+ else
+ AC_MSG_NOTICE([User specified --with-freetype-include but not --with-freetype-lib])
+ AC_MSG_ERROR([Need both freetype lib and include paths. Consider using --with-freetype instead.])
+ fi
fi
- if test "x$OPENJDK_TARGET_OS" = xwindows; then
- FREETYPE2_LIBS="$with_freetype/lib/freetype.lib"
+ else
+ # User did not specify settings, but we need freetype. Try to locate it.
+
+ if test "x$BUNDLE_FREETYPE" = x; then
+ # If not specified, default is to bundle freetype only on windows
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ BUNDLE_FREETYPE=yes
+ else
+ BUNDLE_FREETYPE=no
+ fi
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check builddeps
+ BDEPS_CHECK_MODULE(FREETYPE, freetype2, xxx, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
+ # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
+ if test "x$FOUND_FREETYPE" = xyes; then
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ AC_MSG_NOTICE([Found freetype using builddeps, but ignoring since we can not bundle that])
+ FOUND_FREETYPE=no
+ else
+ AC_MSG_CHECKING([for freetype])
+ AC_MSG_RESULT([yes (using builddeps)])
+ fi
+ fi
fi
- FREETYPE2_CFLAGS="-I$with_freetype/include"
- if test -s $with_freetype/include/ft2build.h && test -d $with_freetype/include/freetype2/freetype; then
- FREETYPE2_CFLAGS="-I$with_freetype/include/freetype2 -I$with_freetype/include"
- fi
- FREETYPE2_FOUND=yes
- if test "x$FREETYPE2_FOUND" = xyes; then
- # Verify that the directories exist
- if ! test -d "$with_freetype/lib" || ! test -d "$with_freetype/include"; then
- AC_MSG_ERROR([Could not find the expected directories $with_freetype/lib and $with_freetype/include])
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check modules using pkg-config, but only if we have it (ugly output results otherwise)
+ if test "x$PKG_CONFIG" != x; then
+ PKG_CHECK_MODULES(FREETYPE, freetype2, [FOUND_FREETYPE=yes], [FOUND_FREETYPE=no])
+ if test "x$FOUND_FREETYPE" = xyes; then
+ # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
+ FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's/-lz//g'`
+ # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
+ if test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
+ FREETYPE_LIBS=`$ECHO $FREETYPE_LIBS | $SED 's?/lib?/lib/amd64?g'`
+ fi
+ # BDEPS_CHECK_MODULE will set FREETYPE_CFLAGS and _LIBS, but we don't get a lib path for bundling.
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ AC_MSG_NOTICE([Found freetype using pkg-config, but ignoring since we can not bundle that])
+ FOUND_FREETYPE=no
+ else
+ AC_MSG_CHECKING([for freetype])
+ AC_MSG_RESULT([yes (using pkg-config)])
+ fi
+ fi
fi
- # List the contents of the lib.
- FREETYPELIB=`ls $with_freetype/lib/libfreetype.so $with_freetype/lib/freetype.dll 2> /dev/null`
- if test "x$FREETYPELIB" = x; then
- AC_MSG_ERROR([Could not find libfreetype.so nor freetype.dll in $with_freetype/lib])
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ # Check in well-known locations
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ FREETYPE_BASE_DIR="$PROGRAMFILES/GnuWin32"
+ BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$ProgramW6432/GnuWin32"
+ BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(FREETYPE_BASE_DIR)
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
+ fi
+ else
+ if test "x$SYS_ROOT" = "x/"; then
+ FREETYPE_ROOT=
+ else
+ FREETYPE_ROOT="$SYS_ROOT"
+ fi
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr/X11"
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib], [well-known location])
+ fi
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ FREETYPE_BASE_DIR="$FREETYPE_ROOT/usr"
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/x86_64-linux-gnu], [well-known location])
+ else
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib/i386-linux-gnu], [well-known location])
+ if test "x$FOUND_FREETYPE" != xyes; then
+ LIB_CHECK_POTENTIAL_FREETYPE([$FREETYPE_BASE_DIR/include], [$FREETYPE_BASE_DIR/lib32], [well-known location])
+ fi
+ fi
+ fi
fi
- # Check one h-file
- if ! test -s "$with_freetype/include/ft2build.h"; then
- AC_MSG_ERROR([Could not find $with_freetype/include/ft2build.h])
- fi
+ fi # end check in well-known locations
+
+ if test "x$FOUND_FREETYPE" != xyes; then
+ HELP_MSG_MISSING_DEPENDENCY([freetype])
+ AC_MSG_ERROR([Could not find freetype! $HELP_MSG ])
+ fi
+ fi # end user specified settings
+
+ # Set FREETYPE_CFLAGS, _LIBS and _LIB_PATH from include and lib dir.
+ if test "x$FREETYPE_CFLAGS" = x; then
+ BASIC_FIXUP_PATH(FREETYPE_INCLUDE_PATH)
+ if test -d $FREETYPE_INCLUDE_PATH/freetype2/freetype; then
+ FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH/freetype2 -I$FREETYPE_INCLUDE_PATH"
+ else
+ FREETYPE_CFLAGS="-I$FREETYPE_INCLUDE_PATH"
fi
fi
- if test "x$FREETYPE2_FOUND" = xno; then
- BDEPS_CHECK_MODULE(FREETYPE2, freetype2, xxx, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
- USING_SYSTEM_FT_LIB=true
- fi
- if test "x$FREETYPE2_FOUND" = xno && test "x$OPENJDK_TARGET_OS" = xwindows; then
- FREETYPELOCATION="$PROGRAMFILES/GnuWin32"
- BASIC_FIXUP_PATH(FREETYPELOCATION)
- AC_MSG_CHECKING([for freetype in some standard windows locations])
- if test -s "$FREETYPELOCATION/include/ft2build.h" && test -d "$FREETYPELOCATION/include/freetype2/freetype"; then
- FREETYPE2_CFLAGS="-I$FREETYPELOCATION/include/freetype2 -I$FREETYPELOCATION/include"
- FREETYPE2_LIBS="$FREETYPELOCATION/lib/freetype.lib"
- FREETYPE2_LIB_PATH="$FREETYPELOCATION/lib"
- if ! test -s "$FREETYPE2_LIBS"; then
- AC_MSG_ERROR([Could not find $FREETYPE2_LIBS])
- fi
- if ! test -s "$FREETYPE2_LIB_PATH/freetype.dll"; then
- AC_MSG_ERROR([Could not find $FREETYPE2_LIB_PATH/freetype.dll])
- fi
- USING_SYSTEM_FT_LIB=true
- FREETYPE2_FOUND=yes
- fi
- AC_MSG_RESULT([$FREETYPE2_FOUND])
- fi
- if test "x$FREETYPE2_FOUND" = xno; then
- PKG_CHECK_MODULES(FREETYPE2, freetype2, [FREETYPE2_FOUND=yes], [FREETYPE2_FOUND=no])
- # On solaris, pkg_check adds -lz to freetype libs, which isn't necessary for us.
- FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's/-lz//g'`
- USING_SYSTEM_FT_LIB=true
- # 64-bit libs for Solaris x86 are installed in the amd64 subdirectory, change lib to lib/amd64
- if test "x$FREETYPE2_FOUND" = xyes && test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
- FREETYPE2_LIBS=`$ECHO $FREETYPE2_LIBS | $SED 's?/lib?/lib/amd64?g'`
+
+ if test "x$FREETYPE_LIBS" = x; then
+ BASIC_FIXUP_PATH(FREETYPE_LIB_PATH)
+ if test "x$OPENJDK_TARGET_OS" = xwindows; then
+ FREETYPE_LIBS="$FREETYPE_LIB_PATH/freetype.lib"
+ else
+ FREETYPE_LIBS="-L$FREETYPE_LIB_PATH -lfreetype"
fi
fi
- if test "x$FREETYPE2_FOUND" = xno; then
- AC_MSG_CHECKING([for freetype in some standard locations])
-
- if test -s $SYS_ROOT/usr/X11/include/ft2build.h && test -d $SYS_ROOT/usr/X11/include/freetype2/freetype; then
- DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/X11/include/freetype2 -I$SYS_ROOT/usr/X11/include"
- DEFAULT_FREETYPE_LIBS="-L$SYS_ROOT/usr/X11/lib -lfreetype"
- fi
- if test -s $SYS_ROOT/usr/include/ft2build.h && test -d $SYS_ROOT/usr/include/freetype2/freetype; then
- DEFAULT_FREETYPE_CFLAGS="-I$SYS_ROOT/usr/include/freetype2"
- DEFAULT_FREETYPE_LIBS="-lfreetype"
- fi
- PREV_CXXCFLAGS="$CXXFLAGS"
- PREV_LDFLAGS="$LDFLAGS"
- CXXFLAGS="$CXXFLAGS $DEFAULT_FREETYPE_CFLAGS"
- LDFLAGS="$LDFLAGS $DEFAULT_FREETYPE_LIBS"
- AC_LINK_IFELSE([AC_LANG_SOURCE([[
- #include<ft2build.h>
- #include FT_FREETYPE_H
- int main() { return 0; }
- ]])],
- [
- # Yes, the default cflags and libs did the trick.
- FREETYPE2_FOUND=yes
- FREETYPE2_CFLAGS="$DEFAULT_FREETYPE_CFLAGS"
- FREETYPE2_LIBS="$DEFAULT_FREETYPE_LIBS"
- ],
- [
- FREETYPE2_FOUND=no
- ]
- )
- CXXCFLAGS="$PREV_CXXFLAGS"
- LDFLAGS="$PREV_LDFLAGS"
- AC_MSG_RESULT([$FREETYPE2_FOUND])
- USING_SYSTEM_FT_LIB=true
+ # Try to compile it
+ AC_MSG_CHECKING([if we can compile and link with freetype])
+ AC_LANG_PUSH(C++)
+ PREV_CXXCFLAGS="$CXXFLAGS"
+ PREV_LDFLAGS="$LDFLAGS"
+ PREV_CXX="$CXX"
+ CXXFLAGS="$CXXFLAGS $FREETYPE_CFLAGS"
+ LDFLAGS="$LDFLAGS $FREETYPE_LIBS"
+ CXX="$FIXPATH $CXX"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[
+ #include<ft2build.h>
+ #include FT_FREETYPE_H
+ int main () {
+ FT_Init_FreeType(NULL);
+ return 0;
+ }
+ ]])],
+ [
+ AC_MSG_RESULT([yes])
+ ],
+ [
+ AC_MSG_RESULT([no])
+ AC_MSG_NOTICE([Could not compile and link with freetype. This might be a 32/64-bit mismatch.])
+ AC_MSG_NOTICE([Using FREETYPE_CFLAGS=$FREETYPE_CFLAGS and FREETYPE_LIBS=$FREETYPE_LIBS])
+
+ HELP_MSG_MISSING_DEPENDENCY([freetype])
+
+ AC_MSG_ERROR([Can not continue without freetype. $HELP_MSG])
+ ]
+ )
+ CXXCFLAGS="$PREV_CXXFLAGS"
+ LDFLAGS="$PREV_LDFLAGS"
+ CXX="$PREV_CXX"
+ AC_LANG_POP(C++)
+
+ AC_MSG_CHECKING([if we should bundle freetype])
+ if test "x$BUNDLE_FREETYPE" = xyes; then
+ FREETYPE_BUNDLE_LIB_PATH="$FREETYPE_LIB_PATH"
fi
- if test "x$FREETYPE2_FOUND" = xno; then
- HELP_MSG_MISSING_DEPENDENCY([freetype2])
- AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ])
- fi
+ AC_MSG_RESULT([$BUNDLE_FREETYPE])
+
+ fi # end freetype needed
- if test "x$OPENJDK_TARGET_OS" != xwindows; then
- # AC_CHECK_LIB does not support use of cl.exe
- PREV_LDFLAGS="$LDFLAGS"
- LDFLAGS="$FREETYPE2_LIBS"
- AC_CHECK_LIB(freetype, FT_Init_FreeType,
- FREETYPE2_FOUND=true,
- AC_MSG_ERROR([Could not find freetype2! $HELP_MSG ]))
- LDFLAGS="$PREV_LDFLAGS"
- fi
- fi
-
- AC_SUBST(USING_SYSTEM_FT_LIB)
- AC_SUBST(FREETYPE2_LIB_PATH)
- AC_SUBST(FREETYPE2_CFLAGS)
- AC_SUBST(FREETYPE2_LIBS)
+ AC_SUBST(FREETYPE_BUNDLE_LIB_PATH)
+ AC_SUBST(FREETYPE_CFLAGS)
+ AC_SUBST(FREETYPE_LIBS)
])
AC_DEFUN_ONCE([LIB_SETUP_ALSA],
--- a/common/autoconf/spec.gmk.in Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/spec.gmk.in Mon Oct 28 12:28:57 2013 -0700
@@ -268,13 +268,9 @@
# Number of parallel jobs to use for compilation
JOBS?=@JOBS@
-# The OpenJDK makefiles should be changed to using the standard
-# configure output ..._CFLAGS and ..._LIBS. In the meantime we
-# extract the information here.
-FREETYPE2_LIB_PATH:=@FREETYPE2_LIB_PATH@
-FREETYPE2_LIBS:=@FREETYPE2_LIBS@
-FREETYPE2_CFLAGS:=@FREETYPE2_CFLAGS@
-USING_SYSTEM_FT_LIB=@USING_SYSTEM_FT_LIB@
+FREETYPE_LIBS:=@FREETYPE_LIBS@
+FREETYPE_CFLAGS:=@FREETYPE_CFLAGS@
+FREETYPE_BUNDLE_LIB_PATH=@FREETYPE_BUNDLE_LIB_PATH@
CUPS_CFLAGS:=@CUPS_CFLAGS@
ALSA_LIBS:=@ALSA_LIBS@
ALSA_CFLAGS:=@ALSA_CFLAGS@
@@ -485,6 +481,7 @@
DATE:=@DATE@
DIFF:=@DIFF@
DIRNAME:=@DIRNAME@
+DSYMUTIL:=@DSYMUTIL@
FIND:=@FIND@
FIND_DELETE:=@FIND_DELETE@
ECHO:=@ECHO@
--- a/common/autoconf/toolchain.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/toolchain.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -176,6 +176,7 @@
[
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
+ TOOLCHAIN_SETUP_MSVCR_DLL
BASIC_DEPRECATED_ARG_WITH([dxsdk])
BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
--- a/common/autoconf/toolchain_windows.m4 Mon Oct 28 10:52:07 2013 +0100
+++ b/common/autoconf/toolchain_windows.m4 Mon Oct 28 12:28:57 2013 -0700
@@ -228,52 +228,113 @@
AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
AC_MSG_ERROR([Cannot continue])
fi
+])
- AC_MSG_CHECKING([for msvcr100.dll])
+AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
+[
+ POSSIBLE_MSVCR_DLL="$1"
+ METHOD="$2"
+ if test -e "$POSSIBLE_MSVCR_DLL"; then
+ AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
+
+ # Need to check if the found msvcr is correct architecture
+ AC_MSG_CHECKING([found msvcr100.dll architecture])
+ MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
+ CORRECT_MSVCR_ARCH=386
+ else
+ CORRECT_MSVCR_ARCH=x86-64
+ fi
+ if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
+ AC_MSG_RESULT([ok])
+ MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
+ AC_MSG_CHECKING([for msvcr100.dll])
+ AC_MSG_RESULT([$MSVCR_DLL])
+ else
+ AC_MSG_RESULT([incorrect, ignoring])
+ AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
+ fi
+ fi
+])
+
+AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
+[
AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
[copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
+
if test "x$with_msvcr_dll" != x; then
- MSVCR_DLL="$with_msvcr_dll"
- else
+ # If given explicitely by user, do not probe. If not present, fail directly.
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
+ if test "x$MSVCR_DLL" = x; then
+ AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Using well-known location from Visual Studio 10.0
if test "x$VCINSTALLDIR" != x; then
+ CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
+ BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
+ POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
else
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
- if test "x$MSVCR_DLL" = x; then
- MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
+ POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
+ fi
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Check in the Boot JDK directory.
+ POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Look in the Windows system32 directory
+ CYGWIN_SYSTEMROOT="$SYSTEMROOT"
+ BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
+ POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: If Visual Studio Express is installed, there is usually one with the debugger
+ if test "x$VS100COMNTOOLS" != x; then
+ CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
+ BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
+ else
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
+ fi
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
+ fi
+ fi
+
+ if test "x$MSVCR_DLL" = x; then
+ # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
+ # (This was the original behaviour; kept since it might turn up something)
+ if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
+ if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
+ else
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
+ if test "x$POSSIBLE_MSVCR_DLL" = x; then
+ # We're grasping at straws now...
+ POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
fi
fi
- if test "x$MSVCR_DLL" != x; then
- AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR])
- else
- AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
- fi
- fi
- # Try some fallback alternatives
- if test "x$MSVCR_DLL" = x; then
- # If visual studio express is installed, there is usually one with the debugger
- if test "x$VS100COMNTOOLS" != x; then
- if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
- MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
- AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
- fi
- fi
- fi
- if test "x$MSVCR_DLL" = x; then
- if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
- # Fallback for 32bit builds, look in the windows directory.
- if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
- AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
- MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
- fi
- fi
+
+ TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
fi
fi
+
if test "x$MSVCR_DLL" = x; then
+ AC_MSG_CHECKING([for msvcr100.dll])
AC_MSG_RESULT([no])
- AC_MSG_ERROR([Could not find msvcr100.dll !])
+ AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
fi
- AC_MSG_RESULT([$MSVCR_DLL])
+
BASIC_FIXUP_PATH(MSVCR_DLL)
])
--- a/common/bin/hgforest.sh Mon Oct 28 10:52:07 2013 +0100
+++ b/common/bin/hgforest.sh Mon Oct 28 12:28:57 2013 -0700
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -27,37 +27,11 @@
command="$1"
pull_extra_base="$2"
-# Python always buffers stdout significantly, thus we will not see any output from hg clone jdk,
-# until a lot of time has passed! By passing -u to python, we get incremental updates
-# on stdout. Much nicer.
-whichhg="`which hg 2> /dev/null | grep -v '^no hg in'`"
-
-if [ "${whichhg}" = "" ] ; then
- echo Cannot find hg!
- exit 1
-fi
-
if [ "" = "$command" ] ; then
echo No command to hg supplied!
exit 1
fi
-has_hash_bang="`head -n 1 "${whichhg}" | cut -b 1-2`"
-python=""
-bpython=""
-
-if [ "#!" = "$has_hash_bang" ] ; then
- python="`head -n 1 ${whichhg} | cut -b 3- | sed -e 's/^[ \t]*//;s/[ \t]*$//'`"
- bpython="`basename "$python"`"
-fi
-
-if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1 -d ' '`" = "Python" ] ; then
- hg="${python} -u ${whichhg}"
-else
- echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.
- hg="hg"
-fi
-
# Clean out the temporary directory that stores the pid files.
tmp=/tmp/forest.$$
rm -f -r ${tmp}
@@ -171,7 +145,7 @@
(
if [ "${command}" = "clone" -o "${command}" = "fclone" ] ; then
pull_newrepo="`echo ${pull_base}/${i} | sed -e 's@\([^:]/\)//*@\1@g'`"
- echo ${hg} clone ${pull_newrepo} ${i}
+ echo hg clone ${pull_newrepo} ${i}
path="`dirname ${i}`"
if [ "${path}" != "." ] ; then
times=0
@@ -184,10 +158,10 @@
sleep 5
done
fi
- (${hg} clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
+ (PYTHONUNBUFFERED=true hg clone ${pull_newrepo} ${i}; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
else
- echo "cd ${i} && ${hg} $*"
- cd ${i} && (${hg} "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
+ echo "cd ${i} && hg $*"
+ cd ${i} && (PYTHONUNBUFFERED=true hg "$@"; echo "$?" > ${tmp}/${repopidfile}.pid.rc )&
fi
echo $! > ${tmp}/${repopidfile}.pid
) 2>&1 | sed -e "s@^@${reponame}: @") &
--- a/common/makefiles/JavaCompilation.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/common/makefiles/JavaCompilation.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -266,8 +266,12 @@
endif
# Find all files in the source tree.
- $1_ALL_SRCS := $$(call not-containing,_the., \
- $$(filter $$(addprefix %,$$($1_SUFFIXES)),$$(call CacheFind,$$($1_FIND_LIST))))
+ $1_ALL_SRCS := $$(call not-containing,_the.,$$(call CacheFind,$$($1_FIND_LIST)))
+
+ # Filter on suffixes if set
+ ifneq ($$($1_SUFFIXES),)
+ $1_ALL_SRCS := $$(filter $$(addprefix %, $$($1_SUFFIXES)), $$($1_ALL_SRCS))
+ endif
ifneq ($$($1_INCLUDES),)
ifneq ($$($1_SUFFIXES),)
@@ -371,8 +375,8 @@
# INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
# EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
# "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
- # JAVAC_SOURCE_PATH_UGLY_OVERRIDE:=Don't use this. This forces an explicit -sourcepath to javac.
- # Its only here until we cleanup some nasty source code pasta in the jdk.
+ # JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
+ # source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
# HEADERS:=path to directory where all generated c-headers are written.
# DEPENDS:=Extra dependecy
$(foreach i,2 3 4 5 6 7 8 9 10 11 12 13 14 15, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
@@ -474,8 +478,8 @@
endif
# Prep the source paths.
- ifneq ($$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE),)
- $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_UGLY_OVERRIDE)))
+ ifneq ($$($1_JAVAC_SOURCE_PATH_OVERRIDE),)
+ $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_OVERRIDE)))
else
$$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
endif
--- a/common/makefiles/NativeCompilation.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/common/makefiles/NativeCompilation.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -435,31 +435,36 @@
$(CP) $$< $$@
endif
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
- # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
- # empty section headers until a fixed $(OBJCOPY) is available.
- # An empty section header has sh_addr == 0 and sh_size == 0.
- # This problem has only been seen on Solaris X64, but we call this tool
- # on all Solaris builds just in case.
- #
- # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
- # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
- $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
- $(RM) $$@
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
- else # not solaris
- $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
- $(RM) $$@
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
- endif # Touch to not retrigger rule on rebuild
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
+ ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+ # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
+ # empty section headers until a fixed $(OBJCOPY) is available.
+ # An empty section header has sh_addr == 0 and sh_size == 0.
+ # This problem has only been seen on Solaris X64, but we call this tool
+ # on all Solaris builds just in case.
+ #
+ # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+ # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET) \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
+ $(RM) $$@
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
+ else # not solaris
+ $$($1_OBJECT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo : $$($1_TARGET)
+ $(RM) $$@
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
+ endif # Touch to not retrigger rule on rebuild
$(TOUCH) $$@
+ endif # !windows
+ endif # !macosx
ifeq ($(ZIP_DEBUGINFO_FILES), true)
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
$1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).diz
ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -472,11 +477,12 @@
$(CD) $$($1_OBJECT_DIR) \
&& $(ZIP) -q $$@ $$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
endif
+ endif # no MacOS X support yet
else
ifeq ($(OPENJDK_TARGET_OS), windows)
$1 += $$($1_OUTPUT_DIR)/$$($1_LIBRARY).map \
$$($1_OUTPUT_DIR)/$$($1_LIBRARY).pdb
- else
+ else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
$1 += $$($1_OUTPUT_DIR)/$$(LIBRARY_PREFIX)$$($1_LIBRARY).debuginfo
endif
endif
@@ -513,31 +519,36 @@
$(CP) $$< $$@
endif
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
- # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
- # empty section headers until a fixed $(OBJCOPY) is available.
- # An empty section header has sh_addr == 0 and sh_size == 0.
- # This problem has only been seen on Solaris X64, but we call this tool
- # on all Solaris builds just in case.
- #
- # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
- # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
- $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
- $(RM) $$@
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
- else # not solaris
- $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
- $(RM) $$@
- $(OBJCOPY) --only-keep-debug $$< $$@
- $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
- endif
- $(TOUCH) $$@
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # OBJCOPY is not used on MacOS X
+ ifneq ($(OPENJDK_TARGET_OS), windows) # nor on Windows
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
+ # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
+ # empty section headers until a fixed $(OBJCOPY) is available.
+ # An empty section header has sh_addr == 0 and sh_size == 0.
+ # This problem has only been seen on Solaris X64, but we call this tool
+ # on all Solaris builds just in case.
+ #
+ # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
+ # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET) \
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
+ $(RM) $$@
+ $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
+ else # not solaris
+ $$($1_OBJECT_DIR)/$$($1_PROGRAM).debuginfo : $$($1_TARGET)
+ $(RM) $$@
+ $(OBJCOPY) --only-keep-debug $$< $$@
+ $(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
+ endif
+ $(TOUCH) $$@
+ endif # !windows
+ endif # !macosx
ifeq ($(ZIP_DEBUGINFO_FILES), true)
+ ifneq ($(OPENJDK_TARGET_OS), macosx) # no MacOS X support yet
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).diz
ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -550,11 +561,12 @@
$(CD) $$($1_OBJECT_DIR) \
&& $(ZIP) -q $$@ $$($1_PROGRAM).debuginfo
endif
+ endif # no MacOS X support yet
else
ifeq ($(OPENJDK_TARGET_OS), windows)
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).map \
$$($1_OUTPUT_DIR)/$$($1_PROGRAM).pdb
- else
+ else ifneq ($(OPENJDK_TARGET_OS), macosx) # MacOS X does not use .debuginfo files
$1 += $$($1_OUTPUT_DIR)/$$($1_PROGRAM).debuginfo
endif
endif
--- a/common/makefiles/RMICompilation.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/common/makefiles/RMICompilation.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
$(call LogSetupMacroEntry,SetupRMICompilation($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11),$(12),$(13),$(14),$(15))
$(if $(16),$(error Internal makefile error: Too many arguments to SetupRMICompilation, please update RMICompilation.gmk))
- $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/$1_rmic
+ $1_DEP_FILE := $$($1_STUB_CLASSES_DIR)/_the.$1_rmic.generated
$1_CLASSES_SLASH := $$(subst .,/,$$($1_CLASSES))
$1_CLASS_FILES := $$(addprefix $$($1_CLASSES_DIR)/,$$(addsuffix .class,$$($1_CLASSES_SLASH)))
@@ -60,11 +60,11 @@
ifneq (,$$($1_RUN_IIOP))
$1_TARGETS += $$($1_TIE_FILES)
- $1_ARGS += -iiop
+ $1_ARGS += -iiop -emitPermissionCheck
endif
ifneq (,$$($1_RUN_IIOP_STDPKG))
$1_TARGETS += $$($1_TIE_STDPKG_FILES)
- $1_ARGS2 := -iiop -standardPackage
+ $1_ARGS2 := -iiop -emitPermissionCheck -standardPackage
endif
ifneq (,$$($1_KEEP_GENERATED))
@@ -88,10 +88,9 @@
$(RMIC) $$($1_ARGS2) -classpath "$$($1_CLASSES_DIR)" \
-d $$($1_STUB_CLASSES_DIR) $$($1_DOLLAR_SAFE_CLASSES); \
fi;
+ $(TOUCH) $$@
- $1 := $$($1_TARGETS)
+ $1 := $$($1_TARGETS) $$($1_DEP_FILE)
- # By marking as secondary, this "touch" file doesn't need to be touched and will never exist.
- .SECONDARY: $$($1_DEP_FILE)
endef
--- a/corba/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
428428cf5e06163322144cfb5367e1faa86acf20 jdk8-b109
3d2b7ce93c5c2e3db748f29c3d29620a8b3b748a jdk8-b110
85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
+43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
--- a/corba/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
--- a/corba/makefiles/BuildCorba.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/makefiles/BuildCorba.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,9 @@
$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_CORBA_WARNINGS), \
+ FLAGS := $(BOOT_JDK_SOURCETARGET) \
+ -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
+ $(DISABLE_CORBA_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -183,6 +185,15 @@
COPY := .prp LogStrings.properties, \
BIN := $(CORBA_OUTPUTDIR)/classes))
+ $(eval $(call SetupJavaCompilation,BUILD_BOOTSTRAP_CORBA, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(BUILD_CORBA_SRC), \
+ EXCLUDES := $(BUILD_CORBA_EXCLUDES), \
+ EXCLUDE_FILES := $(BUILD_CORBA_EXCLUDE_FILES), \
+ COPY := $(BUILD_CORBA_COPY), \
+ BIN := $(CORBA_OUTPUTDIR)/btclasses/corba_classes, \
+ JAR := $(CORBA_OUTPUTDIR)/btjars/btcorba.jar))
+
# Separate src.zip call to include sources that were excluded in the build to
# mimic behavior in old build system.
$(eval $(call SetupZipArchive,ARCHIVE_BUILD_CORBA, \
@@ -241,6 +252,7 @@
all: $(CORBA_OUTPUTDIR)/btjars/stripproperties.jar \
$(CORBA_OUTPUTDIR)/btjars/idlj.jar \
$(CORBA_OUTPUTDIR)/btjars/logutil.jar \
+ $(CORBA_OUTPUTDIR)/btjars/btcorba.jar \
$(CORBA_OUTPUTDIR)/dist/lib/classes.jar \
$(CORBA_OUTPUTDIR)/dist/lib/src.zip \
$(CORBA_OUTPUTDIR)/dist/lib/bin.zip
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -905,28 +905,4 @@
return contents.toString();
}
-
- public static void main(String[] args) {
-
- Class remoteInterface = java.rmi.Remote.class;
-
- if( args.length > 0 ) {
- String className = args[0];
- try {
- remoteInterface = Class.forName(className);
- } catch(Exception e) {
- e.printStackTrace();
- System.exit(-1);
- }
- }
-
- System.out.println("Building name translation for " + remoteInterface);
- try {
- IDLNameTranslator nameTranslator =
- IDLNameTranslatorImpl.get(remoteInterface);
- System.out.println(nameTranslator);
- } catch(IllegalStateException ise) {
- ise.printStackTrace();
- }
- }
}
--- a/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/src/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -43,6 +43,8 @@
import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ;
import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ;
import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory
{
@@ -114,24 +116,32 @@
// which extends org.omg.CORBA.Object. This handler delegates all
// calls directly to a DynamicStubImpl, which extends
// org.omg.CORBA.portable.ObjectImpl.
- InvocationHandler dynamicStubHandler =
+ final InvocationHandler dynamicStubHandler =
DelegateInvocationHandlerImpl.create( stub ) ;
// Create an invocation handler that handles any remote interface
// methods.
- InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
+ final InvocationHandler stubMethodHandler = new StubInvocationHandlerImpl(
pm, classData, stub ) ;
// Create a composite handler that handles the DynamicStub interface
// as well as the remote interfaces.
final CompositeInvocationHandler handler =
new CustomCompositeInvocationHandlerImpl( stub ) ;
+
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run() {
handler.addInvocationHandler( DynamicStub.class,
dynamicStubHandler ) ;
handler.addInvocationHandler( org.omg.CORBA.Object.class,
dynamicStubHandler ) ;
handler.addInvocationHandler( Object.class,
dynamicStubHandler ) ;
+ return null;
+ }
+ });
+
// If the method passed to invoke is not from DynamicStub or its superclasses,
// it must be from an implemented interface, so we just handle
--- a/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,7 +55,7 @@
/**
* @author Harold Carr
*/
-public class SelectorImpl
+class SelectorImpl
extends
Thread
implements
--- a/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/src/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -36,6 +36,7 @@
import com.sun.corba.se.spi.logging.CORBALogDomains ;
import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission;
public class CompositeInvocationHandlerImpl implements
CompositeInvocationHandler
@@ -46,11 +47,13 @@
public void addInvocationHandler( Class interf,
InvocationHandler handler )
{
+ checkAccess();
classToInvocationHandler.put( interf, handler ) ;
}
public void setDefaultHandler( InvocationHandler handler )
{
+ checkAccess();
defaultHandler = handler ;
}
@@ -78,4 +81,12 @@
return handler.invoke( proxy, method, args ) ;
}
+
+ private static final DynamicAccessPermission perm = new DynamicAccessPermission("access");
+ private void checkAccess() {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(perm);
}
+ }
+}
--- a/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java Mon Oct 28 10:52:07 2013 +0100
+++ b/corba/src/share/classes/sun/rmi/rmic/iiop/StubGenerator.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,9 @@
import java.io.File;
import java.io.IOException;
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
@@ -49,6 +52,7 @@
import com.sun.corba.se.impl.util.PackagePrefixChecker;
import sun.rmi.rmic.Main;
+
/**
* An IIOP stub/tie generator for rmic.
*
@@ -78,6 +82,7 @@
protected boolean castArray = false;
protected Hashtable transactionalObjects = new Hashtable() ;
protected boolean POATie = false ;
+ protected boolean emitPermissionCheck = false;
/**
* Default constructor for Main to use.
@@ -193,6 +198,9 @@
} else if (argv[i].equals("-standardPackage")) {
standardPackage = true;
argv[i] = null;
+ } else if (argv[i].equals("-emitPermissionCheck")) {
+ emitPermissionCheck = true;
+ argv[i] = null;
} else if (arg.equals("-xstubbase")) {
argv[i] = null;
if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) {
@@ -390,9 +398,22 @@
writePackageAndImports(p);
+// generate
+// import java.security.AccessController;
+// import java.security.PrivilegedAction;
+// import java.io.SerializablePermission;
+ if (emitPermissionCheck) {
+ p.pln("import java.security.AccessController;");
+ p.pln("import java.security.PrivilegedAction;");
+ p.pln("import java.io.SerializablePermission;");
+ p.pln();
+ p.pln();
+ }
+
// Declare the stub class; implement all remote interfaces.
p.p("public class " + currentClass);
+
p.p(" extends " + getName(stubBaseClass));
p.p(" implements ");
if (remoteInterfaces.length > 0) {
@@ -422,6 +443,57 @@
writeIds( p, theType, false );
p.pln();
+ if (emitPermissionCheck) {
+
+ // produce the following generated code for example
+ // private static Void checkPermission() {
+ // SecurityManager sm = System.getSecurityManager();
+ // if (sm != null) {
+ // sm.checkPermission(new SerializablePermission(
+ // "enableSubclassImplementation")); // testing
+ // }
+ // return null;
+ // }
+ //
+ // private _XXXXX_Stub(Void ignore) {
+ // }
+ //
+ // public _XXXXX_Stub() {
+ // this(checkPermission());
+ // }
+ //
+ // where XXXXX is the name of the remote interface
+
+ p.pln();
+ p.plnI("private static Void checkPermission() {");
+ p.plnI("SecurityManager sm = System.getSecurityManager();");
+ p.pln("if (sm != null) {");
+ p.pI();
+ p.plnI("sm.checkPermission(new SerializablePermission(");
+ p.plnI("\"enableSubclassImplementation\"));");
+ p.pO();
+ p.pO();
+ p.pOln("}");
+ p.pln("return null;");
+ p.pO();
+ p.pOln("}");
+ p.pln();
+ p.pO();
+
+ p.pI();
+ p.pln("private " + currentClass + "(Void ignore) { }");
+ p.pln();
+
+ p.plnI("public " + currentClass + "() { ");
+ p.pln("this(checkPermission());");
+ p.pOln("}");
+ p.pln();
+ }
+
+ if (!emitPermissionCheck) {
+ p.pI();
+ }
+
// Write the _ids() method...
p.plnI("public String[] _ids() { ");
@@ -815,7 +887,6 @@
CompoundType theType) throws IOException {
// Wtite the method declaration and opening brace...
-
String methodName = method.getName();
String methodIDLName = method.getIDLName();
--- a/hotspot/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -385,3 +385,5 @@
562a3d356de67670b4172b82aca2d30743449e04 hs25-b53
f6962730bbde82f279a0ae3a1c14bc5e58096c6e jdk8-b111
4a845c7a463844cead9e1e1641d6bcfb8a77f1c7 hs25-b54
+0ed9a90f45e1b392c671005f9ee22ce1acf02984 jdk8-b112
+23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1HeapRegionTable.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,119 @@
+/*
+ * 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 sun.jvm.hotspot.gc_implementation.g1;
+
+import java.util.Iterator;
+import java.util.Observable;
+import java.util.Observer;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.runtime.VMObject;
+import sun.jvm.hotspot.runtime.VMObjectFactory;
+import sun.jvm.hotspot.types.AddressField;
+import sun.jvm.hotspot.types.CIntegerField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+// Mirror class for G1HeapRegionTable. It's essentially an index -> HeapRegion map.
+
+public class G1HeapRegionTable extends VMObject {
+ // HeapRegion** _base;
+ static private AddressField baseField;
+ // uint _length;
+ static private CIntegerField lengthField;
+ // HeapRegion** _biased_base
+ static private AddressField biasedBaseField;
+ // size_t _bias
+ static private CIntegerField biasField;
+ // uint _shift_by
+ static private CIntegerField shiftByField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ static private synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("G1HeapRegionTable");
+
+ baseField = type.getAddressField("_base");
+ lengthField = type.getCIntegerField("_length");
+ biasedBaseField = type.getAddressField("_biased_base");
+ biasField = type.getCIntegerField("_bias");
+ shiftByField = type.getCIntegerField("_shift_by");
+ }
+
+ private HeapRegion at(long index) {
+ Address arrayAddr = baseField.getValue(addr);
+ // Offset of &_base[index]
+ long offset = index * VM.getVM().getAddressSize();
+ Address regionAddr = arrayAddr.getAddressAt(offset);
+ return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
+ regionAddr);
+ }
+
+ public long length() {
+ return lengthField.getValue(addr);
+ }
+
+ public long bias() {
+ return biasField.getValue(addr);
+ }
+
+ public long shiftBy() {
+ return shiftByField.getValue(addr);
+ }
+
+ private class HeapRegionIterator implements Iterator<HeapRegion> {
+ private long index;
+ private long length;
+
+ @Override
+ public boolean hasNext() { return index < length; }
+
+ @Override
+ public HeapRegion next() { return at(index++); }
+
+ @Override
+ public void remove() { /* not supported */ }
+
+ HeapRegionIterator(Address addr) {
+ index = 0;
+ length = length();
+ }
+ }
+
+ public Iterator<HeapRegion> heapRegionIterator() {
+ return new HeapRegionIterator(addr);
+ }
+
+ public G1HeapRegionTable(Address addr) {
+ super(addr);
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,13 +37,11 @@
import sun.jvm.hotspot.types.Type;
import sun.jvm.hotspot.types.TypeDataBase;
-// Mirror class for HeapRegionSeq. It's essentially an index -> HeapRegion map.
+// Mirror class for HeapRegionSeq. It essentially encapsulates the G1HeapRegionTable.
public class HeapRegionSeq extends VMObject {
- // HeapRegion** _regions;
- static private AddressField regionsField;
- // uint _length;
- static private CIntegerField lengthField;
+ // G1HeapRegionTable _regions
+ static private long regionsFieldOffset;
static {
VM.registerVMInitializedObserver(new Observer() {
@@ -56,44 +54,21 @@
static private synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HeapRegionSeq");
- regionsField = type.getAddressField("_regions");
- lengthField = type.getCIntegerField("_length");
+ regionsFieldOffset = type.getField("_regions").getOffset();
}
- private HeapRegion at(long index) {
- Address arrayAddr = regionsField.getValue(addr);
- // Offset of &_region[index]
- long offset = index * VM.getVM().getAddressSize();
- Address regionAddr = arrayAddr.getAddressAt(offset);
- return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
- regionAddr);
+ private G1HeapRegionTable regions() {
+ Address regionsAddr = addr.addOffsetTo(regionsFieldOffset);
+ return (G1HeapRegionTable) VMObjectFactory.newObject(G1HeapRegionTable.class,
+ regionsAddr);
}
public long length() {
- return lengthField.getValue(addr);
- }
-
- private class HeapRegionIterator implements Iterator<HeapRegion> {
- private long index;
- private long length;
-
- @Override
- public boolean hasNext() { return index < length; }
-
- @Override
- public HeapRegion next() { return at(index++); }
-
- @Override
- public void remove() { /* not supported */ }
-
- HeapRegionIterator(Address addr) {
- index = 0;
- length = length();
- }
+ return regions().length();
}
public Iterator<HeapRegion> heapRegionIterator() {
- return new HeapRegionIterator(addr);
+ return regions().heapRegionIterator();
}
public HeapRegionSeq(Address addr) {
--- a/hotspot/make/Makefile Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/Makefile Mon Oct 28 12:28:57 2013 -0700
@@ -334,6 +334,11 @@
$(install-file)
$(EXPORT_SERVER_DIR)/64/%.diz: $(C2_BUILD_DIR)/%.diz
$(install-file)
+# MacOS X
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: $(C2_BUILD_DIR)/%.dSYM
+ $(install-dir)
+$(EXPORT_SERVER_DIR)/%.dSYM: $(C2_BUILD_DIR)/%.dSYM
+ $(install-dir)
endif
# Client (C1)
@@ -379,6 +384,11 @@
$(install-file)
$(EXPORT_CLIENT_DIR)/64/%.diz: $(C1_BUILD_DIR)/%.diz
$(install-file)
+# MacOS X
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: $(C1_BUILD_DIR)/%.dSYM
+ $(install-dir)
+$(EXPORT_CLIENT_DIR)/%.dSYM: $(C1_BUILD_DIR)/%.dSYM
+ $(install-dir)
endif
# Minimal1
@@ -424,6 +434,7 @@
$(install-file)
$(EXPORT_MINIMAL_DIR)/64/%.diz: $(MINIMAL1_BUILD_DIR)/%.diz
$(install-file)
+# MacOS X does not support Minimal1 config
endif
# Zero
@@ -446,6 +457,11 @@
$(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(ZERO_BUILD_DIR)/%.diz
$(install-file)
+# MacOS X
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: $(ZERO_BUILD_DIR)/%.dSYM
+ $(install-dir)
+$(EXPORT_SERVER_DIR)/%.dSYM: $(ZERO_BUILD_DIR)/%.dSYM
+ $(install-dir)
endif
# Shark
@@ -468,6 +484,11 @@
$(install-file)
$(EXPORT_SERVER_DIR)/%.diz: $(SHARK_BUILD_DIR)/%.diz
$(install-file)
+# MacOS X
+$(EXPORT_JRE_LIB_ARCH_DIR)/%.dSYM: $(SHARK_BUILD_DIR)/%.dSYM
+ $(install-dir)
+$(EXPORT_SERVER_DIR)/%.dSYM: $(SHARK_BUILD_DIR)/%.dSYM
+ $(install-dir)
endif
$(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/%
--- a/hotspot/make/bsd/Makefile Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/Makefile Mon Oct 28 12:28:57 2013 -0700
@@ -204,6 +204,7 @@
BUILDTREE_MAKE = $(GAMMADIR)/make/$(OSNAME)/makefiles/buildtree.make
BUILDTREE_VARS = GAMMADIR=$(GAMMADIR) OS_FAMILY=$(OSNAME) SRCARCH=$(SRCARCH) BUILDARCH=$(BUILDARCH) LIBARCH=$(LIBARCH) LIBRARY_SUFFIX=$(LIBRARY_SUFFIX)
BUILDTREE_VARS += HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) HOTSPOT_BUILD_VERSION=$(HOTSPOT_BUILD_VERSION) JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
+BUILDTREE_VARS += ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS) OBJCOPY=$(OBJCOPY) STRIP_POLICY=$(STRIP_POLICY) ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES) ZIPEXE=$(ZIPEXE)
BUILDTREE = $(MAKE) -f $(BUILDTREE_MAKE) $(BUILDTREE_VARS)
@@ -337,9 +338,11 @@
# Doc target. This is the same for all build options.
# Hence create a docs directory beside ...$(ARCH)_[...]
+# We specify 'BUILD_FLAVOR=product' so that the proper
+# ENABLE_FULL_DEBUG_SYMBOLS value is used.
docs: checks
$(QUIETLY) mkdir -p $(SUBDIR_DOCS)
- $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) jvmtidocs
+ $(MAKE) -f $(GAMMADIR)/make/$(OSNAME)/makefiles/jvmti.make $(MFLAGS) $(BUILDTREE_VARS) JvmtiOutDir=$(SUBDIR_DOCS) BUILD_FLAVOR=product jvmtidocs
# Synonyms for win32-like targets.
compiler2: debug product
--- a/hotspot/make/bsd/makefiles/buildtree.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/buildtree.make Mon Oct 28 12:28:57 2013 -0700
@@ -261,6 +261,16 @@
echo "$(call gamma-path,commonsrc,os/posix/vm)"; \
[ -n "$(CFLAGS_BROWSE)" ] && \
echo && echo "CFLAGS_BROWSE = $(CFLAGS_BROWSE)"; \
+ [ -n "$(ENABLE_FULL_DEBUG_SYMBOLS)" ] && \
+ echo && echo "ENABLE_FULL_DEBUG_SYMBOLS = $(ENABLE_FULL_DEBUG_SYMBOLS)"; \
+ [ -n "$(OBJCOPY)" ] && \
+ echo && echo "OBJCOPY = $(OBJCOPY)"; \
+ [ -n "$(STRIP_POLICY)" ] && \
+ echo && echo "STRIP_POLICY = $(STRIP_POLICY)"; \
+ [ -n "$(ZIP_DEBUGINFO_FILES)" ] && \
+ echo && echo "ZIP_DEBUGINFO_FILES = $(ZIP_DEBUGINFO_FILES)"; \
+ [ -n "$(ZIPEXE)" ] && \
+ echo && echo "ZIPEXE = $(ZIPEXE)"; \
[ -n "$(HOTSPOT_EXTRA_SYSDEFS)" ] && \
echo && \
echo "HOTSPOT_EXTRA_SYSDEFS\$$(HOTSPOT_EXTRA_SYSDEFS) = $(HOTSPOT_EXTRA_SYSDEFS)" && \
--- a/hotspot/make/bsd/makefiles/defs.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/defs.make Mon Oct 28 12:28:57 2013 -0700
@@ -136,10 +136,127 @@
endif
endif
+OS_VENDOR:=$(shell uname -s)
+
+# determine if HotSpot is being built in JDK6 or earlier version
+JDK6_OR_EARLIER=0
+ifeq "$(shell expr \( '$(JDK_MAJOR_VERSION)' != '' \& '$(JDK_MINOR_VERSION)' != '' \& '$(JDK_MICRO_VERSION)' != '' \))" "1"
+ # if the longer variable names (newer build style) are set, then check those
+ ifeq "$(shell expr \( $(JDK_MAJOR_VERSION) = 1 \& $(JDK_MINOR_VERSION) \< 7 \))" "1"
+ JDK6_OR_EARLIER=1
+ endif
+else
+ # the longer variables aren't set so check the shorter variable names
+ ifeq "$(shell expr \( '$(JDK_MAJOR_VER)' = 1 \& '$(JDK_MINOR_VER)' \< 7 \))" "1"
+ JDK6_OR_EARLIER=1
+ endif
+endif
+
+ifeq ($(JDK6_OR_EARLIER),0)
+ # Full Debug Symbols is supported on JDK7 or newer.
+ # The Full Debug Symbols (FDS) default for BUILD_FLAVOR == product
+ # builds is enabled with debug info files ZIP'ed to save space. For
+ # BUILD_FLAVOR != product builds, FDS is always enabled, after all a
+ # debug build without debug info isn't very useful.
+ # The ZIP_DEBUGINFO_FILES option only has meaning when FDS is enabled.
+ #
+ # If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
+ # disabled for a BUILD_FLAVOR == product build.
+ #
+ # Note: Use of a different variable name for the FDS override option
+ # versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
+ # versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
+ # in options via environment variables, use of distinct variables
+ # prevents strange behaviours. For example, in a BUILD_FLAVOR !=
+ # product build, the FULL_DEBUG_SYMBOLS environment variable will be
+ # 0, but the ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If
+ # the same variable name is used, then different values can be picked
+ # up by different parts of the build. Just to be clear, we only need
+ # two variable names because the incoming option value can be
+ # overridden in some situations, e.g., a BUILD_FLAVOR != product
+ # build.
+
+ # Due to the multiple sub-make processes that occur this logic gets
+ # executed multiple times. We reduce the noise by at least checking that
+ # BUILD_FLAVOR has been set.
+ ifneq ($(BUILD_FLAVOR),)
+ ifeq ($(BUILD_FLAVOR), product)
+ FULL_DEBUG_SYMBOLS ?= 1
+ ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
+ else
+ # debug variants always get Full Debug Symbols (if available)
+ ENABLE_FULL_DEBUG_SYMBOLS = 1
+ endif
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
+ # since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
+
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ # MacOS X doesn't use OBJCOPY or STRIP_POLICY
+ OBJCOPY=
+ STRIP_POLICY=
+ ZIP_DEBUGINFO_FILES ?= 1
+ else
+ # Default OBJCOPY comes from GNU Binutils on BSD
+ ifeq ($(CROSS_COMPILE_ARCH),)
+ DEF_OBJCOPY=/usr/bin/objcopy
+ else
+ # Assume objcopy is part of the cross-compilation toolset
+ ifneq ($(ALT_COMPILER_PATH),)
+ DEF_OBJCOPY=$(ALT_COMPILER_PATH)/objcopy
+ endif
+ endif
+ OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
+ ifneq ($(ALT_OBJCOPY),)
+ _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
+ OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
+ endif
+
+ ifeq ($(OBJCOPY),)
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \
+ "files. You may need to set ALT_OBJCOPY.")
+ ENABLE_FULL_DEBUG_SYMBOLS=0
+ _JUNK_ := $(shell \
+ echo >&2 "INFO:" \
+ "ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
+ else
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo" \
+ "files.")
+
+ # Library stripping policies for .debuginfo configs:
+ # all_strip - strips everything from the library
+ # min_strip - strips most stuff from the library; leaves
+ # minimum symbols
+ # no_strip - does not strip the library at all
+ #
+ # Oracle security policy requires "all_strip". A waiver was
+ # granted on 2011.09.01 that permits using "min_strip" in the
+ # Java JDK and Java JRE.
+ #
+ # Currently, STRIP_POLICY is only used when Full Debug Symbols
+ # is enabled.
+ #
+ STRIP_POLICY ?= min_strip
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
+
+ ZIP_DEBUGINFO_FILES ?= 1
+ endif
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
+ endif
+ endif # ENABLE_FULL_DEBUG_SYMBOLS=1
+ endif # BUILD_FLAVOR
+endif # JDK_6_OR_EARLIER
+
JDK_INCLUDE_SUBDIR=bsd
# Library suffix
-OS_VENDOR:=$(shell uname -s)
ifeq ($(OS_VENDOR),Darwin)
LIBRARY_SUFFIX=dylib
else
@@ -150,6 +267,19 @@
# client and server subdirectories have symbolic links to ../libjsig.so
EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX)
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz
+ else
+ ifeq ($(OS_VENDOR), Darwin)
+ EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
+ else
+ EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
+ endif
+ endif
+endif
+
EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
@@ -157,34 +287,76 @@
ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX)
+
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz
+ else
+ ifeq ($(OS_VENDOR), Darwin)
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
+ else
+ EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo
+ endif
+ endif
+ endif
endif
ifeq ($(JVM_VARIANT_CLIENT),true)
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX)
+
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz
+ else
+ ifeq ($(OS_VENDOR), Darwin)
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX).dSYM
+ else
+ EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo
+ endif
+ endif
+ endif
endif
ifeq ($(JVM_VARIANT_MINIMAL1),true)
EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/Xusage.txt
EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.$(LIBRARY_SUFFIX)
-
- ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
- ifeq ($(ZIP_DEBUGINFO_FILES),1)
- EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.diz
- else
- EXPORT_LIST += $(EXPORT_MINIMAL_DIR)/libjvm.debuginfo
- endif
- endif
endif
# Serviceability Binaries
# No SA Support for PPC, IA64, ARM or zero
ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
$(EXPORT_LIB_DIR)/sa-jdi.jar
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
+ else
+ ifeq ($(OS_VENDOR), Darwin)
+ ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
+ else
+ ADD_SA_BINARIES/x86 += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
+ endif
+ endif
+endif
+
ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
$(EXPORT_LIB_DIR)/sa-jdi.jar
ADD_SA_BINARIES/universal = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
$(EXPORT_LIB_DIR)/sa-jdi.jar
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.diz
+ else
+ ifeq ($(OS_VENDOR), Darwin)
+ ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
+ else
+ ADD_SA_BINARIES/universal += $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.debuginfo
+ endif
+ endif
+endif
+
ADD_SA_BINARIES/ppc =
ADD_SA_BINARIES/ia64 =
ADD_SA_BINARIES/arm =
@@ -225,6 +397,19 @@
# Files to simply copy in place
UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/Xusage.txt
UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/Xusage.txt
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/libjvm.diz
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/libjvm.diz
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libjsig.diz
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libsaproc.diz
+ else
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/server/libjvm.$(LIBRARY_SUFFIX).dSYM
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/client/libjvm.$(LIBRARY_SUFFIX).dSYM
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libjsig.$(LIBRARY_SUFFIX).dSYM
+ UNIVERSAL_COPY_LIST += $(EXPORT_JRE_LIB_DIR)/libsaproc.$(LIBRARY_SUFFIX).dSYM
+ endif
+ endif
endif
endif
--- a/hotspot/make/bsd/makefiles/dtrace.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/dtrace.make Mon Oct 28 12:28:57 2013 -0700
@@ -39,9 +39,15 @@
JVM_DB = libjvm_db
LIBJVM_DB = libjvm_db.dylib
+LIBJVM_DB_DEBUGINFO = libjvm_db.dylib.dSYM
+LIBJVM_DB_DIZ = libjvm_db.diz
+
JVM_DTRACE = jvm_dtrace
LIBJVM_DTRACE = libjvm_dtrace.dylib
+LIBJVM_DTRACE_DEBUGINFO = libjvm_dtrace.dylib.dSYM
+LIBJVM_DTRACE_DIZ = libjvm_dtrace.diz
+
JVMOFFS = JvmOffsets
JVMOFFS.o = $(JVMOFFS).o
GENOFFS = generate$(JVMOFFS)
@@ -76,21 +82,87 @@
# Making 64/libjvm_db.so: 64-bit version of libjvm_db.so which handles 32-bit libjvm.so
ifneq ("${ISA}","${BUILDARCH}")
-XLIBJVM_DB = 64/$(LIBJVM_DB)
-XLIBJVM_DTRACE = 64/$(LIBJVM_DTRACE)
+XLIBJVM_DIR = 64
+XLIBJVM_DB = $(XLIBJVM_DIR)/$(LIBJVM_DB)
+XLIBJVM_DTRACE = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE)
XARCH = $(subst sparcv9,v9,$(shell echo $(ISA)))
+XLIBJVM_DB_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DB_DEBUGINFO)
+XLIBJVM_DB_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ)
+XLIBJVM_DTRACE_DEBUGINFO = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
+XLIBJVM_DTRACE_DIZ = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
+
$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
@echo Making $@
- $(QUIETLY) mkdir -p 64/ ; \
+ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c #-lc
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the archived name:
+ ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -r -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) )
+ $(RM) -r $(XLIBJVM_DB_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the link name:
+ $(QUIETLY) ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -x $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the archived name:
+ ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO) )
+ $(RM) $(XLIBJVM_DB_DEBUGINFO)
+ endif
+ endif
+endif
$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
- $(QUIETLY) mkdir -p 64/ ; \
+ $(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
$(CC) $(SYMFLAG) -xarch=$(XARCH) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the archived name:
+ ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -r -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) )
+ $(RM) -r $(XLIBJVM_DTRACE_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the link name:
+ ( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -x $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR)
+ # is not in the archived name:
+ ( cd $(XLIBJVM_DIR) && $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO) )
+ $(RM) $(XLIBJVM_DTRACE_DEBUGINFO)
+ endif
+ endif
+endif
endif # ifneq ("${ISA}","${BUILDARCH}")
@@ -134,11 +206,59 @@
@echo Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -Wall # -lc
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -r -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO)
+ $(RM) -r $(LIBJVM_DB_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -x $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -y $(LIBJVM_DB_DIZ) $(LIBJVM_DB_DEBUGINFO)
+ $(RM) $(LIBJVM_DB_DEBUGINFO)
+ endif
+ endif
+endif
$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
@echo Making $@
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. \
$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c #-lc -lthread -ldoor
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -r -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)
+ $(RM) -r $(LIBJVM_DTRACE_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -x $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -y $(LIBJVM_DTRACE_DIZ) $(LIBJVM_DTRACE_DEBUGINFO)
+ $(RM) $(LIBJVM_DTRACE_DEBUGINFO)
+ endif
+ endif
+endif
#$(DTRACE).d: $(DTRACE_SRCDIR)/hotspot.d $(DTRACE_SRCDIR)/hotspot_jni.d \
# $(DTRACE_SRCDIR)/hs_private.d $(DTRACE_SRCDIR)/jhelper.d
--- a/hotspot/make/bsd/makefiles/gcc.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/gcc.make Mon Oct 28 12:28:57 2013 -0700
@@ -83,6 +83,11 @@
AS = $(CC) -c
endif
+ifeq ($(OS_VENDOR), Darwin)
+ ifeq ($(DSYMUTIL),)
+ DSYMUTIL=dsymutil
+ endif
+endif
ifeq ($(USE_CLANG), true)
CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
@@ -434,6 +439,36 @@
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
DEBUG_CFLAGS += -gstabs
endif
+
+ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ FASTDEBUG_CFLAGS/ia64 = -g
+ FASTDEBUG_CFLAGS/amd64 = -g
+ FASTDEBUG_CFLAGS/arm = -g
+ FASTDEBUG_CFLAGS/ppc = -g
+ FASTDEBUG_CFLAGS += $(FASTDEBUG_CFLAGS/$(BUILDARCH))
+ ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
+ ifeq ($(USE_CLANG), true)
+ # Clang doesn't understand -gstabs
+ FASTDEBUG_CFLAGS += -g
+ else
+ FASTDEBUG_CFLAGS += -gstabs
+ endif
+ endif
+
+ OPT_CFLAGS/ia64 = -g
+ OPT_CFLAGS/amd64 = -g
+ OPT_CFLAGS/arm = -g
+ OPT_CFLAGS/ppc = -g
+ OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
+ ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
+ ifeq ($(USE_CLANG), true)
+ # Clang doesn't understand -gstabs
+ OPT_CFLAGS += -g
+ else
+ OPT_CFLAGS += -gstabs
+ endif
+ endif
+ endif
endif
# If we are building HEADLESS, pass on to VM
--- a/hotspot/make/bsd/makefiles/jsig.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/jsig.make Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,21 @@
ifeq ($(OS_VENDOR), Darwin)
LIBJSIG = lib$(JSIG).dylib
+
+ LIBJSIG_DEBUGINFO = lib$(JSIG).dylib.dSYM
+ LIBJSIG_DIZ = lib$(JSIG).diz
else
LIBJSIG = lib$(JSIG).so
+
+ LIBJSIG_DEBUGINFO = lib$(JSIG).debuginfo
+ LIBJSIG_DIZ = lib$(JSIG).diz
endif
JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm
-DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG)
+DEST_JSIG = $(JDK_LIBDIR)/$(LIBJSIG)
+DEST_JSIG_DEBUGINFO = $(JDK_LIBDIR)/$(LIBJSIG_DEBUGINFO)
+DEST_JSIG_DIZ = $(JDK_LIBDIR)/$(LIBJSIG_DIZ)
LIBJSIG_MAPFILE = $(MAKEFILES_DIR)/mapfile-vers-jsig
@@ -55,9 +63,42 @@
@echo Making signal interposition lib...
$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
$(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -r -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO)
+ $(RM) -r $(LIBJSIG_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -g $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO)
+ $(RM) $(LIBJSIG_DEBUGINFO)
+ endif
+ endif
+endif
install_jsig: $(LIBJSIG)
@echo "Copying $(LIBJSIG) to $(DEST_JSIG)"
+ifeq ($(OS_VENDOR), Darwin)
+ $(QUIETLY) test -d $(LIBJSIG_DEBUGINFO) && \
+ cp -f -r $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO)
+else
+ $(QUIETLY) test -f $(LIBJSIG_DEBUGINFO) && \
+ cp -f $(LIBJSIG_DEBUGINFO) $(DEST_JSIG_DEBUGINFO)
+endif
+ $(QUIETLY) test -f $(LIBJSIG_DIZ) && \
+ cp -f $(LIBJSIG_DIZ) $(DEST_JSIG_DIZ)
$(QUIETLY) cp -f $(LIBJSIG) $(DEST_JSIG) && echo "Done"
.PHONY: install_jsig
--- a/hotspot/make/bsd/makefiles/product.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/product.make Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -43,15 +43,17 @@
SYSDEFS += -DPRODUCT
VERSION = optimized
-# use -g to strip library as -x will discard its symbol table; -x is fine for
-# executables.
-ifdef CROSS_COMPILE_ARCH
- STRIP = $(ALT_COMPILER_PATH)/strip
-else
- STRIP = strip
+ifneq ($(OS_VENDOR), Darwin)
+ # use -g to strip library as -x will discard its symbol table; -x is fine for
+ # executables.
+ ifdef CROSS_COMPILE_ARCH
+ STRIP = $(ALT_COMPILER_PATH)/strip
+ else
+ STRIP = strip
+ endif
+ STRIP_LIBJVM = $(STRIP) -g $@ || exit 1;
+ STRIP_AOUT = $(STRIP) -x $@ || exit 1;
+
+ # Don't strip in VM build; JDK build will strip libraries later
+ # LINK_LIB.CXX/POST_HOOK += $(STRIP_$(LINK_INTO))
endif
-STRIP_LIBJVM = $(STRIP) -g $@ || exit 1;
-STRIP_AOUT = $(STRIP) -x $@ || exit 1;
-
-# Don't strip in VM build; JDK build will strip libraries later
-# LINK_LIB.CXX/POST_HOOK += $(STRIP_$(LINK_INTO))
--- a/hotspot/make/bsd/makefiles/saproc.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/saproc.make Mon Oct 28 12:28:57 2013 -0700
@@ -28,9 +28,15 @@
SAPROC = saproc
ifeq ($(OS_VENDOR), Darwin)
- LIBSAPROC = lib$(SAPROC).dylib
+ LIBSAPROC = lib$(SAPROC).dylib
+
+ LIBSAPROC_DEBUGINFO = lib$(SAPROC).dylib.dSYM
+ LIBSAPROC_DIZ = lib$(SAPROC).diz
else
- LIBSAPROC = lib$(SAPROC).so
+ LIBSAPROC = lib$(SAPROC).so
+
+ LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo
+ LIBSAPROC_DIZ = lib$(SAPROC).diz
endif
AGENT_DIR = $(GAMMADIR)/agent
@@ -70,7 +76,9 @@
SAMAPFILE = $(SASRCDIR)/mapfile
-DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
+DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
+DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
+DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
# DEBUG_BINARIES overrides everything, use full -g debug information
ifeq ($(DEBUG_BINARIES), true)
@@ -117,11 +125,42 @@
$(SA_DEBUG_CFLAGS) \
-o $@ \
$(SALIBS)
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -r -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
+ $(RM) -r $(LIBSAPROC_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -g $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO)
+ $(RM) $(LIBSAPROC_DEBUGINFO)
+ endif
+ endif
+endif
install_saproc: $(BUILDLIBSAPROC)
- $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
- echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
- cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
- fi
+ @echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"
+ifeq ($(OS_VENDOR), Darwin)
+ $(QUIETLY) test -d $(LIBSAPROC_DEBUGINFO) && \
+ cp -f -r $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO)
+else
+ $(QUIETLY) test -f $(LIBSAPROC_DEBUGINFO) && \
+ cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO)
+endif
+ $(QUIETLY) test -f $(LIBSAPROC_DIZ) && \
+ cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ)
+ $(QUIETLY) cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"
.PHONY: install_saproc
--- a/hotspot/make/bsd/makefiles/universal.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/universal.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -19,7 +19,7 @@
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
-#
+#
#
# macosx universal builds
@@ -35,15 +35,15 @@
all_product_universal:
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_PRODUCT_TARGETS)
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_PRODUCT_TARGETS)
- $(QUIETLY) $(MAKE) EXPORT_SUBDIR= universalize
+ $(QUIETLY) $(MAKE) BUILD_FLAVOR=product EXPORT_SUBDIR= universalize
all_fastdebug_universal:
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_FASTDEBUG_TARGETS)
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_FASTDEBUG_TARGETS)
- $(QUIETLY) $(MAKE) EXPORT_SUBDIR=/fastdebug universalize
+ $(QUIETLY) $(MAKE) BUILD_FLAVOR=fastdebug EXPORT_SUBDIR=/fastdebug universalize
all_debug_universal:
# $(QUIETLY) $(MAKE) ARCH_DATA_MODEL=32 $(COMMON_VM_DEBUG_TARGETS)
$(QUIETLY) $(MAKE) ARCH_DATA_MODEL=64 $(COMMON_VM_DEBUG_TARGETS)
- $(QUIETLY) $(MAKE) EXPORT_SUBDIR=/debug universalize
+ $(QUIETLY) $(MAKE) BUILD_FLAVOR=debug EXPORT_SUBDIR=/debug universalize
# Consolidate architecture builds into a single Universal binary
@@ -57,18 +57,18 @@
if [ -n "$${BUILT_LIPO_FILES}" ]; then \
$(MKDIR) -p $(shell dirname $@); \
lipo -create -output $@ $${BUILT_LIPO_FILES}; \
- fi
+ fi
# Copy built non-universal binaries in place
+# - copies directories; including empty dirs
+# - copies files, symlinks, other non-directory files
$(UNIVERSAL_COPY_LIST):
- BUILT_COPY_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) 2>/dev/null`"; \
+ BUILT_COPY_FILES="`find $(EXPORT_JRE_LIB_DIR)/{i386,amd64}/$(subst $(EXPORT_JRE_LIB_DIR)/,,$@) -prune 2>/dev/null`"; \
if [ -n "$${BUILT_COPY_FILES}" ]; then \
for i in $${BUILT_COPY_FILES}; do \
- if [ -f $${i} ]; then \
- $(MKDIR) -p $(shell dirname $@); \
- $(CP) $${i} $@; \
- fi; \
+ $(MKDIR) -p $(shell dirname $@); \
+ $(CP) -R $${i} $@; \
done; \
fi
--- a/hotspot/make/bsd/makefiles/vm.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/bsd/makefiles/vm.make Mon Oct 28 12:28:57 2013 -0700
@@ -60,10 +60,16 @@
# The order is important for the precompiled headers to work.
INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
-ifeq (${VERSION}, debug)
+# SYMFLAG is used by {jsig,saproc}.make
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ # always build with debug info when we can create .dSYM/.debuginfo files
SYMFLAG = -g
else
- SYMFLAG =
+ ifeq (${VERSION}, debug)
+ SYMFLAG = -g
+ else
+ SYMFLAG =
+ endif
endif
# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined
@@ -147,8 +153,14 @@
ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug))
CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
endif
+
+ LIBJVM_DEBUGINFO = lib$(JVM).dylib.dSYM
+ LIBJVM_DIZ = lib$(JVM).diz
else
LIBJVM = lib$(JVM).so
+
+ LIBJVM_DEBUGINFO = lib$(JVM).debuginfo
+ LIBJVM_DIZ = lib$(JVM).diz
endif
SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
@@ -322,10 +334,47 @@
rm -f $@.1; ln -s $@ $@.1; \
}
-DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_VENDOR), Darwin)
+ $(DSYMUTIL) $@
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -r -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
+ $(RM) -r $(LIBJVM_DEBUGINFO)
+ endif
+ else
+ $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
+ $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
+ ifeq ($(STRIP_POLICY),all_strip)
+ $(QUIETLY) $(STRIP) $@
+ else
+ ifeq ($(STRIP_POLICY),min_strip)
+ $(QUIETLY) $(STRIP) -g $@
+ # implied else here is no stripping at all
+ endif
+ endif
+ ifeq ($(ZIP_DEBUGINFO_FILES),1)
+ $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO)
+ $(RM) $(LIBJVM_DEBUGINFO)
+ endif
+ endif
+endif
+
+DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR)
+DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM)
+DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
+DEST_JVM_DIZ = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
install_jvm: $(LIBJVM)
@echo "Copying $(LIBJVM) to $(DEST_JVM)"
+ifeq ($(OS_VENDOR), Darwin)
+ $(QUIETLY) test -d $(LIBJVM_DEBUGINFO) && \
+ cp -f -r $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
+else
+ $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
+ cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
+endif
+ $(QUIETLY) test -f $(LIBJVM_DIZ) && \
+ cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ)
$(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
#----------------------------------------------------------------------
@@ -340,11 +389,8 @@
#----------------------------------------------------------------------
ifeq ($(OS_VENDOR), Darwin)
-$(LIBJVM).dSYM: $(LIBJVM)
- dsymutil $(LIBJVM)
-
# no libjvm_db for macosx
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck $(LIBJVM).dSYM
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(BUILDLIBSAPROC) dtraceCheck
echo "Doing vm.make build:"
else
build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
--- a/hotspot/make/defs.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/defs.make Mon Oct 28 12:28:57 2013 -0700
@@ -77,6 +77,16 @@
@$(RM) $@
$(CP) $< $@
endef
+
+# MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead.
+# May need to have a MacOS X specific definition of install-dir
+# sometime in the future.
+define install-dir
+@$(MKDIR) -p $(@D)
+@$(RM) -r $@
+$(CP) -r $< $@
+endef
+
define prep-target
@$(MKDIR) -p $(@D)
@$(RM) $@
--- a/hotspot/make/hotspot_version Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/hotspot_version Mon Oct 28 12:28:57 2013 -0700
@@ -35,7 +35,7 @@
HS_MAJOR_VER=25
HS_MINOR_VER=0
-HS_BUILD_NUMBER=54
+HS_BUILD_NUMBER=55
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
--- a/hotspot/make/windows/makefiles/compile.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/windows/makefiles/compile.make Mon Oct 28 12:28:57 2013 -0700
@@ -181,6 +181,7 @@
PRODUCT_OPT_OPTION = /O2 /Oy-
FASTDEBUG_OPT_OPTION = /O2 /Oy-
DEBUG_OPT_OPTION = /Od
+SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2005"
@@ -199,6 +200,7 @@
!if "x$(MT)" == "x"
MT=mt.exe
!endif
+SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2008"
@@ -213,6 +215,7 @@
!if "x$(MT)" == "x"
MT=mt.exe
!endif
+SAFESEH_FLAG = /SAFESEH
!endif
!if "$(COMPILER_NAME)" == "VS2010"
@@ -244,9 +247,11 @@
!if "x$(MT)" == "x"
MT=mt.exe
!endif
+SAFESEH_FLAG = /SAFESEH
+!endif
+
!if "$(BUILDARCH)" == "i486"
-LD_FLAGS = /SAFESEH $(LD_FLAGS)
-!endif
+LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
!endif
CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG)
--- a/hotspot/make/windows/makefiles/sa.make Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/make/windows/makefiles/sa.make Mon Oct 28 12:28:57 2013 -0700
@@ -110,6 +110,9 @@
!if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
SA_LFLAGS = $(SA_LFLAGS) -map -debug
!endif
+!if "$(BUILDARCH)" == "i486"
+SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
+!endif
SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
--- a/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -3100,6 +3100,10 @@
}
}
+void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
+ fatal("Type profiling not implemented on this platform");
+}
+
void LIR_Assembler::align_backward_branch_target() {
__ align(OptoLoopAlignment);
}
--- a/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1076,6 +1076,25 @@
__ verify_not_null_oop(Oexception);
+#ifdef ASSERT
+ // check that fields in JavaThread for exception oop and issuing pc are
+ // empty before writing to them
+ Label oop_empty;
+ Register scratch = I7; // We can use I7 here because it's overwritten later anyway.
+ __ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
+ __ br_null(scratch, false, Assembler::pt, oop_empty);
+ __ delayed()->nop();
+ __ stop("exception oop already set");
+ __ bind(oop_empty);
+
+ Label pc_empty;
+ __ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
+ __ br_null(scratch, false, Assembler::pt, pc_empty);
+ __ delayed()->nop();
+ __ stop("exception pc already set");
+ __ bind(pc_empty);
+#endif
+
// save the exception and issuing pc in the thread
__ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
__ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
--- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -76,6 +76,8 @@
// GC Ergo Flags
define_pd_global(uintx, CMSYoungGenPerWorker, 16*M); // default max size of CMS young gen, per GC worker thread
+define_pd_global(uintx, TypeProfileLevel, 0);
+
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \
\
product(intx, UseVIS, 99, \
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -3581,6 +3581,7 @@
// the pending exception will be picked up the interpreter.
__ ld_ptr(G2_thread, in_bytes(JavaThread::exception_oop_offset()), Oexception);
__ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
+ __ st_ptr(G0, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
__ bind(noException);
// deallocate the deoptimization frame taking care to preserve the return values
--- a/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -3632,6 +3632,161 @@
}
}
+void LIR_Assembler::emit_profile_type(LIR_OpProfileType* op) {
+ Register obj = op->obj()->as_register();
+ Register tmp = op->tmp()->as_pointer_register();
+ Address mdo_addr = as_Address(op->mdp()->as_address_ptr());
+ ciKlass* exact_klass = op->exact_klass();
+ intptr_t current_klass = op->current_klass();
+ bool not_null = op->not_null();
+ bool no_conflict = op->no_conflict();
+
+ Label update, next, none;
+
+ bool do_null = !not_null;
+ bool exact_klass_set = exact_klass != NULL && ciTypeEntries::valid_ciklass(current_klass) == exact_klass;
+ bool do_update = !TypeEntries::is_type_unknown(current_klass) && !exact_klass_set;
+
+ assert(do_null || do_update, "why are we here?");
+ assert(!TypeEntries::was_null_seen(current_klass) || do_update, "why are we here?");
+
+ __ verify_oop(obj);
+
+ if (tmp != obj) {
+ __ mov(tmp, obj);
+ }
+ if (do_null) {
+ __ testptr(tmp, tmp);
+ __ jccb(Assembler::notZero, update);
+ if (!TypeEntries::was_null_seen(current_klass)) {
+ __ orptr(mdo_addr, TypeEntries::null_seen);
+ }
+ if (do_update) {
+#ifndef ASSERT
+ __ jmpb(next);
+ }
+#else
+ __ jmp(next);
+ }
+ } else {
+ __ testptr(tmp, tmp);
+ __ jccb(Assembler::notZero, update);
+ __ stop("unexpect null obj");
+#endif
+ }
+
+ __ bind(update);
+
+ if (do_update) {
+#ifdef ASSERT
+ if (exact_klass != NULL) {
+ Label ok;
+ __ load_klass(tmp, tmp);
+ __ push(tmp);
+ __ mov_metadata(tmp, exact_klass->constant_encoding());
+ __ cmpptr(tmp, Address(rsp, 0));
+ __ jccb(Assembler::equal, ok);
+ __ stop("exact klass and actual klass differ");
+ __ bind(ok);
+ __ pop(tmp);
+ }
+#endif
+ if (!no_conflict) {
+ if (exact_klass == NULL || TypeEntries::is_type_none(current_klass)) {
+ if (exact_klass != NULL) {
+ __ mov_metadata(tmp, exact_klass->constant_encoding());
+ } else {
+ __ load_klass(tmp, tmp);
+ }
+
+ __ xorptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_klass_mask);
+ // klass seen before, nothing to do. The unknown bit may have been
+ // set already but no need to check.
+ __ jccb(Assembler::zero, next);
+
+ __ testptr(tmp, TypeEntries::type_unknown);
+ __ jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
+
+ if (TypeEntries::is_type_none(current_klass)) {
+ __ cmpptr(mdo_addr, 0);
+ __ jccb(Assembler::equal, none);
+ __ cmpptr(mdo_addr, TypeEntries::null_seen);
+ __ jccb(Assembler::equal, none);
+ // There is a chance that the checks above (re-reading profiling
+ // data from memory) fail if another thread has just set the
+ // profiling to this obj's klass
+ __ xorptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_klass_mask);
+ __ jccb(Assembler::zero, next);
+ }
+ } else {
+ assert(ciTypeEntries::valid_ciklass(current_klass) != NULL &&
+ ciTypeEntries::valid_ciklass(current_klass) != exact_klass, "conflict only");
+
+ __ movptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_unknown);
+ __ jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
+ }
+
+ // different than before. Cannot keep accurate profile.
+ __ orptr(mdo_addr, TypeEntries::type_unknown);
+
+ if (TypeEntries::is_type_none(current_klass)) {
+ __ jmpb(next);
+
+ __ bind(none);
+ // first time here. Set profile type.
+ __ movptr(mdo_addr, tmp);
+ }
+ } else {
+ // There's a single possible klass at this profile point
+ assert(exact_klass != NULL, "should be");
+ if (TypeEntries::is_type_none(current_klass)) {
+ __ mov_metadata(tmp, exact_klass->constant_encoding());
+ __ xorptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_klass_mask);
+#ifdef ASSERT
+ __ jcc(Assembler::zero, next);
+
+ {
+ Label ok;
+ __ push(tmp);
+ __ cmpptr(mdo_addr, 0);
+ __ jcc(Assembler::equal, ok);
+ __ cmpptr(mdo_addr, TypeEntries::null_seen);
+ __ jcc(Assembler::equal, ok);
+ // may have been set by another thread
+ __ mov_metadata(tmp, exact_klass->constant_encoding());
+ __ xorptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_mask);
+ __ jcc(Assembler::zero, ok);
+
+ __ stop("unexpected profiling mismatch");
+ __ bind(ok);
+ __ pop(tmp);
+ }
+#else
+ __ jccb(Assembler::zero, next);
+#endif
+ // first time here. Set profile type.
+ __ movptr(mdo_addr, tmp);
+ } else {
+ assert(ciTypeEntries::valid_ciklass(current_klass) != NULL &&
+ ciTypeEntries::valid_ciklass(current_klass) != exact_klass, "inconsistent");
+
+ __ movptr(tmp, mdo_addr);
+ __ testptr(tmp, TypeEntries::type_unknown);
+ __ jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
+
+ __ orptr(mdo_addr, TypeEntries::type_unknown);
+ }
+ }
+
+ __ bind(next);
+ }
+}
+
void LIR_Assembler::emit_delay(LIR_OpDelay*) {
Unimplemented();
}
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -79,6 +79,8 @@
// GC Ergo Flags
define_pd_global(uintx, CMSYoungGenPerWorker, 64*M); // default max size of CMS young gen, per GC worker thread
+define_pd_global(uintx, TypeProfileLevel, 11);
+
#define ARCH_FLAGS(develop, product, diagnostic, experimental, notproduct) \
\
develop(bool, IEEEPrecision, true, \
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1046,6 +1046,158 @@
}
}
+void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
+ Label update, next, none;
+
+ verify_oop(obj);
+
+ testptr(obj, obj);
+ jccb(Assembler::notZero, update);
+ orptr(mdo_addr, TypeEntries::null_seen);
+ jmpb(next);
+
+ bind(update);
+ load_klass(obj, obj);
+
+ xorptr(obj, mdo_addr);
+ testptr(obj, TypeEntries::type_klass_mask);
+ jccb(Assembler::zero, next); // klass seen before, nothing to
+ // do. The unknown bit may have been
+ // set already but no need to check.
+
+ testptr(obj, TypeEntries::type_unknown);
+ jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
+
+ cmpptr(mdo_addr, 0);
+ jccb(Assembler::equal, none);
+ cmpptr(mdo_addr, TypeEntries::null_seen);
+ jccb(Assembler::equal, none);
+ // There is a chance that the checks above (re-reading profiling
+ // data from memory) fail if another thread has just set the
+ // profiling to this obj's klass
+ xorptr(obj, mdo_addr);
+ testptr(obj, TypeEntries::type_klass_mask);
+ jccb(Assembler::zero, next);
+
+ // different than before. Cannot keep accurate profile.
+ orptr(mdo_addr, TypeEntries::type_unknown);
+ jmpb(next);
+
+ bind(none);
+ // first time here. Set profile type.
+ movptr(mdo_addr, obj);
+
+ bind(next);
+}
+
+void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) {
+ if (!ProfileInterpreter) {
+ return;
+ }
+
+ if (MethodData::profile_arguments() || MethodData::profile_return()) {
+ Label profile_continue;
+
+ test_method_data_pointer(mdp, profile_continue);
+
+ int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
+
+ cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
+ jcc(Assembler::notEqual, profile_continue);
+
+ if (MethodData::profile_arguments()) {
+ Label done;
+ int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
+ addptr(mdp, off_to_args);
+
+ for (int i = 0; i < TypeProfileArgsLimit; i++) {
+ if (i > 0 || MethodData::profile_return()) {
+ // If return value type is profiled we may have no argument to profile
+ movl(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+ subl(tmp, i*TypeStackSlotEntries::per_arg_count());
+ cmpl(tmp, TypeStackSlotEntries::per_arg_count());
+ jcc(Assembler::less, done);
+ }
+ movptr(tmp, Address(callee, Method::const_offset()));
+ load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
+ // stack offset o (zero based) from the start of the argument
+ // list, for n arguments translates into offset n - o - 1 from
+ // the end of the argument list
+ subl(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args));
+ subl(tmp, 1);
+ Address arg_addr = argument_address(tmp);
+ movptr(tmp, arg_addr);
+
+ Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args);
+ profile_obj_type(tmp, mdo_arg_addr);
+
+ int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
+ addptr(mdp, to_add);
+ off_to_args += to_add;
+ }
+
+ if (MethodData::profile_return()) {
+ movl(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+ subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
+ }
+
+ bind(done);
+
+ if (MethodData::profile_return()) {
+ // We're right after the type profile for the last
+ // argument. tmp is the number of cell left in the
+ // CallTypeData/VirtualCallTypeData to reach its end. Non null
+ // if there's a return to profile.
+ assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
+ shll(tmp, exact_log2(DataLayout::cell_size));
+ addptr(mdp, tmp);
+ }
+ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
+ } else {
+ assert(MethodData::profile_return(), "either profile call args or call ret");
+ update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size()));
+ }
+
+ // mdp points right after the end of the
+ // CallTypeData/VirtualCallTypeData, right after the cells for the
+ // return value type if there's one
+
+ bind(profile_continue);
+ }
+}
+
+void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
+ assert_different_registers(mdp, ret, tmp, rsi);
+ if (ProfileInterpreter && MethodData::profile_return()) {
+ Label profile_continue, done;
+
+ test_method_data_pointer(mdp, profile_continue);
+
+ if (MethodData::profile_return_jsr292_only()) {
+ // If we don't profile all invoke bytecodes we must make sure
+ // it's a bytecode we indeed profile. We can't go back to the
+ // begining of the ProfileData we intend to update to check its
+ // type because we're right after it and we don't known its
+ // length
+ Label do_profile;
+ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic);
+ jcc(Assembler::equal, do_profile);
+ cmpb(Address(rsi, 0), Bytecodes::_invokehandle);
+ jcc(Assembler::equal, do_profile);
+ get_method(tmp);
+ cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
+ jcc(Assembler::notEqual, profile_continue);
+
+ bind(do_profile);
+ }
+
+ Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
+ mov(tmp, ret);
+ profile_obj_type(tmp, mdo_ret_addr);
+
+ bind(profile_continue);
+ }
+}
void InterpreterMacroAssembler::profile_call(Register mdp) {
if (ProfileInterpreter) {
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_32.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -215,6 +215,9 @@
void profile_taken_branch(Register mdp, Register bumped_count);
void profile_not_taken_branch(Register mdp);
+ void profile_obj_type(Register obj, const Address& mdo_addr);
+ void profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual);
+ void profile_return_type(Register mdp, Register ret, Register tmp);
void profile_call(Register mdp);
void profile_final_call(Register mdp);
void profile_virtual_call(Register receiver, Register mdp, Register scratch2,
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1067,6 +1067,159 @@
}
}
+void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
+ Label update, next, none;
+
+ verify_oop(obj);
+
+ testptr(obj, obj);
+ jccb(Assembler::notZero, update);
+ orptr(mdo_addr, TypeEntries::null_seen);
+ jmpb(next);
+
+ bind(update);
+ load_klass(obj, obj);
+
+ xorptr(obj, mdo_addr);
+ testptr(obj, TypeEntries::type_klass_mask);
+ jccb(Assembler::zero, next); // klass seen before, nothing to
+ // do. The unknown bit may have been
+ // set already but no need to check.
+
+ testptr(obj, TypeEntries::type_unknown);
+ jccb(Assembler::notZero, next); // already unknown. Nothing to do anymore.
+
+ // There is a chance that by the time we do these checks (re-reading
+ // profiling data from memory) another thread has set the profling
+ // to this obj's klass and we set the profiling as unknow
+ // erroneously
+ cmpptr(mdo_addr, 0);
+ jccb(Assembler::equal, none);
+ cmpptr(mdo_addr, TypeEntries::null_seen);
+ jccb(Assembler::equal, none);
+ // There is a chance that the checks above (re-reading profiling
+ // data from memory) fail if another thread has just set the
+ // profiling to this obj's klass
+ xorptr(obj, mdo_addr);
+ testptr(obj, TypeEntries::type_klass_mask);
+ jccb(Assembler::zero, next);
+
+ // different than before. Cannot keep accurate profile.
+ orptr(mdo_addr, TypeEntries::type_unknown);
+ jmpb(next);
+
+ bind(none);
+ // first time here. Set profile type.
+ movptr(mdo_addr, obj);
+
+ bind(next);
+}
+
+void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual) {
+ if (!ProfileInterpreter) {
+ return;
+ }
+
+ if (MethodData::profile_arguments() || MethodData::profile_return()) {
+ Label profile_continue;
+
+ test_method_data_pointer(mdp, profile_continue);
+
+ int off_to_start = is_virtual ? in_bytes(VirtualCallData::virtual_call_data_size()) : in_bytes(CounterData::counter_data_size());
+
+ cmpb(Address(mdp, in_bytes(DataLayout::tag_offset()) - off_to_start), is_virtual ? DataLayout::virtual_call_type_data_tag : DataLayout::call_type_data_tag);
+ jcc(Assembler::notEqual, profile_continue);
+
+ if (MethodData::profile_arguments()) {
+ Label done;
+ int off_to_args = in_bytes(TypeEntriesAtCall::args_data_offset());
+ addptr(mdp, off_to_args);
+
+ for (int i = 0; i < TypeProfileArgsLimit; i++) {
+ if (i > 0 || MethodData::profile_return()) {
+ // If return value type is profiled we may have no argument to profile
+ movq(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+ subl(tmp, i*TypeStackSlotEntries::per_arg_count());
+ cmpl(tmp, TypeStackSlotEntries::per_arg_count());
+ jcc(Assembler::less, done);
+ }
+ movptr(tmp, Address(callee, Method::const_offset()));
+ load_unsigned_short(tmp, Address(tmp, ConstMethod::size_of_parameters_offset()));
+ subq(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::stack_slot_offset(i))-off_to_args));
+ subl(tmp, 1);
+ Address arg_addr = argument_address(tmp);
+ movptr(tmp, arg_addr);
+
+ Address mdo_arg_addr(mdp, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args);
+ profile_obj_type(tmp, mdo_arg_addr);
+
+ int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
+ addptr(mdp, to_add);
+ off_to_args += to_add;
+ }
+
+ if (MethodData::profile_return()) {
+ movq(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args));
+ subl(tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
+ }
+
+ bind(done);
+
+ if (MethodData::profile_return()) {
+ // We're right after the type profile for the last
+ // argument. tmp is the number of cell left in the
+ // CallTypeData/VirtualCallTypeData to reach its end. Non null
+ // if there's a return to profile.
+ assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
+ shll(tmp, exact_log2(DataLayout::cell_size));
+ addptr(mdp, tmp);
+ }
+ movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
+ } else {
+ assert(MethodData::profile_return(), "either profile call args or call ret");
+ update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size()));
+ }
+
+ // mdp points right after the end of the
+ // CallTypeData/VirtualCallTypeData, right after the cells for the
+ // return value type if there's one
+
+ bind(profile_continue);
+ }
+}
+
+void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
+ assert_different_registers(mdp, ret, tmp, r13);
+ if (ProfileInterpreter && MethodData::profile_return()) {
+ Label profile_continue, done;
+
+ test_method_data_pointer(mdp, profile_continue);
+
+ if (MethodData::profile_return_jsr292_only()) {
+ // If we don't profile all invoke bytecodes we must make sure
+ // it's a bytecode we indeed profile. We can't go back to the
+ // begining of the ProfileData we intend to update to check its
+ // type because we're right after it and we don't known its
+ // length
+ Label do_profile;
+ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
+ jcc(Assembler::equal, do_profile);
+ cmpb(Address(r13, 0), Bytecodes::_invokehandle);
+ jcc(Assembler::equal, do_profile);
+ get_method(tmp);
+ cmpb(Address(tmp, Method::intrinsic_id_offset_in_bytes()), vmIntrinsics::_compiledLambdaForm);
+ jcc(Assembler::notEqual, profile_continue);
+
+ bind(do_profile);
+ }
+
+ Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
+ mov(tmp, ret);
+ profile_obj_type(tmp, mdo_ret_addr);
+
+ bind(profile_continue);
+ }
+}
void InterpreterMacroAssembler::profile_call(Register mdp) {
if (ProfileInterpreter) {
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86_64.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -224,6 +224,9 @@
void profile_taken_branch(Register mdp, Register bumped_count);
void profile_not_taken_branch(Register mdp);
+ void profile_obj_type(Register obj, const Address& mdo_addr);
+ void profile_arguments_type(Register mdp, Register callee, Register tmp, bool is_virtual);
+ void profile_return_type(Register mdp, Register ret, Register tmp);
void profile_call(Register mdp);
void profile_final_call(Register mdp);
void profile_virtual_call(Register receiver, Register mdp,
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -773,6 +773,7 @@
void orptr(Register dst, Address src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
void orptr(Register dst, Register src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
void orptr(Register dst, int32_t src) { LP64_ONLY(orq(dst, src)) NOT_LP64(orl(dst, src)); }
+ void orptr(Address dst, int32_t imm32) { LP64_ONLY(orq(dst, imm32)) NOT_LP64(orl(dst, imm32)); }
void testptr(Register src, int32_t imm32) { LP64_ONLY(testq(src, imm32)) NOT_LP64(testl(src, imm32)); }
void testptr(Register src1, Register src2);
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_32.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -194,6 +194,12 @@
__ restore_bcp();
__ restore_locals();
+ if (incoming_state == atos) {
+ Register mdp = rbx;
+ Register tmp = rcx;
+ __ profile_return_type(mdp, rax, tmp);
+ }
+
Label L_got_cache, L_giant_index;
if (EnableInvokeDynamic) {
__ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic);
--- a/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/templateInterpreter_x86_64.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -177,6 +177,12 @@
__ restore_bcp();
__ restore_locals();
+ if (state == atos) {
+ Register mdp = rbx;
+ Register tmp = rcx;
+ __ profile_return_type(mdp, rax, tmp);
+ }
+
Label L_got_cache, L_giant_index;
if (EnableInvokeDynamic) {
__ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2970,6 +2970,7 @@
// profile this call
__ profile_final_call(rax);
+ __ profile_arguments_type(rax, method, rsi, true);
__ jump_from_interpreted(method, rax);
@@ -2984,6 +2985,7 @@
// get target Method* & entry point
__ lookup_virtual_method(rax, index, method);
+ __ profile_arguments_type(rdx, method, rsi, true);
__ jump_from_interpreted(method, rdx);
}
@@ -3013,6 +3015,7 @@
__ null_check(rcx);
// do the call
__ profile_call(rax);
+ __ profile_arguments_type(rax, rbx, rsi, false);
__ jump_from_interpreted(rbx, rax);
}
@@ -3023,6 +3026,7 @@
prepare_invoke(byte_no, rbx); // get f1 Method*
// do the call
__ profile_call(rax);
+ __ profile_arguments_type(rax, rbx, rsi, false);
__ jump_from_interpreted(rbx, rax);
}
@@ -3082,6 +3086,8 @@
__ testptr(rbx, rbx);
__ jcc(Assembler::zero, no_such_method);
+ __ profile_arguments_type(rdx, rbx, rsi, true);
+
// do the call
// rcx: receiver
// rbx,: Method*
@@ -3138,6 +3144,7 @@
// FIXME: profile the LambdaForm also
__ profile_final_call(rax);
+ __ profile_arguments_type(rdx, rbx_method, rsi, true);
__ jump_from_interpreted(rbx_method, rdx);
}
@@ -3171,6 +3178,7 @@
// %%% should make a type profile for any invokedynamic that takes a ref argument
// profile this call
__ profile_call(rsi);
+ __ profile_arguments_type(rdx, rbx, rsi, false);
__ verify_oop(rax_callsite);
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -3026,6 +3026,7 @@
// profile this call
__ profile_final_call(rax);
+ __ profile_arguments_type(rax, method, r13, true);
__ jump_from_interpreted(method, rax);
@@ -3040,6 +3041,7 @@
// get target Method* & entry point
__ lookup_virtual_method(rax, index, method);
+ __ profile_arguments_type(rdx, method, r13, true);
__ jump_from_interpreted(method, rdx);
}
@@ -3069,6 +3071,7 @@
__ null_check(rcx);
// do the call
__ profile_call(rax);
+ __ profile_arguments_type(rax, rbx, r13, false);
__ jump_from_interpreted(rbx, rax);
}
@@ -3079,6 +3082,7 @@
prepare_invoke(byte_no, rbx); // get f1 Method*
// do the call
__ profile_call(rax);
+ __ profile_arguments_type(rax, rbx, r13, false);
__ jump_from_interpreted(rbx, rax);
}
@@ -3136,6 +3140,8 @@
__ testptr(rbx, rbx);
__ jcc(Assembler::zero, no_such_method);
+ __ profile_arguments_type(rdx, rbx, r13, true);
+
// do the call
// rcx: receiver
// rbx,: Method*
@@ -3193,6 +3199,7 @@
// FIXME: profile the LambdaForm also
__ profile_final_call(rax);
+ __ profile_arguments_type(rdx, rbx_method, r13, true);
__ jump_from_interpreted(rbx_method, rdx);
}
@@ -3226,6 +3233,7 @@
// %%% should make a type profile for any invokedynamic that takes a ref argument
// profile this call
__ profile_call(r13);
+ __ profile_arguments_type(rdx, rbx_method, r13, false);
__ verify_oop(rax_callsite);
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -159,9 +159,21 @@
return Bsd::available_memory();
}
+// available here means free
julong os::Bsd::available_memory() {
- // XXXBSD: this is just a stopgap implementation
- return physical_memory() >> 2;
+ uint64_t available = physical_memory() >> 2;
+#ifdef __APPLE__
+ mach_msg_type_number_t count = HOST_VM_INFO64_COUNT;
+ vm_statistics64_data_t vmstat;
+ kern_return_t kerr = host_statistics64(mach_host_self(), HOST_VM_INFO64,
+ (host_info64_t)&vmstat, &count);
+ assert(kerr == KERN_SUCCESS,
+ "host_statistics64 failed - check mach_host_self() and count");
+ if (kerr == KERN_SUCCESS) {
+ available = vmstat.free_count * os::vm_page_size();
+ }
+#endif
+ return available;
}
julong os::physical_memory() {
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -935,6 +935,7 @@
void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead* x) {}
void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
+void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {}
void Canonicalizer::do_RangeCheckPredicate(RangeCheckPredicate* x) {}
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -104,6 +104,7 @@
virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x);
virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
virtual void do_ProfileCall (ProfileCall* x);
+ virtual void do_ProfileReturnType (ProfileReturnType* x);
virtual void do_ProfileInvoke (ProfileInvoke* x);
virtual void do_RuntimeCall (RuntimeCall* x);
virtual void do_MemBar (MemBar* x);
--- a/hotspot/src/share/vm/c1/c1_Compilation.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Compilation.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -601,6 +601,17 @@
}
}
+ciKlass* Compilation::cha_exact_type(ciType* type) {
+ if (type != NULL && type->is_loaded() && type->is_instance_klass()) {
+ ciInstanceKlass* ik = type->as_instance_klass();
+ assert(ik->exact_klass() == NULL, "no cha for final klass");
+ if (DeoptC1 && UseCHA && !(ik->has_subklass() || ik->is_interface())) {
+ dependency_recorder()->assert_leaf_type(ik);
+ return ik;
+ }
+ }
+ return NULL;
+}
void Compilation::print_timers() {
// tty->print_cr(" Native methods : %6.3f s, Average : %2.3f", CompileBroker::_t_native_compilation.seconds(), CompileBroker::_t_native_compilation.seconds() / CompileBroker::_total_native_compile_count);
--- a/hotspot/src/share/vm/c1/c1_Compilation.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Compilation.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -246,6 +246,8 @@
(RangeCheckElimination || UseLoopInvariantCodeMotion) &&
method()->method_data()->trap_count(Deoptimization::Reason_none) == 0;
}
+
+ ciKlass* cha_exact_type(ciType* type);
};
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -42,26 +42,16 @@
#include "runtime/interfaceSupport.hpp"
#include "runtime/sharedRuntime.hpp"
-volatile int Compiler::_runtimes = uninitialized;
-
-Compiler::Compiler() {
-}
-
-Compiler::~Compiler() {
- Unimplemented();
-}
+Compiler::Compiler () {}
-
-void Compiler::initialize_all() {
+void Compiler::init_c1_runtime() {
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
Arena* arena = new (mtCompiler) Arena();
Runtime1::initialize(buffer_blob);
FrameMap::initialize();
// initialize data structures
ValueType::initialize(arena);
- // Instruction::initialize();
- // BlockBegin::initialize();
GraphBuilder::initialize();
// note: to use more than one instance of LinearScan at a time this function call has to
// be moved somewhere outside of this constructor:
@@ -70,32 +60,33 @@
void Compiler::initialize() {
- if (_runtimes != initialized) {
- initialize_runtimes( initialize_all, &_runtimes);
+ // Buffer blob must be allocated per C1 compiler thread at startup
+ BufferBlob* buffer_blob = init_buffer_blob();
+
+ if (should_perform_init()) {
+ if (buffer_blob == NULL) {
+ // When we come here we are in state 'initializing'; entire C1 compilation
+ // can be shut down.
+ set_state(failed);
+ } else {
+ init_c1_runtime();
+ set_state(initialized);
+ }
}
- mark_initialized();
}
-
-BufferBlob* Compiler::get_buffer_blob(ciEnv* env) {
+BufferBlob* Compiler::init_buffer_blob() {
// Allocate buffer blob once at startup since allocation for each
// compilation seems to be too expensive (at least on Intel win32).
- BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
- if (buffer_blob != NULL) {
- return buffer_blob;
- }
+ assert (CompilerThread::current()->get_buffer_blob() == NULL, "Should initialize only once");
// setup CodeBuffer. Preallocate a BufferBlob of size
// NMethodSizeLimit plus some extra space for constants.
int code_buffer_size = Compilation::desired_max_code_buffer_size() +
Compilation::desired_max_constant_size();
- buffer_blob = BufferBlob::create("Compiler1 temporary CodeBuffer",
- code_buffer_size);
- if (buffer_blob == NULL) {
- CompileBroker::handle_full_code_cache();
- env->record_failure("CodeCache is full");
- } else {
+ BufferBlob* buffer_blob = BufferBlob::create("C1 temporary CodeBuffer", code_buffer_size);
+ if (buffer_blob != NULL) {
CompilerThread::current()->set_buffer_blob(buffer_blob);
}
@@ -104,15 +95,8 @@
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) {
- BufferBlob* buffer_blob = Compiler::get_buffer_blob(env);
- if (buffer_blob == NULL) {
- return;
- }
-
- if (!is_initialized()) {
- initialize();
- }
-
+ BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
+ assert(buffer_blob != NULL, "Must exist");
// invoke compilation
{
// We are nested here because we need for the destructor
--- a/hotspot/src/share/vm/c1/c1_Compiler.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Compiler.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -30,11 +30,9 @@
// There is one instance of the Compiler per CompilerThread.
class Compiler: public AbstractCompiler {
-
private:
-
- // Tracks whether runtime has been initialized
- static volatile int _runtimes;
+ static void init_c1_runtime();
+ BufferBlob* init_buffer_blob();
public:
// Creation
@@ -46,19 +44,12 @@
virtual bool is_c1() { return true; };
- BufferBlob* get_buffer_blob(ciEnv* env);
-
// Missing feature tests
virtual bool supports_native() { return true; }
virtual bool supports_osr () { return true; }
- // Customization
- virtual bool needs_adapters () { return false; }
- virtual bool needs_stubs () { return false; }
-
// Initialization
virtual void initialize();
- static void initialize_all();
// Compilation entry point for methods
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1466,9 +1466,22 @@
// State at end of inlined method is the state of the caller
// without the method parameters on stack, including the
// return value, if any, of the inlined method on operand stack.
+ int invoke_bci = state()->caller_state()->bci();
set_state(state()->caller_state()->copy_for_parsing());
if (x != NULL) {
state()->push(x->type(), x);
+ if (profile_calls() && MethodData::profile_return() && x->type()->is_object_kind()) {
+ ciMethod* caller = state()->scope()->method();
+ ciMethodData* md = caller->method_data_or_null();
+ ciProfileData* data = md->bci_to_data(invoke_bci);
+ if (data->is_CallTypeData() || data->is_VirtualCallTypeData()) {
+ bool has_return = data->is_CallTypeData() ? ((ciCallTypeData*)data)->has_return() : ((ciVirtualCallTypeData*)data)->has_return();
+ // May not be true in case of an inlined call through a method handle intrinsic.
+ if (has_return) {
+ profile_return_type(x, method(), caller, invoke_bci);
+ }
+ }
+ }
}
Goto* goto_callee = new Goto(continuation(), false);
@@ -1658,6 +1671,42 @@
return compilation()->dependency_recorder();
}
+// How many arguments do we want to profile?
+Values* GraphBuilder::args_list_for_profiling(int& start, bool may_have_receiver) {
+ int n = 0;
+ assert(start == 0, "should be initialized");
+ if (MethodData::profile_arguments()) {
+ ciProfileData* data = method()->method_data()->bci_to_data(bci());
+ if (data->is_CallTypeData() || data->is_VirtualCallTypeData()) {
+ n = data->is_CallTypeData() ? data->as_CallTypeData()->number_of_arguments() : data->as_VirtualCallTypeData()->number_of_arguments();
+ bool has_receiver = may_have_receiver && Bytecodes::has_receiver(method()->java_code_at_bci(bci()));
+ start = has_receiver ? 1 : 0;
+ }
+ }
+ if (n > 0) {
+ return new Values(n);
+ }
+ return NULL;
+}
+
+// Collect arguments that we want to profile in a list
+Values* GraphBuilder::collect_args_for_profiling(Values* args, bool may_have_receiver) {
+ int start = 0;
+ Values* obj_args = args_list_for_profiling(start, may_have_receiver);
+ if (obj_args == NULL) {
+ return NULL;
+ }
+ int s = obj_args->size();
+ for (int i = start, j = 0; j < s; i++) {
+ if (args->at(i)->type()->is_object_kind()) {
+ obj_args->push(args->at(i));
+ j++;
+ }
+ }
+ assert(s == obj_args->length(), "missed on arg?");
+ return obj_args;
+}
+
void GraphBuilder::invoke(Bytecodes::Code code) {
bool will_link;
@@ -1957,7 +2006,7 @@
} else if (exact_target != NULL) {
target_klass = exact_target->holder();
}
- profile_call(target, recv, target_klass);
+ profile_call(target, recv, target_klass, collect_args_for_profiling(args, false), false);
}
}
@@ -1972,6 +2021,9 @@
push(result_type, result);
}
}
+ if (profile_calls() && MethodData::profile_return() && result_type->is_object_kind()) {
+ profile_return_type(result, target);
+ }
}
@@ -3509,7 +3561,7 @@
recv = args->at(0);
null_check(recv);
}
- profile_call(callee, recv, NULL);
+ profile_call(callee, recv, NULL, collect_args_for_profiling(args, true), true);
}
}
}
@@ -3520,6 +3572,10 @@
Value value = append_split(result);
if (result_type != voidType) push(result_type, value);
+ if (callee != method() && profile_calls() && MethodData::profile_return() && result_type->is_object_kind()) {
+ profile_return_type(result, callee);
+ }
+
// done
return true;
}
@@ -3763,7 +3819,28 @@
compilation()->set_would_profile(true);
if (profile_calls()) {
- profile_call(callee, recv, holder_known ? callee->holder() : NULL);
+ int start = 0;
+ Values* obj_args = args_list_for_profiling(start, has_receiver);
+ if (obj_args != NULL) {
+ int s = obj_args->size();
+ // if called through method handle invoke, some arguments may have been popped
+ for (int i = args_base+start, j = 0; j < obj_args->size() && i < state()->stack_size(); ) {
+ Value v = state()->stack_at_inc(i);
+ if (v->type()->is_object_kind()) {
+ obj_args->push(v);
+ j++;
+ }
+ }
+#ifdef ASSERT
+ {
+ bool ignored_will_link;
+ ciSignature* declared_signature = NULL;
+ ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
+ assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
+ }
+#endif
+ }
+ profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true);
}
}
@@ -4251,8 +4328,23 @@
}
#endif // PRODUCT
-void GraphBuilder::profile_call(ciMethod* callee, Value recv, ciKlass* known_holder) {
- append(new ProfileCall(method(), bci(), callee, recv, known_holder));
+void GraphBuilder::profile_call(ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined) {
+ append(new ProfileCall(method(), bci(), callee, recv, known_holder, obj_args, inlined));
+}
+
+void GraphBuilder::profile_return_type(Value ret, ciMethod* callee, ciMethod* m, int invoke_bci) {
+ assert((m == NULL) == (invoke_bci < 0), "invalid method and invalid bci together");
+ if (m == NULL) {
+ m = method();
+ }
+ if (invoke_bci < 0) {
+ invoke_bci = bci();
+ }
+ ciMethodData* md = m->method_data_or_null();
+ ciProfileData* data = md->bci_to_data(invoke_bci);
+ if (data->is_CallTypeData() || data->is_VirtualCallTypeData()) {
+ append(new ProfileReturnType(m , invoke_bci, callee, ret));
+ }
}
void GraphBuilder::profile_invocation(ciMethod* callee, ValueStack* state) {
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -374,7 +374,8 @@
void print_inlining(ciMethod* callee, const char* msg = NULL, bool success = true);
- void profile_call(ciMethod* callee, Value recv, ciKlass* predicted_holder);
+ void profile_call(ciMethod* callee, Value recv, ciKlass* predicted_holder, Values* obj_args, bool inlined);
+ void profile_return_type(Value ret, ciMethod* callee, ciMethod* m = NULL, int bci = -1);
void profile_invocation(ciMethod* inlinee, ValueStack* state);
// Shortcuts to profiling control.
@@ -386,6 +387,9 @@
bool profile_inlined_calls() { return _compilation->profile_inlined_calls(); }
bool profile_checkcasts() { return _compilation->profile_checkcasts(); }
+ Values* args_list_for_profiling(int& start, bool may_have_receiver);
+ Values* collect_args_for_profiling(Values* args, bool may_have_receiver);
+
public:
NOT_PRODUCT(void print_stats();)
--- a/hotspot/src/share/vm/c1/c1_Instruction.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Instruction.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -104,6 +104,14 @@
}
}
+ciType* Instruction::exact_type() const {
+ ciType* t = declared_type();
+ if (t != NULL && t->is_klass()) {
+ return t->as_klass()->exact_klass();
+ }
+ return NULL;
+}
+
#ifndef PRODUCT
void Instruction::check_state(ValueStack* state) {
@@ -135,9 +143,7 @@
// perform constant and interval tests on index value
bool AccessIndexed::compute_needs_range_check() {
-
if (length()) {
-
Constant* clength = length()->as_Constant();
Constant* cindex = index()->as_Constant();
if (clength && cindex) {
@@ -157,34 +163,8 @@
}
-ciType* Local::exact_type() const {
- ciType* type = declared_type();
-
- // for primitive arrays, the declared type is the exact type
- if (type->is_type_array_klass()) {
- return type;
- } else if (type->is_instance_klass()) {
- ciInstanceKlass* ik = (ciInstanceKlass*)type;
- if (ik->is_loaded() && ik->is_final() && !ik->is_interface()) {
- return type;
- }
- } else if (type->is_obj_array_klass()) {
- ciObjArrayKlass* oak = (ciObjArrayKlass*)type;
- ciType* base = oak->base_element_type();
- if (base->is_instance_klass()) {
- ciInstanceKlass* ik = base->as_instance_klass();
- if (ik->is_loaded() && ik->is_final()) {
- return type;
- }
- } else if (base->is_primitive_type()) {
- return type;
- }
- }
- return NULL;
-}
-
ciType* Constant::exact_type() const {
- if (type()->is_object()) {
+ if (type()->is_object() && type()->as_ObjectType()->is_loaded()) {
return type()->as_ObjectType()->exact_type();
}
return NULL;
@@ -192,19 +172,18 @@
ciType* LoadIndexed::exact_type() const {
ciType* array_type = array()->exact_type();
- if (array_type == NULL) {
- return NULL;
- }
- assert(array_type->is_array_klass(), "what else?");
- ciArrayKlass* ak = (ciArrayKlass*)array_type;
+ if (array_type != NULL) {
+ assert(array_type->is_array_klass(), "what else?");
+ ciArrayKlass* ak = (ciArrayKlass*)array_type;
- if (ak->element_type()->is_instance_klass()) {
- ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
- if (ik->is_loaded() && ik->is_final()) {
- return ik;
+ if (ak->element_type()->is_instance_klass()) {
+ ciInstanceKlass* ik = (ciInstanceKlass*)ak->element_type();
+ if (ik->is_loaded() && ik->is_final()) {
+ return ik;
+ }
}
}
- return NULL;
+ return Instruction::exact_type();
}
@@ -224,22 +203,6 @@
}
-ciType* LoadField::exact_type() const {
- ciType* type = declared_type();
- // for primitive arrays, the declared type is the exact type
- if (type->is_type_array_klass()) {
- return type;
- }
- if (type->is_instance_klass()) {
- ciInstanceKlass* ik = (ciInstanceKlass*)type;
- if (ik->is_loaded() && ik->is_final()) {
- return type;
- }
- }
- return NULL;
-}
-
-
ciType* NewTypeArray::exact_type() const {
return ciTypeArrayKlass::make(elt_type());
}
@@ -264,16 +227,6 @@
return klass();
}
-ciType* CheckCast::exact_type() const {
- if (klass()->is_instance_klass()) {
- ciInstanceKlass* ik = (ciInstanceKlass*)klass();
- if (ik->is_loaded() && ik->is_final()) {
- return ik;
- }
- }
- return NULL;
-}
-
// Implementation of ArithmeticOp
bool ArithmeticOp::is_commutative() const {
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -107,6 +107,7 @@
class UnsafePrefetchRead;
class UnsafePrefetchWrite;
class ProfileCall;
+class ProfileReturnType;
class ProfileInvoke;
class RuntimeCall;
class MemBar;
@@ -211,6 +212,7 @@
virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0;
virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
virtual void do_ProfileCall (ProfileCall* x) = 0;
+ virtual void do_ProfileReturnType (ProfileReturnType* x) = 0;
virtual void do_ProfileInvoke (ProfileInvoke* x) = 0;
virtual void do_RuntimeCall (RuntimeCall* x) = 0;
virtual void do_MemBar (MemBar* x) = 0;
@@ -322,6 +324,36 @@
_type = type;
}
+ // Helper class to keep track of which arguments need a null check
+ class ArgsNonNullState {
+ private:
+ int _nonnull_state; // mask identifying which args are nonnull
+ public:
+ ArgsNonNullState()
+ : _nonnull_state(AllBits) {}
+
+ // Does argument number i needs a null check?
+ bool arg_needs_null_check(int i) const {
+ // No data is kept for arguments starting at position 33 so
+ // conservatively assume that they need a null check.
+ if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+ return is_set_nth_bit(_nonnull_state, i);
+ }
+ return true;
+ }
+
+ // Set whether argument number i needs a null check or not
+ void set_arg_needs_null_check(int i, bool check) {
+ if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
+ if (check) {
+ _nonnull_state |= nth_bit(i);
+ } else {
+ _nonnull_state &= ~(nth_bit(i));
+ }
+ }
+ }
+ };
+
public:
void* operator new(size_t size) throw() {
Compilation* c = Compilation::current();
@@ -566,7 +598,7 @@
virtual void other_values_do(ValueVisitor* f) { /* usually no other - override on demand */ }
void values_do(ValueVisitor* f) { input_values_do(f); state_values_do(f); other_values_do(f); }
- virtual ciType* exact_type() const { return NULL; }
+ virtual ciType* exact_type() const;
virtual ciType* declared_type() const { return NULL; }
// hashing
@@ -689,7 +721,6 @@
int java_index() const { return _java_index; }
virtual ciType* declared_type() const { return _declared_type; }
- virtual ciType* exact_type() const;
// generic
virtual void input_values_do(ValueVisitor* f) { /* no values */ }
@@ -806,7 +837,6 @@
{}
ciType* declared_type() const;
- ciType* exact_type() const;
// generic
HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset()) // cannot be eliminated if needs patching or if volatile
@@ -1299,6 +1329,7 @@
virtual bool needs_exception_state() const { return false; }
+ ciType* exact_type() const { return NULL; }
ciType* declared_type() const;
// generic
@@ -1422,7 +1453,6 @@
}
ciType* declared_type() const;
- ciType* exact_type() const;
};
@@ -1490,7 +1520,7 @@
vmIntrinsics::ID _id;
Values* _args;
Value _recv;
- int _nonnull_state; // mask identifying which args are nonnull
+ ArgsNonNullState _nonnull_state;
public:
// preserves_state can be set to true for Intrinsics
@@ -1511,7 +1541,6 @@
, _id(id)
, _args(args)
, _recv(NULL)
- , _nonnull_state(AllBits)
{
assert(args != NULL, "args must exist");
ASSERT_VALUES
@@ -1537,21 +1566,12 @@
Value receiver() const { assert(has_receiver(), "must have receiver"); return _recv; }
bool preserves_state() const { return check_flag(PreservesStateFlag); }
- bool arg_needs_null_check(int i) {
- if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
- return is_set_nth_bit(_nonnull_state, i);
- }
- return true;
+ bool arg_needs_null_check(int i) const {
+ return _nonnull_state.arg_needs_null_check(i);
}
void set_arg_needs_null_check(int i, bool check) {
- if (i >= 0 && i < (int)sizeof(_nonnull_state) * BitsPerByte) {
- if (check) {
- _nonnull_state |= nth_bit(i);
- } else {
- _nonnull_state &= ~(nth_bit(i));
- }
- }
+ _nonnull_state.set_arg_needs_null_check(i, check);
}
// generic
@@ -2450,34 +2470,87 @@
LEAF(ProfileCall, Instruction)
private:
- ciMethod* _method;
- int _bci_of_invoke;
- ciMethod* _callee; // the method that is called at the given bci
- Value _recv;
- ciKlass* _known_holder;
+ ciMethod* _method;
+ int _bci_of_invoke;
+ ciMethod* _callee; // the method that is called at the given bci
+ Value _recv;
+ ciKlass* _known_holder;
+ Values* _obj_args; // arguments for type profiling
+ ArgsNonNullState _nonnull_state; // Do we know whether some arguments are never null?
+ bool _inlined; // Are we profiling a call that is inlined
public:
- ProfileCall(ciMethod* method, int bci, ciMethod* callee, Value recv, ciKlass* known_holder)
+ ProfileCall(ciMethod* method, int bci, ciMethod* callee, Value recv, ciKlass* known_holder, Values* obj_args, bool inlined)
: Instruction(voidType)
, _method(method)
, _bci_of_invoke(bci)
, _callee(callee)
, _recv(recv)
, _known_holder(known_holder)
+ , _obj_args(obj_args)
+ , _inlined(inlined)
{
// The ProfileCall has side-effects and must occur precisely where located
pin();
}
- ciMethod* method() { return _method; }
- int bci_of_invoke() { return _bci_of_invoke; }
- ciMethod* callee() { return _callee; }
- Value recv() { return _recv; }
- ciKlass* known_holder() { return _known_holder; }
-
- virtual void input_values_do(ValueVisitor* f) { if (_recv != NULL) f->visit(&_recv); }
+ ciMethod* method() const { return _method; }
+ int bci_of_invoke() const { return _bci_of_invoke; }
+ ciMethod* callee() const { return _callee; }
+ Value recv() const { return _recv; }
+ ciKlass* known_holder() const { return _known_holder; }
+ int nb_profiled_args() const { return _obj_args == NULL ? 0 : _obj_args->length(); }
+ Value profiled_arg_at(int i) const { return _obj_args->at(i); }
+ bool arg_needs_null_check(int i) const {
+ return _nonnull_state.arg_needs_null_check(i);
+ }
+ bool inlined() const { return _inlined; }
+
+ void set_arg_needs_null_check(int i, bool check) {
+ _nonnull_state.set_arg_needs_null_check(i, check);
+ }
+
+ virtual void input_values_do(ValueVisitor* f) {
+ if (_recv != NULL) {
+ f->visit(&_recv);
+ }
+ for (int i = 0; i < nb_profiled_args(); i++) {
+ f->visit(_obj_args->adr_at(i));
+ }
+ }
};
+LEAF(ProfileReturnType, Instruction)
+ private:
+ ciMethod* _method;
+ ciMethod* _callee;
+ int _bci_of_invoke;
+ Value _ret;
+
+ public:
+ ProfileReturnType(ciMethod* method, int bci, ciMethod* callee, Value ret)
+ : Instruction(voidType)
+ , _method(method)
+ , _callee(callee)
+ , _bci_of_invoke(bci)
+ , _ret(ret)
+ {
+ set_needs_null_check(true);
+ // The ProfileType has side-effects and must occur precisely where located
+ pin();
+ }
+
+ ciMethod* method() const { return _method; }
+ ciMethod* callee() const { return _callee; }
+ int bci_of_invoke() const { return _bci_of_invoke; }
+ Value ret() const { return _ret; }
+
+ virtual void input_values_do(ValueVisitor* f) {
+ if (_ret != NULL) {
+ f->visit(&_ret);
+ }
+ }
+};
// Call some C runtime function that doesn't safepoint,
// optionally passing the current thread as the first argument.
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -892,10 +892,24 @@
if (x->known_holder() != NULL) {
output()->print(", ");
print_klass(x->known_holder());
+ output()->print(" ");
+ }
+ for (int i = 0; i < x->nb_profiled_args(); i++) {
+ if (i > 0) output()->print(", ");
+ print_value(x->profiled_arg_at(i));
+ if (x->arg_needs_null_check(i)) {
+ output()->print(" [NC]");
+ }
}
output()->put(')');
}
+void InstructionPrinter::do_ProfileReturnType(ProfileReturnType* x) {
+ output()->print("profile ret type ");
+ print_value(x->ret());
+ output()->print(" %s.%s", x->method()->holder()->name()->as_utf8(), x->method()->name()->as_utf8());
+ output()->put(')');
+}
void InstructionPrinter::do_ProfileInvoke(ProfileInvoke* x) {
output()->print("profile_invoke ");
output()->print(" %s.%s", x->inlinee()->holder()->name()->as_utf8(), x->inlinee()->name()->as_utf8());
--- a/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_InstructionPrinter.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -132,6 +132,7 @@
virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x);
virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
virtual void do_ProfileCall (ProfileCall* x);
+ virtual void do_ProfileReturnType (ProfileReturnType* x);
virtual void do_ProfileInvoke (ProfileInvoke* x);
virtual void do_RuntimeCall (RuntimeCall* x);
virtual void do_MemBar (MemBar* x);
--- a/hotspot/src/share/vm/c1/c1_LIR.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIR.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1001,6 +1001,17 @@
assert(opProfileCall->_tmp1->is_valid(), "used"); do_temp(opProfileCall->_tmp1);
break;
}
+
+// LIR_OpProfileType:
+ case lir_profile_type: {
+ assert(op->as_OpProfileType() != NULL, "must be");
+ LIR_OpProfileType* opProfileType = (LIR_OpProfileType*)op;
+
+ do_input(opProfileType->_mdp); do_temp(opProfileType->_mdp);
+ do_input(opProfileType->_obj);
+ do_temp(opProfileType->_tmp);
+ break;
+ }
default:
ShouldNotReachHere();
}
@@ -1151,6 +1162,10 @@
masm->emit_profile_call(this);
}
+void LIR_OpProfileType::emit_code(LIR_Assembler* masm) {
+ masm->emit_profile_type(this);
+}
+
// LIR_List
LIR_List::LIR_List(Compilation* compilation, BlockBegin* block)
: _operations(8)
@@ -1803,6 +1818,8 @@
case lir_cas_int: s = "cas_int"; break;
// LIR_OpProfileCall
case lir_profile_call: s = "profile_call"; break;
+ // LIR_OpProfileType
+ case lir_profile_type: s = "profile_type"; break;
// LIR_OpAssert
#ifdef ASSERT
case lir_assert: s = "assert"; break;
@@ -2086,6 +2103,15 @@
tmp1()->print(out); out->print(" ");
}
+// LIR_OpProfileType
+void LIR_OpProfileType::print_instr(outputStream* out) const {
+ out->print("exact = "); exact_klass()->print_name_on(out);
+ out->print("current = "); ciTypeEntries::print_ciklass(out, current_klass());
+ mdp()->print(out); out->print(" ");
+ obj()->print(out); out->print(" ");
+ tmp()->print(out); out->print(" ");
+}
+
#endif // PRODUCT
// Implementation of LIR_InsertionBuffer
--- a/hotspot/src/share/vm/c1/c1_LIR.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIR.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -882,6 +882,7 @@
class LIR_OpTypeCheck;
class LIR_OpCompareAndSwap;
class LIR_OpProfileCall;
+class LIR_OpProfileType;
#ifdef ASSERT
class LIR_OpAssert;
#endif
@@ -1005,6 +1006,7 @@
, end_opCompareAndSwap
, begin_opMDOProfile
, lir_profile_call
+ , lir_profile_type
, end_opMDOProfile
, begin_opAssert
, lir_assert
@@ -1145,6 +1147,7 @@
virtual LIR_OpTypeCheck* as_OpTypeCheck() { return NULL; }
virtual LIR_OpCompareAndSwap* as_OpCompareAndSwap() { return NULL; }
virtual LIR_OpProfileCall* as_OpProfileCall() { return NULL; }
+ virtual LIR_OpProfileType* as_OpProfileType() { return NULL; }
#ifdef ASSERT
virtual LIR_OpAssert* as_OpAssert() { return NULL; }
#endif
@@ -1925,8 +1928,8 @@
public:
// Destroys recv
- LIR_OpProfileCall(LIR_Code code, ciMethod* profiled_method, int profiled_bci, ciMethod* profiled_callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* known_holder)
- : LIR_Op(code, LIR_OprFact::illegalOpr, NULL) // no result, no info
+ LIR_OpProfileCall(ciMethod* profiled_method, int profiled_bci, ciMethod* profiled_callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* known_holder)
+ : LIR_Op(lir_profile_call, LIR_OprFact::illegalOpr, NULL) // no result, no info
, _profiled_method(profiled_method)
, _profiled_bci(profiled_bci)
, _profiled_callee(profiled_callee)
@@ -1948,6 +1951,45 @@
virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
};
+// LIR_OpProfileType
+class LIR_OpProfileType : public LIR_Op {
+ friend class LIR_OpVisitState;
+
+ private:
+ LIR_Opr _mdp;
+ LIR_Opr _obj;
+ LIR_Opr _tmp;
+ ciKlass* _exact_klass; // non NULL if we know the klass statically (no need to load it from _obj)
+ intptr_t _current_klass; // what the profiling currently reports
+ bool _not_null; // true if we know statically that _obj cannot be null
+ bool _no_conflict; // true if we're profling parameters, _exact_klass is not NULL and we know
+ // _exact_klass it the only possible type for this parameter in any context.
+
+ public:
+ // Destroys recv
+ LIR_OpProfileType(LIR_Opr mdp, LIR_Opr obj, ciKlass* exact_klass, intptr_t current_klass, LIR_Opr tmp, bool not_null, bool no_conflict)
+ : LIR_Op(lir_profile_type, LIR_OprFact::illegalOpr, NULL) // no result, no info
+ , _mdp(mdp)
+ , _obj(obj)
+ , _exact_klass(exact_klass)
+ , _current_klass(current_klass)
+ , _tmp(tmp)
+ , _not_null(not_null)
+ , _no_conflict(no_conflict) { }
+
+ LIR_Opr mdp() const { return _mdp; }
+ LIR_Opr obj() const { return _obj; }
+ LIR_Opr tmp() const { return _tmp; }
+ ciKlass* exact_klass() const { return _exact_klass; }
+ intptr_t current_klass() const { return _current_klass; }
+ bool not_null() const { return _not_null; }
+ bool no_conflict() const { return _no_conflict; }
+
+ virtual void emit_code(LIR_Assembler* masm);
+ virtual LIR_OpProfileType* as_OpProfileType() { return this; }
+ virtual void print_instr(outputStream* out) const PRODUCT_RETURN;
+};
+
class LIR_InsertionBuffer;
//--------------------------------LIR_List---------------------------------------------------
@@ -2247,7 +2289,10 @@
ciMethod* profiled_method, int profiled_bci);
// MethodData* profiling
void profile_call(ciMethod* method, int bci, ciMethod* callee, LIR_Opr mdo, LIR_Opr recv, LIR_Opr t1, ciKlass* cha_klass) {
- append(new LIR_OpProfileCall(lir_profile_call, method, bci, callee, mdo, recv, t1, cha_klass));
+ append(new LIR_OpProfileCall(method, bci, callee, mdo, recv, t1, cha_klass));
+ }
+ void profile_type(LIR_Address* mdp, LIR_Opr obj, ciKlass* exact_klass, intptr_t current_klass, LIR_Opr tmp, bool not_null, bool no_conflict) {
+ append(new LIR_OpProfileType(LIR_OprFact::address(mdp), obj, exact_klass, current_klass, tmp, not_null, no_conflict));
}
void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
--- a/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIRAssembler.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -208,6 +208,7 @@
void emit_call(LIR_OpJavaCall* op);
void emit_rtcall(LIR_OpRTCall* op);
void emit_profile_call(LIR_OpProfileCall* op);
+ void emit_profile_type(LIR_OpProfileType* op);
void emit_delay(LIR_OpDelay* op);
void arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr dest, CodeEmitInfo* info, bool pop_fpu_stack);
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2571,6 +2571,78 @@
}
+ciKlass* LIRGenerator::profile_arg_type(ciMethodData* md, int md_base_offset, int md_offset, intptr_t profiled_k, Value arg, LIR_Opr& mdp, bool not_null, ciKlass* signature_k) {
+ ciKlass* result = NULL;
+ bool do_null = !not_null && !TypeEntries::was_null_seen(profiled_k);
+ bool do_update = !TypeEntries::is_type_unknown(profiled_k);
+ // known not to be null or null bit already set and already set to
+ // unknown: nothing we can do to improve profiling
+ if (!do_null && !do_update) {
+ return result;
+ }
+
+ ciKlass* exact_klass = NULL;
+ Compilation* comp = Compilation::current();
+ if (do_update) {
+ // try to find exact type, using CHA if possible, so that loading
+ // the klass from the object can be avoided
+ ciType* type = arg->exact_type();
+ if (type == NULL) {
+ type = arg->declared_type();
+ type = comp->cha_exact_type(type);
+ }
+ assert(type == NULL || type->is_klass(), "type should be class");
+ exact_klass = (type != NULL && type->is_loaded()) ? (ciKlass*)type : NULL;
+
+ do_update = exact_klass == NULL || ciTypeEntries::valid_ciklass(profiled_k) != exact_klass;
+ }
+
+ if (!do_null && !do_update) {
+ return result;
+ }
+
+ ciKlass* exact_signature_k = NULL;
+ if (do_update) {
+ // Is the type from the signature exact (the only one possible)?
+ exact_signature_k = signature_k->exact_klass();
+ if (exact_signature_k == NULL) {
+ exact_signature_k = comp->cha_exact_type(signature_k);
+ } else {
+ result = exact_signature_k;
+ do_update = false;
+ // Known statically. No need to emit any code: prevent
+ // LIR_Assembler::emit_profile_type() from emitting useless code
+ profiled_k = ciTypeEntries::with_status(result, profiled_k);
+ }
+ if (exact_signature_k != NULL && exact_klass != exact_signature_k) {
+ assert(exact_klass == NULL, "arg and signature disagree?");
+ // sometimes the type of the signature is better than the best type
+ // the compiler has
+ exact_klass = exact_signature_k;
+ do_update = exact_klass == NULL || ciTypeEntries::valid_ciklass(profiled_k) != exact_klass;
+ }
+ }
+
+ if (!do_null && !do_update) {
+ return result;
+ }
+
+ if (mdp == LIR_OprFact::illegalOpr) {
+ mdp = new_register(T_METADATA);
+ __ metadata2reg(md->constant_encoding(), mdp);
+ if (md_base_offset != 0) {
+ LIR_Address* base_type_address = new LIR_Address(mdp, md_base_offset, T_ADDRESS);
+ mdp = new_pointer_register();
+ __ leal(LIR_OprFact::address(base_type_address), mdp);
+ }
+ }
+ LIRItem value(arg, this);
+ value.load_item();
+ __ profile_type(new LIR_Address(mdp, md_offset, T_METADATA),
+ value.result(), exact_klass, profiled_k, new_pointer_register(), not_null, exact_signature_k != NULL);
+ return result;
+}
+
void LIRGenerator::do_Base(Base* x) {
__ std_entry(LIR_OprFact::illegalOpr);
// Emit moves from physical registers / stack slots to virtual registers
@@ -3004,12 +3076,52 @@
}
}
+void LIRGenerator::profile_arguments(ProfileCall* x) {
+ if (MethodData::profile_arguments()) {
+ int bci = x->bci_of_invoke();
+ ciMethodData* md = x->method()->method_data_or_null();
+ ciProfileData* data = md->bci_to_data(bci);
+ if (data->is_CallTypeData() || data->is_VirtualCallTypeData()) {
+ ByteSize extra = data->is_CallTypeData() ? CallTypeData::args_data_offset() : VirtualCallTypeData::args_data_offset();
+ int base_offset = md->byte_offset_of_slot(data, extra);
+ LIR_Opr mdp = LIR_OprFact::illegalOpr;
+ ciTypeStackSlotEntries* args = data->is_CallTypeData() ? ((ciCallTypeData*)data)->args() : ((ciVirtualCallTypeData*)data)->args();
+
+ Bytecodes::Code bc = x->method()->java_code_at_bci(bci);
+ int start = 0;
+ int stop = data->is_CallTypeData() ? ((ciCallTypeData*)data)->number_of_arguments() : ((ciVirtualCallTypeData*)data)->number_of_arguments();
+ if (x->nb_profiled_args() < stop) {
+ // if called through method handle invoke, some arguments may have been popped
+ stop = x->nb_profiled_args();
+ }
+ ciSignature* sig = x->callee()->signature();
+ // method handle call to virtual method
+ bool has_receiver = x->inlined() && !x->callee()->is_static() && !Bytecodes::has_receiver(bc);
+ ciSignatureStream sig_stream(sig, has_receiver ? x->callee()->holder() : NULL);
+ for (int i = 0; i < stop; i++) {
+ int off = in_bytes(TypeEntriesAtCall::argument_type_offset(i)) - in_bytes(TypeEntriesAtCall::args_data_offset());
+ ciKlass* exact = profile_arg_type(md, base_offset, off,
+ args->type(i), x->profiled_arg_at(i+start), mdp,
+ !x->arg_needs_null_check(i+start), sig_stream.next_klass());
+ if (exact != NULL) {
+ md->set_argument_type(bci, i, exact);
+ }
+ }
+ }
+ }
+}
+
void LIRGenerator::do_ProfileCall(ProfileCall* x) {
// Need recv in a temporary register so it interferes with the other temporaries
LIR_Opr recv = LIR_OprFact::illegalOpr;
LIR_Opr mdo = new_register(T_OBJECT);
// tmp is used to hold the counters on SPARC
LIR_Opr tmp = new_pointer_register();
+
+ if (x->nb_profiled_args() > 0) {
+ profile_arguments(x);
+ }
+
if (x->recv() != NULL) {
LIRItem value(x->recv(), this);
value.load_item();
@@ -3019,6 +3131,21 @@
__ profile_call(x->method(), x->bci_of_invoke(), x->callee(), mdo, recv, tmp, x->known_holder());
}
+void LIRGenerator::do_ProfileReturnType(ProfileReturnType* x) {
+ int bci = x->bci_of_invoke();
+ ciMethodData* md = x->method()->method_data_or_null();
+ ciProfileData* data = md->bci_to_data(bci);
+ assert(data->is_CallTypeData() || data->is_VirtualCallTypeData(), "wrong profile data type");
+ ciReturnTypeEntry* ret = data->is_CallTypeData() ? ((ciCallTypeData*)data)->ret() : ((ciVirtualCallTypeData*)data)->ret();
+ LIR_Opr mdp = LIR_OprFact::illegalOpr;
+ ciKlass* exact = profile_arg_type(md, 0, md->byte_offset_of_slot(data, ret->type_offset()),
+ ret->type(), x->ret(), mdp,
+ !x->needs_null_check(), x->callee()->signature()->return_type()->as_klass());
+ if (exact != NULL) {
+ md->set_return_type(bci, exact);
+ }
+}
+
void LIRGenerator::do_ProfileInvoke(ProfileInvoke* x) {
// We can safely ignore accessors here, since c2 will inline them anyway,
// accessors are also always mature.
@@ -3053,7 +3180,11 @@
int offset = -1;
LIR_Opr counter_holder;
if (level == CompLevel_limited_profile) {
- address counters_adr = method->ensure_method_counters();
+ MethodCounters* counters_adr = method->ensure_method_counters();
+ if (counters_adr == NULL) {
+ bailout("method counters allocation failed");
+ return;
+ }
counter_holder = new_pointer_register();
__ move(LIR_OprFact::intptrConst(counters_adr), counter_holder);
offset = in_bytes(backedge ? MethodCounters::backedge_counter_offset() :
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -434,6 +434,8 @@
void do_ThreadIDIntrinsic(Intrinsic* x);
void do_ClassIDIntrinsic(Intrinsic* x);
#endif
+ ciKlass* profile_arg_type(ciMethodData* md, int md_first_offset, int md_offset, intptr_t profiled_k, Value arg, LIR_Opr& mdp, bool not_null, ciKlass* signature_k);
+ void profile_arguments(ProfileCall* x);
public:
Compilation* compilation() const { return _compilation; }
@@ -534,6 +536,7 @@
virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x);
virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
virtual void do_ProfileCall (ProfileCall* x);
+ virtual void do_ProfileReturnType (ProfileReturnType* x);
virtual void do_ProfileInvoke (ProfileInvoke* x);
virtual void do_RuntimeCall (RuntimeCall* x);
virtual void do_MemBar (MemBar* x);
--- a/hotspot/src/share/vm/c1/c1_Optimizer.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Optimizer.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -531,6 +531,7 @@
void do_UnsafePrefetchRead (UnsafePrefetchRead* x);
void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
void do_ProfileCall (ProfileCall* x);
+ void do_ProfileReturnType (ProfileReturnType* x);
void do_ProfileInvoke (ProfileInvoke* x);
void do_RuntimeCall (RuntimeCall* x);
void do_MemBar (MemBar* x);
@@ -657,6 +658,8 @@
void handle_Intrinsic (Intrinsic* x);
void handle_ExceptionObject (ExceptionObject* x);
void handle_Phi (Phi* x);
+ void handle_ProfileCall (ProfileCall* x);
+ void handle_ProfileReturnType (ProfileReturnType* x);
};
@@ -715,7 +718,9 @@
void NullCheckVisitor::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
void NullCheckVisitor::do_UnsafePrefetchRead (UnsafePrefetchRead* x) {}
void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
-void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check(); }
+void NullCheckVisitor::do_ProfileCall (ProfileCall* x) { nce()->clear_last_explicit_null_check();
+ nce()->handle_ProfileCall(x); }
+void NullCheckVisitor::do_ProfileReturnType (ProfileReturnType* x) { nce()->handle_ProfileReturnType(x); }
void NullCheckVisitor::do_ProfileInvoke (ProfileInvoke* x) {}
void NullCheckVisitor::do_RuntimeCall (RuntimeCall* x) {}
void NullCheckVisitor::do_MemBar (MemBar* x) {}
@@ -1134,6 +1139,15 @@
}
}
+void NullCheckEliminator::handle_ProfileCall(ProfileCall* x) {
+ for (int i = 0; i < x->nb_profiled_args(); i++) {
+ x->set_arg_needs_null_check(i, !set_contains(x->profiled_arg_at(i)));
+ }
+}
+
+void NullCheckEliminator::handle_ProfileReturnType(ProfileReturnType* x) {
+ x->set_needs_null_check(!set_contains(x->ret()));
+}
void Optimizer::eliminate_null_checks() {
ResourceMark rm;
--- a/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_RangeCheckElimination.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -162,7 +162,8 @@
void do_UnsafePrefetchRead (UnsafePrefetchRead* x) { /* nothing to do */ };
void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ };
void do_ProfileCall (ProfileCall* x) { /* nothing to do */ };
- void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
+ void do_ProfileReturnType (ProfileReturnType* x) { /* nothing to do */ };
+ void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ };
void do_MemBar (MemBar* x) { /* nothing to do */ };
void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -542,8 +542,7 @@
// exception handler can cause class loading, which might throw an
// exception and those fields are expected to be clear during
// normal bytecode execution.
- thread->set_exception_oop(NULL);
- thread->set_exception_pc(NULL);
+ thread->clear_exception_oop_and_pc();
continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
// If an exception was thrown during exception dispatch, the exception oop may have changed
--- a/hotspot/src/share/vm/c1/c1_ValueMap.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/c1/c1_ValueMap.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -203,6 +203,7 @@
void do_UnsafePrefetchRead (UnsafePrefetchRead* x) { /* nothing to do */ }
void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
+ void do_ProfileReturnType (ProfileReturnType* x) { /* nothing to do */ }
void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ };
void do_MemBar (MemBar* x) { /* nothing to do */ };
--- a/hotspot/src/share/vm/ci/ciClassList.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciClassList.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -102,6 +102,7 @@
friend class ciMethodHandle; \
friend class ciMethodType; \
friend class ciReceiverTypeData; \
+friend class ciTypeEntries; \
friend class ciSymbol; \
friend class ciArray; \
friend class ciObjArray; \
--- a/hotspot/src/share/vm/ci/ciEnv.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1154,9 +1154,12 @@
GUARDED_VM_ENTRY(return _factory->get_unloaded_object_constant();)
}
-void ciEnv::dump_replay_data(outputStream* out) {
- VM_ENTRY_MARK;
- MutexLocker ml(Compile_lock);
+// ------------------------------------------------------------------
+// ciEnv::dump_replay_data*
+
+// Don't change thread state and acquire any locks.
+// Safe to call from VM error reporter.
+void ciEnv::dump_replay_data_unsafe(outputStream* out) {
ResourceMark rm;
#if INCLUDE_JVMTI
out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables);
@@ -1181,3 +1184,10 @@
entry_bci, comp_level);
out->flush();
}
+
+void ciEnv::dump_replay_data(outputStream* out) {
+ GUARDED_VM_ENTRY(
+ MutexLocker ml(Compile_lock);
+ dump_replay_data_unsafe(out);
+ )
+}
--- a/hotspot/src/share/vm/ci/ciEnv.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -452,6 +452,7 @@
// Dump the compilation replay data for the ciEnv to the stream.
void dump_replay_data(outputStream* out);
+ void dump_replay_data_unsafe(outputStream* out);
};
#endif // SHARE_VM_CI_CIENV_HPP
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -671,7 +671,6 @@
void ciInstanceKlass::dump_replay_data(outputStream* out) {
- ASSERT_IN_VM;
ResourceMark rm;
InstanceKlass* ik = get_instanceKlass();
--- a/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciInstanceKlass.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -235,6 +235,13 @@
bool is_instance_klass() const { return true; }
bool is_java_klass() const { return true; }
+ virtual ciKlass* exact_klass() {
+ if (is_loaded() && is_final() && !is_interface()) {
+ return this;
+ }
+ return NULL;
+ }
+
// Dump the current state of this klass for compilation replay.
virtual void dump_replay_data(outputStream* out);
};
--- a/hotspot/src/share/vm/ci/ciKlass.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciKlass.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -66,7 +66,9 @@
// ------------------------------------------------------------------
// ciKlass::is_subtype_of
bool ciKlass::is_subtype_of(ciKlass* that) {
- assert(is_loaded() && that->is_loaded(), "must be loaded");
+ assert(this->is_loaded(), err_msg("must be loaded: %s", this->name()->as_quoted_ascii()));
+ assert(that->is_loaded(), err_msg("must be loaded: %s", that->name()->as_quoted_ascii()));
+
// Check to see if the klasses are identical.
if (this == that) {
return true;
@@ -83,8 +85,8 @@
// ------------------------------------------------------------------
// ciKlass::is_subclass_of
bool ciKlass::is_subclass_of(ciKlass* that) {
- assert(is_loaded() && that->is_loaded(), "must be loaded");
- // Check to see if the klasses are identical.
+ assert(this->is_loaded(), err_msg("must be loaded: %s", this->name()->as_quoted_ascii()));
+ assert(that->is_loaded(), err_msg("must be loaded: %s", that->name()->as_quoted_ascii()));
VM_ENTRY_MARK;
Klass* this_klass = get_Klass();
--- a/hotspot/src/share/vm/ci/ciKlass.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciKlass.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -41,6 +41,7 @@
friend class ciEnv;
friend class ciField;
friend class ciMethod;
+ friend class ciMethodData;
friend class ciObjArrayKlass;
private:
@@ -121,6 +122,8 @@
// What kind of ciObject is this?
bool is_klass() const { return true; }
+ virtual ciKlass* exact_klass() = 0;
+
void print_name_on(outputStream* st);
};
--- a/hotspot/src/share/vm/ci/ciMethod.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -846,7 +846,9 @@
// Return true if allocation was successful or no MDO is required.
bool ciMethod::ensure_method_data(methodHandle h_m) {
EXCEPTION_CONTEXT;
- if (is_native() || is_abstract() || h_m()->is_accessor()) return true;
+ if (is_native() || is_abstract() || h_m()->is_accessor()) {
+ return true;
+ }
if (h_m()->method_data() == NULL) {
Method::build_interpreter_method_data(h_m, THREAD);
if (HAS_PENDING_EXCEPTION) {
@@ -903,22 +905,21 @@
// NULL otherwise.
ciMethodData* ciMethod::method_data_or_null() {
ciMethodData *md = method_data();
- if (md->is_empty()) return NULL;
+ if (md->is_empty()) {
+ return NULL;
+ }
return md;
}
// ------------------------------------------------------------------
// ciMethod::ensure_method_counters
//
-address ciMethod::ensure_method_counters() {
+MethodCounters* ciMethod::ensure_method_counters() {
check_is_loaded();
VM_ENTRY_MARK;
methodHandle mh(THREAD, get_Method());
- MethodCounters *counter = mh->method_counters();
- if (counter == NULL) {
- counter = Method::build_method_counters(mh(), CHECK_AND_CLEAR_NULL);
- }
- return (address)counter;
+ MethodCounters* method_counters = mh->get_method_counters(CHECK_NULL);
+ return method_counters;
}
// ------------------------------------------------------------------
@@ -1247,7 +1248,6 @@
#undef FETCH_FLAG_FROM_VM
void ciMethod::dump_replay_data(outputStream* st) {
- ASSERT_IN_VM;
ResourceMark rm;
Method* method = get_Method();
MethodCounters* mcs = method->method_counters();
--- a/hotspot/src/share/vm/ci/ciMethod.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -265,7 +265,7 @@
bool is_klass_loaded(int refinfo_index, bool must_be_resolved) const;
bool check_call(int refinfo_index, bool is_static) const;
bool ensure_method_data(); // make sure it exists in the VM also
- address ensure_method_counters();
+ MethodCounters* ensure_method_counters();
int instructions_size();
int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC
--- a/hotspot/src/share/vm/ci/ciMethodData.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciMethodData.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -78,7 +78,9 @@
void ciMethodData::load_data() {
MethodData* mdo = get_MethodData();
- if (mdo == NULL) return;
+ if (mdo == NULL) {
+ return;
+ }
// To do: don't copy the data if it is not "ripe" -- require a minimum #
// of invocations.
@@ -123,7 +125,7 @@
#endif
}
-void ciReceiverTypeData::translate_receiver_data_from(ProfileData* data) {
+void ciReceiverTypeData::translate_receiver_data_from(const ProfileData* data) {
for (uint row = 0; row < row_limit(); row++) {
Klass* k = data->as_ReceiverTypeData()->receiver(row);
if (k != NULL) {
@@ -134,6 +136,18 @@
}
+void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
+ for (int i = 0; i < _number_of_entries; i++) {
+ intptr_t k = entries->type(i);
+ TypeStackSlotEntries::set_type(i, translate_klass(k));
+ }
+}
+
+void ciReturnTypeEntry::translate_type_data_from(const ReturnTypeEntry* ret) {
+ intptr_t k = ret->type();
+ set_type(translate_klass(k));
+}
+
// Get the data at an arbitrary (sort of) data index.
ciProfileData* ciMethodData::data_at(int data_index) {
if (out_of_bounds(data_index)) {
@@ -164,6 +178,10 @@
return new ciMultiBranchData(data_layout);
case DataLayout::arg_info_data_tag:
return new ciArgInfoData(data_layout);
+ case DataLayout::call_type_data_tag:
+ return new ciCallTypeData(data_layout);
+ case DataLayout::virtual_call_type_data_tag:
+ return new ciVirtualCallTypeData(data_layout);
};
}
@@ -286,6 +304,34 @@
}
}
+void ciMethodData::set_argument_type(int bci, int i, ciKlass* k) {
+ VM_ENTRY_MARK;
+ MethodData* mdo = get_MethodData();
+ if (mdo != NULL) {
+ ProfileData* data = mdo->bci_to_data(bci);
+ if (data->is_CallTypeData()) {
+ data->as_CallTypeData()->set_argument_type(i, k->get_Klass());
+ } else {
+ assert(data->is_VirtualCallTypeData(), "no arguments!");
+ data->as_VirtualCallTypeData()->set_argument_type(i, k->get_Klass());
+ }
+ }
+}
+
+void ciMethodData::set_return_type(int bci, ciKlass* k) {
+ VM_ENTRY_MARK;
+ MethodData* mdo = get_MethodData();
+ if (mdo != NULL) {
+ ProfileData* data = mdo->bci_to_data(bci);
+ if (data->is_CallTypeData()) {
+ data->as_CallTypeData()->set_return_type(k->get_Klass());
+ } else {
+ assert(data->is_VirtualCallTypeData(), "no arguments!");
+ data->as_VirtualCallTypeData()->set_return_type(k->get_Klass());
+ }
+ }
+}
+
bool ciMethodData::has_escape_info() {
return eflag_set(MethodData::estimated);
}
@@ -373,7 +419,6 @@
}
void ciMethodData::dump_replay_data(outputStream* out) {
- ASSERT_IN_VM;
ResourceMark rm;
MethodData* mdo = get_MethodData();
Method* method = mdo->method();
@@ -477,7 +522,50 @@
}
}
-void ciReceiverTypeData::print_receiver_data_on(outputStream* st) {
+void ciTypeEntries::print_ciklass(outputStream* st, intptr_t k) {
+ if (TypeEntries::is_type_none(k)) {
+ st->print("none");
+ } else if (TypeEntries::is_type_unknown(k)) {
+ st->print("unknown");
+ } else {
+ valid_ciklass(k)->print_name_on(st);
+ }
+ if (TypeEntries::was_null_seen(k)) {
+ st->print(" (null seen)");
+ }
+}
+
+void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
+ for (int i = 0; i < _number_of_entries; i++) {
+ _pd->tab(st);
+ st->print("%d: stack (%u) ", i, stack_slot(i));
+ print_ciklass(st, type(i));
+ st->cr();
+ }
+}
+
+void ciReturnTypeEntry::print_data_on(outputStream* st) const {
+ _pd->tab(st);
+ st->print("ret ");
+ print_ciklass(st, type());
+ st->cr();
+}
+
+void ciCallTypeData::print_data_on(outputStream* st) const {
+ print_shared(st, "ciCallTypeData");
+ if (has_arguments()) {
+ tab(st, true);
+ st->print("argument types");
+ args()->print_data_on(st);
+ }
+ if (has_return()) {
+ tab(st, true);
+ st->print("return type");
+ ret()->print_data_on(st);
+ }
+}
+
+void ciReceiverTypeData::print_receiver_data_on(outputStream* st) const {
uint row;
int entries = 0;
for (row = 0; row < row_limit(); row++) {
@@ -493,13 +581,28 @@
}
}
-void ciReceiverTypeData::print_data_on(outputStream* st) {
+void ciReceiverTypeData::print_data_on(outputStream* st) const {
print_shared(st, "ciReceiverTypeData");
print_receiver_data_on(st);
}
-void ciVirtualCallData::print_data_on(outputStream* st) {
+void ciVirtualCallData::print_data_on(outputStream* st) const {
print_shared(st, "ciVirtualCallData");
rtd_super()->print_receiver_data_on(st);
}
+
+void ciVirtualCallTypeData::print_data_on(outputStream* st) const {
+ print_shared(st, "ciVirtualCallTypeData");
+ rtd_super()->print_receiver_data_on(st);
+ if (has_arguments()) {
+ tab(st, true);
+ st->print("argument types");
+ args()->print_data_on(st);
+ }
+ if (has_return()) {
+ tab(st, true);
+ st->print("return type");
+ ret()->print_data_on(st);
+ }
+}
#endif
--- a/hotspot/src/share/vm/ci/ciMethodData.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciMethodData.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -41,6 +41,8 @@
class ciArrayData;
class ciMultiBranchData;
class ciArgInfoData;
+class ciCallTypeData;
+class ciVirtualCallTypeData;
typedef ProfileData ciProfileData;
@@ -59,6 +61,103 @@
ciJumpData(DataLayout* layout) : JumpData(layout) {};
};
+class ciTypeEntries {
+protected:
+ static intptr_t translate_klass(intptr_t k) {
+ Klass* v = TypeEntries::valid_klass(k);
+ if (v != NULL) {
+ ciKlass* klass = CURRENT_ENV->get_klass(v);
+ return with_status(klass, k);
+ }
+ return with_status(NULL, k);
+ }
+
+public:
+ static ciKlass* valid_ciklass(intptr_t k) {
+ if (!TypeEntries::is_type_none(k) &&
+ !TypeEntries::is_type_unknown(k)) {
+ return (ciKlass*)TypeEntries::klass_part(k);
+ } else {
+ return NULL;
+ }
+ }
+
+ static intptr_t with_status(ciKlass* k, intptr_t in) {
+ return TypeEntries::with_status((intptr_t)k, in);
+ }
+
+#ifndef PRODUCT
+ static void print_ciklass(outputStream* st, intptr_t k);
+#endif
+};
+
+class ciTypeStackSlotEntries : public TypeStackSlotEntries, ciTypeEntries {
+public:
+ void translate_type_data_from(const TypeStackSlotEntries* args);
+
+ ciKlass* valid_type(int i) const {
+ return valid_ciklass(type(i));
+ }
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+class ciReturnTypeEntry : public ReturnTypeEntry, ciTypeEntries {
+public:
+ void translate_type_data_from(const ReturnTypeEntry* ret);
+
+ ciKlass* valid_type() const {
+ return valid_ciklass(type());
+ }
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+class ciCallTypeData : public CallTypeData {
+public:
+ ciCallTypeData(DataLayout* layout) : CallTypeData(layout) {}
+
+ ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)CallTypeData::args(); }
+ ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)CallTypeData::ret(); }
+
+ void translate_type_data_from(const ProfileData* data) {
+ if (has_arguments()) {
+ args()->translate_type_data_from(data->as_CallTypeData()->args());
+ }
+ if (has_return()) {
+ ret()->translate_type_data_from(data->as_CallTypeData()->ret());
+ }
+ }
+
+ intptr_t argument_type(int i) const {
+ assert(has_arguments(), "no arg type profiling data");
+ return args()->type(i);
+ }
+
+ ciKlass* valid_argument_type(int i) const {
+ assert(has_arguments(), "no arg type profiling data");
+ return args()->valid_type(i);
+ }
+
+ intptr_t return_type() const {
+ assert(has_return(), "no ret type profiling data");
+ return ret()->type();
+ }
+
+ ciKlass* valid_return_type() const {
+ assert(has_return(), "no ret type profiling data");
+ return ret()->valid_type();
+ }
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
class ciReceiverTypeData : public ReceiverTypeData {
public:
ciReceiverTypeData(DataLayout* layout) : ReceiverTypeData(layout) {};
@@ -69,7 +168,7 @@
(intptr_t) recv);
}
- ciKlass* receiver(uint row) {
+ ciKlass* receiver(uint row) const {
assert((uint)row < row_limit(), "oob");
ciKlass* recv = (ciKlass*)intptr_at(receiver0_offset + row * receiver_type_row_cell_count);
assert(recv == NULL || recv->is_klass(), "wrong type");
@@ -77,19 +176,19 @@
}
// Copy & translate from oop based ReceiverTypeData
- virtual void translate_from(ProfileData* data) {
+ virtual void translate_from(const ProfileData* data) {
translate_receiver_data_from(data);
}
- void translate_receiver_data_from(ProfileData* data);
+ void translate_receiver_data_from(const ProfileData* data);
#ifndef PRODUCT
- void print_data_on(outputStream* st);
- void print_receiver_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
+ void print_receiver_data_on(outputStream* st) const;
#endif
};
class ciVirtualCallData : public VirtualCallData {
// Fake multiple inheritance... It's a ciReceiverTypeData also.
- ciReceiverTypeData* rtd_super() { return (ciReceiverTypeData*) this; }
+ ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
public:
ciVirtualCallData(DataLayout* layout) : VirtualCallData(layout) {};
@@ -103,11 +202,65 @@
}
// Copy & translate from oop based VirtualCallData
- virtual void translate_from(ProfileData* data) {
+ virtual void translate_from(const ProfileData* data) {
rtd_super()->translate_receiver_data_from(data);
}
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+class ciVirtualCallTypeData : public VirtualCallTypeData {
+private:
+ // Fake multiple inheritance... It's a ciReceiverTypeData also.
+ ciReceiverTypeData* rtd_super() const { return (ciReceiverTypeData*) this; }
+public:
+ ciVirtualCallTypeData(DataLayout* layout) : VirtualCallTypeData(layout) {}
+
+ void set_receiver(uint row, ciKlass* recv) {
+ rtd_super()->set_receiver(row, recv);
+ }
+
+ ciKlass* receiver(uint row) const {
+ return rtd_super()->receiver(row);
+ }
+
+ ciTypeStackSlotEntries* args() const { return (ciTypeStackSlotEntries*)VirtualCallTypeData::args(); }
+ ciReturnTypeEntry* ret() const { return (ciReturnTypeEntry*)VirtualCallTypeData::ret(); }
+
+ // Copy & translate from oop based VirtualCallData
+ virtual void translate_from(const ProfileData* data) {
+ rtd_super()->translate_receiver_data_from(data);
+ if (has_arguments()) {
+ args()->translate_type_data_from(data->as_VirtualCallTypeData()->args());
+ }
+ if (has_return()) {
+ ret()->translate_type_data_from(data->as_VirtualCallTypeData()->ret());
+ }
+ }
+
+ intptr_t argument_type(int i) const {
+ assert(has_arguments(), "no arg type profiling data");
+ return args()->type(i);
+ }
+
+ ciKlass* valid_argument_type(int i) const {
+ assert(has_arguments(), "no arg type profiling data");
+ return args()->valid_type(i);
+ }
+
+ intptr_t return_type() const {
+ assert(has_return(), "no ret type profiling data");
+ return ret()->type();
+ }
+
+ ciKlass* valid_return_type() const {
+ assert(has_return(), "no ret type profiling data");
+ return ret()->valid_type();
+ }
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -232,8 +385,6 @@
public:
bool is_method_data() const { return true; }
- void set_mature() { _state = mature_state; }
-
bool is_empty() { return _state == empty_state; }
bool is_mature() { return _state == mature_state; }
@@ -249,6 +400,10 @@
// Also set the numer of loops and blocks in the method.
// Again, this is used to determine if a method is trivial.
void set_compilation_stats(short loops, short blocks);
+ // If the compiler finds a profiled type that is known statically
+ // for sure, set it in the MethodData
+ void set_argument_type(int bci, int i, ciKlass* k);
+ void set_return_type(int bci, ciKlass* k);
void load_data();
--- a/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -179,3 +179,16 @@
ciObjArrayKlass* ciObjArrayKlass::make(ciKlass* element_klass) {
GUARDED_VM_ENTRY(return make_impl(element_klass);)
}
+
+ciKlass* ciObjArrayKlass::exact_klass() {
+ ciType* base = base_element_type();
+ if (base->is_instance_klass()) {
+ ciInstanceKlass* ik = base->as_instance_klass();
+ if (ik->exact_klass() != NULL) {
+ return this;
+ }
+ } else if (base->is_primitive_type()) {
+ return this;
+ }
+ return NULL;
+}
--- a/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciObjArrayKlass.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -73,6 +73,8 @@
bool is_obj_array_klass() const { return true; }
static ciObjArrayKlass* make(ciKlass* element_klass);
+
+ virtual ciKlass* exact_klass();
};
#endif // SHARE_VM_CI_CIOBJARRAYKLASS_HPP
--- a/hotspot/src/share/vm/ci/ciReplay.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -965,14 +965,12 @@
tty->cr();
} else {
EXCEPTION_CONTEXT;
- MethodCounters* mcs = method->method_counters();
// m->_instructions_size = rec->instructions_size;
m->_instructions_size = -1;
m->_interpreter_invocation_count = rec->interpreter_invocation_count;
m->_interpreter_throwout_count = rec->interpreter_throwout_count;
- if (mcs == NULL) {
- mcs = Method::build_method_counters(method, CHECK_AND_CLEAR);
- }
+ MethodCounters* mcs = method->get_method_counters(CHECK_AND_CLEAR);
+ guarantee(mcs != NULL, "method counters allocation failed");
mcs->invocation_counter()->_counter = rec->invocation_counter;
mcs->backedge_counter()->_counter = rec->backedge_counter;
}
--- a/hotspot/src/share/vm/ci/ciStreams.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciStreams.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -277,11 +277,14 @@
class ciSignatureStream : public StackObj {
private:
ciSignature* _sig;
- int _pos;
+ int _pos;
+ // holder is a method's holder
+ ciKlass* _holder;
public:
- ciSignatureStream(ciSignature* signature) {
+ ciSignatureStream(ciSignature* signature, ciKlass* holder = NULL) {
_sig = signature;
_pos = 0;
+ _holder = holder;
}
bool at_return_type() { return _pos == _sig->count(); }
@@ -301,6 +304,23 @@
return _sig->type_at(_pos);
}
}
+
+ // next klass in the signature
+ ciKlass* next_klass() {
+ ciKlass* sig_k;
+ if (_holder != NULL) {
+ sig_k = _holder;
+ _holder = NULL;
+ } else {
+ while (!type()->is_klass()) {
+ next();
+ }
+ assert(!at_return_type(), "passed end of signature");
+ sig_k = type()->as_klass();
+ next();
+ }
+ return sig_k;
+ }
};
--- a/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/ci/ciTypeArrayKlass.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -57,6 +57,10 @@
// Make an array klass corresponding to the specified primitive type.
static ciTypeArrayKlass* make(BasicType type);
+
+ virtual ciKlass* exact_klass() {
+ return this;
+ }
};
#endif // SHARE_VM_CI_CITYPEARRAYKLASS_HPP
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2197,8 +2197,8 @@
}
if (lvt_cnt == max_lvt_cnt) {
max_lvt_cnt <<= 1;
- REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
- REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
+ localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
+ localvariable_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
}
localvariable_table_start[lvt_cnt] =
parse_localvariable_table(code_length,
@@ -2226,8 +2226,8 @@
// Parse local variable type table
if (lvtt_cnt == max_lvtt_cnt) {
max_lvtt_cnt <<= 1;
- REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
- REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
+ localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
+ localvariable_type_table_start = REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
}
localvariable_type_table_start[lvtt_cnt] =
parse_localvariable_table(code_length,
@@ -4483,9 +4483,8 @@
for (int index = 0; index < num_methods; index++) {
Method* m = methods->at(index);
- // skip private, static and <init> methods
- if ((!m->is_private()) &&
- (!m->is_static()) &&
+ // skip static and <init> methods
+ if ((!m->is_static()) &&
(m->name() != vmSymbols::object_initializer_name())) {
Symbol* name = m->name();
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -857,7 +857,6 @@
m->set_max_locals(params);
m->constMethod()->set_stackmap_data(NULL);
m->set_code(code_start);
- m->set_force_inline(true);
return m;
}
--- a/hotspot/src/share/vm/classfile/verifier.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/classfile/verifier.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2439,19 +2439,19 @@
&& !ref_class_type.equals(current_type())
&& !ref_class_type.equals(VerificationType::reference_type(
current_class()->super()->name()))) {
- bool subtype = ref_class_type.is_assignable_from(
- current_type(), this, CHECK_VERIFY(this));
+ bool subtype = false;
+ if (!current_class()->is_anonymous()) {
+ subtype = ref_class_type.is_assignable_from(
+ current_type(), this, CHECK_VERIFY(this));
+ } else {
+ subtype = ref_class_type.is_assignable_from(VerificationType::reference_type(
+ current_class()->host_klass()->name()), this, CHECK_VERIFY(this));
+ }
if (!subtype) {
- if (current_class()->is_anonymous()) {
- subtype = ref_class_type.is_assignable_from(VerificationType::reference_type(
- current_class()->host_klass()->name()), this, CHECK_VERIFY(this));
- }
- if (!subtype) {
- verify_error(ErrorContext::bad_code(bci),
- "Bad invokespecial instruction: "
- "current class isn't assignable to reference class.");
- return;
- }
+ verify_error(ErrorContext::bad_code(bci),
+ "Bad invokespecial instruction: "
+ "current class isn't assignable to reference class.");
+ return;
}
}
// Match method descriptor with operand stack
@@ -2470,17 +2470,13 @@
if (!current_class()->is_anonymous()) {
current_frame->pop_stack(current_type(), CHECK_VERIFY(this));
} else {
- // anonymous class invokespecial calls: either the
- // operand stack/objectref is a subtype of the current class OR
- // the objectref is a subtype of the host_klass of the current class
+ // anonymous class invokespecial calls: check if the
+ // objectref is a subtype of the host_klass of the current class
// to allow an anonymous class to reference methods in the host_klass
VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this));
- bool subtype = current_type().is_assignable_from(top, this, CHECK_VERIFY(this));
- if (!subtype) {
- VerificationType hosttype =
- VerificationType::reference_type(current_class()->host_klass()->name());
- subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this));
- }
+ VerificationType hosttype =
+ VerificationType::reference_type(current_class()->host_klass()->name());
+ bool subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this));
if (!subtype) {
verify_error( ErrorContext::bad_type(current_frame->offset(),
current_frame->stack_top_ctx(),
--- a/hotspot/src/share/vm/code/codeBlob.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/code/codeBlob.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -245,8 +245,8 @@
}
-void* BufferBlob::operator new(size_t s, unsigned size) throw() {
- void* p = CodeCache::allocate(size);
+void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
+ void* p = CodeCache::allocate(size, is_critical);
return p;
}
@@ -277,7 +277,10 @@
unsigned int size = allocation_size(cb, sizeof(AdapterBlob));
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- blob = new (size) AdapterBlob(size, cb);
+ // The parameter 'true' indicates a critical memory allocation.
+ // This means that CodeCacheMinimumFreeSpace is used, if necessary
+ const bool is_critical = true;
+ blob = new (size, is_critical) AdapterBlob(size, cb);
}
// Track memory usage statistic after releasing CodeCache_lock
MemoryService::track_code_cache_memory_usage();
@@ -299,7 +302,10 @@
size += round_to(buffer_size, oopSize);
{
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
- blob = new (size) MethodHandlesAdapterBlob(size);
+ // The parameter 'true' indicates a critical memory allocation.
+ // This means that CodeCacheMinimumFreeSpace is used, if necessary
+ const bool is_critical = true;
+ blob = new (size, is_critical) MethodHandlesAdapterBlob(size);
}
// Track memory usage statistic after releasing CodeCache_lock
MemoryService::track_code_cache_memory_usage();
--- a/hotspot/src/share/vm/code/codeBlob.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/code/codeBlob.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -209,7 +209,7 @@
BufferBlob(const char* name, int size);
BufferBlob(const char* name, int size, CodeBuffer* cb);
- void* operator new(size_t s, unsigned size) throw();
+ void* operator new(size_t s, unsigned size, bool is_critical = false) throw();
public:
// Creation
@@ -253,7 +253,6 @@
class MethodHandlesAdapterBlob: public BufferBlob {
private:
MethodHandlesAdapterBlob(int size) : BufferBlob("MethodHandles adapters", size) {}
- MethodHandlesAdapterBlob(int size, CodeBuffer* cb) : BufferBlob("MethodHandles adapters", size, cb) {}
public:
// Creation
--- a/hotspot/src/share/vm/compiler/abstractCompiler.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -24,41 +24,42 @@
#include "precompiled.hpp"
#include "compiler/abstractCompiler.hpp"
+#include "compiler/compileBroker.hpp"
#include "runtime/mutexLocker.hpp"
-void AbstractCompiler::initialize_runtimes(initializer f, volatile int* state) {
- if (*state != initialized) {
+
+bool AbstractCompiler::should_perform_init() {
+ if (_compiler_state != initialized) {
+ MutexLocker only_one(CompileThread_lock);
- // We are thread in native here...
- CompilerThread* thread = CompilerThread::current();
- bool do_initialization = false;
- {
- ThreadInVMfromNative tv(thread);
- ResetNoHandleMark rnhm;
- MutexLocker only_one(CompileThread_lock, thread);
- if ( *state == uninitialized) {
- do_initialization = true;
- *state = initializing;
- } else {
- while (*state == initializing ) {
- CompileThread_lock->wait();
- }
+ if (_compiler_state == uninitialized) {
+ _compiler_state = initializing;
+ return true;
+ } else {
+ while (_compiler_state == initializing) {
+ CompileThread_lock->wait();
}
}
- if (do_initialization) {
- // We can not hold any locks here since JVMTI events may call agents
+ }
+ return false;
+}
- // Compiler(s) run as native
-
- (*f)();
-
- // To in_vm so we can use the lock
+bool AbstractCompiler::should_perform_shutdown() {
+ // Since this method can be called by multiple threads, the lock ensures atomicity of
+ // decrementing '_num_compiler_threads' and the following operations.
+ MutexLocker only_one(CompileThread_lock);
+ _num_compiler_threads--;
+ assert (CompileBroker::is_compilation_disabled_forever(), "Must be set, otherwise thread waits forever");
- ThreadInVMfromNative tv(thread);
- ResetNoHandleMark rnhm;
- MutexLocker only_one(CompileThread_lock, thread);
- assert(*state == initializing, "wrong state");
- *state = initialized;
- CompileThread_lock->notify_all();
- }
+ // Only the last thread will perform shutdown operations
+ if (_num_compiler_threads == 0) {
+ return true;
}
+ return false;
}
+
+void AbstractCompiler::set_state(int state) {
+ // Ensure that ste is only set by one thread at a time
+ MutexLocker only_one(CompileThread_lock);
+ _compiler_state = state;
+ CompileThread_lock->notify_all();
+}
--- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -27,22 +27,25 @@
#include "ci/compilerInterface.hpp"
-typedef void (*initializer)(void);
-
class AbstractCompiler : public CHeapObj<mtCompiler> {
private:
- bool _is_initialized; // Mark whether compiler object is initialized
+ volatile int _num_compiler_threads;
protected:
+ volatile int _compiler_state;
// Used for tracking global state of compiler runtime initialization
- enum { uninitialized, initializing, initialized };
+ enum { uninitialized, initializing, initialized, failed, shut_down };
- // This method will call the initialization method "f" once (per compiler class/subclass)
- // and do so without holding any locks
- void initialize_runtimes(initializer f, volatile int* state);
+ // This method returns true for the first compiler thread that reaches that methods.
+ // This thread will initialize the compiler runtime.
+ bool should_perform_init();
public:
- AbstractCompiler() : _is_initialized(false) {}
+ AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {}
+
+ // This function determines the compiler thread that will perform the
+ // shutdown of the corresponding compiler runtime.
+ bool should_perform_shutdown();
// Name of this compiler
virtual const char* name() = 0;
@@ -74,17 +77,18 @@
#endif // TIERED
// Customization
- virtual bool needs_stubs () = 0;
+ virtual void initialize () = 0;
- void mark_initialized() { _is_initialized = true; }
- bool is_initialized() { return _is_initialized; }
+ void set_num_compiler_threads(int num) { _num_compiler_threads = num; }
+ int num_compiler_threads() { return _num_compiler_threads; }
- virtual void initialize() = 0;
-
+ // Get/set state of compiler objects
+ bool is_initialized() { return _compiler_state == initialized; }
+ bool is_failed () { return _compiler_state == failed;}
+ void set_state (int state);
+ void set_shut_down () { set_state(shut_down); }
// Compilation entry point for methods
- virtual void compile_method(ciEnv* env,
- ciMethod* target,
- int entry_bci) {
+ virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
ShouldNotReachHere();
}
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -186,7 +186,7 @@
CompileQueue* CompileBroker::_c1_method_queue = NULL;
CompileTask* CompileBroker::_task_free_list = NULL;
-GrowableArray<CompilerThread*>* CompileBroker::_method_threads = NULL;
+GrowableArray<CompilerThread*>* CompileBroker::_compiler_threads = NULL;
class CompilationLog : public StringEventLog {
@@ -587,9 +587,6 @@
-// ------------------------------------------------------------------
-// CompileQueue::add
-//
// Add a CompileTask to a CompileQueue
void CompileQueue::add(CompileTask* task) {
assert(lock()->owned_by_self(), "must own lock");
@@ -626,6 +623,16 @@
lock()->notify_all();
}
+void CompileQueue::delete_all() {
+ assert(lock()->owned_by_self(), "must own lock");
+ if (_first != NULL) {
+ for (CompileTask* task = _first; task != NULL; task = task->next()) {
+ delete task;
+ }
+ _first = NULL;
+ }
+}
+
// ------------------------------------------------------------------
// CompileQueue::get
//
@@ -640,6 +647,11 @@
// case we perform code cache sweeps to free memory such that we can re-enable
// compilation.
while (_first == NULL) {
+ // Exit loop if compilation is disabled forever
+ if (CompileBroker::is_compilation_disabled_forever()) {
+ return NULL;
+ }
+
if (UseCodeCacheFlushing && !CompileBroker::should_compile_new_jobs()) {
// Wait a certain amount of time to possibly do another sweep.
// We must wait until stack scanning has happened so that we can
@@ -664,9 +676,17 @@
// remains unchanged. This behavior is desired, since we want to keep
// the stable state, i.e., we do not want to evict methods from the
// code cache if it is unnecessary.
- lock()->wait();
+ // We need a timed wait here, since compiler threads can exit if compilation
+ // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
+ // is not critical and we do not want idle compiler threads to wake up too often.
+ lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
}
}
+
+ if (CompileBroker::is_compilation_disabled_forever()) {
+ return NULL;
+ }
+
CompileTask* task = CompilationPolicy::policy()->select_task(this);
remove(task);
return task;
@@ -891,10 +911,8 @@
}
-
-// ------------------------------------------------------------------
-// CompileBroker::make_compiler_thread
-CompilerThread* CompileBroker::make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, TRAPS) {
+CompilerThread* CompileBroker::make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters,
+ AbstractCompiler* comp, TRAPS) {
CompilerThread* compiler_thread = NULL;
Klass* k =
@@ -961,6 +979,7 @@
java_lang_Thread::set_daemon(thread_oop());
compiler_thread->set_threadObj(thread_oop());
+ compiler_thread->set_compiler(comp);
Threads::add(compiler_thread);
Thread::start(compiler_thread);
}
@@ -972,25 +991,24 @@
}
-// ------------------------------------------------------------------
-// CompileBroker::init_compiler_threads
-//
-// Initialize the compilation queue
void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
EXCEPTION_MARK;
#if !defined(ZERO) && !defined(SHARK)
assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
#endif // !ZERO && !SHARK
+ // Initialize the compilation queue
if (c2_compiler_count > 0) {
_c2_method_queue = new CompileQueue("C2MethodQueue", MethodCompileQueue_lock);
+ _compilers[1]->set_num_compiler_threads(c2_compiler_count);
}
if (c1_compiler_count > 0) {
_c1_method_queue = new CompileQueue("C1MethodQueue", MethodCompileQueue_lock);
+ _compilers[0]->set_num_compiler_threads(c1_compiler_count);
}
int compiler_count = c1_compiler_count + c2_compiler_count;
- _method_threads =
+ _compiler_threads =
new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<CompilerThread*>(compiler_count, true);
char name_buffer[256];
@@ -998,21 +1016,22 @@
// Create a name for our thread.
sprintf(name_buffer, "C2 CompilerThread%d", i);
CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK);
- CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, CHECK);
- _method_threads->append(new_thread);
+ // Shark and C2
+ CompilerThread* new_thread = make_compiler_thread(name_buffer, _c2_method_queue, counters, _compilers[1], CHECK);
+ _compiler_threads->append(new_thread);
}
for (int i = c2_compiler_count; i < compiler_count; i++) {
// Create a name for our thread.
sprintf(name_buffer, "C1 CompilerThread%d", i);
CompilerCounters* counters = new CompilerCounters("compilerThread", i, CHECK);
- CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, CHECK);
- _method_threads->append(new_thread);
+ // C1
+ CompilerThread* new_thread = make_compiler_thread(name_buffer, _c1_method_queue, counters, _compilers[0], CHECK);
+ _compiler_threads->append(new_thread);
}
if (UsePerfData) {
- PerfDataManager::create_constant(SUN_CI, "threads", PerfData::U_Bytes,
- compiler_count, CHECK);
+ PerfDataManager::create_constant(SUN_CI, "threads", PerfData::U_Bytes, compiler_count, CHECK);
}
}
@@ -1029,27 +1048,6 @@
}
// ------------------------------------------------------------------
-// CompileBroker::is_idle
-bool CompileBroker::is_idle() {
- if (_c2_method_queue != NULL && !_c2_method_queue->is_empty()) {
- return false;
- } else if (_c1_method_queue != NULL && !_c1_method_queue->is_empty()) {
- return false;
- } else {
- int num_threads = _method_threads->length();
- for (int i=0; i<num_threads; i++) {
- if (_method_threads->at(i)->task() != NULL) {
- return false;
- }
- }
-
- // No pending or active compilations.
- return true;
- }
-}
-
-
-// ------------------------------------------------------------------
// CompileBroker::compile_method
//
// Request compilation of a method.
@@ -1551,6 +1549,101 @@
free_task(task);
}
+// Initialize compiler thread(s) + compiler object(s). The postcondition
+// of this function is that the compiler runtimes are initialized and that
+//compiler threads can start compiling.
+bool CompileBroker::init_compiler_runtime() {
+ CompilerThread* thread = CompilerThread::current();
+ AbstractCompiler* comp = thread->compiler();
+ // Final sanity check - the compiler object must exist
+ guarantee(comp != NULL, "Compiler object must exist");
+
+ int system_dictionary_modification_counter;
+ {
+ MutexLocker locker(Compile_lock, thread);
+ system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
+ }
+
+ {
+ // Must switch to native to allocate ci_env
+ ThreadToNativeFromVM ttn(thread);
+ ciEnv ci_env(NULL, system_dictionary_modification_counter);
+ // Cache Jvmti state
+ ci_env.cache_jvmti_state();
+ // Cache DTrace flags
+ ci_env.cache_dtrace_flags();
+
+ // Switch back to VM state to do compiler initialization
+ ThreadInVMfromNative tv(thread);
+ ResetNoHandleMark rnhm;
+
+
+ if (!comp->is_shark()) {
+ // Perform per-thread and global initializations
+ comp->initialize();
+ }
+ }
+
+ if (comp->is_failed()) {
+ disable_compilation_forever();
+ // If compiler initialization failed, no compiler thread that is specific to a
+ // particular compiler runtime will ever start to compile methods.
+
+ shutdown_compiler_runtime(comp, thread);
+ return false;
+ }
+
+ // C1 specific check
+ if (comp->is_c1() && (thread->get_buffer_blob() == NULL)) {
+ warning("Initialization of %s thread failed (no space to run compilers)", thread->name());
+ return false;
+ }
+
+ return true;
+}
+
+// If C1 and/or C2 initialization failed, we shut down all compilation.
+// We do this to keep things simple. This can be changed if it ever turns out to be
+// a problem.
+void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
+ // Free buffer blob, if allocated
+ if (thread->get_buffer_blob() != NULL) {
+ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ CodeCache::free(thread->get_buffer_blob());
+ }
+
+ if (comp->should_perform_shutdown()) {
+ // There are two reasons for shutting down the compiler
+ // 1) compiler runtime initialization failed
+ // 2) The code cache is full and the following flag is set: -XX:-UseCodeCacheFlushing
+ warning("Shutting down compiler %s (no space to run compilers)", comp->name());
+
+ // Only one thread per compiler runtime object enters here
+ // Set state to shut down
+ comp->set_shut_down();
+
+ MutexLocker mu(MethodCompileQueue_lock, thread);
+ CompileQueue* queue;
+ if (_c1_method_queue != NULL) {
+ _c1_method_queue->delete_all();
+ queue = _c1_method_queue;
+ _c1_method_queue = NULL;
+ delete _c1_method_queue;
+ }
+
+ if (_c2_method_queue != NULL) {
+ _c2_method_queue->delete_all();
+ queue = _c2_method_queue;
+ _c2_method_queue = NULL;
+ delete _c2_method_queue;
+ }
+
+ // We could delete compiler runtimes also. However, there are references to
+ // the compiler runtime(s) (e.g., nmethod::is_compiled_by_c1()) which then
+ // fail. This can be done later if necessary.
+ }
+}
+
// ------------------------------------------------------------------
// CompileBroker::compiler_thread_loop
//
@@ -1558,7 +1651,6 @@
void CompileBroker::compiler_thread_loop() {
CompilerThread* thread = CompilerThread::current();
CompileQueue* queue = thread->queue();
-
// For the thread that initializes the ciObjectFactory
// this resource mark holds all the shared objects
ResourceMark rm;
@@ -1587,65 +1679,78 @@
log->end_elem();
}
- while (true) {
- {
- // We need this HandleMark to avoid leaking VM handles.
- HandleMark hm(thread);
+ // If compiler thread/runtime initialization fails, exit the compiler thread
+ if (!init_compiler_runtime()) {
+ return;
+ }
- if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) {
- // the code cache is really full
- handle_full_code_cache();
- }
+ // Poll for new compilation tasks as long as the JVM runs. Compilation
+ // should only be disabled if something went wrong while initializing the
+ // compiler runtimes. This, in turn, should not happen. The only known case
+ // when compiler runtime initialization fails is if there is not enough free
+ // space in the code cache to generate the necessary stubs, etc.
+ while (!is_compilation_disabled_forever()) {
+ // We need this HandleMark to avoid leaking VM handles.
+ HandleMark hm(thread);
- CompileTask* task = queue->get();
+ if (CodeCache::unallocated_capacity() < CodeCacheMinimumFreeSpace) {
+ // the code cache is really full
+ handle_full_code_cache();
+ }
- // Give compiler threads an extra quanta. They tend to be bursty and
- // this helps the compiler to finish up the job.
- if( CompilerThreadHintNoPreempt )
- os::hint_no_preempt();
+ CompileTask* task = queue->get();
+ if (task == NULL) {
+ continue;
+ }
- // trace per thread time and compile statistics
- CompilerCounters* counters = ((CompilerThread*)thread)->counters();
- PerfTraceTimedEvent(counters->time_counter(), counters->compile_counter());
+ // Give compiler threads an extra quanta. They tend to be bursty and
+ // this helps the compiler to finish up the job.
+ if( CompilerThreadHintNoPreempt )
+ os::hint_no_preempt();
- // Assign the task to the current thread. Mark this compilation
- // thread as active for the profiler.
- CompileTaskWrapper ctw(task);
- nmethodLocker result_handle; // (handle for the nmethod produced by this task)
- task->set_code_handle(&result_handle);
- methodHandle method(thread, task->method());
+ // trace per thread time and compile statistics
+ CompilerCounters* counters = ((CompilerThread*)thread)->counters();
+ PerfTraceTimedEvent(counters->time_counter(), counters->compile_counter());
- // Never compile a method if breakpoints are present in it
- if (method()->number_of_breakpoints() == 0) {
- // Compile the method.
- if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
+ // Assign the task to the current thread. Mark this compilation
+ // thread as active for the profiler.
+ CompileTaskWrapper ctw(task);
+ nmethodLocker result_handle; // (handle for the nmethod produced by this task)
+ task->set_code_handle(&result_handle);
+ methodHandle method(thread, task->method());
+
+ // Never compile a method if breakpoints are present in it
+ if (method()->number_of_breakpoints() == 0) {
+ // Compile the method.
+ if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
#ifdef COMPILER1
- // Allow repeating compilations for the purpose of benchmarking
- // compile speed. This is not useful for customers.
- if (CompilationRepeat != 0) {
- int compile_count = CompilationRepeat;
- while (compile_count > 0) {
- invoke_compiler_on_method(task);
- nmethod* nm = method->code();
- if (nm != NULL) {
- nm->make_zombie();
- method->clear_code();
- }
- compile_count--;
+ // Allow repeating compilations for the purpose of benchmarking
+ // compile speed. This is not useful for customers.
+ if (CompilationRepeat != 0) {
+ int compile_count = CompilationRepeat;
+ while (compile_count > 0) {
+ invoke_compiler_on_method(task);
+ nmethod* nm = method->code();
+ if (nm != NULL) {
+ nm->make_zombie();
+ method->clear_code();
}
+ compile_count--;
}
+ }
#endif /* COMPILER1 */
- invoke_compiler_on_method(task);
- } else {
- // After compilation is disabled, remove remaining methods from queue
- method->clear_queued_for_compilation();
- }
+ invoke_compiler_on_method(task);
+ } else {
+ // After compilation is disabled, remove remaining methods from queue
+ method->clear_queued_for_compilation();
}
}
}
+
+ // Shut down compiler runtime
+ shutdown_compiler_runtime(thread->compiler(), thread);
}
-
// ------------------------------------------------------------------
// CompileBroker::init_compiler_thread_log
//
@@ -1953,11 +2058,14 @@
// Since code cache is full, immediately stop new compiles
if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) {
NMethodSweeper::log_sweep("disable_compiler");
+
+ // Switch to 'vm_state'. This ensures that possibly_sweep() can be called
+ // without having to consider the state in which the current thread is.
+ ThreadInVMfromUnknown in_vm;
NMethodSweeper::possibly_sweep();
}
} else {
- UseCompiler = false;
- AlwaysCompileLoopMethods = false;
+ disable_compilation_forever();
}
}
codecache_print(/* detailed= */ true);
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -213,8 +213,12 @@
// Redefine Classes support
void mark_on_stack();
+ void delete_all();
+ void print();
- void print();
+ ~CompileQueue() {
+ assert (is_empty(), " Compile Queue must be empty");
+ }
};
// CompileTaskWrapper
@@ -266,7 +270,7 @@
static CompileQueue* _c1_method_queue;
static CompileTask* _task_free_list;
- static GrowableArray<CompilerThread*>* _method_threads;
+ static GrowableArray<CompilerThread*>* _compiler_threads;
// performance counters
static PerfCounter* _perf_total_compilation;
@@ -311,7 +315,7 @@
static int _sum_nmethod_code_size;
static long _peak_compilation_time;
- static CompilerThread* make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, TRAPS);
+ static CompilerThread* make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, TRAPS);
static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count);
static bool compilation_is_complete (methodHandle method, int osr_bci, int comp_level);
static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
@@ -351,6 +355,9 @@
if (is_c1_compile(comp_level)) return _c1_method_queue;
return NULL;
}
+ static bool init_compiler_runtime();
+ static void shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread);
+
public:
enum {
// The entry bci used for non-OSR compilations.
@@ -378,9 +385,7 @@
const char* comment, Thread* thread);
static void compiler_thread_loop();
-
static uint get_compilation_id() { return _compilation_id; }
- static bool is_idle();
// Set _should_block.
// Call this from the VM, with Threads_lock held and a safepoint requested.
@@ -391,8 +396,9 @@
enum {
// Flags for toggling compiler activity
- stop_compilation = 0,
- run_compilation = 1
+ stop_compilation = 0,
+ run_compilation = 1,
+ shutdown_compilaton = 2
};
static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
@@ -401,6 +407,16 @@
jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
return (old == (1-new_state));
}
+
+ static void disable_compilation_forever() {
+ UseCompiler = false;
+ AlwaysCompileLoopMethods = false;
+ Atomic::xchg(shutdown_compilaton, &_should_compile_new_jobs);
+ }
+
+ static bool is_compilation_disabled_forever() {
+ return _should_compile_new_jobs == shutdown_compilaton;
+ }
static void handle_full_code_cache();
// Return total compilation ticks
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -344,6 +344,10 @@
}
}
+ if (FLAG_IS_CMDLINE(NewSize) && FLAG_IS_CMDLINE(MaxNewSize) && NewSize > MaxNewSize) {
+ vm_exit_during_initialization("Initial young gen size set larger than the maximum young gen size");
+ }
+
if (FLAG_IS_CMDLINE(NewSize)) {
_min_desired_young_length = MAX2((uint) (NewSize / HeapRegion::GrainBytes),
1U);
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -211,7 +211,7 @@
// a GC that freed space for the allocation.
if (!MetadataAllocationFailALot) {
_result = _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
- }
+ }
if (_result == NULL) {
if (UseConcMarkSweepGC) {
@@ -223,9 +223,7 @@
_loader_data->metaspace_non_null()->expand_and_allocate(_size, _mdtype);
}
if (_result == NULL) {
- // Don't clear the soft refs. This GC is for reclaiming metadata
- // and is unrelated to the fullness of the Java heap which should
- // be the criteria for clearing SoftReferences.
+ // Don't clear the soft refs yet.
if (Verbose && PrintGCDetails && UseConcMarkSweepGC) {
gclog_or_tty->print_cr("\nCMS full GC for Metaspace");
}
@@ -235,7 +233,7 @@
_result =
_loader_data->metaspace_non_null()->allocate(_size, _mdtype);
}
- if (_result == NULL && !UseConcMarkSweepGC /* CMS already tried */) {
+ if (_result == NULL) {
// If still failing, allow the Metaspace to expand.
// See delta_capacity_until_GC() for explanation of the
// amount of the expansion.
@@ -243,7 +241,16 @@
// or a MaxMetaspaceSize has been specified on the command line.
_result =
_loader_data->metaspace_non_null()->expand_and_allocate(_size, _mdtype);
-
+ if (_result == NULL) {
+ // If expansion failed, do a last-ditch collection and try allocating
+ // again. A last-ditch collection will clear softrefs. This
+ // behavior is similar to the last-ditch collection done for perm
+ // gen when it was full and a collection for failed allocation
+ // did not free perm gen space.
+ heap->collect_as_vm_thread(GCCause::_last_ditch_collection);
+ _result =
+ _loader_data->metaspace_non_null()->allocate(_size, _mdtype);
+ }
}
if (Verbose && PrintGCDetails && _result == NULL) {
gclog_or_tty->print_cr("\nAfter Metaspace GC failed to allocate size "
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -158,6 +159,22 @@
index = vt->index_of_miranda(resolved_method->name(),
resolved_method->signature());
kind = CallInfo::vtable_call;
+ } else if (resolved_method->has_vtable_index()) {
+ // Can occur if an interface redeclares a method of Object.
+
+#ifdef ASSERT
+ // Ensure that this is really the case.
+ KlassHandle object_klass = SystemDictionary::Object_klass();
+ Method * object_resolved_method = object_klass()->vtable()->method_at(index);
+ assert(object_resolved_method->name() == resolved_method->name(),
+ err_msg("Object and interface method names should match at vtable index %d, %s != %s",
+ index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string()));
+ assert(object_resolved_method->signature() == resolved_method->signature(),
+ err_msg("Object and interface method signatures should match at vtable index %d, %s != %s",
+ index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string()));
+#endif // ASSERT
+
+ kind = CallInfo::vtable_call;
} else {
// A regular interface call.
kind = CallInfo::itable_call;
@@ -454,7 +471,7 @@
Symbol* method_name = vmSymbols::invoke_name();
Symbol* method_signature = pool->signature_ref_at(index);
KlassHandle current_klass(THREAD, pool->pool_holder());
- resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, false, CHECK);
return;
}
@@ -476,22 +493,34 @@
if (code == Bytecodes::_invokeinterface) {
resolve_interface_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
+ } else if (code == Bytecodes::_invokevirtual) {
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, true, CHECK);
} else {
- resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, false, CHECK);
}
}
void LinkResolver::resolve_method(methodHandle& resolved_method, KlassHandle resolved_klass,
Symbol* method_name, Symbol* method_signature,
- KlassHandle current_klass, bool check_access, TRAPS) {
+ KlassHandle current_klass, bool check_access,
+ bool require_methodref, TRAPS) {
Handle nested_exception;
- // 1. lookup method in resolved klass and its super klasses
+ // 1. check if methodref required, that resolved_klass is not interfacemethodref
+ if (require_methodref && resolved_klass->is_interface()) {
+ ResourceMark rm(THREAD);
+ char buf[200];
+ jio_snprintf(buf, sizeof(buf), "Found interface %s, but class was expected",
+ resolved_klass()->external_name());
+ THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
+ }
+
+ // 2. lookup method in resolved klass and its super klasses
lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, CHECK);
if (resolved_method.is_null()) { // not found in the class hierarchy
- // 2. lookup method in all the interfaces implemented by the resolved klass
+ // 3. lookup method in all the interfaces implemented by the resolved klass
lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK);
if (resolved_method.is_null()) {
@@ -505,7 +534,7 @@
}
if (resolved_method.is_null()) {
- // 3. method lookup failed
+ // 4. method lookup failed
ResourceMark rm(THREAD);
THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
Method::name_and_sig_as_C_string(resolved_klass(),
@@ -515,15 +544,6 @@
}
}
- // 4. check if klass is not interface
- if (resolved_klass->is_interface() && resolved_method->is_abstract()) {
- ResourceMark rm(THREAD);
- char buf[200];
- jio_snprintf(buf, sizeof(buf), "Found interface %s, but class was expected",
- resolved_klass()->external_name());
- THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
- }
-
// 5. check if method is concrete
if (resolved_method->is_abstract() && !resolved_klass->is_abstract()) {
ResourceMark rm(THREAD);
@@ -833,7 +853,7 @@
Symbol* method_name, Symbol* method_signature,
KlassHandle current_klass, bool check_access, TRAPS) {
- resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, false, CHECK);
assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier");
// check if static
@@ -867,7 +887,7 @@
// and the selected method is recalculated relative to the direct superclass
// superinterface.method, which explicitly does not check shadowing
- resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, false, CHECK);
// check if method name is <init>, that it is found in same klass as static type
if (resolved_method->name() == vmSymbols::object_initializer_name() &&
@@ -1013,7 +1033,7 @@
Symbol* method_name, Symbol* method_signature,
KlassHandle current_klass, bool check_access, TRAPS) {
// normal method resolution
- resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, CHECK);
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, check_access, true, CHECK);
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier");
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier");
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -136,7 +136,7 @@
static void resolve_pool (KlassHandle& resolved_klass, Symbol*& method_name, Symbol*& method_signature, KlassHandle& current_klass, constantPoolHandle pool, int index, TRAPS);
static void resolve_interface_method(methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
- static void resolve_method (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
+ static void resolve_method (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, bool require_methodref, TRAPS);
static void linktime_resolve_static_method (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
static void linktime_resolve_special_method (methodHandle& resolved_method, KlassHandle resolved_klass, Symbol* method_name, Symbol* method_signature, KlassHandle current_klass, bool check_access, TRAPS);
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -28,7 +28,6 @@
#include "memory/binaryTreeDictionary.hpp"
#include "memory/freeList.hpp"
#include "memory/freeBlockDictionary.hpp"
-#include "memory/metablock.hpp"
#include "memory/metachunk.hpp"
#include "runtime/globals.hpp"
#include "utilities/ostream.hpp"
--- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -28,7 +28,6 @@
#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
#endif // INCLUDE_ALL_GCS
#include "memory/freeBlockDictionary.hpp"
-#include "memory/metablock.hpp"
#include "memory/metachunk.hpp"
#include "runtime/thread.inline.hpp"
#include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/memory/freeList.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/freeList.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,6 @@
#include "precompiled.hpp"
#include "memory/freeBlockDictionary.hpp"
#include "memory/freeList.hpp"
-#include "memory/metablock.hpp"
#include "memory/metachunk.hpp"
#include "memory/sharedHeap.hpp"
#include "runtime/globals.hpp"
--- a/hotspot/src/share/vm/memory/metablock.cpp Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "memory/allocation.hpp"
-#include "memory/metablock.hpp"
-#include "utilities/copy.hpp"
-#include "utilities/debug.hpp"
-
-// Blocks of space for metadata are allocated out of Metachunks.
-//
-// Metachunk are allocated out of MetadataVirtualspaces and once
-// allocated there is no explicit link between a Metachunk and
-// the MetadataVirtualspaces from which it was allocated.
-//
-// Each SpaceManager maintains a
-// list of the chunks it is using and the current chunk. The current
-// chunk is the chunk from which allocations are done. Space freed in
-// a chunk is placed on the free list of blocks (BlockFreelist) and
-// reused from there.
-//
-// Future modification
-//
-// The Metachunk can conceivable be replaced by the Chunk in
-// allocation.hpp. Note that the latter Chunk is the space for
-// allocation (allocations from the chunk are out of the space in
-// the Chunk after the header for the Chunk) where as Metachunks
-// point to space in a VirtualSpace. To replace Metachunks with
-// Chunks, change Chunks so that they can be allocated out of a VirtualSpace.
-size_t Metablock::_min_block_byte_size = sizeof(Metablock);
-
-// New blocks returned by the Metaspace are zero initialized.
-// We should fix the constructors to not assume this instead.
-Metablock* Metablock::initialize(MetaWord* p, size_t word_size) {
- if (p == NULL) {
- return NULL;
- }
-
- Metablock* result = (Metablock*) p;
-
- // Clear the memory
- Copy::fill_to_aligned_words((HeapWord*)result, word_size);
-#ifdef ASSERT
- result->set_word_size(word_size);
-#endif
- return result;
-}
--- a/hotspot/src/share/vm/memory/metablock.hpp Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-#ifndef SHARE_VM_MEMORY_METABLOCK_HPP
-#define SHARE_VM_MEMORY_METABLOCK_HPP
-
-// Metablock are the unit of allocation from a Chunk. It is initialized
-// with the size of the requested allocation. That size is overwritten
-// once the allocation returns.
-//
-// A Metablock may be reused by its SpaceManager but are never moved between
-// SpaceManagers. There is no explicit link to the Metachunk
-// from which it was allocated. Metablock may be deallocated and
-// put on a freelist but the space is never freed, rather
-// the Metachunk it is a part of will be deallocated when it's
-// associated class loader is collected.
-
-class Metablock VALUE_OBJ_CLASS_SPEC {
- friend class VMStructs;
- private:
- // Used to align the allocation (see below).
- union block_t {
- void* _data[3];
- struct header_t {
- size_t _word_size;
- Metablock* _next;
- Metablock* _prev;
- } _header;
- } _block;
- static size_t _min_block_byte_size;
-
- typedef union block_t Block;
- typedef struct header_t Header;
- const Block* block() const { return &_block; }
- const Block::header_t* header() const { return &(block()->_header); }
- public:
-
- static Metablock* initialize(MetaWord* p, size_t word_size);
-
- // This places the body of the block at a 2 word boundary
- // because every block starts on a 2 word boundary. Work out
- // how to make the body on a 2 word boundary if the block
- // starts on a arbitrary boundary. JJJ
-
- size_t word_size() const { return header()->_word_size; }
- void set_word_size(size_t v) { _block._header._word_size = v; }
- size_t size() const volatile { return _block._header._word_size; }
- void set_size(size_t v) { _block._header._word_size = v; }
- Metablock* next() const { return header()->_next; }
- void set_next(Metablock* v) { _block._header._next = v; }
- Metablock* prev() const { return header()->_prev; }
- void set_prev(Metablock* v) { _block._header._prev = v; }
-
- static size_t min_block_byte_size() { return _min_block_byte_size; }
-
- bool is_free() { return header()->_word_size != 0; }
- void clear_next() { set_next(NULL); }
- void link_prev(Metablock* ptr) { set_prev(ptr); }
- uintptr_t* end() { return ((uintptr_t*) this) + size(); }
- bool cantCoalesce() const { return false; }
- void link_next(Metablock* ptr) { set_next(ptr); }
- void link_after(Metablock* ptr){
- link_next(ptr);
- if (ptr != NULL) ptr->link_prev(this);
- }
-
- // Should not be needed in a free list of Metablocks
- void markNotFree() { ShouldNotReachHere(); }
-
- // Debug support
-#ifdef ASSERT
- void* prev_addr() const { return (void*)&_block._header._prev; }
- void* next_addr() const { return (void*)&_block._header._next; }
- void* size_addr() const { return (void*)&_block._header._word_size; }
-#endif
- bool verify_chunk_in_free_list(Metablock* tc) const { return true; }
- bool verify_par_locked() { return true; }
-
- void assert_is_mangled() const {/* Don't check "\*/}
-};
-#endif // SHARE_VM_MEMORY_METABLOCK_HPP
--- a/hotspot/src/share/vm/memory/metachunk.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/metachunk.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,42 +29,39 @@
#include "utilities/debug.hpp"
class VirtualSpaceNode;
-//
-// Future modification
-//
-// The Metachunk can conceivable be replaced by the Chunk in
-// allocation.hpp. Note that the latter Chunk is the space for
-// allocation (allocations from the chunk are out of the space in
-// the Chunk after the header for the Chunk) where as Metachunks
-// point to space in a VirtualSpace. To replace Metachunks with
-// Chunks, change Chunks so that they can be allocated out of a VirtualSpace.
const size_t metadata_chunk_initialize = 0xf7f7f7f7;
-size_t Metachunk::_overhead =
- Chunk::aligned_overhead_size(sizeof(Metachunk)) / BytesPerWord;
+size_t Metachunk::object_alignment() {
+ // Must align pointers and sizes to 8,
+ // so that 64 bit types get correctly aligned.
+ const size_t alignment = 8;
+
+ // Make sure that the Klass alignment also agree.
+ STATIC_ASSERT(alignment == (size_t)KlassAlignmentInBytes);
+
+ return alignment;
+}
+
+size_t Metachunk::overhead() {
+ return align_size_up(sizeof(Metachunk), object_alignment()) / BytesPerWord;
+}
// Metachunk methods
Metachunk::Metachunk(size_t word_size,
- VirtualSpaceNode* container) :
- _word_size(word_size),
- _bottom(NULL),
- _end(NULL),
+ VirtualSpaceNode* container)
+ : Metabase<Metachunk>(word_size),
_top(NULL),
- _next(NULL),
- _prev(NULL),
_container(container)
{
- _bottom = (MetaWord*)this;
- _top = (MetaWord*)this + _overhead;
- _end = (MetaWord*)this + word_size;
+ _top = initial_top();
#ifdef ASSERT
- set_is_free(false);
+ set_is_tagged_free(false);
size_t data_word_size = pointer_delta(end(),
- top(),
+ _top,
sizeof(MetaWord));
- Copy::fill_to_words((HeapWord*) top(),
+ Copy::fill_to_words((HeapWord*)_top,
data_word_size,
metadata_chunk_initialize);
#endif
@@ -82,22 +79,18 @@
// _bottom points to the start of the chunk including the overhead.
size_t Metachunk::used_word_size() const {
- return pointer_delta(_top, _bottom, sizeof(MetaWord));
+ return pointer_delta(_top, bottom(), sizeof(MetaWord));
}
size_t Metachunk::free_word_size() const {
- return pointer_delta(_end, _top, sizeof(MetaWord));
-}
-
-size_t Metachunk::capacity_word_size() const {
- return pointer_delta(_end, _bottom, sizeof(MetaWord));
+ return pointer_delta(end(), _top, sizeof(MetaWord));
}
void Metachunk::print_on(outputStream* st) const {
st->print_cr("Metachunk:"
" bottom " PTR_FORMAT " top " PTR_FORMAT
" end " PTR_FORMAT " size " SIZE_FORMAT,
- bottom(), top(), end(), word_size());
+ bottom(), _top, end(), word_size());
if (Verbose) {
st->print_cr(" used " SIZE_FORMAT " free " SIZE_FORMAT,
used_word_size(), free_word_size());
@@ -109,8 +102,8 @@
// Mangle the payload of the chunk and not the links that
// maintain list of chunks.
HeapWord* start = (HeapWord*)(bottom() + overhead());
- size_t word_size = capacity_word_size() - overhead();
- Copy::fill_to_words(start, word_size, metadata_chunk_initialize);
+ size_t size = word_size() - overhead();
+ Copy::fill_to_words(start, size, metadata_chunk_initialize);
}
#endif // PRODUCT
@@ -118,9 +111,68 @@
#ifdef ASSERT
// Cannot walk through the blocks unless the blocks have
// headers with sizes.
- assert(_bottom <= _top &&
- _top <= _end,
+ assert(bottom() <= _top &&
+ _top <= (MetaWord*)end(),
"Chunk has been smashed");
#endif
return;
}
+
+/////////////// Unit tests ///////////////
+
+#ifndef PRODUCT
+
+class TestMetachunk {
+ public:
+ static void test() {
+ size_t size = 2 * 1024 * 1024;
+ void* memory = malloc(size);
+ assert(memory != NULL, "Failed to malloc 2MB");
+
+ Metachunk* metachunk = ::new (memory) Metachunk(size / BytesPerWord, NULL);
+
+ assert(metachunk->bottom() == (MetaWord*)metachunk, "assert");
+ assert(metachunk->end() == (uintptr_t*)metachunk + metachunk->size(), "assert");
+
+ // Check sizes
+ assert(metachunk->size() == metachunk->word_size(), "assert");
+ assert(metachunk->word_size() == pointer_delta(metachunk->end(), metachunk->bottom(),
+ sizeof(MetaWord*)), "assert");
+
+ // Check usage
+ assert(metachunk->used_word_size() == metachunk->overhead(), "assert");
+ assert(metachunk->free_word_size() == metachunk->word_size() - metachunk->used_word_size(), "assert");
+ assert(metachunk->top() == metachunk->initial_top(), "assert");
+ assert(metachunk->is_empty(), "assert");
+
+ // Allocate
+ size_t alloc_size = 64; // Words
+ assert(is_size_aligned(alloc_size, Metachunk::object_alignment()), "assert");
+
+ MetaWord* mem = metachunk->allocate(alloc_size);
+
+ // Check post alloc
+ assert(mem == metachunk->initial_top(), "assert");
+ assert(mem + alloc_size == metachunk->top(), "assert");
+ assert(metachunk->used_word_size() == metachunk->overhead() + alloc_size, "assert");
+ assert(metachunk->free_word_size() == metachunk->word_size() - metachunk->used_word_size(), "assert");
+ assert(!metachunk->is_empty(), "assert");
+
+ // Clear chunk
+ metachunk->reset_empty();
+
+ // Check post clear
+ assert(metachunk->used_word_size() == metachunk->overhead(), "assert");
+ assert(metachunk->free_word_size() == metachunk->word_size() - metachunk->used_word_size(), "assert");
+ assert(metachunk->top() == metachunk->initial_top(), "assert");
+ assert(metachunk->is_empty(), "assert");
+
+ free(memory);
+ }
+};
+
+void TestMetachunk_test() {
+ TestMetachunk::test();
+}
+
+#endif
--- a/hotspot/src/share/vm/memory/metachunk.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/metachunk.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,89 +24,44 @@
#ifndef SHARE_VM_MEMORY_METACHUNK_HPP
#define SHARE_VM_MEMORY_METACHUNK_HPP
-// Metachunk - Quantum of allocation from a Virtualspace
-// Metachunks are reused (when freed are put on a global freelist) and
-// have no permanent association to a SpaceManager.
-
-// +--------------+ <- end
-// | | --+ ---+
-// | | | free |
-// | | | |
-// | | | | capacity
-// | | | |
-// | | <- top --+ |
-// | | ---+ |
-// | | | used |
-// | | | |
-// | | | |
-// +--------------+ <- bottom ---+ ---+
+#include "memory/allocation.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
class VirtualSpaceNode;
-class Metachunk VALUE_OBJ_CLASS_SPEC {
- // link to support lists of chunks
- Metachunk* _next;
- Metachunk* _prev;
- VirtualSpaceNode* _container;
-
- MetaWord* _bottom;
- MetaWord* _end;
- MetaWord* _top;
+// Super class of Metablock and Metachunk to allow them to
+// be put on the FreeList and in the BinaryTreeDictionary.
+template <class T>
+class Metabase VALUE_OBJ_CLASS_SPEC {
size_t _word_size;
- // Used in a guarantee() so included in the Product builds
- // even through it is only for debugging.
- bool _is_free;
+ T* _next;
+ T* _prev;
- // Metachunks are allocated out of a MetadataVirtualSpace and
- // and use some of its space to describe itself (plus alignment
- // considerations). Metadata is allocated in the rest of the chunk.
- // This size is the overhead of maintaining the Metachunk within
- // the space.
- static size_t _overhead;
+ protected:
+ Metabase(size_t word_size) : _word_size(word_size), _next(NULL), _prev(NULL) {}
public:
- Metachunk(size_t word_size , VirtualSpaceNode* container);
-
- // Used to add a Metachunk to a list of Metachunks
- void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");}
- void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");}
- void set_container(VirtualSpaceNode* v) { _container = v; }
-
- MetaWord* allocate(size_t word_size);
+ T* next() const { return _next; }
+ T* prev() const { return _prev; }
+ void set_next(T* v) { _next = v; assert(v != this, "Boom");}
+ void set_prev(T* v) { _prev = v; assert(v != this, "Boom");}
+ void clear_next() { set_next(NULL); }
+ void clear_prev() { set_prev(NULL); }
- // Accessors
- Metachunk* next() const { return _next; }
- Metachunk* prev() const { return _prev; }
- VirtualSpaceNode* container() const { return _container; }
- MetaWord* bottom() const { return _bottom; }
- MetaWord* end() const { return _end; }
- MetaWord* top() const { return _top; }
- size_t word_size() const { return _word_size; }
size_t size() const volatile { return _word_size; }
void set_size(size_t v) { _word_size = v; }
- bool is_free() { return _is_free; }
- void set_is_free(bool v) { _is_free = v; }
- static size_t overhead() { return _overhead; }
- void clear_next() { set_next(NULL); }
- void link_prev(Metachunk* ptr) { set_prev(ptr); }
- uintptr_t* end() { return ((uintptr_t*) this) + size(); }
- bool cantCoalesce() const { return false; }
- void link_next(Metachunk* ptr) { set_next(ptr); }
- void link_after(Metachunk* ptr){
+
+ void link_next(T* ptr) { set_next(ptr); }
+ void link_prev(T* ptr) { set_prev(ptr); }
+ void link_after(T* ptr) {
link_next(ptr);
- if (ptr != NULL) ptr->link_prev(this);
+ if (ptr != NULL) ptr->link_prev((T*)this);
}
- // Reset top to bottom so chunk can be reused.
- void reset_empty() { _top = (_bottom + _overhead); _next = NULL; _prev = NULL; }
- bool is_empty() { return _top == (_bottom + _overhead); }
+ uintptr_t* end() const { return ((uintptr_t*) this) + size(); }
- // used (has been allocated)
- // free (available for future allocations)
- // capacity (total size of chunk)
- size_t used_word_size() const;
- size_t free_word_size() const;
- size_t capacity_word_size()const;
+ bool cantCoalesce() const { return false; }
// Debug support
#ifdef ASSERT
@@ -114,14 +69,99 @@
void* next_addr() const { return (void*)&_next; }
void* size_addr() const { return (void*)&_word_size; }
#endif
- bool verify_chunk_in_free_list(Metachunk* tc) const { return true; }
+ bool verify_chunk_in_free_list(T* tc) const { return true; }
bool verify_par_locked() { return true; }
void assert_is_mangled() const {/* Don't check "\*/}
+ bool is_free() { return true; }
+};
+
+// Metachunk - Quantum of allocation from a Virtualspace
+// Metachunks are reused (when freed are put on a global freelist) and
+// have no permanent association to a SpaceManager.
+
+// +--------------+ <- end --+ --+
+// | | | |
+// | | | free |
+// | | | |
+// | | | | size | capacity
+// | | | |
+// | | <- top -- + |
+// | | | |
+// | | | used |
+// | | | |
+// | | | |
+// +--------------+ <- bottom --+ --+
+
+class Metachunk : public Metabase<Metachunk> {
+ friend class TestMetachunk;
+ // The VirtualSpaceNode containing this chunk.
+ VirtualSpaceNode* _container;
+
+ // Current allocation top.
+ MetaWord* _top;
+
+ DEBUG_ONLY(bool _is_tagged_free;)
+
+ MetaWord* initial_top() const { return (MetaWord*)this + overhead(); }
+ MetaWord* top() const { return _top; }
+
+ public:
+ // Metachunks are allocated out of a MetadataVirtualSpace and
+ // and use some of its space to describe itself (plus alignment
+ // considerations). Metadata is allocated in the rest of the chunk.
+ // This size is the overhead of maintaining the Metachunk within
+ // the space.
+
+ // Alignment of each allocation in the chunks.
+ static size_t object_alignment();
+
+ // Size of the Metachunk header, including alignment.
+ static size_t overhead();
+
+ Metachunk(size_t word_size , VirtualSpaceNode* container);
+
+ MetaWord* allocate(size_t word_size);
+
+ VirtualSpaceNode* container() const { return _container; }
+
+ MetaWord* bottom() const { return (MetaWord*) this; }
+
+ // Reset top to bottom so chunk can be reused.
+ void reset_empty() { _top = initial_top(); clear_next(); clear_prev(); }
+ bool is_empty() { return _top == initial_top(); }
+
+ // used (has been allocated)
+ // free (available for future allocations)
+ size_t word_size() const { return size(); }
+ size_t used_word_size() const;
+ size_t free_word_size() const;
+
+#ifdef ASSERT
+ bool is_tagged_free() { return _is_tagged_free; }
+ void set_is_tagged_free(bool v) { _is_tagged_free = v; }
+#endif
+
NOT_PRODUCT(void mangle();)
void print_on(outputStream* st) const;
void verify();
};
+
+// Metablock is the unit of allocation from a Chunk.
+//
+// A Metablock may be reused by its SpaceManager but are never moved between
+// SpaceManagers. There is no explicit link to the Metachunk
+// from which it was allocated. Metablock may be deallocated and
+// put on a freelist but the space is never freed, rather
+// the Metachunk it is a part of will be deallocated when it's
+// associated class loader is collected.
+
+class Metablock : public Metabase<Metablock> {
+ friend class VMStructs;
+ public:
+ Metablock(size_t word_size) : Metabase<Metablock>(word_size) {}
+};
+
#endif // SHARE_VM_MEMORY_METACHUNK_HPP
--- a/hotspot/src/share/vm/memory/metadataFactory.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/metadataFactory.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,7 @@
static void free_array(ClassLoaderData* loader_data, Array<T>* data) {
if (data != NULL) {
assert(loader_data != NULL, "shouldn't pass null");
+ assert(!data->is_shared(), "cannot deallocate array in shared spaces");
int size = data->size();
if (DumpSharedSpaces) {
loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
@@ -83,6 +84,7 @@
// Call metadata's deallocate function which will call deallocate fields
assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive");
assert(!md->on_stack(), "can't deallocate things on stack");
+ assert(!md->is_shared(), "cannot deallocate if in shared spaces");
md->deallocate_contents(loader_data);
loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());
}
--- a/hotspot/src/share/vm/memory/metaspace.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspace.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -30,7 +30,6 @@
#include "memory/filemap.hpp"
#include "memory/freeList.hpp"
#include "memory/gcLocker.hpp"
-#include "memory/metablock.hpp"
#include "memory/metachunk.hpp"
#include "memory/metaspace.hpp"
#include "memory/metaspaceShared.hpp"
@@ -49,13 +48,10 @@
typedef BinaryTreeDictionary<Metablock, FreeList> BlockTreeDictionary;
typedef BinaryTreeDictionary<Metachunk, FreeList> ChunkTreeDictionary;
-// Define this macro to enable slow integrity checking of
-// the free chunk lists
+
+// Set this constant to enable slow integrity checking of the free chunk lists
const bool metaspace_slow_verify = false;
-// Parameters for stress mode testing
-const uint metadata_deallocate_a_lot_block = 10;
-const uint metadata_deallocate_a_lock_chunk = 3;
size_t const allocation_from_dictionary_limit = 4 * K;
MetaWord* last_allocated = 0;
@@ -92,24 +88,9 @@
uint MetaspaceGC::_shrink_factor = 0;
bool MetaspaceGC::_should_concurrent_collect = false;
-// Blocks of space for metadata are allocated out of Metachunks.
-//
-// Metachunk are allocated out of MetadataVirtualspaces and once
-// allocated there is no explicit link between a Metachunk and
-// the MetadataVirtualspaces from which it was allocated.
-//
-// Each SpaceManager maintains a
-// list of the chunks it is using and the current chunk. The current
-// chunk is the chunk from which allocations are done. Space freed in
-// a chunk is placed on the free list of blocks (BlockFreelist) and
-// reused from there.
-
typedef class FreeList<Metachunk> ChunkList;
// Manages the global free lists of chunks.
-// Has three lists of free chunks, and a total size and
-// count that includes all three
-
class ChunkManager : public CHeapObj<mtInternal> {
// Free list of chunks of different sizes.
@@ -119,7 +100,6 @@
// HumongousChunk
ChunkList _free_chunks[NumberOfFreeLists];
-
// HumongousChunk
ChunkTreeDictionary _humongous_dictionary;
@@ -166,7 +146,6 @@
// add or delete (return) a chunk to the global freelist.
Metachunk* chunk_freelist_allocate(size_t word_size);
- void chunk_freelist_deallocate(Metachunk* chunk);
// Map a size to a list index assuming that there are lists
// for special, small, medium, and humongous chunks.
@@ -200,9 +179,7 @@
// Returns the list for the given chunk word size.
ChunkList* find_free_chunks_list(size_t word_size);
- // Add and remove from a list by size. Selects
- // list based on size of chunk.
- void free_chunks_put(Metachunk* chuck);
+ // Remove from a list by size. Selects list based on size of chunk.
Metachunk* free_chunks_get(size_t chunk_word_size);
// Debug support
@@ -230,7 +207,6 @@
// to the allocation of a quantum of metadata).
class BlockFreelist VALUE_OBJ_CLASS_SPEC {
BlockTreeDictionary* _dictionary;
- static Metablock* initialize_free_chunk(MetaWord* p, size_t word_size);
// Only allocate and split from freelist if the size of the allocation
// is at least 1/4th the size of the available block.
@@ -258,6 +234,7 @@
void print_on(outputStream* st) const;
};
+// A VirtualSpaceList node.
class VirtualSpaceNode : public CHeapObj<mtClass> {
friend class VirtualSpaceList;
@@ -414,13 +391,13 @@
Metachunk* chunk = first_chunk();
Metachunk* invalid_chunk = (Metachunk*) top();
while (chunk < invalid_chunk ) {
- assert(chunk->is_free(), "Should be marked free");
- MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
- chunk_manager->remove_chunk(chunk);
- assert(chunk->next() == NULL &&
- chunk->prev() == NULL,
- "Was not removed from its list");
- chunk = (Metachunk*) next;
+ assert(chunk->is_tagged_free(), "Should be tagged free");
+ MetaWord* next = ((MetaWord*)chunk) + chunk->word_size();
+ chunk_manager->remove_chunk(chunk);
+ assert(chunk->next() == NULL &&
+ chunk->prev() == NULL,
+ "Was not removed from its list");
+ chunk = (Metachunk*) next;
}
}
@@ -434,7 +411,7 @@
// Don't count the chunks on the free lists. Those are
// still part of the VirtualSpaceNode but not currently
// counted.
- if (!chunk->is_free()) {
+ if (!chunk->is_tagged_free()) {
count++;
}
chunk = (Metachunk*) next;
@@ -550,44 +527,16 @@
class Metadebug : AllStatic {
// Debugging support for Metaspaces
- static int _deallocate_block_a_lot_count;
- static int _deallocate_chunk_a_lot_count;
static int _allocation_fail_alot_count;
public:
- static int deallocate_block_a_lot_count() {
- return _deallocate_block_a_lot_count;
- }
- static void set_deallocate_block_a_lot_count(int v) {
- _deallocate_block_a_lot_count = v;
- }
- static void inc_deallocate_block_a_lot_count() {
- _deallocate_block_a_lot_count++;
- }
- static int deallocate_chunk_a_lot_count() {
- return _deallocate_chunk_a_lot_count;
- }
- static void reset_deallocate_chunk_a_lot_count() {
- _deallocate_chunk_a_lot_count = 1;
- }
- static void inc_deallocate_chunk_a_lot_count() {
- _deallocate_chunk_a_lot_count++;
- }
static void init_allocation_fail_alot_count();
#ifdef ASSERT
static bool test_metadata_failure();
#endif
-
- static void deallocate_chunk_a_lot(SpaceManager* sm,
- size_t chunk_word_size);
- static void deallocate_block_a_lot(SpaceManager* sm,
- size_t chunk_word_size);
-
};
-int Metadebug::_deallocate_block_a_lot_count = 0;
-int Metadebug::_deallocate_chunk_a_lot_count = 0;
int Metadebug::_allocation_fail_alot_count = 0;
// SpaceManager - used by Metaspace to handle allocations
@@ -753,14 +702,11 @@
#endif
size_t get_raw_word_size(size_t word_size) {
- // If only the dictionary is going to be used (i.e., no
- // indexed free list), then there is a minimum size requirement.
- // MinChunkSize is a placeholder for the real minimum size JJJ
size_t byte_size = word_size * BytesPerWord;
- size_t raw_bytes_size = MAX2(byte_size,
- Metablock::min_block_byte_size());
- raw_bytes_size = ARENA_ALIGN(raw_bytes_size);
+ size_t raw_bytes_size = MAX2(byte_size, sizeof(Metablock));
+ raw_bytes_size = align_size_up(raw_bytes_size, Metachunk::object_alignment());
+
size_t raw_word_size = raw_bytes_size / BytesPerWord;
assert(raw_word_size * BytesPerWord == raw_bytes_size, "Size problem");
@@ -813,17 +759,8 @@
}
}
-Metablock* BlockFreelist::initialize_free_chunk(MetaWord* p, size_t word_size) {
- Metablock* block = (Metablock*) p;
- block->set_word_size(word_size);
- block->set_prev(NULL);
- block->set_next(NULL);
-
- return block;
-}
-
void BlockFreelist::return_block(MetaWord* p, size_t word_size) {
- Metablock* free_chunk = initialize_free_chunk(p, word_size);
+ Metablock* free_chunk = ::new (p) Metablock(word_size);
if (dictionary() == NULL) {
_dictionary = new BlockTreeDictionary();
}
@@ -1069,7 +1006,7 @@
}
// Chunk is being removed from the chunks free list.
- dec_free_chunks_total(chunk->capacity_word_size());
+ dec_free_chunks_total(chunk->word_size());
}
// Walk the list of VirtualSpaceNodes and delete
@@ -1563,54 +1500,6 @@
// Metadebug methods
-void Metadebug::deallocate_chunk_a_lot(SpaceManager* sm,
- size_t chunk_word_size){
-#ifdef ASSERT
- VirtualSpaceList* vsl = sm->vs_list();
- if (MetaDataDeallocateALot &&
- Metadebug::deallocate_chunk_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) {
- Metadebug::reset_deallocate_chunk_a_lot_count();
- for (uint i = 0; i < metadata_deallocate_a_lock_chunk; i++) {
- Metachunk* dummy_chunk = vsl->current_virtual_space()->take_from_committed(chunk_word_size);
- if (dummy_chunk == NULL) {
- break;
- }
- sm->chunk_manager()->chunk_freelist_deallocate(dummy_chunk);
-
- if (TraceMetadataChunkAllocation && Verbose) {
- gclog_or_tty->print("Metadebug::deallocate_chunk_a_lot: %d) ",
- sm->sum_count_in_chunks_in_use());
- dummy_chunk->print_on(gclog_or_tty);
- gclog_or_tty->print_cr(" Free chunks total %d count %d",
- sm->chunk_manager()->free_chunks_total_words(),
- sm->chunk_manager()->free_chunks_count());
- }
- }
- } else {
- Metadebug::inc_deallocate_chunk_a_lot_count();
- }
-#endif
-}
-
-void Metadebug::deallocate_block_a_lot(SpaceManager* sm,
- size_t raw_word_size){
-#ifdef ASSERT
- if (MetaDataDeallocateALot &&
- Metadebug::deallocate_block_a_lot_count() % MetaDataDeallocateALotInterval == 0 ) {
- Metadebug::set_deallocate_block_a_lot_count(0);
- for (uint i = 0; i < metadata_deallocate_a_lot_block; i++) {
- MetaWord* dummy_block = sm->allocate_work(raw_word_size);
- if (dummy_block == 0) {
- break;
- }
- sm->deallocate(dummy_block, raw_word_size);
- }
- } else {
- Metadebug::inc_deallocate_block_a_lot_count();
- }
-#endif
-}
-
void Metadebug::init_allocation_fail_alot_count() {
if (MetadataAllocationFailALot) {
_allocation_fail_alot_count =
@@ -1754,31 +1643,6 @@
return free_chunks(index);
}
-void ChunkManager::free_chunks_put(Metachunk* chunk) {
- assert_lock_strong(SpaceManager::expand_lock());
- ChunkList* free_list = find_free_chunks_list(chunk->word_size());
- chunk->set_next(free_list->head());
- free_list->set_head(chunk);
- // chunk is being returned to the chunk free list
- inc_free_chunks_total(chunk->capacity_word_size());
- slow_locked_verify();
-}
-
-void ChunkManager::chunk_freelist_deallocate(Metachunk* chunk) {
- // The deallocation of a chunk originates in the freelist
- // manangement code for a Metaspace and does not hold the
- // lock.
- assert(chunk != NULL, "Deallocating NULL");
- assert_lock_strong(SpaceManager::expand_lock());
- slow_locked_verify();
- if (TraceMetadataChunkAllocation) {
- gclog_or_tty->print_cr("ChunkManager::chunk_freelist_deallocate: chunk "
- PTR_FORMAT " size " SIZE_FORMAT,
- chunk, chunk->word_size());
- }
- free_chunks_put(chunk);
-}
-
Metachunk* ChunkManager::free_chunks_get(size_t word_size) {
assert_lock_strong(SpaceManager::expand_lock());
@@ -1822,7 +1686,7 @@
}
// Chunk is being removed from the chunks free list.
- dec_free_chunks_total(chunk->capacity_word_size());
+ dec_free_chunks_total(chunk->word_size());
// Remove it from the links to this freelist
chunk->set_next(NULL);
@@ -1830,7 +1694,7 @@
#ifdef ASSERT
// Chunk is no longer on any freelist. Setting to false make container_count_slow()
// work.
- chunk->set_is_free(false);
+ chunk->set_is_tagged_free(false);
#endif
chunk->container()->inc_container_count();
@@ -1962,7 +1826,7 @@
for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
Metachunk* chunk = chunks_in_use(i);
while (chunk != NULL) {
- sum += chunk->capacity_word_size();
+ sum += chunk->word_size();
chunk = chunk->next();
}
}
@@ -2098,10 +1962,6 @@
size_t grow_chunks_by_words = calc_chunk_size(word_size);
Metachunk* next = get_new_chunk(word_size, grow_chunks_by_words);
- if (next != NULL) {
- Metadebug::deallocate_chunk_a_lot(this, grow_chunks_by_words);
- }
-
MetaWord* mem = NULL;
// If a chunk was available, add it to the in-use chunk list
@@ -2210,7 +2070,7 @@
// Capture the next link before it is changed
// by the call to return_chunk_at_head();
Metachunk* next = cur->next();
- cur->set_is_free(true);
+ DEBUG_ONLY(cur->set_is_tagged_free(true);)
list->return_chunk_at_head(cur);
cur = next;
}
@@ -2282,7 +2142,7 @@
while (humongous_chunks != NULL) {
#ifdef ASSERT
- humongous_chunks->set_is_free(true);
+ humongous_chunks->set_is_tagged_free(true);
#endif
if (TraceMetadataChunkAllocation && Verbose) {
gclog_or_tty->print(PTR_FORMAT " (" SIZE_FORMAT ") ",
@@ -2446,7 +2306,6 @@
if (p == NULL) {
p = allocate_work(raw_word_size);
}
- Metadebug::deallocate_block_a_lot(this, raw_word_size);
return p;
}
@@ -2545,7 +2404,7 @@
curr->print_on(out);
curr_total += curr->word_size();
used += curr->used_word_size();
- capacity += curr->capacity_word_size();
+ capacity += curr->word_size();
waste += curr->free_word_size() + curr->overhead();;
}
}
@@ -3396,7 +3255,7 @@
}
-Metablock* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
+MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
bool read_only, MetaspaceObj::Type type, TRAPS) {
if (HAS_PENDING_EXCEPTION) {
assert(false, "Should not allocate with exception pending");
@@ -3415,10 +3274,14 @@
MetaWord* result = space->allocate(word_size, NonClassType);
if (result == NULL) {
report_out_of_shared_space(read_only ? SharedReadOnly : SharedReadWrite);
- } else {
- space->record_allocation(result, type, space->vsm()->get_raw_word_size(word_size));
}
- return Metablock::initialize(result, word_size);
+
+ space->record_allocation(result, type, space->vsm()->get_raw_word_size(word_size));
+
+ // Zero initialize.
+ Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0);
+
+ return result;
}
MetadataType mdtype = (type == MetaspaceObj::ClassType) ? ClassType : NonClassType;
@@ -3443,7 +3306,10 @@
return NULL;
}
- return Metablock::initialize(result, word_size);
+ // Zero initialize.
+ Copy::fill_to_aligned_words((HeapWord*)result, word_size, 0);
+
+ return result;
}
void Metaspace::report_metadata_oome(ClassLoaderData* loader_data, size_t word_size, MetadataType mdtype, TRAPS) {
--- a/hotspot/src/share/vm/memory/metaspace.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/memory/metaspace.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -139,7 +139,6 @@
// Allocate space for metadata of type mdtype. This is space
// within a Metachunk and is used by
// allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
- // which returns a Metablock.
MetaWord* allocate(size_t word_size, MetadataType mdtype);
// Virtual Space lists for both classes and other metadata
@@ -217,8 +216,8 @@
size_t used_bytes_slow(MetadataType mdtype) const;
size_t capacity_bytes_slow(MetadataType mdtype) const;
- static Metablock* allocate(ClassLoaderData* loader_data, size_t word_size,
- bool read_only, MetaspaceObj::Type type, TRAPS);
+ static MetaWord* allocate(ClassLoaderData* loader_data, size_t word_size,
+ bool read_only, MetaspaceObj::Type type, TRAPS);
void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
MetaWord* expand_and_allocate(size_t size,
--- a/hotspot/src/share/vm/oops/constantPool.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/oops/constantPool.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -869,18 +869,9 @@
bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
int index2, TRAPS) {
- jbyte t1 = tag_at(index1).value();
- jbyte t2 = cp2->tag_at(index2).value();
-
-
- // JVM_CONSTANT_UnresolvedClassInError is equal to JVM_CONSTANT_UnresolvedClass
- // when comparing
- if (t1 == JVM_CONSTANT_UnresolvedClassInError) {
- t1 = JVM_CONSTANT_UnresolvedClass;
- }
- if (t2 == JVM_CONSTANT_UnresolvedClassInError) {
- t2 = JVM_CONSTANT_UnresolvedClass;
- }
+ // The error tags are equivalent to non-error tags when comparing
+ jbyte t1 = tag_at(index1).non_error_value();
+ jbyte t2 = cp2->tag_at(index2).non_error_value();
if (t1 != t2) {
// Not the same entry type so there is nothing else to check. Note
@@ -1001,8 +992,8 @@
case JVM_CONSTANT_MethodType:
{
- int k1 = method_type_index_at(index1);
- int k2 = cp2->method_type_index_at(index2);
+ int k1 = method_type_index_at_error_ok(index1);
+ int k2 = cp2->method_type_index_at_error_ok(index2);
bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
if (match) {
return true;
@@ -1011,11 +1002,11 @@
case JVM_CONSTANT_MethodHandle:
{
- int k1 = method_handle_ref_kind_at(index1);
- int k2 = cp2->method_handle_ref_kind_at(index2);
+ int k1 = method_handle_ref_kind_at_error_ok(index1);
+ int k2 = cp2->method_handle_ref_kind_at_error_ok(index2);
if (k1 == k2) {
- int i1 = method_handle_index_at(index1);
- int i2 = cp2->method_handle_index_at(index2);
+ int i1 = method_handle_index_at_error_ok(index1);
+ int i2 = cp2->method_handle_index_at_error_ok(index2);
bool match = compare_entry_to(i1, cp2, i2, CHECK_false);
if (match) {
return true;
@@ -1329,14 +1320,6 @@
}
} break;
- case JVM_CONSTANT_UnresolvedClassInError:
- {
- Symbol* k = from_cp->unresolved_klass_at(from_i);
- to_cp->unresolved_klass_at_put(to_i, k);
- to_cp->tag_at_put(to_i, JVM_CONSTANT_UnresolvedClassInError);
- } break;
-
-
case JVM_CONSTANT_String:
{
Symbol* s = from_cp->unresolved_string_at(from_i);
@@ -1352,15 +1335,17 @@
} break;
case JVM_CONSTANT_MethodType:
+ case JVM_CONSTANT_MethodTypeInError:
{
- jint k = from_cp->method_type_index_at(from_i);
+ jint k = from_cp->method_type_index_at_error_ok(from_i);
to_cp->method_type_index_at_put(to_i, k);
} break;
case JVM_CONSTANT_MethodHandle:
+ case JVM_CONSTANT_MethodHandleInError:
{
- int k1 = from_cp->method_handle_ref_kind_at(from_i);
- int k2 = from_cp->method_handle_index_at(from_i);
+ int k1 = from_cp->method_handle_ref_kind_at_error_ok(from_i);
+ int k2 = from_cp->method_handle_index_at_error_ok(from_i);
to_cp->method_handle_index_at_put(to_i, k1, k2);
} break;
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -320,7 +320,8 @@
void InstanceKlass::deallocate_methods(ClassLoaderData* loader_data,
Array<Method*>* methods) {
- if (methods != NULL && methods != Universe::the_empty_method_array()) {
+ if (methods != NULL && methods != Universe::the_empty_method_array() &&
+ !methods->is_shared()) {
for (int i = 0; i < methods->length(); i++) {
Method* method = methods->at(i);
if (method == NULL) continue; // maybe null if error processing
@@ -344,13 +345,14 @@
// check that the interfaces don't come from super class
Array<Klass*>* sti = (super_klass == NULL) ? NULL :
InstanceKlass::cast(super_klass)->transitive_interfaces();
- if (ti != sti) {
+ if (ti != sti && ti != NULL && !ti->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, ti);
}
}
// local interfaces can be empty
- if (local_interfaces != Universe::the_empty_klass_array()) {
+ if (local_interfaces != Universe::the_empty_klass_array() &&
+ local_interfaces != NULL && !local_interfaces->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, local_interfaces);
}
}
@@ -380,21 +382,25 @@
deallocate_methods(loader_data, methods());
set_methods(NULL);
- if (method_ordering() != Universe::the_empty_int_array()) {
+ if (method_ordering() != NULL &&
+ method_ordering() != Universe::the_empty_int_array() &&
+ !method_ordering()->is_shared()) {
MetadataFactory::free_array<int>(loader_data, method_ordering());
}
set_method_ordering(NULL);
// default methods can be empty
if (default_methods() != NULL &&
- default_methods() != Universe::the_empty_method_array()) {
+ default_methods() != Universe::the_empty_method_array() &&
+ !default_methods()->is_shared()) {
MetadataFactory::free_array<Method*>(loader_data, default_methods());
}
// Do NOT deallocate the default methods, they are owned by superinterfaces.
set_default_methods(NULL);
// default methods vtable indices can be empty
- if (default_vtable_indices() != NULL) {
+ if (default_vtable_indices() != NULL &&
+ !default_vtable_indices()->is_shared()) {
MetadataFactory::free_array<int>(loader_data, default_vtable_indices());
}
set_default_vtable_indices(NULL);
@@ -403,8 +409,10 @@
// This array is in Klass, but remove it with the InstanceKlass since
// this place would be the only caller and it can share memory with transitive
// interfaces.
- if (secondary_supers() != Universe::the_empty_klass_array() &&
- secondary_supers() != transitive_interfaces()) {
+ if (secondary_supers() != NULL &&
+ secondary_supers() != Universe::the_empty_klass_array() &&
+ secondary_supers() != transitive_interfaces() &&
+ !secondary_supers()->is_shared()) {
MetadataFactory::free_array<Klass*>(loader_data, secondary_supers());
}
set_secondary_supers(NULL);
@@ -413,24 +421,32 @@
set_transitive_interfaces(NULL);
set_local_interfaces(NULL);
- MetadataFactory::free_array<jushort>(loader_data, fields());
+ if (fields() != NULL && !fields()->is_shared()) {
+ MetadataFactory::free_array<jushort>(loader_data, fields());
+ }
set_fields(NULL, 0);
// If a method from a redefined class is using this constant pool, don't
// delete it, yet. The new class's previous version will point to this.
if (constants() != NULL) {
assert (!constants()->on_stack(), "shouldn't be called if anything is onstack");
- MetadataFactory::free_metadata(loader_data, constants());
+ if (!constants()->is_shared()) {
+ MetadataFactory::free_metadata(loader_data, constants());
+ }
set_constants(NULL);
}
- if (inner_classes() != Universe::the_empty_short_array()) {
+ if (inner_classes() != NULL &&
+ inner_classes() != Universe::the_empty_short_array() &&
+ !inner_classes()->is_shared()) {
MetadataFactory::free_array<jushort>(loader_data, inner_classes());
}
set_inner_classes(NULL);
- // We should deallocate the Annotations instance
- MetadataFactory::free_metadata(loader_data, annotations());
+ // We should deallocate the Annotations instance if it's not in shared spaces.
+ if (annotations() != NULL && !annotations()->is_shared()) {
+ MetadataFactory::free_metadata(loader_data, annotations());
+ }
set_annotations(NULL);
}
--- a/hotspot/src/share/vm/oops/method.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/oops/method.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -805,6 +805,7 @@
private:
void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason);
+ public:
MethodCounters* get_method_counters(TRAPS) {
if (_method_counters == NULL) {
build_method_counters(this, CHECK_AND_CLEAR_NULL);
@@ -812,7 +813,6 @@
return _method_counters;
}
- public:
bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); }
void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); }
void clear_not_c1_compilable() { _access_flags.clear_not_c1_compilable(); }
--- a/hotspot/src/share/vm/oops/methodData.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/oops/methodData.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -56,6 +56,11 @@
if (needs_array_len(tag)) {
set_cell_at(ArrayData::array_len_off_set, cell_count - 1); // -1 for header.
}
+ if (tag == call_type_data_tag) {
+ CallTypeData::initialize(this, cell_count);
+ } else if (tag == virtual_call_type_data_tag) {
+ VirtualCallTypeData::initialize(this, cell_count);
+ }
}
void DataLayout::clean_weak_klass_links(BoolObjectClosure* cl) {
@@ -76,7 +81,7 @@
}
#ifndef PRODUCT
-void ProfileData::print_shared(outputStream* st, const char* name) {
+void ProfileData::print_shared(outputStream* st, const char* name) const {
st->print("bci: %d", bci());
st->fill_to(tab_width_one);
st->print("%s", name);
@@ -91,8 +96,8 @@
st->print("flags(%d) ", flags);
}
-void ProfileData::tab(outputStream* st) {
- st->fill_to(tab_width_two);
+void ProfileData::tab(outputStream* st, bool first) const {
+ st->fill_to(first ? tab_width_one : tab_width_two);
}
#endif // !PRODUCT
@@ -104,7 +109,7 @@
#ifndef PRODUCT
-void BitData::print_data_on(outputStream* st) {
+void BitData::print_data_on(outputStream* st) const {
print_shared(st, "BitData");
}
#endif // !PRODUCT
@@ -115,7 +120,7 @@
// A CounterData corresponds to a simple counter.
#ifndef PRODUCT
-void CounterData::print_data_on(outputStream* st) {
+void CounterData::print_data_on(outputStream* st) const {
print_shared(st, "CounterData");
st->print_cr("count(%u)", count());
}
@@ -145,12 +150,207 @@
}
#ifndef PRODUCT
-void JumpData::print_data_on(outputStream* st) {
+void JumpData::print_data_on(outputStream* st) const {
print_shared(st, "JumpData");
st->print_cr("taken(%u) displacement(%d)", taken(), displacement());
}
#endif // !PRODUCT
+int TypeStackSlotEntries::compute_cell_count(Symbol* signature, int max) {
+ ResourceMark rm;
+ SignatureStream ss(signature);
+ int args_count = MIN2(ss.reference_parameter_count(), max);
+ return args_count * per_arg_cell_count;
+}
+
+int TypeEntriesAtCall::compute_cell_count(BytecodeStream* stream) {
+ assert(Bytecodes::is_invoke(stream->code()), "should be invoke");
+ assert(TypeStackSlotEntries::per_arg_count() > ReturnTypeEntry::static_cell_count(), "code to test for arguments/results broken");
+ Bytecode_invoke inv(stream->method(), stream->bci());
+ int args_cell = 0;
+ if (arguments_profiling_enabled()) {
+ args_cell = TypeStackSlotEntries::compute_cell_count(inv.signature(), TypeProfileArgsLimit);
+ }
+ int ret_cell = 0;
+ if (return_profiling_enabled() && (inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY)) {
+ ret_cell = ReturnTypeEntry::static_cell_count();
+ }
+ int header_cell = 0;
+ if (args_cell + ret_cell > 0) {
+ header_cell = header_cell_count();
+ }
+
+ return header_cell + args_cell + ret_cell;
+}
+
+class ArgumentOffsetComputer : public SignatureInfo {
+private:
+ int _max;
+ GrowableArray<int> _offsets;
+
+ void set(int size, BasicType type) { _size += size; }
+ void do_object(int begin, int end) {
+ if (_offsets.length() < _max) {
+ _offsets.push(_size);
+ }
+ SignatureInfo::do_object(begin, end);
+ }
+ void do_array (int begin, int end) {
+ if (_offsets.length() < _max) {
+ _offsets.push(_size);
+ }
+ SignatureInfo::do_array(begin, end);
+ }
+
+public:
+ ArgumentOffsetComputer(Symbol* signature, int max)
+ : SignatureInfo(signature), _max(max), _offsets(Thread::current(), max) {
+ }
+
+ int total() { lazy_iterate_parameters(); return _size; }
+
+ int off_at(int i) const { return _offsets.at(i); }
+};
+
+void TypeStackSlotEntries::post_initialize(Symbol* signature, bool has_receiver) {
+ ResourceMark rm;
+ ArgumentOffsetComputer aos(signature, _number_of_entries);
+ aos.total();
+ for (int i = 0; i < _number_of_entries; i++) {
+ set_stack_slot(i, aos.off_at(i) + (has_receiver ? 1 : 0));
+ set_type(i, type_none());
+ }
+}
+
+void CallTypeData::post_initialize(BytecodeStream* stream, MethodData* mdo) {
+ assert(Bytecodes::is_invoke(stream->code()), "should be invoke");
+ Bytecode_invoke inv(stream->method(), stream->bci());
+
+ SignatureStream ss(inv.signature());
+ if (has_arguments()) {
+#ifdef ASSERT
+ ResourceMark rm;
+ int count = MIN2(ss.reference_parameter_count(), (int)TypeProfileArgsLimit);
+ assert(count > 0, "room for args type but none found?");
+ check_number_of_arguments(count);
+#endif
+ _args.post_initialize(inv.signature(), inv.has_receiver());
+ }
+
+ if (has_return()) {
+ assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+ _ret.post_initialize();
+ }
+}
+
+void VirtualCallTypeData::post_initialize(BytecodeStream* stream, MethodData* mdo) {
+ assert(Bytecodes::is_invoke(stream->code()), "should be invoke");
+ Bytecode_invoke inv(stream->method(), stream->bci());
+
+ if (has_arguments()) {
+#ifdef ASSERT
+ ResourceMark rm;
+ SignatureStream ss(inv.signature());
+ int count = MIN2(ss.reference_parameter_count(), (int)TypeProfileArgsLimit);
+ assert(count > 0, "room for args type but none found?");
+ check_number_of_arguments(count);
+#endif
+ _args.post_initialize(inv.signature(), inv.has_receiver());
+ }
+
+ if (has_return()) {
+ assert(inv.result_type() == T_OBJECT || inv.result_type() == T_ARRAY, "room for a ret type but doesn't return obj?");
+ _ret.post_initialize();
+ }
+}
+
+bool TypeEntries::is_loader_alive(BoolObjectClosure* is_alive_cl, intptr_t p) {
+ return !is_type_none(p) &&
+ !((Klass*)klass_part(p))->is_loader_alive(is_alive_cl);
+}
+
+void TypeStackSlotEntries::clean_weak_klass_links(BoolObjectClosure* is_alive_cl) {
+ for (int i = 0; i < _number_of_entries; i++) {
+ intptr_t p = type(i);
+ if (is_loader_alive(is_alive_cl, p)) {
+ set_type(i, type_none());
+ }
+ }
+}
+
+void ReturnTypeEntry::clean_weak_klass_links(BoolObjectClosure* is_alive_cl) {
+ intptr_t p = type();
+ if (is_loader_alive(is_alive_cl, p)) {
+ set_type(type_none());
+ }
+}
+
+bool TypeEntriesAtCall::return_profiling_enabled() {
+ return MethodData::profile_return();
+}
+
+bool TypeEntriesAtCall::arguments_profiling_enabled() {
+ return MethodData::profile_arguments();
+}
+
+#ifndef PRODUCT
+void TypeEntries::print_klass(outputStream* st, intptr_t k) {
+ if (is_type_none(k)) {
+ st->print("none");
+ } else if (is_type_unknown(k)) {
+ st->print("unknown");
+ } else {
+ valid_klass(k)->print_value_on(st);
+ }
+ if (was_null_seen(k)) {
+ st->print(" (null seen)");
+ }
+}
+
+void TypeStackSlotEntries::print_data_on(outputStream* st) const {
+ for (int i = 0; i < _number_of_entries; i++) {
+ _pd->tab(st);
+ st->print("%d: stack(%u) ", i, stack_slot(i));
+ print_klass(st, type(i));
+ st->cr();
+ }
+}
+
+void ReturnTypeEntry::print_data_on(outputStream* st) const {
+ _pd->tab(st);
+ print_klass(st, type());
+ st->cr();
+}
+
+void CallTypeData::print_data_on(outputStream* st) const {
+ CounterData::print_data_on(st);
+ if (has_arguments()) {
+ tab(st, true);
+ st->print("argument types");
+ _args.print_data_on(st);
+ }
+ if (has_return()) {
+ tab(st, true);
+ st->print("return type");
+ _ret.print_data_on(st);
+ }
+}
+
+void VirtualCallTypeData::print_data_on(outputStream* st) const {
+ VirtualCallData::print_data_on(st);
+ if (has_arguments()) {
+ tab(st, true);
+ st->print("argument types");
+ _args.print_data_on(st);
+ }
+ if (has_return()) {
+ tab(st, true);
+ st->print("return type");
+ _ret.print_data_on(st);
+ }
+}
+#endif
+
// ==================================================================
// ReceiverTypeData
//
@@ -169,7 +369,7 @@
}
#ifndef PRODUCT
-void ReceiverTypeData::print_receiver_data_on(outputStream* st) {
+void ReceiverTypeData::print_receiver_data_on(outputStream* st) const {
uint row;
int entries = 0;
for (row = 0; row < row_limit(); row++) {
@@ -190,11 +390,11 @@
}
}
}
-void ReceiverTypeData::print_data_on(outputStream* st) {
+void ReceiverTypeData::print_data_on(outputStream* st) const {
print_shared(st, "ReceiverTypeData");
print_receiver_data_on(st);
}
-void VirtualCallData::print_data_on(outputStream* st) {
+void VirtualCallData::print_data_on(outputStream* st) const {
print_shared(st, "VirtualCallData");
print_receiver_data_on(st);
}
@@ -246,7 +446,7 @@
#ifndef PRODUCT
-void RetData::print_data_on(outputStream* st) {
+void RetData::print_data_on(outputStream* st) const {
print_shared(st, "RetData");
uint row;
int entries = 0;
@@ -281,7 +481,7 @@
}
#ifndef PRODUCT
-void BranchData::print_data_on(outputStream* st) {
+void BranchData::print_data_on(outputStream* st) const {
print_shared(st, "BranchData");
st->print_cr("taken(%u) displacement(%d)",
taken(), displacement());
@@ -355,7 +555,7 @@
}
#ifndef PRODUCT
-void MultiBranchData::print_data_on(outputStream* st) {
+void MultiBranchData::print_data_on(outputStream* st) const {
print_shared(st, "MultiBranchData");
st->print_cr("default_count(%u) displacement(%d)",
default_count(), default_displacement());
@@ -369,7 +569,7 @@
#endif
#ifndef PRODUCT
-void ArgInfoData::print_data_on(outputStream* st) {
+void ArgInfoData::print_data_on(outputStream* st) const {
print_shared(st, "ArgInfoData");
int nargs = number_of_args();
for (int i = 0; i < nargs; i++) {
@@ -407,7 +607,11 @@
}
case Bytecodes::_invokespecial:
case Bytecodes::_invokestatic:
- return CounterData::static_cell_count();
+ if (MethodData::profile_arguments() || MethodData::profile_return()) {
+ return variable_cell_count;
+ } else {
+ return CounterData::static_cell_count();
+ }
case Bytecodes::_goto:
case Bytecodes::_goto_w:
case Bytecodes::_jsr:
@@ -415,9 +619,17 @@
return JumpData::static_cell_count();
case Bytecodes::_invokevirtual:
case Bytecodes::_invokeinterface:
- return VirtualCallData::static_cell_count();
+ if (MethodData::profile_arguments() || MethodData::profile_return()) {
+ return variable_cell_count;
+ } else {
+ return VirtualCallData::static_cell_count();
+ }
case Bytecodes::_invokedynamic:
- return CounterData::static_cell_count();
+ if (MethodData::profile_arguments() || MethodData::profile_return()) {
+ return variable_cell_count;
+ } else {
+ return CounterData::static_cell_count();
+ }
case Bytecodes::_ret:
return RetData::static_cell_count();
case Bytecodes::_ifeq:
@@ -453,7 +665,36 @@
return 0;
}
if (cell_count == variable_cell_count) {
- cell_count = MultiBranchData::compute_cell_count(stream);
+ switch (stream->code()) {
+ case Bytecodes::_lookupswitch:
+ case Bytecodes::_tableswitch:
+ cell_count = MultiBranchData::compute_cell_count(stream);
+ break;
+ case Bytecodes::_invokespecial:
+ case Bytecodes::_invokestatic:
+ case Bytecodes::_invokedynamic:
+ assert(MethodData::profile_arguments() || MethodData::profile_return(), "should be collecting args profile");
+ if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
+ profile_return_for_invoke(stream->method(), stream->bci())) {
+ cell_count = CallTypeData::compute_cell_count(stream);
+ } else {
+ cell_count = CounterData::static_cell_count();
+ }
+ break;
+ case Bytecodes::_invokevirtual:
+ case Bytecodes::_invokeinterface: {
+ assert(MethodData::profile_arguments() || MethodData::profile_return(), "should be collecting args profile");
+ if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
+ profile_return_for_invoke(stream->method(), stream->bci())) {
+ cell_count = VirtualCallTypeData::compute_cell_count(stream);
+ } else {
+ cell_count = VirtualCallData::static_cell_count();
+ }
+ break;
+ }
+ default:
+ fatal("unexpected bytecode for var length profile data");
+ }
}
// Note: cell_count might be zero, meaning that there is just
// a DataLayout header, with no extra cells.
@@ -499,6 +740,7 @@
// Add a cell to record information about modified arguments.
int arg_size = method->size_of_parameters();
object_size += DataLayout::compute_size_in_bytes(arg_size+1);
+
return object_size;
}
@@ -534,10 +776,21 @@
}
break;
case Bytecodes::_invokespecial:
- case Bytecodes::_invokestatic:
- cell_count = CounterData::static_cell_count();
- tag = DataLayout::counter_data_tag;
+ case Bytecodes::_invokestatic: {
+ int counter_data_cell_count = CounterData::static_cell_count();
+ if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
+ profile_return_for_invoke(stream->method(), stream->bci())) {
+ cell_count = CallTypeData::compute_cell_count(stream);
+ } else {
+ cell_count = counter_data_cell_count;
+ }
+ if (cell_count > counter_data_cell_count) {
+ tag = DataLayout::call_type_data_tag;
+ } else {
+ tag = DataLayout::counter_data_tag;
+ }
break;
+ }
case Bytecodes::_goto:
case Bytecodes::_goto_w:
case Bytecodes::_jsr:
@@ -546,15 +799,37 @@
tag = DataLayout::jump_data_tag;
break;
case Bytecodes::_invokevirtual:
- case Bytecodes::_invokeinterface:
- cell_count = VirtualCallData::static_cell_count();
- tag = DataLayout::virtual_call_data_tag;
+ case Bytecodes::_invokeinterface: {
+ int virtual_call_data_cell_count = VirtualCallData::static_cell_count();
+ if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
+ profile_return_for_invoke(stream->method(), stream->bci())) {
+ cell_count = VirtualCallTypeData::compute_cell_count(stream);
+ } else {
+ cell_count = virtual_call_data_cell_count;
+ }
+ if (cell_count > virtual_call_data_cell_count) {
+ tag = DataLayout::virtual_call_type_data_tag;
+ } else {
+ tag = DataLayout::virtual_call_data_tag;
+ }
break;
- case Bytecodes::_invokedynamic:
+ }
+ case Bytecodes::_invokedynamic: {
// %%% should make a type profile for any invokedynamic that takes a ref argument
- cell_count = CounterData::static_cell_count();
- tag = DataLayout::counter_data_tag;
+ int counter_data_cell_count = CounterData::static_cell_count();
+ if (profile_arguments_for_invoke(stream->method(), stream->bci()) ||
+ profile_return_for_invoke(stream->method(), stream->bci())) {
+ cell_count = CallTypeData::compute_cell_count(stream);
+ } else {
+ cell_count = counter_data_cell_count;
+ }
+ if (cell_count > counter_data_cell_count) {
+ tag = DataLayout::call_type_data_tag;
+ } else {
+ tag = DataLayout::counter_data_tag;
+ }
break;
+ }
case Bytecodes::_ret:
cell_count = RetData::static_cell_count();
tag = DataLayout::ret_data_tag;
@@ -585,6 +860,11 @@
break;
}
assert(tag == DataLayout::multi_branch_data_tag ||
+ ((MethodData::profile_arguments() || MethodData::profile_return()) &&
+ (tag == DataLayout::call_type_data_tag ||
+ tag == DataLayout::counter_data_tag ||
+ tag == DataLayout::virtual_call_type_data_tag ||
+ tag == DataLayout::virtual_call_data_tag)) ||
cell_count == bytecode_cell_count(c), "cell counts must agree");
if (cell_count >= 0) {
assert(tag != DataLayout::no_tag, "bad tag");
@@ -631,6 +911,10 @@
return new MultiBranchData(this);
case DataLayout::arg_info_data_tag:
return new ArgInfoData(this);
+ case DataLayout::call_type_data_tag:
+ return new CallTypeData(this);
+ case DataLayout::virtual_call_type_data_tag:
+ return new VirtualCallTypeData(this);
};
}
@@ -898,3 +1182,70 @@
NEEDS_CLEANUP;
// not yet implemented.
}
+
+bool MethodData::profile_jsr292(methodHandle m, int bci) {
+ if (m->is_compiled_lambda_form()) {
+ return true;
+ }
+
+ Bytecode_invoke inv(m , bci);
+ return inv.is_invokedynamic() || inv.is_invokehandle();
+}
+
+int MethodData::profile_arguments_flag() {
+ return TypeProfileLevel % 10;
+}
+
+bool MethodData::profile_arguments() {
+ return profile_arguments_flag() > no_type_profile && profile_arguments_flag() <= type_profile_all;
+}
+
+bool MethodData::profile_arguments_jsr292_only() {
+ return profile_arguments_flag() == type_profile_jsr292;
+}
+
+bool MethodData::profile_all_arguments() {
+ return profile_arguments_flag() == type_profile_all;
+}
+
+bool MethodData::profile_arguments_for_invoke(methodHandle m, int bci) {
+ if (!profile_arguments()) {
+ return false;
+ }
+
+ if (profile_all_arguments()) {
+ return true;
+ }
+
+ assert(profile_arguments_jsr292_only(), "inconsistent");
+ return profile_jsr292(m, bci);
+}
+
+int MethodData::profile_return_flag() {
+ return TypeProfileLevel / 10;
+}
+
+bool MethodData::profile_return() {
+ return profile_return_flag() > no_type_profile && profile_return_flag() <= type_profile_all;
+}
+
+bool MethodData::profile_return_jsr292_only() {
+ return profile_return_flag() == type_profile_jsr292;
+}
+
+bool MethodData::profile_all_return() {
+ return profile_return_flag() == type_profile_all;
+}
+
+bool MethodData::profile_return_for_invoke(methodHandle m, int bci) {
+ if (!profile_return()) {
+ return false;
+ }
+
+ if (profile_all_return()) {
+ return true;
+ }
+
+ assert(profile_return_jsr292_only(), "inconsistent");
+ return profile_jsr292(m, bci);
+}
--- a/hotspot/src/share/vm/oops/methodData.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/oops/methodData.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -117,7 +117,9 @@
ret_data_tag,
branch_data_tag,
multi_branch_data_tag,
- arg_info_data_tag
+ arg_info_data_tag,
+ call_type_data_tag,
+ virtual_call_type_data_tag
};
enum {
@@ -165,7 +167,7 @@
// occurred, and the MDO shows N occurrences of X, we make the
// simplifying assumption that all N occurrences can be blamed
// on that BCI.
- int trap_state() {
+ int trap_state() const {
return ((_header._struct._flags >> trap_shift) & trap_mask);
}
@@ -175,11 +177,11 @@
_header._struct._flags = (new_state << trap_shift) | old_flags;
}
- u1 flags() {
+ u1 flags() const {
return _header._struct._flags;
}
- u2 bci() {
+ u2 bci() const {
return _header._struct._bci;
}
@@ -198,7 +200,7 @@
void release_set_cell_at(int index, intptr_t value) {
OrderAccess::release_store_ptr(&_cells[index], value);
}
- intptr_t cell_at(int index) {
+ intptr_t cell_at(int index) const {
return _cells[index];
}
@@ -206,7 +208,7 @@
assert(flag_number < flag_limit, "oob");
_header._struct._flags |= (0x1 << flag_number);
}
- bool flag_at(int flag_number) {
+ bool flag_at(int flag_number) const {
assert(flag_number < flag_limit, "oob");
return (_header._struct._flags & (0x1 << flag_number)) != 0;
}
@@ -254,19 +256,23 @@
class CounterData;
class ReceiverTypeData;
class VirtualCallData;
+class VirtualCallTypeData;
class RetData;
+class CallTypeData;
class JumpData;
class BranchData;
class ArrayData;
class MultiBranchData;
class ArgInfoData;
-
// ProfileData
//
// A ProfileData object is created to refer to a section of profiling
// data in a structured way.
class ProfileData : public ResourceObj {
+ friend class TypeEntries;
+ friend class ReturnTypeEntry;
+ friend class TypeStackSlotEntries;
private:
#ifndef PRODUCT
enum {
@@ -280,6 +286,7 @@
protected:
DataLayout* data() { return _data; }
+ const DataLayout* data() const { return _data; }
enum {
cell_size = DataLayout::cell_size
@@ -287,7 +294,7 @@
public:
// How many cells are in this?
- virtual int cell_count() {
+ virtual int cell_count() const {
ShouldNotReachHere();
return -1;
}
@@ -307,7 +314,7 @@
assert(0 <= index && index < cell_count(), "oob");
data()->release_set_cell_at(index, value);
}
- intptr_t intptr_at(int index) {
+ intptr_t intptr_at(int index) const {
assert(0 <= index && index < cell_count(), "oob");
return data()->cell_at(index);
}
@@ -317,7 +324,7 @@
void release_set_uint_at(int index, uint value) {
release_set_intptr_at(index, (intptr_t) value);
}
- uint uint_at(int index) {
+ uint uint_at(int index) const {
return (uint)intptr_at(index);
}
void set_int_at(int index, int value) {
@@ -326,23 +333,23 @@
void release_set_int_at(int index, int value) {
release_set_intptr_at(index, (intptr_t) value);
}
- int int_at(int index) {
+ int int_at(int index) const {
return (int)intptr_at(index);
}
- int int_at_unchecked(int index) {
+ int int_at_unchecked(int index) const {
return (int)data()->cell_at(index);
}
void set_oop_at(int index, oop value) {
set_intptr_at(index, cast_from_oop<intptr_t>(value));
}
- oop oop_at(int index) {
+ oop oop_at(int index) const {
return cast_to_oop(intptr_at(index));
}
void set_flag_at(int flag_number) {
data()->set_flag_at(flag_number);
}
- bool flag_at(int flag_number) {
+ bool flag_at(int flag_number) const {
return data()->flag_at(flag_number);
}
@@ -362,7 +369,7 @@
// Constructor for invalid ProfileData.
ProfileData();
- u2 bci() {
+ u2 bci() const {
return data()->bci();
}
@@ -370,7 +377,7 @@
return (address)_data;
}
- int trap_state() {
+ int trap_state() const {
return data()->trap_state();
}
void set_trap_state(int new_state) {
@@ -378,58 +385,68 @@
}
// Type checking
- virtual bool is_BitData() { return false; }
- virtual bool is_CounterData() { return false; }
- virtual bool is_JumpData() { return false; }
- virtual bool is_ReceiverTypeData(){ return false; }
- virtual bool is_VirtualCallData() { return false; }
- virtual bool is_RetData() { return false; }
- virtual bool is_BranchData() { return false; }
- virtual bool is_ArrayData() { return false; }
- virtual bool is_MultiBranchData() { return false; }
- virtual bool is_ArgInfoData() { return false; }
+ virtual bool is_BitData() const { return false; }
+ virtual bool is_CounterData() const { return false; }
+ virtual bool is_JumpData() const { return false; }
+ virtual bool is_ReceiverTypeData()const { return false; }
+ virtual bool is_VirtualCallData() const { return false; }
+ virtual bool is_RetData() const { return false; }
+ virtual bool is_BranchData() const { return false; }
+ virtual bool is_ArrayData() const { return false; }
+ virtual bool is_MultiBranchData() const { return false; }
+ virtual bool is_ArgInfoData() const { return false; }
+ virtual bool is_CallTypeData() const { return false; }
+ virtual bool is_VirtualCallTypeData()const { return false; }
- BitData* as_BitData() {
+ BitData* as_BitData() const {
assert(is_BitData(), "wrong type");
return is_BitData() ? (BitData*) this : NULL;
}
- CounterData* as_CounterData() {
+ CounterData* as_CounterData() const {
assert(is_CounterData(), "wrong type");
return is_CounterData() ? (CounterData*) this : NULL;
}
- JumpData* as_JumpData() {
+ JumpData* as_JumpData() const {
assert(is_JumpData(), "wrong type");
return is_JumpData() ? (JumpData*) this : NULL;
}
- ReceiverTypeData* as_ReceiverTypeData() {
+ ReceiverTypeData* as_ReceiverTypeData() const {
assert(is_ReceiverTypeData(), "wrong type");
return is_ReceiverTypeData() ? (ReceiverTypeData*)this : NULL;
}
- VirtualCallData* as_VirtualCallData() {
+ VirtualCallData* as_VirtualCallData() const {
assert(is_VirtualCallData(), "wrong type");
return is_VirtualCallData() ? (VirtualCallData*)this : NULL;
}
- RetData* as_RetData() {
+ RetData* as_RetData() const {
assert(is_RetData(), "wrong type");
return is_RetData() ? (RetData*) this : NULL;
}
- BranchData* as_BranchData() {
+ BranchData* as_BranchData() const {
assert(is_BranchData(), "wrong type");
return is_BranchData() ? (BranchData*) this : NULL;
}
- ArrayData* as_ArrayData() {
+ ArrayData* as_ArrayData() const {
assert(is_ArrayData(), "wrong type");
return is_ArrayData() ? (ArrayData*) this : NULL;
}
- MultiBranchData* as_MultiBranchData() {
+ MultiBranchData* as_MultiBranchData() const {
assert(is_MultiBranchData(), "wrong type");
return is_MultiBranchData() ? (MultiBranchData*)this : NULL;
}
- ArgInfoData* as_ArgInfoData() {
+ ArgInfoData* as_ArgInfoData() const {
assert(is_ArgInfoData(), "wrong type");
return is_ArgInfoData() ? (ArgInfoData*)this : NULL;
}
+ CallTypeData* as_CallTypeData() const {
+ assert(is_CallTypeData(), "wrong type");
+ return is_CallTypeData() ? (CallTypeData*)this : NULL;
+ }
+ VirtualCallTypeData* as_VirtualCallTypeData() const {
+ assert(is_VirtualCallTypeData(), "wrong type");
+ return is_VirtualCallTypeData() ? (VirtualCallTypeData*)this : NULL;
+ }
// Subclass specific initialization
@@ -443,15 +460,15 @@
// an oop in a ProfileData to the ci equivalent. Generally speaking,
// most ProfileData don't require any translation, so we provide the null
// translation here, and the required translators are in the ci subclasses.
- virtual void translate_from(ProfileData* data) {}
+ virtual void translate_from(const ProfileData* data) {}
- virtual void print_data_on(outputStream* st) {
+ virtual void print_data_on(outputStream* st) const {
ShouldNotReachHere();
}
#ifndef PRODUCT
- void print_shared(outputStream* st, const char* name);
- void tab(outputStream* st);
+ void print_shared(outputStream* st, const char* name) const;
+ void tab(outputStream* st, bool first = false) const;
#endif
};
@@ -470,13 +487,13 @@
BitData(DataLayout* layout) : ProfileData(layout) {
}
- virtual bool is_BitData() { return true; }
+ virtual bool is_BitData() const { return true; }
static int static_cell_count() {
return bit_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
@@ -498,7 +515,7 @@
}
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -514,18 +531,18 @@
public:
CounterData(DataLayout* layout) : BitData(layout) {}
- virtual bool is_CounterData() { return true; }
+ virtual bool is_CounterData() const { return true; }
static int static_cell_count() {
return counter_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
// Direct accessor
- uint count() {
+ uint count() const {
return uint_at(count_off);
}
@@ -542,7 +559,7 @@
}
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -570,18 +587,18 @@
layout->tag() == DataLayout::branch_data_tag, "wrong type");
}
- virtual bool is_JumpData() { return true; }
+ virtual bool is_JumpData() const { return true; }
static int static_cell_count() {
return jump_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
// Direct accessor
- uint taken() {
+ uint taken() const {
return uint_at(taken_off_set);
}
@@ -598,7 +615,7 @@
return cnt;
}
- int displacement() {
+ int displacement() const {
return int_at(displacement_off_set);
}
@@ -615,7 +632,418 @@
void post_initialize(BytecodeStream* stream, MethodData* mdo);
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+// Entries in a ProfileData object to record types: it can either be
+// none (no profile), unknown (conflicting profile data) or a klass if
+// a single one is seen. Whether a null reference was seen is also
+// recorded. No counter is associated with the type and a single type
+// is tracked (unlike VirtualCallData).
+class TypeEntries {
+
+public:
+
+ // A single cell is used to record information for a type:
+ // - the cell is initialized to 0
+ // - when a type is discovered it is stored in the cell
+ // - bit zero of the cell is used to record whether a null reference
+ // was encountered or not
+ // - bit 1 is set to record a conflict in the type information
+
+ enum {
+ null_seen = 1,
+ type_mask = ~null_seen,
+ type_unknown = 2,
+ status_bits = null_seen | type_unknown,
+ type_klass_mask = ~status_bits
+ };
+
+ // what to initialize a cell to
+ static intptr_t type_none() {
+ return 0;
+ }
+
+ // null seen = bit 0 set?
+ static bool was_null_seen(intptr_t v) {
+ return (v & null_seen) != 0;
+ }
+
+ // conflicting type information = bit 1 set?
+ static bool is_type_unknown(intptr_t v) {
+ return (v & type_unknown) != 0;
+ }
+
+ // not type information yet = all bits cleared, ignoring bit 0?
+ static bool is_type_none(intptr_t v) {
+ return (v & type_mask) == 0;
+ }
+
+ // recorded type: cell without bit 0 and 1
+ static intptr_t klass_part(intptr_t v) {
+ intptr_t r = v & type_klass_mask;
+ assert (r != 0, "invalid");
+ return r;
+ }
+
+ // type recorded
+ static Klass* valid_klass(intptr_t k) {
+ if (!is_type_none(k) &&
+ !is_type_unknown(k)) {
+ return (Klass*)klass_part(k);
+ } else {
+ return NULL;
+ }
+ }
+
+ static intptr_t with_status(intptr_t k, intptr_t in) {
+ return k | (in & status_bits);
+ }
+
+ static intptr_t with_status(Klass* k, intptr_t in) {
+ return with_status((intptr_t)k, in);
+ }
+
+#ifndef PRODUCT
+ static void print_klass(outputStream* st, intptr_t k);
+#endif
+
+ // GC support
+ static bool is_loader_alive(BoolObjectClosure* is_alive_cl, intptr_t p);
+
+protected:
+ // ProfileData object these entries are part of
+ ProfileData* _pd;
+ // offset within the ProfileData object where the entries start
+ const int _base_off;
+
+ TypeEntries(int base_off)
+ : _base_off(base_off), _pd(NULL) {}
+
+ void set_intptr_at(int index, intptr_t value) {
+ _pd->set_intptr_at(index, value);
+ }
+
+ intptr_t intptr_at(int index) const {
+ return _pd->intptr_at(index);
+ }
+
+public:
+ void set_profile_data(ProfileData* pd) {
+ _pd = pd;
+ }
+};
+
+// Type entries used for arguments passed at a call and parameters on
+// method entry. 2 cells per entry: one for the type encoded as in
+// TypeEntries and one initialized with the stack slot where the
+// profiled object is to be found so that the interpreter can locate
+// it quickly.
+class TypeStackSlotEntries : public TypeEntries {
+
+private:
+ enum {
+ stack_slot_entry,
+ type_entry,
+ per_arg_cell_count
+ };
+
+ // offset of cell for stack slot for entry i within ProfileData object
+ int stack_slot_offset(int i) const {
+ return _base_off + stack_slot_local_offset(i);
+ }
+
+protected:
+ const int _number_of_entries;
+
+ // offset of cell for type for entry i within ProfileData object
+ int type_offset(int i) const {
+ return _base_off + type_local_offset(i);
+ }
+
+public:
+
+ TypeStackSlotEntries(int base_off, int nb_entries)
+ : TypeEntries(base_off), _number_of_entries(nb_entries) {}
+
+ static int compute_cell_count(Symbol* signature, int max);
+
+ void post_initialize(Symbol* signature, bool has_receiver);
+
+ // offset of cell for stack slot for entry i within this block of cells for a TypeStackSlotEntries
+ static int stack_slot_local_offset(int i) {
+ return i * per_arg_cell_count + stack_slot_entry;
+ }
+
+ // offset of cell for type for entry i within this block of cells for a TypeStackSlotEntries
+ static int type_local_offset(int i) {
+ return i * per_arg_cell_count + type_entry;
+ }
+
+ // stack slot for entry i
+ uint stack_slot(int i) const {
+ assert(i >= 0 && i < _number_of_entries, "oob");
+ return _pd->uint_at(stack_slot_offset(i));
+ }
+
+ // set stack slot for entry i
+ void set_stack_slot(int i, uint num) {
+ assert(i >= 0 && i < _number_of_entries, "oob");
+ _pd->set_uint_at(stack_slot_offset(i), num);
+ }
+
+ // type for entry i
+ intptr_t type(int i) const {
+ assert(i >= 0 && i < _number_of_entries, "oob");
+ return _pd->intptr_at(type_offset(i));
+ }
+
+ // set type for entry i
+ void set_type(int i, intptr_t k) {
+ assert(i >= 0 && i < _number_of_entries, "oob");
+ _pd->set_intptr_at(type_offset(i), k);
+ }
+
+ static ByteSize per_arg_size() {
+ return in_ByteSize(per_arg_cell_count * DataLayout::cell_size);
+ }
+
+ static int per_arg_count() {
+ return per_arg_cell_count ;
+ }
+
+ // GC support
+ void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+// Type entry used for return from a call. A single cell to record the
+// type.
+class ReturnTypeEntry : public TypeEntries {
+
+private:
+ enum {
+ cell_count = 1
+ };
+
+public:
+ ReturnTypeEntry(int base_off)
+ : TypeEntries(base_off) {}
+
+ void post_initialize() {
+ set_type(type_none());
+ }
+
+ intptr_t type() const {
+ return _pd->intptr_at(_base_off);
+ }
+
+ void set_type(intptr_t k) {
+ _pd->set_intptr_at(_base_off, k);
+ }
+
+ static int static_cell_count() {
+ return cell_count;
+ }
+
+ static ByteSize size() {
+ return in_ByteSize(cell_count * DataLayout::cell_size);
+ }
+
+ ByteSize type_offset() {
+ return DataLayout::cell_offset(_base_off);
+ }
+
+ // GC support
+ void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
+
+#ifndef PRODUCT
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+// Entries to collect type information at a call: contains arguments
+// (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
+// number of cells. Because the number of cells for the return type is
+// smaller than the number of cells for the type of an arguments, the
+// number of cells is used to tell how many arguments are profiled and
+// whether a return value is profiled. See has_arguments() and
+// has_return().
+class TypeEntriesAtCall {
+private:
+ static int stack_slot_local_offset(int i) {
+ return header_cell_count() + TypeStackSlotEntries::stack_slot_local_offset(i);
+ }
+
+ static int argument_type_local_offset(int i) {
+ return header_cell_count() + TypeStackSlotEntries::type_local_offset(i);;
+ }
+
+public:
+
+ static int header_cell_count() {
+ return 1;
+ }
+
+ static int cell_count_local_offset() {
+ return 0;
+ }
+
+ static int compute_cell_count(BytecodeStream* stream);
+
+ static void initialize(DataLayout* dl, int base, int cell_count) {
+ int off = base + cell_count_local_offset();
+ dl->set_cell_at(off, cell_count - base - header_cell_count());
+ }
+
+ static bool arguments_profiling_enabled();
+ static bool return_profiling_enabled();
+
+ // Code generation support
+ static ByteSize cell_count_offset() {
+ return in_ByteSize(cell_count_local_offset() * DataLayout::cell_size);
+ }
+
+ static ByteSize args_data_offset() {
+ return in_ByteSize(header_cell_count() * DataLayout::cell_size);
+ }
+
+ static ByteSize stack_slot_offset(int i) {
+ return in_ByteSize(stack_slot_local_offset(i) * DataLayout::cell_size);
+ }
+
+ static ByteSize argument_type_offset(int i) {
+ return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size);
+ }
+};
+
+// CallTypeData
+//
+// A CallTypeData is used to access profiling information about a non
+// virtual call for which we collect type information about arguments
+// and return value.
+class CallTypeData : public CounterData {
+private:
+ // entries for arguments if any
+ TypeStackSlotEntries _args;
+ // entry for return type if any
+ ReturnTypeEntry _ret;
+
+ int cell_count_global_offset() const {
+ return CounterData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
+ }
+
+ // number of cells not counting the header
+ int cell_count_no_header() const {
+ return uint_at(cell_count_global_offset());
+ }
+
+ void check_number_of_arguments(int total) {
+ assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
+ }
+
+protected:
+ // An entry for a return value takes less space than an entry for an
+ // argument so if the number of cells exceeds the number of cells
+ // needed for an argument, this object contains type information for
+ // at least one argument.
+ bool has_arguments() const {
+ bool res = cell_count_no_header() >= TypeStackSlotEntries::per_arg_count();
+ assert (!res || TypeEntriesAtCall::arguments_profiling_enabled(), "no profiling of arguments");
+ return res;
+ }
+
+public:
+ CallTypeData(DataLayout* layout) :
+ CounterData(layout),
+ _args(CounterData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
+ _ret(cell_count() - ReturnTypeEntry::static_cell_count())
+ {
+ assert(layout->tag() == DataLayout::call_type_data_tag, "wrong type");
+ // Some compilers (VC++) don't want this passed in member initialization list
+ _args.set_profile_data(this);
+ _ret.set_profile_data(this);
+ }
+
+ const TypeStackSlotEntries* args() const {
+ assert(has_arguments(), "no profiling of arguments");
+ return &_args;
+ }
+
+ const ReturnTypeEntry* ret() const {
+ assert(has_return(), "no profiling of return value");
+ return &_ret;
+ }
+
+ virtual bool is_CallTypeData() const { return true; }
+
+ static int static_cell_count() {
+ return -1;
+ }
+
+ static int compute_cell_count(BytecodeStream* stream) {
+ return CounterData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
+ }
+
+ static void initialize(DataLayout* dl, int cell_count) {
+ TypeEntriesAtCall::initialize(dl, CounterData::static_cell_count(), cell_count);
+ }
+
+ virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
+
+ virtual int cell_count() const {
+ return CounterData::static_cell_count() +
+ TypeEntriesAtCall::header_cell_count() +
+ int_at_unchecked(cell_count_global_offset());
+ }
+
+ int number_of_arguments() const {
+ return cell_count_no_header() / TypeStackSlotEntries::per_arg_count();
+ }
+
+ void set_argument_type(int i, Klass* k) {
+ assert(has_arguments(), "no arguments!");
+ intptr_t current = _args.type(i);
+ _args.set_type(i, TypeEntries::with_status(k, current));
+ }
+
+ void set_return_type(Klass* k) {
+ assert(has_return(), "no return!");
+ intptr_t current = _ret.type();
+ _ret.set_type(TypeEntries::with_status(k, current));
+ }
+
+ // An entry for a return value takes less space than an entry for an
+ // argument, so if the remainder of the number of cells divided by
+ // the number of cells for an argument is not null, a return value
+ // is profiled in this object.
+ bool has_return() const {
+ bool res = (cell_count_no_header() % TypeStackSlotEntries::per_arg_count()) != 0;
+ assert (!res || TypeEntriesAtCall::return_profiling_enabled(), "no profiling of return values");
+ return res;
+ }
+
+ // Code generation support
+ static ByteSize args_data_offset() {
+ return cell_offset(CounterData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
+ }
+
+ // GC support
+ virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
+ if (has_arguments()) {
+ _args.clean_weak_klass_links(is_alive_closure);
+ }
+ if (has_return()) {
+ _ret.clean_weak_klass_links(is_alive_closure);
+ }
+ }
+
+#ifndef PRODUCT
+ virtual void print_data_on(outputStream* st) const;
#endif
};
@@ -636,16 +1064,17 @@
public:
ReceiverTypeData(DataLayout* layout) : CounterData(layout) {
assert(layout->tag() == DataLayout::receiver_type_data_tag ||
- layout->tag() == DataLayout::virtual_call_data_tag, "wrong type");
+ layout->tag() == DataLayout::virtual_call_data_tag ||
+ layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
}
- virtual bool is_ReceiverTypeData() { return true; }
+ virtual bool is_ReceiverTypeData() const { return true; }
static int static_cell_count() {
return counter_cell_count + (uint) TypeProfileWidth * receiver_type_row_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
@@ -660,7 +1089,7 @@
return count0_offset + row * receiver_type_row_cell_count;
}
- Klass* receiver(uint row) {
+ Klass* receiver(uint row) const {
assert(row < row_limit(), "oob");
Klass* recv = (Klass*)intptr_at(receiver_cell_index(row));
@@ -673,7 +1102,7 @@
set_intptr_at(receiver_cell_index(row), (uintptr_t)k);
}
- uint receiver_count(uint row) {
+ uint receiver_count(uint row) const {
assert(row < row_limit(), "oob");
return uint_at(receiver_count_cell_index(row));
}
@@ -721,8 +1150,8 @@
virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure);
#ifndef PRODUCT
- void print_receiver_data_on(outputStream* st);
- void print_data_on(outputStream* st);
+ void print_receiver_data_on(outputStream* st) const;
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -733,10 +1162,11 @@
class VirtualCallData : public ReceiverTypeData {
public:
VirtualCallData(DataLayout* layout) : ReceiverTypeData(layout) {
- assert(layout->tag() == DataLayout::virtual_call_data_tag, "wrong type");
+ assert(layout->tag() == DataLayout::virtual_call_data_tag ||
+ layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
}
- virtual bool is_VirtualCallData() { return true; }
+ virtual bool is_VirtualCallData() const { return true; }
static int static_cell_count() {
// At this point we could add more profile state, e.g., for arguments.
@@ -744,7 +1174,7 @@
return ReceiverTypeData::static_cell_count();
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
@@ -754,7 +1184,134 @@
}
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
+#endif
+};
+
+// VirtualCallTypeData
+//
+// A VirtualCallTypeData is used to access profiling information about
+// a virtual call for which we collect type information about
+// arguments and return value.
+class VirtualCallTypeData : public VirtualCallData {
+private:
+ // entries for arguments if any
+ TypeStackSlotEntries _args;
+ // entry for return type if any
+ ReturnTypeEntry _ret;
+
+ int cell_count_global_offset() const {
+ return VirtualCallData::static_cell_count() + TypeEntriesAtCall::cell_count_local_offset();
+ }
+
+ // number of cells not counting the header
+ int cell_count_no_header() const {
+ return uint_at(cell_count_global_offset());
+ }
+
+ void check_number_of_arguments(int total) {
+ assert(number_of_arguments() == total, "should be set in DataLayout::initialize");
+ }
+
+protected:
+ // An entry for a return value takes less space than an entry for an
+ // argument so if the number of cells exceeds the number of cells
+ // needed for an argument, this object contains type information for
+ // at least one argument.
+ bool has_arguments() const {
+ bool res = cell_count_no_header() >= TypeStackSlotEntries::per_arg_count();
+ assert (!res || TypeEntriesAtCall::arguments_profiling_enabled(), "no profiling of arguments");
+ return res;
+ }
+
+public:
+ VirtualCallTypeData(DataLayout* layout) :
+ VirtualCallData(layout),
+ _args(VirtualCallData::static_cell_count()+TypeEntriesAtCall::header_cell_count(), number_of_arguments()),
+ _ret(cell_count() - ReturnTypeEntry::static_cell_count())
+ {
+ assert(layout->tag() == DataLayout::virtual_call_type_data_tag, "wrong type");
+ // Some compilers (VC++) don't want this passed in member initialization list
+ _args.set_profile_data(this);
+ _ret.set_profile_data(this);
+ }
+
+ const TypeStackSlotEntries* args() const {
+ assert(has_arguments(), "no profiling of arguments");
+ return &_args;
+ }
+
+ const ReturnTypeEntry* ret() const {
+ assert(has_return(), "no profiling of return value");
+ return &_ret;
+ }
+
+ virtual bool is_VirtualCallTypeData() const { return true; }
+
+ static int static_cell_count() {
+ return -1;
+ }
+
+ static int compute_cell_count(BytecodeStream* stream) {
+ return VirtualCallData::static_cell_count() + TypeEntriesAtCall::compute_cell_count(stream);
+ }
+
+ static void initialize(DataLayout* dl, int cell_count) {
+ TypeEntriesAtCall::initialize(dl, VirtualCallData::static_cell_count(), cell_count);
+ }
+
+ virtual void post_initialize(BytecodeStream* stream, MethodData* mdo);
+
+ virtual int cell_count() const {
+ return VirtualCallData::static_cell_count() +
+ TypeEntriesAtCall::header_cell_count() +
+ int_at_unchecked(cell_count_global_offset());
+ }
+
+ int number_of_arguments() const {
+ return cell_count_no_header() / TypeStackSlotEntries::per_arg_count();
+ }
+
+ void set_argument_type(int i, Klass* k) {
+ assert(has_arguments(), "no arguments!");
+ intptr_t current = _args.type(i);
+ _args.set_type(i, TypeEntries::with_status(k, current));
+ }
+
+ void set_return_type(Klass* k) {
+ assert(has_return(), "no return!");
+ intptr_t current = _ret.type();
+ _ret.set_type(TypeEntries::with_status(k, current));
+ }
+
+ // An entry for a return value takes less space than an entry for an
+ // argument, so if the remainder of the number of cells divided by
+ // the number of cells for an argument is not null, a return value
+ // is profiled in this object.
+ bool has_return() const {
+ bool res = (cell_count_no_header() % TypeStackSlotEntries::per_arg_count()) != 0;
+ assert (!res || TypeEntriesAtCall::return_profiling_enabled(), "no profiling of return values");
+ return res;
+ }
+
+ // Code generation support
+ static ByteSize args_data_offset() {
+ return cell_offset(VirtualCallData::static_cell_count()) + TypeEntriesAtCall::args_data_offset();
+ }
+
+ // GC support
+ virtual void clean_weak_klass_links(BoolObjectClosure* is_alive_closure) {
+ ReceiverTypeData::clean_weak_klass_links(is_alive_closure);
+ if (has_arguments()) {
+ _args.clean_weak_klass_links(is_alive_closure);
+ }
+ if (has_return()) {
+ _ret.clean_weak_klass_links(is_alive_closure);
+ }
+ }
+
+#ifndef PRODUCT
+ virtual void print_data_on(outputStream* st) const;
#endif
};
@@ -797,7 +1354,7 @@
assert(layout->tag() == DataLayout::ret_data_tag, "wrong type");
}
- virtual bool is_RetData() { return true; }
+ virtual bool is_RetData() const { return true; }
enum {
no_bci = -1 // value of bci when bci1/2 are not in use.
@@ -807,7 +1364,7 @@
return counter_cell_count + (uint) BciProfileWidth * ret_row_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
@@ -825,13 +1382,13 @@
}
// Direct accessors
- int bci(uint row) {
+ int bci(uint row) const {
return int_at(bci_cell_index(row));
}
- uint bci_count(uint row) {
+ uint bci_count(uint row) const {
return uint_at(bci_count_cell_index(row));
}
- int bci_displacement(uint row) {
+ int bci_displacement(uint row) const {
return int_at(bci_displacement_cell_index(row));
}
@@ -853,7 +1410,7 @@
void post_initialize(BytecodeStream* stream, MethodData* mdo);
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -878,18 +1435,18 @@
assert(layout->tag() == DataLayout::branch_data_tag, "wrong type");
}
- virtual bool is_BranchData() { return true; }
+ virtual bool is_BranchData() const { return true; }
static int static_cell_count() {
return branch_cell_count;
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return static_cell_count();
}
// Direct accessor
- uint not_taken() {
+ uint not_taken() const {
return uint_at(not_taken_off_set);
}
@@ -917,7 +1474,7 @@
void post_initialize(BytecodeStream* stream, MethodData* mdo);
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -935,15 +1492,15 @@
array_start_off_set
};
- uint array_uint_at(int index) {
+ uint array_uint_at(int index) const {
int aindex = index + array_start_off_set;
return uint_at(aindex);
}
- int array_int_at(int index) {
+ int array_int_at(int index) const {
int aindex = index + array_start_off_set;
return int_at(aindex);
}
- oop array_oop_at(int index) {
+ oop array_oop_at(int index) const {
int aindex = index + array_start_off_set;
return oop_at(aindex);
}
@@ -960,17 +1517,17 @@
public:
ArrayData(DataLayout* layout) : ProfileData(layout) {}
- virtual bool is_ArrayData() { return true; }
+ virtual bool is_ArrayData() const { return true; }
static int static_cell_count() {
return -1;
}
- int array_len() {
+ int array_len() const {
return int_at_unchecked(array_len_off_set);
}
- virtual int cell_count() {
+ virtual int cell_count() const {
return array_len() + 1;
}
@@ -1017,29 +1574,29 @@
assert(layout->tag() == DataLayout::multi_branch_data_tag, "wrong type");
}
- virtual bool is_MultiBranchData() { return true; }
+ virtual bool is_MultiBranchData() const { return true; }
static int compute_cell_count(BytecodeStream* stream);
- int number_of_cases() {
+ int number_of_cases() const {
int alen = array_len() - 2; // get rid of default case here.
assert(alen % per_case_cell_count == 0, "must be even");
return (alen / per_case_cell_count);
}
- uint default_count() {
+ uint default_count() const {
return array_uint_at(default_count_off_set);
}
- int default_displacement() {
+ int default_displacement() const {
return array_int_at(default_disaplacement_off_set);
}
- uint count_at(int index) {
+ uint count_at(int index) const {
return array_uint_at(case_array_start +
index * per_case_cell_count +
relative_count_off_set);
}
- int displacement_at(int index) {
+ int displacement_at(int index) const {
return array_int_at(case_array_start +
index * per_case_cell_count +
relative_displacement_off_set);
@@ -1074,7 +1631,7 @@
void post_initialize(BytecodeStream* stream, MethodData* mdo);
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -1085,14 +1642,14 @@
assert(layout->tag() == DataLayout::arg_info_data_tag, "wrong type");
}
- virtual bool is_ArgInfoData() { return true; }
+ virtual bool is_ArgInfoData() const { return true; }
- int number_of_args() {
+ int number_of_args() const {
return array_len();
}
- uint arg_modified(int arg) {
+ uint arg_modified(int arg) const {
return array_uint_at(arg);
}
@@ -1101,7 +1658,7 @@
}
#ifndef PRODUCT
- void print_data_on(outputStream* st);
+ void print_data_on(outputStream* st) const;
#endif
};
@@ -1271,6 +1828,21 @@
// return the argument info cell
ArgInfoData *arg_info();
+ enum {
+ no_type_profile = 0,
+ type_profile_jsr292 = 1,
+ type_profile_all = 2
+ };
+
+ static bool profile_jsr292(methodHandle m, int bci);
+ static int profile_arguments_flag();
+ static bool profile_arguments_jsr292_only();
+ static bool profile_all_arguments();
+ static bool profile_arguments_for_invoke(methodHandle m, int bci);
+ static int profile_return_flag();
+ static bool profile_all_return();
+ static bool profile_return_for_invoke(methodHandle m, int bci);
+
public:
static int header_size() {
return sizeof(MethodData)/wordSize;
@@ -1510,6 +2082,10 @@
// verification
void verify_on(outputStream* st);
void verify_data_on(outputStream* st);
+
+ static bool profile_arguments();
+ static bool profile_return();
+ static bool profile_return_jsr292_only();
};
#endif // SHARE_VM_OOPS_METHODDATAOOP_HPP
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -197,6 +197,7 @@
// negative filter: should callee NOT be inlined?
bool InlineTree::should_not_inline(ciMethod *callee_method,
ciMethod* caller_method,
+ JVMState* jvms,
WarmCallInfo* wci_result) {
const char* fail_msg = NULL;
@@ -226,7 +227,7 @@
// don't inline exception code unless the top method belongs to an
// exception class
if (callee_method->holder()->is_subclass_of(C->env()->Throwable_klass())) {
- ciMethod* top_method = caller_jvms() ? caller_jvms()->of_depth(1)->method() : method();
+ ciMethod* top_method = jvms->caller() != NULL ? jvms->caller()->of_depth(1)->method() : method();
if (!top_method->holder()->is_subclass_of(C->env()->Throwable_klass())) {
wci_result->set_profit(wci_result->profit() * 0.1);
}
@@ -328,7 +329,7 @@
// return true if ok
// Relocated from "InliningClosure::try_to_inline"
bool InlineTree::try_to_inline(ciMethod* callee_method, ciMethod* caller_method,
- int caller_bci, ciCallProfile& profile,
+ int caller_bci, JVMState* jvms, ciCallProfile& profile,
WarmCallInfo* wci_result, bool& should_delay) {
// Old algorithm had funny accumulating BC-size counters
@@ -346,7 +347,7 @@
wci_result)) {
return false;
}
- if (should_not_inline(callee_method, caller_method, wci_result)) {
+ if (should_not_inline(callee_method, caller_method, jvms, wci_result)) {
return false;
}
@@ -397,24 +398,35 @@
}
// detect direct and indirect recursive inlining
- if (!callee_method->is_compiled_lambda_form()) {
+ {
// count the current method and the callee
- int inline_level = (method() == callee_method) ? 1 : 0;
- if (inline_level > MaxRecursiveInlineLevel) {
- set_msg("recursively inlining too deep");
- return false;
+ const bool is_compiled_lambda_form = callee_method->is_compiled_lambda_form();
+ int inline_level = 0;
+ if (!is_compiled_lambda_form) {
+ if (method() == callee_method) {
+ inline_level++;
+ }
}
// count callers of current method and callee
- JVMState* jvms = caller_jvms();
- while (jvms != NULL && jvms->has_method()) {
- if (jvms->method() == callee_method) {
- inline_level++;
- if (inline_level > MaxRecursiveInlineLevel) {
- set_msg("recursively inlining too deep");
- return false;
+ Node* callee_argument0 = is_compiled_lambda_form ? jvms->map()->argument(jvms, 0)->uncast() : NULL;
+ for (JVMState* j = jvms->caller(); j != NULL && j->has_method(); j = j->caller()) {
+ if (j->method() == callee_method) {
+ if (is_compiled_lambda_form) {
+ // Since compiled lambda forms are heavily reused we allow recursive inlining. If it is truly
+ // a recursion (using the same "receiver") we limit inlining otherwise we can easily blow the
+ // compiler stack.
+ Node* caller_argument0 = j->map()->argument(j, 0)->uncast();
+ if (caller_argument0 == callee_argument0) {
+ inline_level++;
+ }
+ } else {
+ inline_level++;
}
}
- jvms = jvms->caller();
+ }
+ if (inline_level > MaxRecursiveInlineLevel) {
+ set_msg("recursive inlining is too deep");
+ return false;
}
}
@@ -536,7 +548,7 @@
// Check if inlining policy says no.
WarmCallInfo wci = *(initial_wci);
bool success = try_to_inline(callee_method, caller_method, caller_bci,
- profile, &wci, should_delay);
+ jvms, profile, &wci, should_delay);
#ifndef PRODUCT
if (UseOldInlining && InlineWarmCalls
--- a/hotspot/src/share/vm/opto/c2compiler.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -44,9 +44,6 @@
# include "adfiles/ad_ppc.hpp"
#endif
-
-volatile int C2Compiler::_runtimes = uninitialized;
-
// register information defined by ADLC
extern const char register_save_policy[];
extern const int register_save_type[];
@@ -57,7 +54,7 @@
const char* C2Compiler::retry_no_escape_analysis() {
return "retry without escape analysis";
}
-void C2Compiler::initialize_runtime() {
+bool C2Compiler::init_c2_runtime() {
// Check assumptions used while running ADLC
Compile::adlc_verification();
@@ -90,41 +87,31 @@
CompilerThread* thread = CompilerThread::current();
- HandleMark handle_mark(thread);
-
- OptoRuntime::generate(thread->env());
-
+ HandleMark handle_mark(thread);
+ return OptoRuntime::generate(thread->env());
}
void C2Compiler::initialize() {
-
- // This method can only be called once per C2Compiler object
// The first compiler thread that gets here will initialize the
- // small amount of global state (and runtime stubs) that c2 needs.
+ // small amount of global state (and runtime stubs) that C2 needs.
// There is a race possible once at startup and then we're fine
// Note that this is being called from a compiler thread not the
// main startup thread.
-
- if (_runtimes != initialized) {
- initialize_runtimes( initialize_runtime, &_runtimes);
+ if (should_perform_init()) {
+ bool successful = C2Compiler::init_c2_runtime();
+ int new_state = (successful) ? initialized : failed;
+ set_state(new_state);
}
-
- // Mark this compiler object as ready to roll
- mark_initialized();
}
-void C2Compiler::compile_method(ciEnv* env,
- ciMethod* target,
- int entry_bci) {
- if (!is_initialized()) {
- initialize();
- }
+void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
+ assert(is_initialized(), "Compiler thread must be initialized");
+
bool subsume_loads = SubsumeLoads;
- bool do_escape_analysis = DoEscapeAnalysis &&
- !env->jvmti_can_access_local_variables();
+ bool do_escape_analysis = DoEscapeAnalysis && !env->jvmti_can_access_local_variables();
bool eliminate_boxing = EliminateAutoBox;
while (!env->failing()) {
// Attempt to compile while subsuming loads into machine instructions.
--- a/hotspot/src/share/vm/opto/c2compiler.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/c2compiler.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -28,24 +28,17 @@
#include "compiler/abstractCompiler.hpp"
class C2Compiler : public AbstractCompiler {
-private:
-
- static void initialize_runtime();
+ private:
+ static bool init_c2_runtime();
public:
// Name
const char *name() { return "C2"; }
- static volatile int _runtimes;
-
#ifdef TIERED
virtual bool is_c2() { return true; };
#endif // TIERED
- // Customization
- bool needs_adapters () { return true; }
- bool needs_stubs () { return true; }
-
void initialize();
// Compilation entry point for methods
--- a/hotspot/src/share/vm/opto/chaitin.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/chaitin.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -52,6 +52,7 @@
class LRG : public ResourceObj {
friend class VMStructs;
public:
+ static const uint AllStack_size = 0xFFFFF; // This mask size is used to tell that the mask of this LRG supports stack positions
enum { SPILL_REG=29999 }; // Register number of a spilled LRG
double _cost; // 2 for loads/1 for stores times block freq
@@ -80,14 +81,21 @@
private:
uint _eff_degree; // Effective degree: Sum of neighbors _num_regs
public:
- int degree() const { assert( _degree_valid, "" ); return _eff_degree; }
+ int degree() const { assert( _degree_valid , "" ); return _eff_degree; }
// Degree starts not valid and any change to the IFG neighbor
// set makes it not valid.
- void set_degree( uint degree ) { _eff_degree = degree; debug_only(_degree_valid = 1;) }
+ void set_degree( uint degree ) {
+ _eff_degree = degree;
+ debug_only(_degree_valid = 1;)
+ assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than AllStack_size - _num_regs if the mask supports stack registers");
+ }
// Made a change that hammered degree
void invalid_degree() { debug_only(_degree_valid=0;) }
// Incrementally modify degree. If it was correct, it should remain correct
- void inc_degree( uint mod ) { _eff_degree += mod; }
+ void inc_degree( uint mod ) {
+ _eff_degree += mod;
+ assert(!_mask.is_AllStack() || (_mask.is_AllStack() && lo_degree()), "_eff_degree can't be bigger than AllStack_size - _num_regs if the mask supports stack registers");
+ }
// Compute the degree between 2 live ranges
int compute_degree( LRG &l ) const;
@@ -95,9 +103,9 @@
RegMask _mask; // Allowed registers for this LRG
uint _mask_size; // cache of _mask.Size();
public:
- int compute_mask_size() const { return _mask.is_AllStack() ? 65535 : _mask.Size(); }
+ int compute_mask_size() const { return _mask.is_AllStack() ? AllStack_size : _mask.Size(); }
void set_mask_size( int size ) {
- assert((size == 65535) || (size == (int)_mask.Size()), "");
+ assert((size == (int)AllStack_size) || (size == (int)_mask.Size()), "");
_mask_size = size;
#ifdef ASSERT
_msize_valid=1;
--- a/hotspot/src/share/vm/opto/compile.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/compile.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -47,6 +47,7 @@
#include "opto/machnode.hpp"
#include "opto/macro.hpp"
#include "opto/matcher.hpp"
+#include "opto/mathexactnode.hpp"
#include "opto/memnode.hpp"
#include "opto/mulnode.hpp"
#include "opto/node.hpp"
@@ -2986,6 +2987,32 @@
n->set_req(MemBarNode::Precedent, top());
}
break;
+ // Must set a control edge on all nodes that produce a FlagsProj
+ // so they can't escape the block that consumes the flags.
+ // Must also set the non throwing branch as the control
+ // for all nodes that depends on the result. Unless the node
+ // already have a control that isn't the control of the
+ // flag producer
+ case Op_FlagsProj:
+ {
+ MathExactNode* math = (MathExactNode*) n->in(0);
+ Node* ctrl = math->control_node();
+ Node* non_throwing = math->non_throwing_branch();
+ math->set_req(0, ctrl);
+
+ Node* result = math->result_node();
+ if (result != NULL) {
+ for (DUIterator_Fast jmax, j = result->fast_outs(jmax); j < jmax; j++) {
+ Node* out = result->fast_out(j);
+ if (out->in(0) == NULL) {
+ out->set_req(0, non_throwing);
+ } else if (out->in(0) == ctrl) {
+ out->set_req(0, non_throwing);
+ }
+ }
+ }
+ }
+ break;
default:
assert( !n->is_Call(), "" );
assert( !n->is_Mem(), "" );
--- a/hotspot/src/share/vm/opto/escape.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/escape.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -780,6 +780,7 @@
}
} else { // Allocate instance
if (cik->is_subclass_of(_compile->env()->Thread_klass()) ||
+ cik->is_subclass_of(_compile->env()->Reference_klass()) ||
!cik->is_instance_klass() || // StressReflectiveCode
cik->as_instance_klass()->has_finalizer()) {
es = PointsToNode::GlobalEscape;
--- a/hotspot/src/share/vm/opto/graphKit.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/graphKit.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2122,7 +2122,7 @@
// Null check oop. Set null-path control into Region in slot 3.
// Make a cast-not-nullness use the other not-null control. Return cast.
Node* GraphKit::null_check_oop(Node* value, Node* *null_control,
- bool never_see_null) {
+ bool never_see_null, bool safe_for_replace) {
// Initial NULL check taken path
(*null_control) = top();
Node* cast = null_check_common(value, T_OBJECT, false, null_control);
@@ -2140,6 +2140,9 @@
Deoptimization::Action_make_not_entrant);
(*null_control) = top(); // NULL path is dead
}
+ if ((*null_control) == top() && safe_for_replace) {
+ replace_in_map(value, cast);
+ }
// Cast away null-ness on the result
return cast;
@@ -2634,15 +2637,17 @@
C->set_has_split_ifs(true); // Has chance for split-if optimization
ciProfileData* data = NULL;
+ bool safe_for_replace = false;
if (java_bc() == Bytecodes::_instanceof) { // Only for the bytecode
data = method()->method_data()->bci_to_data(bci());
+ safe_for_replace = true;
}
bool never_see_null = (ProfileDynamicTypes // aggressive use of profile
&& seems_never_null(obj, data));
// Null check; get casted pointer; set region slot 3
Node* null_ctl = top();
- Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null);
+ Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null, safe_for_replace);
// If not_null_obj is dead, only null-path is taken
if (stopped()) { // Doing instance-of on a NULL?
@@ -2723,11 +2728,13 @@
}
ciProfileData* data = NULL;
+ bool safe_for_replace = false;
if (failure_control == NULL) { // use MDO in regular case only
assert(java_bc() == Bytecodes::_aastore ||
java_bc() == Bytecodes::_checkcast,
"interpreter profiles type checks only for these BCs");
data = method()->method_data()->bci_to_data(bci());
+ safe_for_replace = true;
}
// Make the merge point
@@ -2742,7 +2749,7 @@
// Null check; get casted pointer; set region slot 3
Node* null_ctl = top();
- Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null);
+ Node* not_null_obj = null_check_oop(obj, &null_ctl, never_see_null, safe_for_replace);
// If not_null_obj is dead, only null-path is taken
if (stopped()) { // Doing instance-of on a NULL?
@@ -3608,7 +3615,7 @@
Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);
// if (!marking)
- __ if_then(marking, BoolTest::ne, zero); {
+ __ if_then(marking, BoolTest::ne, zero, unlikely); {
BasicType index_bt = TypeX_X->basic_type();
assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 PtrQueue::_index with wrong size.");
Node* index = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);
--- a/hotspot/src/share/vm/opto/graphKit.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/graphKit.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -378,8 +378,10 @@
// Return a cast-not-null node which depends on the not-null control.
// If never_see_null, use an uncommon trap (*null_control sees a top).
// The cast is not valid along the null path; keep a copy of the original.
+ // If safe_for_replace, then we can replace the value with the cast
+ // in the parsing map (the cast is guaranteed to dominate the map)
Node* null_check_oop(Node* value, Node* *null_control,
- bool never_see_null = false);
+ bool never_see_null = false, bool safe_for_replace = false);
// Check the null_seen bit.
bool seems_never_null(Node* obj, ciProfileData* data);
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -616,7 +616,11 @@
buffer[0] = 0;
_chaitin->dump_register(node, buffer);
print_prop("reg", buffer);
- print_prop("lrg", _chaitin->_lrg_map.live_range_id(node));
+ uint lrg_id = 0;
+ if (node->_idx < _chaitin->_lrg_map.size()) {
+ lrg_id = _chaitin->_lrg_map.live_range_id(node);
+ }
+ print_prop("lrg", lrg_id);
}
node->_in_dump_cnt--;
--- a/hotspot/src/share/vm/opto/ifg.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/ifg.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -677,7 +677,7 @@
} else { // Common case: size 1 bound removal
if( lrg.mask().Member(r_reg) ) {
lrg.Remove(r_reg);
- lrg.set_mask_size(lrg.mask().is_AllStack() ? 65535:old_size-1);
+ lrg.set_mask_size(lrg.mask().is_AllStack() ? LRG::AllStack_size : old_size - 1);
}
}
// If 'l' goes completely dry, it must spill.
--- a/hotspot/src/share/vm/opto/ifnode.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/ifnode.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -689,6 +689,7 @@
ctrl->in(0)->in(1)->is_Bool() &&
ctrl->in(0)->in(1)->in(1)->Opcode() == Op_CmpI &&
ctrl->in(0)->in(1)->in(1)->in(2)->is_Con() &&
+ ctrl->in(0)->in(1)->in(1)->in(2) != phase->C->top() &&
ctrl->in(0)->in(1)->in(1)->in(1) == n) {
IfNode* dom_iff = ctrl->in(0)->as_If();
Node* otherproj = dom_iff->proj_out(!ctrl->as_Proj()->_con);
--- a/hotspot/src/share/vm/opto/mathexactnode.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/mathexactnode.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -25,9 +25,10 @@
#include "precompiled.hpp"
#include "memory/allocation.inline.hpp"
#include "opto/addnode.hpp"
+#include "opto/cfgnode.hpp"
#include "opto/machnode.hpp"
+#include "opto/matcher.hpp"
#include "opto/mathexactnode.hpp"
-#include "opto/matcher.hpp"
#include "opto/subnode.hpp"
MathExactNode::MathExactNode(Node* ctrl, Node* n1, Node* n2) : MultiNode(3) {
@@ -36,6 +37,33 @@
init_req(2, n2);
}
+BoolNode* MathExactNode::bool_node() const {
+ Node* flags = flags_node();
+ BoolNode* boolnode = flags->unique_out()->as_Bool();
+ assert(boolnode != NULL, "must have BoolNode");
+ return boolnode;
+}
+
+IfNode* MathExactNode::if_node() const {
+ BoolNode* boolnode = bool_node();
+ IfNode* ifnode = boolnode->unique_out()->as_If();
+ assert(ifnode != NULL, "must have IfNode");
+ return ifnode;
+}
+
+Node* MathExactNode::control_node() const {
+ IfNode* ifnode = if_node();
+ return ifnode->in(0);
+}
+
+Node* MathExactNode::non_throwing_branch() const {
+ IfNode* ifnode = if_node();
+ if (bool_node()->_test._test == BoolTest::overflow) {
+ return ifnode->proj_out(0);
+ }
+ return ifnode->proj_out(1);
+}
+
Node* AddExactINode::match(const ProjNode* proj, const Matcher* m) {
uint ideal_reg = proj->ideal_reg();
RegMask rm;
@@ -62,15 +90,15 @@
}
if (flags != NULL) {
- BoolNode* bolnode = (BoolNode *) flags->unique_out();
- switch (bolnode->_test._test) {
+ BoolNode* boolnode = bool_node();
+ switch (boolnode->_test._test) {
case BoolTest::overflow:
// if the check is for overflow - never taken
- igvn->replace_node(bolnode, phase->intcon(0));
+ igvn->replace_node(boolnode, phase->intcon(0));
break;
case BoolTest::no_overflow:
// if the check is for no overflow - always taken
- igvn->replace_node(bolnode, phase->intcon(1));
+ igvn->replace_node(boolnode, phase->intcon(1));
break;
default:
fatal("Unexpected value of BoolTest");
--- a/hotspot/src/share/vm/opto/mathexactnode.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/mathexactnode.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -27,8 +27,11 @@
#include "opto/multnode.hpp"
#include "opto/node.hpp"
+#include "opto/subnode.hpp"
#include "opto/type.hpp"
+class BoolNode;
+class IfNode;
class Node;
class PhaseGVN;
@@ -49,9 +52,13 @@
virtual bool is_CFG() const { return false; }
virtual uint ideal_reg() const { return NotAMachineReg; }
- ProjNode* result_node() { return proj_out(result_proj_node); }
- ProjNode* flags_node() { return proj_out(flags_proj_node); }
+ ProjNode* result_node() const { return proj_out(result_proj_node); }
+ ProjNode* flags_node() const { return proj_out(flags_proj_node); }
+ Node* control_node() const;
+ Node* non_throwing_branch() const;
protected:
+ IfNode* if_node() const;
+ BoolNode* bool_node() const;
Node* no_overflow(PhaseGVN *phase, Node* new_result);
};
--- a/hotspot/src/share/vm/opto/parse.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/parse.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -73,6 +73,7 @@
bool try_to_inline(ciMethod* callee_method,
ciMethod* caller_method,
int caller_bci,
+ JVMState* jvms,
ciCallProfile& profile,
WarmCallInfo* wci_result,
bool& should_delay);
@@ -83,6 +84,7 @@
WarmCallInfo* wci_result);
bool should_not_inline(ciMethod* callee_method,
ciMethod* caller_method,
+ JVMState* jvms,
WarmCallInfo* wci_result);
void print_inlining(ciMethod* callee_method, int caller_bci,
bool success) const;
--- a/hotspot/src/share/vm/opto/parse2.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/parse2.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -268,7 +268,7 @@
return adjoinRange(value, value, dest, table_index);
}
- void print(ciEnv* env) {
+ void print() {
if (is_singleton())
tty->print(" {%d}=>%d", lo(), dest());
else if (lo() == min_jint)
@@ -471,8 +471,8 @@
// These are the switch destinations hanging off the jumpnode
int i = 0;
for (SwitchRange* r = lo; r <= hi; r++) {
- for (int j = r->lo(); j <= r->hi(); j++, i++) {
- Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), j - lowval));
+ for (int64 j = r->lo(); j <= r->hi(); j++, i++) {
+ Node* input = _gvn.transform(new (C) JumpProjNode(jtn, i, r->dest(), (int)(j - lowval)));
{
PreserveJVMState pjvms(this);
set_control(input);
@@ -632,7 +632,7 @@
}
tty->print(" ");
for( r = lo; r <= hi; r++ ) {
- r->print(env());
+ r->print();
}
tty->print_cr("");
}
--- a/hotspot/src/share/vm/opto/parseHelper.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/parseHelper.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -343,10 +343,14 @@
// Get the Method* node.
ciMethod* m = method();
- address counters_adr = m->ensure_method_counters();
+ MethodCounters* counters_adr = m->ensure_method_counters();
+ if (counters_adr == NULL) {
+ C->record_failure("method counters allocation failed");
+ return;
+ }
Node* ctrl = control();
- const TypePtr* adr_type = TypeRawPtr::make(counters_adr);
+ const TypePtr* adr_type = TypeRawPtr::make((address) counters_adr);
Node *counters_node = makecon(adr_type);
Node* adr_iic_node = basic_plus_adr(counters_node, counters_node,
MethodCounters::interpreter_invocation_counter_offset_in_bytes());
--- a/hotspot/src/share/vm/opto/reg_split.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/reg_split.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -375,6 +375,7 @@
}
if (lidx < _lrg_map.max_lrg_id() && lrgs(lidx).reg() >= LRG::SPILL_REG) {
+ assert(Reachblock != NULL, "Reachblock must be non-NULL");
Node *rdef = Reachblock[lrg2reach[lidx]];
if (rdef) {
spill->set_req(i, rdef);
@@ -1336,7 +1337,8 @@
_lrg_map.find(pred->get_node(insert - 1)) >= lrgs_before_phi_split) {
insert--;
}
- def = split_Rematerialize(def, pred, insert, maxlrg, splits, slidx, lrg2reach, Reachblock, false);
+ // since the def cannot contain any live range input, we can pass in NULL as Reachlock parameter
+ def = split_Rematerialize(def, pred, insert, maxlrg, splits, slidx, lrg2reach, NULL, false);
if (!def) {
return 0; // Bail out
}
--- a/hotspot/src/share/vm/opto/runtime.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/runtime.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -138,9 +138,10 @@
#define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
- var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc)
+ var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \
+ if (var == NULL) { return false; }
-void OptoRuntime::generate(ciEnv* env) {
+bool OptoRuntime::generate(ciEnv* env) {
generate_exception_blob();
@@ -158,7 +159,7 @@
gen(env, _multianewarrayN_Java , multianewarrayN_Type , multianewarrayN_C , 0 , true , false, false);
gen(env, _g1_wb_pre_Java , g1_wb_pre_Type , SharedRuntime::g1_wb_pre , 0 , false, false, false);
gen(env, _g1_wb_post_Java , g1_wb_post_Type , SharedRuntime::g1_wb_post , 0 , false, false, false);
- gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C , 0 , false, false, false);
+ gen(env, _complete_monitor_locking_Java , complete_monitor_enter_Type , SharedRuntime::complete_monitor_locking_C, 0, false, false, false);
gen(env, _rethrow_Java , rethrow_Type , rethrow_C , 2 , true , false, true );
gen(env, _slow_arraycopy_Java , slow_arraycopy_Type , SharedRuntime::slow_arraycopy_C , 0 , false, false, false);
@@ -168,7 +169,7 @@
gen(env, _zap_dead_Java_locals_Java , zap_dead_locals_Type , zap_dead_Java_locals_C , 0 , false, true , false );
gen(env, _zap_dead_native_locals_Java , zap_dead_locals_Type , zap_dead_native_locals_C , 0 , false, true , false );
# endif
-
+ return true;
}
#undef gen
@@ -976,30 +977,36 @@
address handler_address = NULL;
Handle exception(thread, thread->exception_oop());
+ address pc = thread->exception_pc();
+
+ // Clear out the exception oop and pc since looking up an
+ // exception handler can cause class loading, which might throw an
+ // exception and those fields are expected to be clear during
+ // normal bytecode execution.
+ thread->clear_exception_oop_and_pc();
if (TraceExceptions) {
- trace_exception(exception(), thread->exception_pc(), "");
+ trace_exception(exception(), pc, "");
}
+
// for AbortVMOnException flag
NOT_PRODUCT(Exceptions::debug_check_abort(exception));
- #ifdef ASSERT
- if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
- // should throw an exception here
- ShouldNotReachHere();
- }
- #endif
-
+#ifdef ASSERT
+ if (!(exception->is_a(SystemDictionary::Throwable_klass()))) {
+ // should throw an exception here
+ ShouldNotReachHere();
+ }
+#endif
// new exception handling: this method is entered only from adapters
// exceptions from compiled java methods are handled in compiled code
// using rethrow node
- address pc = thread->exception_pc();
nm = CodeCache::find_nmethod(pc);
assert(nm != NULL, "No NMethod found");
if (nm->is_native_method()) {
- fatal("Native mathod should not have path to exception handling");
+ fatal("Native method should not have path to exception handling");
} else {
// we are switching to old paradigm: search for exception handler in caller_frame
// instead in exception handler of caller_frame.sender()
@@ -1346,7 +1353,8 @@
tty->print(" in ");
CodeBlob* blob = CodeCache::find_blob(exception_pc);
if (blob->is_nmethod()) {
- ((nmethod*)blob)->method()->print_value();
+ nmethod* nm = blob->as_nmethod_or_null();
+ nm->method()->print_value();
} else if (blob->is_runtime_stub()) {
tty->print("<runtime-stub>");
} else {
--- a/hotspot/src/share/vm/opto/runtime.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/runtime.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -203,8 +203,10 @@
static bool is_callee_saved_register(MachRegisterNumbers reg);
- // One time only generate runtime code stubs
- static void generate(ciEnv* env);
+ // One time only generate runtime code stubs. Returns true
+ // when runtime stubs have been generated successfully and
+ // false otherwise.
+ static bool generate(ciEnv* env);
// Returns the name of a stub
static const char* stub_name(address entry);
--- a/hotspot/src/share/vm/opto/stringopts.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/opto/stringopts.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,10 +50,11 @@
Node* _arguments; // The list of arguments to be concatenated
GrowableArray<int> _mode; // into a String along with a mode flag
// indicating how to treat the value.
-
+ Node_List _constructors; // List of constructors (many in case of stacked concat)
Node_List _control; // List of control nodes that will be deleted
Node_List _uncommon_traps; // Uncommon traps that needs to be rewritten
// to restart at the initial JVMState.
+
public:
// Mode for converting arguments to Strings
enum {
@@ -73,6 +74,7 @@
_arguments->del_req(0);
}
+ bool validate_mem_flow();
bool validate_control_flow();
void merge_add() {
@@ -189,6 +191,10 @@
assert(!_control.contains(ctrl), "only push once");
_control.push(ctrl);
}
+ void add_constructor(Node* init) {
+ assert(!_constructors.contains(init), "only push once");
+ _constructors.push(init);
+ }
CallStaticJavaNode* end() { return _end; }
AllocateNode* begin() { return _begin; }
Node* string_alloc() { return _string_alloc; }
@@ -301,6 +307,12 @@
}
}
result->set_allocation(other->_begin);
+ for (uint i = 0; i < _constructors.size(); i++) {
+ result->add_constructor(_constructors.at(i));
+ }
+ for (uint i = 0; i < other->_constructors.size(); i++) {
+ result->add_constructor(other->_constructors.at(i));
+ }
result->_multiple = true;
return result;
}
@@ -510,7 +522,8 @@
sc->add_control(constructor);
sc->add_control(alloc);
sc->set_allocation(alloc);
- if (sc->validate_control_flow()) {
+ sc->add_constructor(constructor);
+ if (sc->validate_control_flow() && sc->validate_mem_flow()) {
return sc;
} else {
return NULL;
@@ -620,7 +633,7 @@
#endif
StringConcat* merged = sc->merge(other, arg);
- if (merged->validate_control_flow()) {
+ if (merged->validate_control_flow() && merged->validate_mem_flow()) {
#ifndef PRODUCT
if (PrintOptimizeStringConcat) {
tty->print_cr("stacking would succeed");
@@ -708,6 +721,139 @@
}
+bool StringConcat::validate_mem_flow() {
+ Compile* C = _stringopts->C;
+
+ for (uint i = 0; i < _control.size(); i++) {
+#ifndef PRODUCT
+ Node_List path;
+#endif
+ Node* curr = _control.at(i);
+ if (curr->is_Call() && curr != _begin) { // For all calls except the first allocation
+ // Now here's the main invariant in our case:
+ // For memory between the constructor, and appends, and toString we should only see bottom memory,
+ // produced by the previous call we know about.
+ if (!_constructors.contains(curr)) {
+ NOT_PRODUCT(path.push(curr);)
+ Node* mem = curr->in(TypeFunc::Memory);
+ assert(mem != NULL, "calls should have memory edge");
+ assert(!mem->is_Phi(), "should be handled by control flow validation");
+ NOT_PRODUCT(path.push(mem);)
+ while (mem->is_MergeMem()) {
+ for (uint i = 1; i < mem->req(); i++) {
+ if (i != Compile::AliasIdxBot && mem->in(i) != C->top()) {
+#ifndef PRODUCT
+ if (PrintOptimizeStringConcat) {
+ tty->print("fusion has incorrect memory flow (side effects) for ");
+ _begin->jvms()->dump_spec(tty); tty->cr();
+ path.dump();
+ }
+#endif
+ return false;
+ }
+ }
+ // skip through a potential MergeMem chain, linked through Bot
+ mem = mem->in(Compile::AliasIdxBot);
+ NOT_PRODUCT(path.push(mem);)
+ }
+ // now let it fall through, and see if we have a projection
+ if (mem->is_Proj()) {
+ // Should point to a previous known call
+ Node *prev = mem->in(0);
+ NOT_PRODUCT(path.push(prev);)
+ if (!prev->is_Call() || !_control.contains(prev)) {
+#ifndef PRODUCT
+ if (PrintOptimizeStringConcat) {
+ tty->print("fusion has incorrect memory flow (unknown call) for ");
+ _begin->jvms()->dump_spec(tty); tty->cr();
+ path.dump();
+ }
+#endif
+ return false;
+ }
+ } else {
+ assert(mem->is_Store() || mem->is_LoadStore(), err_msg_res("unexpected node type: %s", mem->Name()));
+#ifndef PRODUCT
+ if (PrintOptimizeStringConcat) {
+ tty->print("fusion has incorrect memory flow (unexpected source) for ");
+ _begin->jvms()->dump_spec(tty); tty->cr();
+ path.dump();
+ }
+#endif
+ return false;
+ }
+ } else {
+ // For memory that feeds into constructors it's more complicated.
+ // However the advantage is that any side effect that happens between the Allocate/Initialize and
+ // the constructor will have to be control-dependent on Initialize.
+ // So we actually don't have to do anything, since it's going to be caught by the control flow
+ // analysis.
+#ifdef ASSERT
+ // Do a quick verification of the control pattern between the constructor and the initialize node
+ assert(curr->is_Call(), "constructor should be a call");
+ // Go up the control starting from the constructor call
+ Node* ctrl = curr->in(0);
+ IfNode* iff = NULL;
+ RegionNode* copy = NULL;
+
+ while (true) {
+ // skip known check patterns
+ if (ctrl->is_Region()) {
+ if (ctrl->as_Region()->is_copy()) {
+ copy = ctrl->as_Region();
+ ctrl = copy->is_copy();
+ } else { // a cast
+ assert(ctrl->req() == 3 &&
+ ctrl->in(1) != NULL && ctrl->in(1)->is_Proj() &&
+ ctrl->in(2) != NULL && ctrl->in(2)->is_Proj() &&
+ ctrl->in(1)->in(0) == ctrl->in(2)->in(0) &&
+ ctrl->in(1)->in(0) != NULL && ctrl->in(1)->in(0)->is_If(),
+ "must be a simple diamond");
+ Node* true_proj = ctrl->in(1)->is_IfTrue() ? ctrl->in(1) : ctrl->in(2);
+ for (SimpleDUIterator i(true_proj); i.has_next(); i.next()) {
+ Node* use = i.get();
+ assert(use == ctrl || use->is_ConstraintCast(),
+ err_msg_res("unexpected user: %s", use->Name()));
+ }
+
+ iff = ctrl->in(1)->in(0)->as_If();
+ ctrl = iff->in(0);
+ }
+ } else if (ctrl->is_IfTrue()) { // null checks, class checks
+ iff = ctrl->in(0)->as_If();
+ assert(iff->is_If(), "must be if");
+ // Verify that the other arm is an uncommon trap
+ Node* otherproj = iff->proj_out(1 - ctrl->as_Proj()->_con);
+ CallStaticJavaNode* call = otherproj->unique_out()->isa_CallStaticJava();
+ assert(strcmp(call->_name, "uncommon_trap") == 0, "must be uncommond trap");
+ ctrl = iff->in(0);
+ } else {
+ break;
+ }
+ }
+
+ assert(ctrl->is_Proj(), "must be a projection");
+ assert(ctrl->in(0)->is_Initialize(), "should be initialize");
+ for (SimpleDUIterator i(ctrl); i.has_next(); i.next()) {
+ Node* use = i.get();
+ assert(use == copy || use == iff || use == curr || use->is_CheckCastPP() || use->is_Load(),
+ err_msg_res("unexpected user: %s", use->Name()));
+ }
+#endif // ASSERT
+ }
+ }
+ }
+
+#ifndef PRODUCT
+ if (PrintOptimizeStringConcat) {
+ tty->print("fusion has correct memory flow for ");
+ _begin->jvms()->dump_spec(tty); tty->cr();
+ tty->cr();
+ }
+#endif
+ return true;
+}
+
bool StringConcat::validate_control_flow() {
// We found all the calls and arguments now lets see if it's
// safe to transform the graph as we would expect.
@@ -753,7 +899,7 @@
}
}
- // Skip backwards through the control checking for unexpected contro flow
+ // Skip backwards through the control checking for unexpected control flow
Node* ptr = _end;
bool fail = false;
while (ptr != _begin) {
@@ -936,7 +1082,7 @@
if (PrintOptimizeStringConcat && !fail) {
ttyLocker ttyl;
tty->cr();
- tty->print("fusion would succeed (%d %d) for ", null_check_count, _uncommon_traps.size());
+ tty->print("fusion has correct control flow (%d %d) for ", null_check_count, _uncommon_traps.size());
_begin->jvms()->dump_spec(tty); tty->cr();
for (int i = 0; i < num_arguments(); i++) {
argument(i)->dump();
--- a/hotspot/src/share/vm/prims/jni.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/prims/jni.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -5059,6 +5059,7 @@
void TestReserveMemorySpecial_test();
void TestVirtualSpace_test();
void TestMetaspaceAux_test();
+void TestMetachunk_test();
#if INCLUDE_ALL_GCS
void TestG1BiasedArray_test();
#endif
@@ -5070,6 +5071,7 @@
run_unit_test(TestReserveMemorySpecial_test());
run_unit_test(TestVirtualSpace_test());
run_unit_test(TestMetaspaceAux_test());
+ run_unit_test(TestMetachunk_test());
run_unit_test(GlobalDefinitions::test_globals());
run_unit_test(GCTimerAllTest::all());
run_unit_test(arrayOopDesc::test_max_array_length());
--- a/hotspot/src/share/vm/runtime/arguments.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -2694,8 +2694,9 @@
FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
// Xmaxf
} else if (match_option(option, "-Xmaxf", &tail)) {
- int maxf = (int)(atof(tail) * 100);
- if (maxf < 0 || maxf > 100) {
+ char* err;
+ int maxf = (int)(strtod(tail, &err) * 100);
+ if (*err != '\0' || maxf < 0 || maxf > 100) {
jio_fprintf(defaultStream::error_stream(),
"Bad max heap free percentage size: %s\n",
option->optionString);
@@ -2705,8 +2706,9 @@
}
// Xminf
} else if (match_option(option, "-Xminf", &tail)) {
- int minf = (int)(atof(tail) * 100);
- if (minf < 0 || minf > 100) {
+ char* err;
+ int minf = (int)(strtod(tail, &err) * 100);
+ if (*err != '\0' || minf < 0 || minf > 100) {
jio_fprintf(defaultStream::error_stream(),
"Bad min heap free percentage size: %s\n",
option->optionString);
--- a/hotspot/src/share/vm/runtime/globals.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -1979,13 +1979,6 @@
develop(uintx, MetadataAllocationFailALotInterval, 1000, \
"Metadata allocation failure a lot interval") \
\
- develop(bool, MetaDataDeallocateALot, false, \
- "Deallocation bunches of metadata at intervals controlled by " \
- "MetaDataAllocateALotInterval") \
- \
- develop(uintx, MetaDataDeallocateALotInterval, 100, \
- "Metadata deallocation alot interval") \
- \
develop(bool, TraceMetadataChunkAllocation, false, \
"Trace chunk metadata allocations") \
\
@@ -2175,7 +2168,7 @@
"Minimum ratio of young generation/survivor space size") \
\
product(uintx, InitialSurvivorRatio, 8, \
- "Initial ratio of eden/survivor space size") \
+ "Initial ratio of young generation/survivor space size") \
\
product(uintx, BaseFootPrintEstimate, 256*M, \
"Estimate of footprint other than Java Heap") \
@@ -2677,6 +2670,14 @@
product(bool, AggressiveOpts, false, \
"Enable aggressive optimizations - see arguments.cpp") \
\
+ product_pd(uintx, TypeProfileLevel, \
+ "=XY, with Y, Type profiling of arguments at call" \
+ " X, Type profiling of return value at call" \
+ "X and Y in 0->off ; 1->js292 only; 2->all methods") \
+ \
+ product(intx, TypeProfileArgsLimit, 2, \
+ "max number of call arguments to consider for type profiling") \
+ \
/* statistics */ \
develop(bool, CountCompiledCalls, false, \
"Count method invocations") \
@@ -3125,10 +3126,14 @@
"class pointers are used") \
\
product(uintx, MinHeapFreeRatio, 40, \
- "The minimum percentage of heap free after GC to avoid expansion")\
+ "The minimum percentage of heap free after GC to avoid expansion."\
+ " For most GCs this applies to the old generation. In G1 it" \
+ " applies to the whole heap. Not supported by ParallelGC.") \
\
product(uintx, MaxHeapFreeRatio, 70, \
- "The maximum percentage of heap free after GC to avoid shrinking")\
+ "The maximum percentage of heap free after GC to avoid shrinking."\
+ " For most GCs this applies to the old generation. In G1 it" \
+ " applies to the whole heap. Not supported by ParallelGC.") \
\
product(intx, SoftRefLRUPolicyMSPerMB, 1000, \
"Number of milliseconds per MB of free space in the heap") \
@@ -3823,7 +3828,6 @@
product(bool, UseLockedTracing, false, \
"Use locked-tracing when doing event-based tracing")
-
/*
* Macros for factoring of globals
*/
--- a/hotspot/src/share/vm/runtime/java.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/java.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -183,6 +183,7 @@
collected_profiled_methods->sort(&compare_methods);
int count = collected_profiled_methods->length();
+ int total_size = 0;
if (count > 0) {
for (int index = 0; index < count; index++) {
Method* m = collected_profiled_methods->at(index);
@@ -190,10 +191,13 @@
tty->print_cr("------------------------------------------------------------------------");
//m->print_name(tty);
m->print_invocation_count();
+ tty->print_cr(" mdo size: %d bytes", m->method_data()->size_in_bytes());
tty->cr();
m->print_codes();
+ total_size += m->method_data()->size_in_bytes();
}
tty->print_cr("------------------------------------------------------------------------");
+ tty->print_cr("Total MDO size: %d bytes", total_size);
}
}
--- a/hotspot/src/share/vm/runtime/signature.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/signature.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -378,6 +378,16 @@
return result;
}
+int SignatureStream::reference_parameter_count() {
+ int args_count = 0;
+ for ( ; !at_return_type(); next()) {
+ if (is_object()) {
+ args_count++;
+ }
+ }
+ return args_count;
+}
+
bool SignatureVerifier::is_valid_signature(Symbol* sig) {
const char* signature = (const char*)sig->bytes();
ssize_t len = sig->utf8_length();
--- a/hotspot/src/share/vm/runtime/signature.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/signature.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -401,6 +401,9 @@
// return same as_symbol except allocation of new symbols is avoided.
Symbol* as_symbol_or_null();
+
+ // count the number of references in the signature
+ int reference_parameter_count();
};
class SignatureVerifier : public StackObj {
--- a/hotspot/src/share/vm/runtime/thread.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1454,7 +1454,6 @@
_interp_only_mode = 0;
_special_runtime_exit_condition = _no_async_condition;
_pending_async_exception = NULL;
- _is_compiling = false;
_thread_stat = NULL;
_thread_stat = new ThreadStatistics();
_blocked_on_compilation = false;
@@ -1815,7 +1814,8 @@
// Call Thread.exit(). We try 3 times in case we got another Thread.stop during
// the execution of the method. If that is not enough, then we don't really care. Thread.stop
// is deprecated anyhow.
- { int count = 3;
+ if (!is_Compiler_thread()) {
+ int count = 3;
while (java_lang_Thread::threadGroup(threadObj()) != NULL && (count-- > 0)) {
EXCEPTION_MARK;
JavaValue result(T_VOID);
@@ -1828,7 +1828,6 @@
CLEAR_PENDING_EXCEPTION;
}
}
-
// notify JVMTI
if (JvmtiExport::should_post_thread_life()) {
JvmtiExport::post_thread_end(this);
@@ -3239,6 +3238,7 @@
_counters = counters;
_buffer_blob = NULL;
_scanned_nmethod = NULL;
+ _compiler = NULL;
#ifndef PRODUCT
_ideal_graph_printer = NULL;
@@ -3255,6 +3255,7 @@
}
}
+
// ======= Threads ========
// The Threads class links together all active threads, and provides
@@ -3275,8 +3276,6 @@
// All JavaThreads
#define ALL_JAVA_THREADS(X) for (JavaThread* X = _thread_list; X; X = X->next())
-void os_stream();
-
// All JavaThreads + all non-JavaThreads (i.e., every thread in the system)
void Threads::threads_do(ThreadClosure* tc) {
assert_locked_or_safepoint(Threads_lock);
--- a/hotspot/src/share/vm/runtime/thread.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/thread.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -923,9 +923,6 @@
volatile address _exception_handler_pc; // PC for handler of exception
volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site.
- // support for compilation
- bool _is_compiling; // is true if a compilation is active inthis thread (one compilation per thread possible)
-
// support for JNI critical regions
jint _jni_active_critical; // count of entries into JNI critical region
@@ -1005,10 +1002,6 @@
// Testers
virtual bool is_Java_thread() const { return true; }
- // compilation
- void set_is_compiling(bool f) { _is_compiling = f; }
- bool is_compiling() const { return _is_compiling; }
-
// Thread chain operations
JavaThread* next() const { return _next; }
void set_next(JavaThread* p) { _next = p; }
@@ -1283,6 +1276,11 @@
void set_exception_handler_pc(address a) { _exception_handler_pc = a; }
void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; }
+ void clear_exception_oop_and_pc() {
+ set_exception_oop(NULL);
+ set_exception_pc(NULL);
+ }
+
// Stack overflow support
inline size_t stack_available(address cur_sp);
address stack_yellow_zone_base()
@@ -1811,13 +1809,14 @@
private:
CompilerCounters* _counters;
- ciEnv* _env;
- CompileLog* _log;
- CompileTask* _task;
- CompileQueue* _queue;
- BufferBlob* _buffer_blob;
+ ciEnv* _env;
+ CompileLog* _log;
+ CompileTask* _task;
+ CompileQueue* _queue;
+ BufferBlob* _buffer_blob;
- nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper
+ nmethod* _scanned_nmethod; // nmethod being scanned by the sweeper
+ AbstractCompiler* _compiler;
public:
@@ -1829,14 +1828,17 @@
// Hide this compiler thread from external view.
bool is_hidden_from_external_view() const { return true; }
- CompileQueue* queue() { return _queue; }
- CompilerCounters* counters() { return _counters; }
+ void set_compiler(AbstractCompiler* c) { _compiler = c; }
+ AbstractCompiler* compiler() const { return _compiler; }
+
+ CompileQueue* queue() const { return _queue; }
+ CompilerCounters* counters() const { return _counters; }
// Get/set the thread's compilation environment.
ciEnv* env() { return _env; }
void set_env(ciEnv* env) { _env = env; }
- BufferBlob* get_buffer_blob() { return _buffer_blob; }
+ BufferBlob* get_buffer_blob() const { return _buffer_blob; }
void set_buffer_blob(BufferBlob* b) { _buffer_blob = b; };
// Get/set the thread's logging information
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -58,7 +58,7 @@
#include "memory/generation.hpp"
#include "memory/generationSpec.hpp"
#include "memory/heap.hpp"
-#include "memory/metablock.hpp"
+#include "memory/metachunk.hpp"
#include "memory/referenceType.hpp"
#include "memory/space.hpp"
#include "memory/tenuredGeneration.hpp"
@@ -917,7 +917,6 @@
volatile_nonstatic_field(JavaThread, _exception_oop, oop) \
volatile_nonstatic_field(JavaThread, _exception_pc, address) \
volatile_nonstatic_field(JavaThread, _is_method_handle_return, int) \
- nonstatic_field(JavaThread, _is_compiling, bool) \
nonstatic_field(JavaThread, _special_runtime_exit_condition, JavaThread::AsyncRequests) \
nonstatic_field(JavaThread, _saved_exception_pc, address) \
volatile_nonstatic_field(JavaThread, _thread_state, JavaThreadState) \
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -48,7 +48,7 @@
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
#if INCLUDE_SERVICES // Heap dumping/inspection supported
- DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(full_export, true, false));
+ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
#endif // INCLUDE_SERVICES
--- a/hotspot/src/share/vm/services/heapDumper.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/services/heapDumper.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1545,7 +1545,9 @@
// writes a HPROF_GC_CLASS_DUMP record for the given class
void VM_HeapDumper::do_class_dump(Klass* k) {
- DumperSupport::dump_class_and_array_classes(writer(), k);
+ if (k->oop_is_instance()) {
+ DumperSupport::dump_class_and_array_classes(writer(), k);
+ }
}
// writes a HPROF_GC_CLASS_DUMP records for a given basic type
@@ -1722,7 +1724,7 @@
SymbolTable::symbols_do(&sym_dumper);
// write HPROF_LOAD_CLASS records
- SystemDictionary::classes_do(&do_load_class);
+ ClassLoaderDataGraph::classes_do(&do_load_class);
Universe::basic_type_classes_do(&do_load_class);
// write HPROF_FRAME and HPROF_TRACE records
@@ -1733,7 +1735,7 @@
write_dump_header();
// Writes HPROF_GC_CLASS_DUMP records
- SystemDictionary::classes_do(&do_class_dump);
+ ClassLoaderDataGraph::classes_do(&do_class_dump);
Universe::basic_type_classes_do(&do_basic_type_array_class_dump);
check_segment_length();
--- a/hotspot/src/share/vm/services/runtimeService.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/services/runtimeService.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
#endif /* USDT2 */
// Print the time interval in which the app was executing
- if (PrintGCApplicationConcurrentTime) {
+ if (PrintGCApplicationConcurrentTime && _app_timer.is_updated()) {
gclog_or_tty->date_stamp(PrintGCDateStamps);
gclog_or_tty->stamp(PrintGCTimeStamps);
gclog_or_tty->print_cr("Application time: %3.7f seconds",
--- a/hotspot/src/share/vm/shark/sharkCompiler.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -133,11 +133,10 @@
exit(1);
}
- execution_engine()->addModule(
- _native_context->module());
+ execution_engine()->addModule(_native_context->module());
// All done
- mark_initialized();
+ set_state(initialized);
}
void SharkCompiler::initialize() {
--- a/hotspot/src/share/vm/shark/sharkCompiler.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -50,10 +50,6 @@
return ! (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form());
}
- // Customization
- bool needs_adapters() { return false; }
- bool needs_stubs() { return false; }
-
// Initialization
void initialize();
--- a/hotspot/src/share/vm/utilities/constantTag.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/utilities/constantTag.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -51,7 +51,9 @@
case JVM_CONSTANT_ClassIndex :
case JVM_CONSTANT_StringIndex :
case JVM_CONSTANT_MethodHandle :
+ case JVM_CONSTANT_MethodHandleInError :
case JVM_CONSTANT_MethodType :
+ case JVM_CONSTANT_MethodTypeInError :
return T_OBJECT;
default:
ShouldNotReachHere();
@@ -60,6 +62,19 @@
}
+jbyte constantTag::non_error_value() const {
+ switch (_tag) {
+ case JVM_CONSTANT_UnresolvedClassInError:
+ return JVM_CONSTANT_UnresolvedClass;
+ case JVM_CONSTANT_MethodHandleInError:
+ return JVM_CONSTANT_MethodHandle;
+ case JVM_CONSTANT_MethodTypeInError:
+ return JVM_CONSTANT_MethodType;
+ default:
+ return _tag;
+ }
+}
+
const char* constantTag::internal_name() const {
switch (_tag) {
--- a/hotspot/src/share/vm/utilities/constantTag.hpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/utilities/constantTag.hpp Mon Oct 28 12:28:57 2013 -0700
@@ -108,7 +108,8 @@
_tag = tag;
}
- jbyte value() { return _tag; }
+ jbyte value() const { return _tag; }
+ jbyte non_error_value() const;
BasicType basic_type() const; // if used with ldc, what kind of value gets pushed?
--- a/hotspot/src/share/vm/utilities/ostream.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/utilities/ostream.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -465,7 +465,7 @@
}
// log_name comes from -XX:LogFile=log_name or -Xloggc:log_name
-// in log_name, %p => pipd1234 and
+// in log_name, %p => pid1234 and
// %t => YYYY-MM-DD_HH-MM-SS
static const char* make_log_name(const char* log_name, const char* force_directory) {
char timestr[32];
@@ -792,7 +792,7 @@
void defaultStream::init_log() {
// %%% Need a MutexLocker?
- const char* log_name = LogFile != NULL ? LogFile : "hotspot_pid%p.log";
+ const char* log_name = LogFile != NULL ? LogFile : "hotspot_%p.log";
const char* try_name = make_log_name(log_name, NULL);
fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
if (!file->is_open()) {
--- a/hotspot/src/share/vm/utilities/vmError.cpp Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/src/share/vm/utilities/vmError.cpp Mon Oct 28 12:28:57 2013 -0700
@@ -1050,7 +1050,7 @@
FILE* replay_data_file = os::open(fd, "w");
if (replay_data_file != NULL) {
fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
- env->dump_replay_data(&replay_data_stream);
+ env->dump_replay_data_unsafe(&replay_data_stream);
out.print_raw("#\n# Compiler replay data is saved as:\n# ");
out.print_raw_cr(buffer);
} else {
--- a/hotspot/test/TEST.groups Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/TEST.groups Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
# - compact1, compact2, compact3, full JRE, JDK
#
# In addition they support testing of the minimal VM on compact1 and compact2.
-# Essentially this defines groups based around the specified API's and VM
+# Essentially this defines groups based around the specified API's and VM
# services available in the runtime.
#
# The groups are defined hierarchically in two forms:
@@ -44,9 +44,9 @@
# by listing the top-level test directories.
#
# To use a group simply list it on the jtreg command line eg:
-# jtreg :jdk
+# jtreg :jdk
# runs all tests. While
-# jtreg :compact2
+# jtreg :compact2
# runs those tests that only require compact1 and compact2 API's.
#
@@ -69,6 +69,7 @@
runtime/7107135/Test7107135.sh \
runtime/7158988/FieldMonitor.java \
runtime/7194254/Test7194254.java \
+ runtime/8026365/InvokeSpecialAnonTest.java \
runtime/jsig/Test8017498.sh \
runtime/Metaspace/FragmentMetaspace.java \
runtime/NMT/BaselineWithParameter.java \
@@ -124,7 +125,7 @@
compiler/whitebox/IsMethodCompilableTest.java \
gc/6581734/Test6581734.java \
gc/7072527/TestFullGCCount.java \
- gc/7168848/HumongousAlloc.java \
+ gc/g1/TestHumongousAllocInitialMark.java \
gc/arguments/TestG1HeapRegionSize.java \
gc/metaspace/TestMetaspaceMemoryPool.java \
runtime/InternalApi/ThreadCpuTimesDeadlock.java \
@@ -140,7 +141,7 @@
-:needs_jdk
# Tests that require compact2 API's and a full VM
-#
+#
needs_full_vm_compact2 =
# Compact 1 adds full VM tests
--- a/hotspot/test/compiler/8013496/Test8013496.sh Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-#
-# @test
-# @bug 8013496
-# @summary Test checks that the order in which ReversedCodeCacheSize and
-# InitialCodeCacheSize are passed to the VM is irrelevant.
-# @run shell Test8013496.sh
-#
-#
-## some tests require path to find test source dir
-if [ "${TESTSRC}" = "" ]
-then
- TESTSRC=${PWD}
- echo "TESTSRC not set. Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
-set -x
-
-${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:ReservedCodeCacheSize=2m -XX:InitialCodeCacheSize=500K -version > 1.out 2>&1
-${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:InitialCodeCacheSize=500K -XX:ReservedCodeCacheSize=2m -version > 2.out 2>&1
-
-diff 1.out 2.out
-
-result=$?
-if [ $result -eq 0 ] ; then
- echo "Test Passed"
- exit 0
-else
- echo "Test Failed"
- exit 1
-fi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8013496
+ * @summary Test checks that the order in which ReversedCodeCacheSize and
+ * InitialCodeCacheSize are passed to the VM is irrelevant.
+ * @library /testlibrary
+ *
+ */
+import com.oracle.java.testlibrary.*;
+
+public class CheckReservedInitialCodeCacheSizeArgOrder {
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb1, pb2;
+ OutputAnalyzer out1, out2;
+
+ pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version");
+ pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version");
+
+ out1 = new OutputAnalyzer(pb1.start());
+ out2 = new OutputAnalyzer(pb2.start());
+
+ // Check that the outputs are equal
+ if (out1.getStdout().compareTo(out2.getStdout()) != 0) {
+ throw new RuntimeException("Test failed");
+ }
+
+ out1.shouldHaveExitValue(0);
+ out2.shouldHaveExitValue(0);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/mathexact/RepeatTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025657
+ * @summary Test repeating addExact
+ * @compile RepeatTest.java
+ * @run main RepeatTest
+ *
+ */
+
+import java.lang.ArithmeticException;
+
+public class RepeatTest {
+ public static void main(String[] args) {
+ java.util.Random rnd = new java.util.Random();
+ for (int i = 0; i < 50000; ++i) {
+ int x = Integer.MAX_VALUE - 10;
+ int y = Integer.MAX_VALUE - 10 + rnd.nextInt(5); //rnd.nextInt() / 2;
+
+ int c = rnd.nextInt() / 2;
+ int d = rnd.nextInt() / 2;
+
+ int a = addExact(x, y);
+
+ if (a != 36) {
+ throw new RuntimeException("a != 0 : " + a);
+ }
+
+ int b = nonExact(c, d);
+ int n = addExact2(c, d);
+
+
+ if (n != b) {
+ throw new RuntimeException("n != b : " + n + " != " + b);
+ }
+ }
+ }
+
+ public static int addExact2(int x, int y) {
+ int result = 0;
+ result += java.lang.Math.addExact(x, y);
+ result += java.lang.Math.addExact(x, y);
+ result += java.lang.Math.addExact(x, y);
+ result += java.lang.Math.addExact(x, y);
+ return result;
+ }
+
+ public static int addExact(int x, int y) {
+ int result = 0;
+ try {
+ result += 5;
+ result = java.lang.Math.addExact(x, y);
+ } catch (ArithmeticException e) {
+ result += 1;
+ }
+ try {
+ result += 6;
+
+ result += java.lang.Math.addExact(x, y);
+ } catch (ArithmeticException e) {
+ result += 2;
+ }
+ try {
+ result += 7;
+ result += java.lang.Math.addExact(x, y);
+ } catch (ArithmeticException e) {
+ result += 3;
+ }
+ try {
+ result += 8;
+ result += java.lang.Math.addExact(x, y);
+ } catch (ArithmeticException e) {
+ result += 4;
+ }
+ return result;
+ }
+
+ public static int nonExact(int x, int y) {
+ int result = x + y;
+ result += x + y;
+ result += x + y;
+ result += x + y;
+ return result;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8026124
+ * @summary Javascript file provoked assertion failure in linkResolver.cpp
+ *
+ * @run main/othervm CreatesInterfaceDotEqualsCallInfo
+ */
+
+public class CreatesInterfaceDotEqualsCallInfo {
+ public static void main(String[] args) throws java.io.IOException {
+ String[] jsargs = { System.getProperty("test.src", ".") +
+ "/createsInterfaceDotEqualsCallInfo.js" };
+ jdk.nashorn.tools.Shell.main(System.in, System.out, System.err, jsargs);
+ System.out.println("PASS, did not crash running Javascript");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/createsInterfaceDotEqualsCallInfo.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ *
+ */
+
+var path = new java.io.File("/Users/someone").toPath();
+path.toString();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8023014
+ * @summary Test ensures that there is no crash when compiler initialization fails
+ * @library /testlibrary
+ *
+ */
+import com.oracle.java.testlibrary.*;
+
+public class SmallCodeCacheStartup {
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb;
+ OutputAnalyzer out;
+
+ pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m", "-XX:CICompilerCount=64", "-version");
+ out = new OutputAnalyzer(pb.start());
+ out.shouldContain("no space to run compiler");
+ out.shouldHaveExitValue(0);
+ }
+}
--- a/hotspot/test/gc/7168848/HumongousAlloc.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test Humongous.java
- * @bug 7168848
- * @summary G1: humongous object allocations should initiate marking cycles when necessary
- * @run main/othervm -Xms100m -Xmx100m -XX:+PrintGC -XX:G1HeapRegionSize=1m -XX:+UseG1GC HumongousAlloc
- *
- */
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
-import java.util.List;
-
-public class HumongousAlloc {
-
- public static byte[] dummy;
- private static int sleepFreq = 40;
- private static int sleepTime = 1000;
- private static double size = 0.75;
- private static int iterations = 50;
- private static int MB = 1024 * 1024;
-
- public static void allocate(int size, int sleepTime, int sleepFreq) throws InterruptedException {
- System.out.println("Will allocate objects of size: " + size
- + " bytes and sleep for " + sleepTime
- + " ms after every " + sleepFreq + "th allocation.");
- int count = 0;
- while (count < iterations) {
- for (int i = 0; i < sleepFreq; i++) {
- dummy = new byte[size - 16];
- }
- Thread.sleep(sleepTime);
- count++;
- }
- }
-
- public static void main(String[] args) throws InterruptedException {
- allocate((int) (size * MB), sleepTime, sleepFreq);
- List<GarbageCollectorMXBean> collectors = ManagementFactory.getGarbageCollectorMXBeans();
- for (GarbageCollectorMXBean collector : collectors) {
- if (collector.getName().contains("G1 Old")) {
- long count = collector.getCollectionCount();
- if (count > 0) {
- throw new RuntimeException("Failed: FullGCs should not have happened. The number of FullGC run is " + count);
- }
- else {
- System.out.println("Passed.");
- }
- }
- }
- }
-}
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestHeapFreeRatio.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestHeapFreeRatio
+ * @key gc
+ * @bug 8025661
+ * @summary Test parsing of -Xminf and -Xmaxf
+ * @library /testlibrary
+ * @run main/othervm TestHeapFreeRatio
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class TestHeapFreeRatio {
+
+ enum Validation {
+ VALID,
+ MIN_INVALID,
+ MAX_INVALID,
+ COMBINATION_INVALID
+ }
+
+ private static void testMinMaxFreeRatio(String min, String max, Validation type) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-Xminf" + min,
+ "-Xmaxf" + max,
+ "-version");
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+ switch (type) {
+ case VALID:
+ output.shouldNotContain("Error");
+ output.shouldHaveExitValue(0);
+ break;
+ case MIN_INVALID:
+ output.shouldContain("Bad min heap free percentage size: -Xminf" + min);
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
+ break;
+ case MAX_INVALID:
+ output.shouldContain("Bad max heap free percentage size: -Xmaxf" + max);
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
+ break;
+ case COMBINATION_INVALID:
+ output.shouldContain("must be less than or equal to MaxHeapFreeRatio");
+ output.shouldContain("Error");
+ output.shouldHaveExitValue(1);
+ break;
+ default:
+ throw new IllegalStateException("Must specify expected validation type");
+ }
+
+ System.out.println(output.getOutput());
+ }
+
+ public static void main(String args[]) throws Exception {
+ testMinMaxFreeRatio( "0.1", "0.5", Validation.VALID);
+ testMinMaxFreeRatio( ".1", ".5", Validation.VALID);
+ testMinMaxFreeRatio( "0.5", "0.5", Validation.VALID);
+
+ testMinMaxFreeRatio("-0.1", "0.5", Validation.MIN_INVALID);
+ testMinMaxFreeRatio( "1.1", "0.5", Validation.MIN_INVALID);
+ testMinMaxFreeRatio("=0.1", "0.5", Validation.MIN_INVALID);
+ testMinMaxFreeRatio("0.1f", "0.5", Validation.MIN_INVALID);
+ testMinMaxFreeRatio(
+ "INVALID", "0.5", Validation.MIN_INVALID);
+ testMinMaxFreeRatio(
+ "2147483647", "0.5", Validation.MIN_INVALID);
+
+ testMinMaxFreeRatio( "0.1", "-0.5", Validation.MAX_INVALID);
+ testMinMaxFreeRatio( "0.1", "1.5", Validation.MAX_INVALID);
+ testMinMaxFreeRatio( "0.1", "0.5f", Validation.MAX_INVALID);
+ testMinMaxFreeRatio( "0.1", "=0.5", Validation.MAX_INVALID);
+ testMinMaxFreeRatio(
+ "0.1", "INVALID", Validation.MAX_INVALID);
+ testMinMaxFreeRatio(
+ "0.1", "2147483647", Validation.MAX_INVALID);
+
+ testMinMaxFreeRatio( "0.5", "0.1", Validation.COMBINATION_INVALID);
+ testMinMaxFreeRatio( ".5", ".10", Validation.COMBINATION_INVALID);
+ testMinMaxFreeRatio("0.12","0.100", Validation.COMBINATION_INVALID);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestHumongousAllocInitialMark
+ * @bug 7168848
+ * @summary G1: humongous object allocations should initiate marking cycles when necessary
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class TestHumongousAllocInitialMark {
+ private static final int heapSize = 200; // MB
+ private static final int heapRegionSize = 1; // MB
+ private static final int initiatingHeapOccupancyPercent = 50; // %
+
+ public static void main(String[] args) throws Exception {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+ "-XX:+UseG1GC",
+ "-Xms" + heapSize + "m",
+ "-Xmx" + heapSize + "m",
+ "-XX:G1HeapRegionSize=" + heapRegionSize + "m",
+ "-XX:InitiatingHeapOccupancyPercent=" + initiatingHeapOccupancyPercent,
+ "-XX:+PrintGC",
+ HumongousObjectAllocator.class.getName());
+
+ OutputAnalyzer output = new OutputAnalyzer(pb.start());
+ output.shouldContain("GC pause (G1 Humongous Allocation) (young) (initial-mark)");
+ output.shouldNotContain("Full GC");
+ output.shouldHaveExitValue(0);
+ }
+
+ static class HumongousObjectAllocator {
+ private static byte[] dummy;
+
+ public static void main(String [] args) throws Exception {
+ // Make object size 75% of region size
+ final int humongousObjectSize =
+ (int)(heapRegionSize * 1024 * 1024 * 0.75);
+
+ // Number of objects to allocate to go above IHOP
+ final int humongousObjectAllocations =
+ (int)((heapSize * initiatingHeapOccupancyPercent / 100.0) / heapRegionSize) + 1;
+
+ // Allocate
+ for (int i = 1; i <= humongousObjectAllocations; i++) {
+ System.out.println("Allocating humongous object " + i + "/" + humongousObjectAllocations +
+ " of size " + humongousObjectSize + " bytes");
+ dummy = new byte[humongousObjectSize];
+ }
+ }
+ }
+}
+
--- a/hotspot/test/gc/startup_warnings/TestCMS.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestCMS.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java Mon Oct 28 12:28:57 2013 -0700
@@ -37,7 +37,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:-CMSIncrementalMode", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestG1.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestG1.java Mon Oct 28 12:28:57 2013 -0700
@@ -37,7 +37,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestParallelGC.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestParallelGC.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParallelGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParallelGC", "-XX:-UseParallelOldGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/gc/startup_warnings/TestSerialGC.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/gc/startup_warnings/TestSerialGC.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseSerialGC", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
- output.shouldNotContain("warning");
+ output.shouldNotContain("deprecated");
output.shouldNotContain("error");
output.shouldHaveExitValue(0);
}
--- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -59,7 +59,7 @@
// If we are on MacOSX, test if JMap tool is signed, otherwise return
// since test will fail with privilege error.
if (Platform.isOSX()) {
- String jmapToolPath = JDKToolFinder.getCurrentJDKTool("jmap");
+ String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap");
ProcessBuilder codesignProcessBuilder = new ProcessBuilder(
"codesign", "-v", jmapToolPath);
Process codesignProcess = codesignProcessBuilder.start();
@@ -107,7 +107,7 @@
System.out.println("Extracted pid: " + pid);
JDKToolLauncher jMapLauncher = JDKToolLauncher
- .create("jmap", false);
+ .createUsingTestJDK("jmap");
jMapLauncher.addToolArg("-dump:format=b,file=" + pid + "-"
+ HEAP_DUMP_FILE_NAME);
jMapLauncher.addToolArg(String.valueOf(pid));
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/JDKToolLauncher.java Mon Oct 28 10:52:07 2013 +0100
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/JDKToolLauncher.java Mon Oct 28 12:28:57 2013 -0700
@@ -56,7 +56,7 @@
if (useCompilerJDK) {
executable = JDKToolFinder.getJDKTool(tool);
} else {
- executable = JDKToolFinder.getCurrentJDKTool(tool);
+ executable = JDKToolFinder.getTestJDKTool(tool);
}
vmArgs.addAll(Arrays.asList(ProcessTools.getPlatformSpecificVMArgs()));
}
@@ -74,17 +74,15 @@
}
/**
- * Creates a new JDKToolLauncher for the specified tool.
+ * Creates a new JDKToolLauncher for the specified tool in the Tested JDK.
*
* @param tool
* The name of the tool
- * @param useCompilerPath
- * If true use the compiler JDK path, otherwise use the tested
- * JDK path.
+ *
* @return A new JDKToolLauncher
*/
- public static JDKToolLauncher create(String tool, boolean useCompilerJDK) {
- return new JDKToolLauncher(tool, useCompilerJDK);
+ public static JDKToolLauncher createUsingTestJDK(String tool) {
+ return new JDKToolLauncher(tool, false);
}
/**
--- a/jaxp/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
02bfab2aa93899e0f02584f1e85537485a196553 jdk8-b109
4c84c5b447b09aff27f3b72667ab3a5401e85968 jdk8-b110
17ee0d3e97fdb412e48f14d87f504946a708f846 jdk8-b111
+c1f9158fbb9c2da50f6946fffd974e8236e08447 jdk8-b112
--- a/jaxp/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
--- a/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/XalanConstants.java Mon Oct 28 12:28:57 2013 -0700
@@ -39,6 +39,116 @@
//
// Constants
//
+ //Xerces security manager
+ public static final String SECURITY_MANAGER =
+ "http://apache.org/xml/properties/security-manager";
+
+ //
+ // Implementation limits: API properties
+ //
+ /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */
+ public static final String ORACLE_JAXP_PROPERTY_PREFIX =
+ "http://www.oracle.com/xml/jaxp/properties/";
+ /**
+ * JDK entity expansion limit; Note that the existing system property
+ * "entityExpansionLimit" with no prefix is still observed
+ */
+ public static final String JDK_ENTITY_EXPANSION_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit";
+
+ /**
+ * JDK element attribute limit; Note that the existing system property
+ * "elementAttributeLimit" with no prefix is still observed
+ */
+ public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit";
+
+ /**
+ * JDK maxOccur limit; Note that the existing system property
+ * "maxOccurLimit" with no prefix is still observed
+ */
+ public static final String JDK_MAX_OCCUR_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit";
+
+ /**
+ * JDK total entity size limit
+ */
+ public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit";
+
+ /**
+ * JDK maximum general entity size limit
+ */
+ public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit";
+ /**
+ * JDK maximum parameter entity size limit
+ */
+ public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit";
+ /**
+ * JDK maximum XML name limit
+ */
+ public static final String JDK_XML_NAME_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
+ /**
+ * JDK property indicating whether the parser shall print out entity
+ * count information
+ * Value: a string "yes" means print, "no" or any other string means not.
+ */
+ public static final String JDK_ENTITY_COUNT_INFO =
+ ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo";
+
+ //
+ // Implementation limits: corresponding System Properties of the above
+ // API properties
+ //
+ /**
+ * JDK entity expansion limit; Note that the existing system property
+ * "entityExpansionLimit" with no prefix is still observed
+ */
+ public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
+
+ /**
+ * JDK element attribute limit; Note that the existing system property
+ * "elementAttributeLimit" with no prefix is still observed
+ */
+ public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit";
+
+ /**
+ * JDK maxOccur limit; Note that the existing system property
+ * "maxOccurLimit" with no prefix is still observed
+ */
+ public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
+
+ /**
+ * JDK total entity size limit
+ */
+ public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit";
+
+ /**
+ * JDK maximum general entity size limit
+ */
+ public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit";
+ /**
+ * JDK maximum parameter entity size limit
+ */
+ public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit";
+ /**
+ * JDK maximum XML name limit
+ */
+ public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
+
+ //legacy System Properties
+ public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
+ public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
+ public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
+
+ /**
+ * A string "yes" that can be used for properties such as getEntityCountInfo
+ */
+ public static final String JDK_YES = "yes";
+
// Oracle Feature:
/**
* <p>Use Service Mechanism</p>
@@ -51,21 +161,16 @@
* <li>
* {@code false} instruct an object to skip service mechanism and
* use the default implementation for that service.
- * </li>
- * </ul>
- */
-
+ * </li>
+ * </ul>
+ */
public static final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
- /** Oracle JAXP property prefix ("http://www.oracle.com/xml/jaxp/properties/"). */
- public static final String ORACLE_JAXP_PROPERTY_PREFIX =
- "http://www.oracle.com/xml/jaxp/properties/";
//System Properties corresponding to ACCESS_EXTERNAL_* properties
public static final String SP_ACCESS_EXTERNAL_STYLESHEET = "javax.xml.accessExternalStylesheet";
public static final String SP_ACCESS_EXTERNAL_DTD = "javax.xml.accessExternalDTD";
-
//all access keyword
public static final String ACCESS_EXTERNAL_ALL = "all";
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_de.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_es.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_fr.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_it.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ja.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_ko.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_pt_BR.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_sv.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_CN.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- a/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/res/XSLTErrorResources_zh_TW.java Mon Oct 28 12:28:57 2013 -0700
@@ -471,7 +471,13 @@
// Error messages...
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
@@ -1412,13 +1418,6 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
// ================= INFRASTRUCTURE ======================
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,449 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.org.apache.xalan.internal.utils;
+
+import com.sun.org.apache.xalan.internal.XalanConstants;
+
+
+/**
+ * This class is not the same as that in Xerces. It is used to manage the
+ * state of corresponding Xerces properties and pass the values over to
+ * the Xerces Security Manager.
+ *
+ * @author Joe Wang Oracle Corp.
+ *
+ */
+public final class XMLSecurityManager {
+
+ /**
+ * States of the settings of a property, in the order: default value, value
+ * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+ * properties, and jaxp api properties
+ */
+ public static enum State {
+ //this order reflects the overriding order
+
+ DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"),
+ JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"),
+ APIPROPERTY("property");
+
+ final String literal;
+ State(String literal) {
+ this.literal = literal;
+ }
+
+ String literal() {
+ return literal;
+ }
+ }
+
+ /**
+ * Limits managed by the security manager
+ */
+ public static enum Limit {
+
+ ENTITY_EXPANSION_LIMIT(XalanConstants.JDK_ENTITY_EXPANSION_LIMIT,
+ XalanConstants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000),
+ MAX_OCCUR_NODE_LIMIT(XalanConstants.JDK_MAX_OCCUR_LIMIT,
+ XalanConstants.SP_MAX_OCCUR_LIMIT, 0, 5000),
+ ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.JDK_ELEMENT_ATTRIBUTE_LIMIT,
+ XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000),
+ TOTAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_TOTAL_ENTITY_SIZE_LIMIT,
+ XalanConstants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000),
+ GENEAL_ENTITY_SIZE_LIMIT(XalanConstants.JDK_GENEAL_ENTITY_SIZE_LIMIT,
+ XalanConstants.SP_GENEAL_ENTITY_SIZE_LIMIT, 0, 0),
+ PARAMETER_ENTITY_SIZE_LIMIT(XalanConstants.JDK_PARAMETER_ENTITY_SIZE_LIMIT,
+ XalanConstants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000);
+
+ final String apiProperty;
+ final String systemProperty;
+ final int defaultValue;
+ final int secureValue;
+
+ Limit(String apiProperty, String systemProperty, int value, int secureValue) {
+ this.apiProperty = apiProperty;
+ this.systemProperty = systemProperty;
+ this.defaultValue = value;
+ this.secureValue = secureValue;
+ }
+
+ public boolean equalsAPIPropertyName(String propertyName) {
+ return (propertyName == null) ? false : apiProperty.equals(propertyName);
+ }
+
+ public boolean equalsSystemPropertyName(String propertyName) {
+ return (propertyName == null) ? false : systemProperty.equals(propertyName);
+ }
+
+ public String apiProperty() {
+ return apiProperty;
+ }
+
+ String systemProperty() {
+ return systemProperty;
+ }
+
+ int defaultValue() {
+ return defaultValue;
+ }
+
+ int secureValue() {
+ return secureValue;
+ }
+ }
+
+ /**
+ * Map old property names with the new ones
+ */
+ public static enum NameMap {
+
+ ENTITY_EXPANSION_LIMIT(XalanConstants.SP_ENTITY_EXPANSION_LIMIT,
+ XalanConstants.ENTITY_EXPANSION_LIMIT),
+ MAX_OCCUR_NODE_LIMIT(XalanConstants.SP_MAX_OCCUR_LIMIT,
+ XalanConstants.MAX_OCCUR_LIMIT),
+ ELEMENT_ATTRIBUTE_LIMIT(XalanConstants.SP_ELEMENT_ATTRIBUTE_LIMIT,
+ XalanConstants.ELEMENT_ATTRIBUTE_LIMIT);
+ final String newName;
+ final String oldName;
+
+ NameMap(String newName, String oldName) {
+ this.newName = newName;
+ this.oldName = oldName;
+ }
+
+ String getOldName(String newName) {
+ if (newName.equals(this.newName)) {
+ return oldName;
+ }
+ return null;
+ }
+ }
+ /**
+ * Values of the properties
+ */
+ private final int[] values;
+ /**
+ * States of the settings for each property
+ */
+ private State[] states;
+ /**
+ * States that determine if properties are set explicitly
+ */
+ private boolean[] isSet;
+
+
+ /**
+ * Index of the special entityCountInfo property
+ */
+ private int indexEntityCountInfo = 10000;
+ private String printEntityCountInfo = "";
+
+ /**
+ * Default constructor. Establishes default values for known security
+ * vulnerabilities.
+ */
+ public XMLSecurityManager() {
+ this(false);
+ }
+
+ /**
+ * Instantiate Security Manager in accordance with the status of
+ * secure processing
+ * @param secureProcessing
+ */
+ public XMLSecurityManager(boolean secureProcessing) {
+ values = new int[Limit.values().length];
+ states = new State[Limit.values().length];
+ isSet = new boolean[Limit.values().length];
+ for (Limit limit : Limit.values()) {
+ if (secureProcessing) {
+ values[limit.ordinal()] = limit.secureValue();
+ states[limit.ordinal()] = State.FSP;
+ } else {
+ values[limit.ordinal()] = limit.defaultValue();
+ states[limit.ordinal()] = State.DEFAULT;
+ }
+ }
+ //read system properties or jaxp.properties
+ readSystemProperties();
+ }
+
+ /**
+ * Setting FEATURE_SECURE_PROCESSING explicitly
+ */
+ public void setSecureProcessing(boolean secure) {
+ for (Limit limit : Limit.values()) {
+ if (secure) {
+ setLimit(limit.ordinal(), State.FSP, limit.secureValue());
+ } else {
+ setLimit(limit.ordinal(), State.FSP, limit.defaultValue());
+ }
+ }
+ }
+
+ /**
+ * Set limit by property name and state
+ * @param propertyName property name
+ * @param state the state of the property
+ * @param value the value of the property
+ * @return true if the property is managed by the security manager; false
+ * if otherwise.
+ */
+ public boolean setLimit(String propertyName, State state, Object value) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ setLimit(index, state, value);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Set the value for a specific limit.
+ *
+ * @param limit the limit
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(Limit limit, State state, int value) {
+ setLimit(limit.ordinal(), state, value);
+ }
+
+ /**
+ * Set the value of a property by its index
+ *
+ * @param index the index of the property
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(int index, State state, Object value) {
+ if (index == indexEntityCountInfo) {
+ //if it's explicitly set, it's treated as yes no matter the value
+ printEntityCountInfo = (String)value;
+ } else {
+ int temp = 0;
+ try {
+ temp = Integer.parseInt((String) value);
+ if (temp < 0) {
+ temp = 0;
+ }
+ } catch (NumberFormatException e) {}
+ setLimit(index, state, temp); }
+ }
+
+ /**
+ * Set the value of a property by its index
+ *
+ * @param index the index of the property
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(int index, State state, int value) {
+ if (index == indexEntityCountInfo) {
+ //if it's explicitly set, it's treated as yes no matter the value
+ printEntityCountInfo = XalanConstants.JDK_YES;
+ } else {
+ //only update if it shall override
+ if (state.compareTo(states[index]) >= 0) {
+ values[index] = value;
+ states[index] = state;
+ isSet[index] = true;
+ }
+ }
+ }
+
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param propertyName the property name
+ * @return the value of the property as a string. If a property is managed
+ * by this manager, its value shall not be null.
+ */
+ public String getLimitAsString(String propertyName) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ return getLimitValueByIndex(index);
+ }
+
+ return null;
+ }
+
+ /**
+ * Return the value of a property by its ordinal
+ *
+ * @param limit the property
+ * @return value of a property
+ */
+ public String getLimitValueAsString(Limit limit) {
+ return Integer.toString(values[limit.ordinal()]);
+ }
+
+ /**
+ * Return the value of the specified property
+ *
+ * @param limit the property
+ * @return the value of the property
+ */
+ public int getLimit(Limit limit) {
+ return values[limit.ordinal()];
+ }
+
+ /**
+ * Return the value of a property by its ordinal
+ *
+ * @param index the index of a property
+ * @return value of a property
+ */
+ public int getLimitByIndex(int index) {
+ return values[index];
+ }
+ /**
+ * Return the value of a property by its index
+ *
+ * @param index the index of a property
+ * @return limit of a property as a string
+ */
+ public String getLimitValueByIndex(int index) {
+ if (index == indexEntityCountInfo) {
+ return printEntityCountInfo;
+ }
+
+ return Integer.toString(values[index]);
+ }
+ /**
+ * Return the state of the limit property
+ *
+ * @param limit the limit
+ * @return the state of the limit property
+ */
+ public State getState(Limit limit) {
+ return states[limit.ordinal()];
+ }
+
+ /**
+ * Return the state of the limit property
+ *
+ * @param limit the limit
+ * @return the state of the limit property
+ */
+ public String getStateLiteral(Limit limit) {
+ return states[limit.ordinal()].literal();
+ }
+
+ /**
+ * Get the index by property name
+ *
+ * @param propertyName property name
+ * @return the index of the property if found; return -1 if not
+ */
+ public int getIndex(String propertyName) {
+ for (Limit limit : Limit.values()) {
+ if (limit.equalsAPIPropertyName(propertyName)) {
+ //internally, ordinal is used as index
+ return limit.ordinal();
+ }
+ }
+ //special property to return entity count info
+ if (propertyName.equals(XalanConstants.JDK_ENTITY_COUNT_INFO)) {
+ return indexEntityCountInfo;
+ }
+ return -1;
+ }
+
+ /**
+ * Indicate if a property is set explicitly
+ * @param index
+ * @return
+ */
+ public boolean isSet(int index) {
+ return isSet[index];
+ }
+
+ public boolean printEntityCountInfo() {
+ return printEntityCountInfo.equals(XalanConstants.JDK_YES);
+ }
+ /**
+ * Read from system properties, or those in jaxp.properties
+ */
+ private void readSystemProperties() {
+
+ for (Limit limit : Limit.values()) {
+ if (!getSystemProperty(limit, limit.systemProperty())) {
+ //if system property is not found, try the older form if any
+ for (NameMap nameMap : NameMap.values()) {
+ String oldName = nameMap.getOldName(limit.systemProperty());
+ if (oldName != null) {
+ getSystemProperty(limit, oldName);
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Read from system properties, or those in jaxp.properties
+ *
+ * @param property the type of the property
+ * @param sysPropertyName the name of system property
+ */
+ private boolean getSystemProperty(Limit limit, String sysPropertyName) {
+ try {
+ String value = SecuritySupport.getSystemProperty(sysPropertyName);
+ if (value != null && !value.equals("")) {
+ values[limit.ordinal()] = Integer.parseInt(value);
+ states[limit.ordinal()] = State.SYSTEMPROPERTY;
+ return true;
+ }
+
+ value = SecuritySupport.readJAXPProperty(sysPropertyName);
+ if (value != null && !value.equals("")) {
+ values[limit.ordinal()] = Integer.parseInt(value);
+ states[limit.ordinal()] = State.JAXPDOTPROPERTIES;
+ return true;
+ }
+ } catch (NumberFormatException e) {
+ //invalid setting
+ throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty());
+ }
+ return false;
+ }
+}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/utils/XMLSecurityPropertyManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -94,6 +94,23 @@
}
/**
+ * Set limit by property name and state
+ * @param propertyName property name
+ * @param state the state of the property
+ * @param value the value of the property
+ * @return true if the property is managed by the security property manager;
+ * false if otherwise.
+ */
+ public boolean setValue(String propertyName, State state, Object value) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ setValue(index, state, (String)value);
+ return true;
+ }
+ return false;
+ }
+
+ /**
* Set the value for a specific property.
*
* @param property the property
@@ -121,6 +138,22 @@
states[index] = state;
}
}
+
+ /**
+ * Return the value of the specified property
+ *
+ * @param propertyName the property name
+ * @return the value of the property as a string
+ */
+ public String getValue(String propertyName) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ return getValueByIndex(index);
+ }
+
+ return null;
+ }
+
/**
* Return the value of the specified property
*
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Import.java Mon Oct 28 12:28:57 2013 -0700
@@ -86,7 +86,7 @@
if (input == null) {
docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc);
String accessError = SecuritySupport.checkAccess(docToLoad,
- xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
+ (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Include.java Mon Oct 28 12:28:57 2013 -0700
@@ -87,7 +87,7 @@
if (input == null) {
docToLoad = SystemIDResolver.getAbsoluteURI(docToLoad, currLoadedDoc);
String accessError = SecuritySupport.checkAccess(docToLoad,
- xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
+ (String)xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Parser.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,6 +28,7 @@
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
@@ -487,6 +488,20 @@
}
final XMLReader reader = parser.getXMLReader();
+ try {
+ XMLSecurityManager securityManager =
+ (XMLSecurityManager)_xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
+ for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
+ reader.setProperty(limit.apiProperty(), securityManager.getLimitValueAsString(limit));
+ }
+ if (securityManager.printEntityCountInfo()) {
+ parser.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
+ }
+ } catch (SAXException se) {
+ System.err.println("Warning: " + reader.getClass().getName() + ": "
+ + se.getMessage());
+ }
+
return(parse(reader, input));
}
catch (ParserConfigurationException e) {
@@ -565,7 +580,7 @@
}
path = SystemIDResolver.getAbsoluteURI(path);
String accessError = SecuritySupport.checkAccess(path,
- _xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
+ (String)_xsltc.getProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET),
XalanConstants.ACCESS_EXTERNAL_ALL);
if (accessError != null) {
ErrorMsg msg = new ErrorMsg(ErrorMsg.ACCESSING_XSLT_TARGET_ERR,
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java Mon Oct 28 12:28:57 2013 -0700
@@ -44,11 +44,11 @@
import com.sun.org.apache.bcel.internal.classfile.JavaClass;
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
import com.sun.org.apache.xml.internal.dtm.DTM;
-import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
@@ -146,6 +146,7 @@
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+ private XMLSecurityManager _xmlSecurityManager;
/**
* XSLTC compiler constructor
@@ -184,12 +185,14 @@
/**
* Return allowed protocols for accessing external stylesheet.
*/
- public String getProperty(String name) {
+ public Object getProperty(String name) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
return _accessExternalStylesheet;
}
else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
return _accessExternalDTD;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ return _xmlSecurityManager;
}
return null;
}
@@ -197,12 +200,14 @@
/**
* Set allowed protocols for accessing external stylesheet.
*/
- public void setProperty(String name, String value) {
+ public void setProperty(String name, Object value) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_STYLESHEET)) {
_accessExternalStylesheet = (String)value;
}
else if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
_accessExternalDTD = (String)value;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ _xmlSecurityManager = (XMLSecurityManager)value;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"More than one stylesheet defined in the same file."},
@@ -1012,12 +1018,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"S'ha definit m\u00e9s d'un full d'estils en el mateix fitxer."},
@@ -853,12 +859,5 @@
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"V\u00edce ne\u017e jedna p\u0159edloha stylu je definov\u00e1na ve stejn\u00e9m souboru."},
@@ -853,12 +859,5 @@
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Mehrere Stylesheets in derselben Datei definiert."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Se ha definido m\u00E1s de una hoja de estilo en el mismo archivo."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Plusieurs feuilles de style d\u00E9finies dans le m\u00EAme fichier."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Sono stati definiti pi\u00F9 fogli di stile nello stesso file."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u540C\u3058\u30D5\u30A1\u30A4\u30EB\u306B\u8907\u6570\u306E\u30B9\u30BF\u30A4\u30EB\u30B7\u30FC\u30C8\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u3059\u3002"},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\uB3D9\uC77C\uD55C \uD30C\uC77C\uC5D0 \uC2A4\uD0C0\uC77C\uC2DC\uD2B8\uAC00 \uB450 \uAC1C \uC774\uC0C1 \uC815\uC758\uB418\uC5C8\uC2B5\uB2C8\uB2E4."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_pt_BR.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Mais de uma folha de estilos definida no mesmo arquivo."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Viac ne\u017e jeden \u0161t\u00fdl dokumentu bol definovan\u00fd v rovnakom s\u00fabore."},
@@ -853,12 +859,5 @@
"FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sv.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"Fler \u00E4n en formatmall har definierats i samma fil."},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u540C\u4E00\u6587\u4EF6\u4E2D\u5B9A\u4E49\u4E86\u591A\u4E2A\u6837\u5F0F\u8868\u3002"},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java Mon Oct 28 12:28:57 2013 -0700
@@ -90,7 +90,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
{ErrorMsg.MULTIPLE_STYLESHEET_ERR,
"\u76F8\u540C\u6A94\u6848\u4E2D\u5B9A\u7FA9\u4E86\u8D85\u904E\u4E00\u500B\u6A23\u5F0F\u8868\u3002"},
@@ -964,12 +970,5 @@
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ca.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ca.java Mon Oct 28 12:28:57 2013 -0700
@@ -79,7 +79,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -223,13 +229,6 @@
"No s''ha pogut resoldre la refer\u00e8ncia d''URI ''{0}''."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_cs.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_cs.java Mon Oct 28 12:28:57 2013 -0700
@@ -79,7 +79,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -223,13 +229,6 @@
"Nelze p\u0159elo\u017eit odkazy URI ''{0}''."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_de.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Verwendung des Erweiterungselements \"{0}\" ist nicht zul\u00E4ssig, wenn das Feature f\u00FCr die sichere Verarbeitung auf \"true\" gesetzt ist."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_es.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_es.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"El uso del elemento de extensi\u00F3n ''{0}'' no est\u00E1 permitido cuando la funci\u00F3n de procesamiento seguro se ha definido en true."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_fr.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_fr.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"L''utilisation de l''\u00E9l\u00E9ment d''extension ''{0}'' n''est pas autoris\u00E9e lorsque la fonctionnalit\u00E9 de traitement s\u00E9curis\u00E9 est d\u00E9finie sur True."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_it.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_it.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Non \u00E8 consentito utilizzare l''elemento di estensione ''{0}'' se la funzione di elaborazione sicura \u00E8 impostata su true."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ja.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u30BB\u30AD\u30E5\u30A2\u51E6\u7406\u6A5F\u80FD\u304Ctrue\u306B\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u308B\u3068\u304D\u3001\u62E1\u5F35\u8981\u7D20''{0}''\u306E\u4F7F\u7528\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002"},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ko.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_ko.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\uBCF4\uC548 \uCC98\uB9AC \uAE30\uB2A5\uC774 true\uB85C \uC124\uC815\uB41C \uACBD\uC6B0 \uD655\uC7A5 \uC694\uC18C ''{0}''\uC744(\uB97C) \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_pt_BR.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_pt_BR.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"O uso do elemento da extens\u00E3o ''{0}'' n\u00E3o ser\u00E1 permitido quando o recurso de processamento seguro for definido como verdadeiro."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sk.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sk.java Mon Oct 28 12:28:57 2013 -0700
@@ -79,7 +79,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -223,13 +229,6 @@
"Nebolo mo\u017en\u00e9 rozl\u00ed\u0161i\u0165 referenciu URI ''{0}''."}
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sv.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_sv.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"Anv\u00E4ndning av till\u00E4ggselementet ''{0}'' \u00E4r inte till\u00E5tet n\u00E4r s\u00E4ker bearbetning till\u00E4mpas."},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_CN.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u5F53\u5B89\u5168\u5904\u7406\u529F\u80FD\u8BBE\u7F6E\u4E3A\u201C\u771F\u201D\u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u6269\u5C55\u5143\u7D20 ''{0}''\u3002"},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_TW.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ErrorMessages_zh_TW.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,13 @@
*/
// These message should be read from a locale-specific resource bundle
- private static final Object[][] _contents = new Object[][] {
+ /** Get the lookup table for error messages.
+ *
+ * @return The message lookup table.
+ */
+ public Object[][] getContents()
+ {
+ return new Object[][] {
/*
* Note to translators: the substitution text in the following message
@@ -276,13 +282,6 @@
{BasisLibrary.UNALLOWED_EXTENSION_ELEMENT_ERR,
"\u7576\u5B89\u5168\u8655\u7406\u529F\u80FD\u8A2D\u70BA\u771F\u6642\uFF0C\u4E0D\u5141\u8A31\u4F7F\u7528\u64F4\u5145\u5957\u4EF6\u5143\u7D20 ''{0}''\u3002"},
};
- /** Get the lookup table for error messages.
- *
- * @return The message lookup table.
- */
- public Object[][] getContents()
- {
- return _contents;
}
}
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -29,7 +29,7 @@
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.sax.TemplatesHandler;
-
+import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.xsltc.compiler.CompilerException;
import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;
import com.sun.org.apache.xalan.internal.xsltc.compiler.SourceLoader;
@@ -103,6 +103,8 @@
(String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET));
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD,
(String)tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD));
+ xsltc.setProperty(XalanConstants.SECURITY_MANAGER,
+ tfactory.getAttribute(XalanConstants.SECURITY_MANAGER));
if ("true".equals(tfactory.getAttribute(TransformerFactoryImpl.ENABLE_INLINING)))
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,6 +27,7 @@
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xalan.internal.utils.XMLSecurityPropertyManager.State;
@@ -218,13 +219,13 @@
* protocols allowed for external references set by the stylesheet processing instruction, Import and Include element.
*/
private String _accessExternalStylesheet = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
-
/**
* protocols allowed for external DTD references in source file and/or stylesheet.
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
private XMLSecurityPropertyManager _xmlSecurityPropertyMgr;
+ private XMLSecurityManager _xmlSecurityManager;
/**
* javax.xml.transform.sax.TransformerFactory implementation.
@@ -250,6 +251,9 @@
Property.ACCESS_EXTERNAL_DTD);
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
Property.ACCESS_EXTERNAL_STYLESHEET);
+
+ //Parser's security manager
+ _xmlSecurityManager = new XMLSecurityManager(true);
}
/**
@@ -311,11 +315,21 @@
return Boolean.TRUE;
else
return Boolean.FALSE;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ return _xmlSecurityManager;
}
- int index = _xmlSecurityPropertyMgr.getIndex(name);
- if (index > -1) {
- return _xmlSecurityPropertyMgr.getValueByIndex(index);
+ /** Check to see if the property is managed by the security manager **/
+ String propertyValue = (_xmlSecurityManager != null) ?
+ _xmlSecurityManager.getLimitAsString(name) : null;
+ if (propertyValue != null) {
+ return propertyValue;
+ } else {
+ propertyValue = (_xmlSecurityPropertyMgr != null) ?
+ _xmlSecurityPropertyMgr.getValue(name) : null;
+ if (propertyValue != null) {
+ return propertyValue;
+ }
}
// Throw an exception for all other attributes
@@ -419,10 +433,13 @@
}
}
- int index = _xmlSecurityPropertyMgr.getIndex(name);
- if (index > -1) {
- _xmlSecurityPropertyMgr.setValue(index,
- State.APIPROPERTY, (String)value);
+ if (_xmlSecurityManager != null &&
+ _xmlSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
+ return;
+ }
+
+ if (_xmlSecurityPropertyMgr != null &&
+ _xmlSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
_accessExternalDTD = _xmlSecurityPropertyMgr.getValue(
Property.ACCESS_EXTERNAL_DTD);
_accessExternalStylesheet = _xmlSecurityPropertyMgr.getValue(
@@ -473,6 +490,7 @@
throw new TransformerConfigurationException(err.toString());
}
_isNotSecureProcessing = !value;
+ _xmlSecurityManager.setSecureProcessing(value);
// set external access restriction when FSP is explicitly set
if (value && XalanConstants.IS_JDK8_OR_ABOVE) {
@@ -849,6 +867,7 @@
if (!_isNotSecureProcessing) xsltc.setSecureProcessing(true);
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, _accessExternalStylesheet);
xsltc.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
+ xsltc.setProperty(XalanConstants.SECURITY_MANAGER, _xmlSecurityManager);
xsltc.init();
// Set a document loader (for xsl:include/import) if defined
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -214,6 +215,7 @@
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+ private XMLSecurityManager _securityManager;
/**
* A hashtable to store parameters for the identity transform. These
* are not needed during the transformation, but we must keep track of
@@ -269,8 +271,11 @@
_useServicesMechanism = _tfactory.useServicesMechnism();
_accessExternalStylesheet = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET);
_accessExternalDTD = (String)_tfactory.getAttribute(XMLConstants.ACCESS_EXTERNAL_DTD);
+ _securityManager = (XMLSecurityManager)_tfactory.getAttribute(XalanConstants.SECURITY_MANAGER);
_readerManager = XMLReaderManager.getInstance(_useServicesMechanism);
_readerManager.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, _accessExternalDTD);
+ _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
+ _readerManager.setProperty(XalanConstants.SECURITY_MANAGER, _securityManager);
//_isIncremental = tfactory._incremental;
}
@@ -286,6 +291,7 @@
*/
public void setSecureProcessing(boolean flag) {
_isSecureProcessing = flag;
+ _readerManager.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _isSecureProcessing);
}
/**
* Return the state of the services mechanism feature.
--- a/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/trax/Util.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,6 +23,7 @@
package com.sun.org.apache.xalan.internal.xsltc.trax;
+import com.sun.org.apache.xalan.internal.XalanConstants;
import java.io.InputStream;
import java.io.Reader;
@@ -43,6 +44,7 @@
import javax.xml.transform.stream.StreamSource;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
@@ -105,6 +107,13 @@
if (reader == null) {
try {
reader= XMLReaderFactory.createXMLReader();
+ try {
+ reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
+ xsltc.isSecureProcessing());
+ } catch (SAXNotRecognizedException e) {
+ System.err.println("Warning: " + reader.getClass().getName() + ": "
+ + e.getMessage());
+ }
} catch (Exception e ) {
try {
@@ -144,6 +153,22 @@
+ e.getMessage());
}
+ try {
+ XMLSecurityManager securityManager =
+ (XMLSecurityManager)xsltc.getProperty(XalanConstants.SECURITY_MANAGER);
+ if (securityManager != null) {
+ for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
+ reader.setProperty(limit.apiProperty(),
+ securityManager.getLimitValueAsString(limit));
+ }
+ if (securityManager.printEntityCountInfo()) {
+ reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
+ }
+ }
+ } catch (SAXException se) {
+ System.err.println("Warning: " + reader.getClass().getName() + ": "
+ + se.getMessage());
+ }
xsltc.setXMLReader(reader);
}catch (SAXNotRecognizedException snre ) {
throw new TransformerConfigurationException
--- a/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/dom/DOMConfigurationImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -33,6 +33,7 @@
import com.sun.org.apache.xerces.internal.util.PropertyState;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.utils.ObjectFactory;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
@@ -59,6 +60,7 @@
import org.w3c.dom.ls.LSResourceResolver;
+
/**
* Xerces implementation of DOMConfiguration that maintains a table of recognized parameters.
*
@@ -156,6 +158,9 @@
protected static final String SCHEMA_DV_FACTORY =
Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY;
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
+
/** Property identifier: Security property manager. */
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
@@ -279,6 +284,7 @@
JAXP_SCHEMA_LANGUAGE,
DTD_VALIDATOR_FACTORY_PROPERTY,
SCHEMA_DV_FACTORY,
+ SECURITY_MANAGER,
XML_SECURITY_PROPERTY_MANAGER
};
addRecognizedProperties(recognizedProperties);
@@ -313,6 +319,8 @@
fValidationManager = createValidationManager();
setProperty(VALIDATION_MANAGER, fValidationManager);
+ setProperty(SECURITY_MANAGER, new XMLSecurityManager(true));
+
setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
new XMLSecurityPropertyManager());
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/Constants.java Mon Oct 28 12:28:57 2013 -0700
@@ -174,8 +174,6 @@
/** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
public static final String SCHEMA_LANGUAGE = "schemaLanguage";
- public static final String SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
-
/** JAXP Standard property prefix ("http://javax.xml.XMLConstants/property/"). */
public static final String JAXPAPI_PROPERTY_PREFIX =
"http://javax.xml.XMLConstants/property/";
@@ -209,6 +207,107 @@
public static final boolean IS_JDK8_OR_ABOVE = isJavaVersionAtLeast(8);
//
+ // Implementation limits: corresponding System Properties of the above
+ // API properties
+ //
+ /**
+ * JDK entity expansion limit; Note that the existing system property
+ * "entityExpansionLimit" with no prefix is still observed
+ */
+ public static final String JDK_ENTITY_EXPANSION_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "entityExpansionLimit";
+
+ /**
+ * JDK element attribute limit; Note that the existing system property
+ * "elementAttributeLimit" with no prefix is still observed
+ */
+ public static final String JDK_ELEMENT_ATTRIBUTE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "elementAttributeLimit";
+
+ /**
+ * JDK maxOccur limit; Note that the existing system property
+ * "maxOccurLimit" with no prefix is still observed
+ */
+ public static final String JDK_MAX_OCCUR_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxOccurLimit";
+
+ /**
+ * JDK total entity size limit
+ */
+ public static final String JDK_TOTAL_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "totalEntitySizeLimit";
+
+ /**
+ * JDK maximum general entity size limit
+ */
+ public static final String JDK_GENEAL_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxGeneralEntitySizeLimit";
+ /**
+ * JDK maximum parameter entity size limit
+ */
+ public static final String JDK_PARAMETER_ENTITY_SIZE_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxParameterEntitySizeLimit";
+ /**
+ * JDK maximum XML name limit
+ */
+ public static final String JDK_XML_NAME_LIMIT =
+ ORACLE_JAXP_PROPERTY_PREFIX + "maxXMLNameLimit";
+ /**
+ * JDK property to allow printing out information from the limit analyzer
+ */
+ public static final String JDK_ENTITY_COUNT_INFO =
+ ORACLE_JAXP_PROPERTY_PREFIX + "getEntityCountInfo";
+
+ //
+ // Implementation limits: API properties
+ //
+ /**
+ * JDK entity expansion limit; Note that the existing system property
+ * "entityExpansionLimit" with no prefix is still observed
+ */
+ public static final String SP_ENTITY_EXPANSION_LIMIT = "jdk.xml.entityExpansionLimit";
+
+ /**
+ * JDK element attribute limit; Note that the existing system property
+ * "elementAttributeLimit" with no prefix is still observed
+ */
+ public static final String SP_ELEMENT_ATTRIBUTE_LIMIT = "jdk.xml.elementAttributeLimit";
+
+ /**
+ * JDK maxOccur limit; Note that the existing system property
+ * "maxOccurLimit" with no prefix is still observed
+ */
+ public static final String SP_MAX_OCCUR_LIMIT = "jdk.xml.maxOccurLimit";
+
+ /**
+ * JDK total entity size limit
+ */
+ public static final String SP_TOTAL_ENTITY_SIZE_LIMIT = "jdk.xml.totalEntitySizeLimit";
+
+ /**
+ * JDK maximum general entity size limit
+ */
+ public static final String SP_GENEAL_ENTITY_SIZE_LIMIT = "jdk.xml.maxGeneralEntitySizeLimit";
+ /**
+ * JDK maximum parameter entity size limit
+ */
+ public static final String SP_PARAMETER_ENTITY_SIZE_LIMIT = "jdk.xml.maxParameterEntitySizeLimit";
+ /**
+ * JDK maximum XML name limit
+ */
+ public static final String SP_XML_NAME_LIMIT = "jdk.xml.maxXMLNameLimit";
+
+ //legacy System Properties
+ public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
+ public static final String ELEMENT_ATTRIBUTE_LIMIT = "elementAttributeLimit" ;
+ public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
+
+ /**
+ * A string "yes" that can be used for properties such as getEntityCountInfo
+ */
+ public static final String JDK_YES = "yes";
+
+ //
// DOM features
//
@@ -443,7 +542,7 @@
public static final String LOCALE_PROPERTY = "locale";
/** property identifier: security manager. */
- protected static final String SECURITY_MANAGER =
+ public static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
@@ -511,9 +610,6 @@
*/
public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
- public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
-
- public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
/**
* {@link org.w3c.dom.TypeInfo} associated with current element/attribute
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
package com.sun.org.apache.xerces.internal.impl;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.xml.internal.stream.StaxEntityResolverWrapper;
import java.util.HashMap;
@@ -50,12 +51,16 @@
private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
+
/** Property identifier: Security property manager. */
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
HashMap supportedProps = new HashMap();
+ private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
public static final int CONTEXT_READER = 1;
@@ -82,6 +87,7 @@
HashMap properties = propertyManager.getProperties();
supportedProps.putAll(properties);
+ fSecurityManager = (XMLSecurityManager)getProperty(SECURITY_MANAGER);
fSecurityPropertyMgr = (XMLSecurityPropertyManager)getProperty(XML_SECURITY_PROPERTY_MANAGER);
}
@@ -124,6 +130,8 @@
supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false));
supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false));
+ fSecurityManager = new XMLSecurityManager(true);
+ supportedProps.put(SECURITY_MANAGER, fSecurityManager);
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
supportedProps.put(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
}
@@ -142,6 +150,7 @@
*/
public boolean containsProperty(String property){
return supportedProps.containsKey(property) ||
+ (fSecurityManager != null && fSecurityManager.getIndex(property) > -1) ||
(fSecurityPropertyMgr!=null && fSecurityPropertyMgr.getIndex(property) > -1) ;
}
@@ -169,12 +178,34 @@
supportedProps.put( Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY , new StaxEntityResolverWrapper((XMLResolver)value)) ;
}
- int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(property) : -1;
- if (index > -1) {
- fSecurityPropertyMgr.setValue(index,
- XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
- } else {
- supportedProps.put(property, value);
+ /**
+ * It's possible for users to set a security manager through the interface.
+ * If it's the old SecurityManager, convert it to the new XMLSecurityManager
+ */
+ if (property.equals(Constants.SECURITY_MANAGER)) {
+ fSecurityManager = XMLSecurityManager.convert(value, fSecurityManager);
+ supportedProps.put(Constants.SECURITY_MANAGER, fSecurityManager);
+ return;
+ }
+ if (property.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) {
+ if (value == null) {
+ fSecurityPropertyMgr = new XMLSecurityPropertyManager();
+ } else {
+ fSecurityPropertyMgr = (XMLSecurityPropertyManager)value;
+ }
+ supportedProps.put(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+ return;
+ }
+
+ //check if the property is managed by security manager
+ if (fSecurityManager == null ||
+ !fSecurityManager.setLimit(property, XMLSecurityManager.State.APIPROPERTY, value)) {
+ //check if the property is managed by security property manager
+ if (fSecurityPropertyMgr == null ||
+ !fSecurityPropertyMgr.setValue(property, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
+ //fall back to the existing property manager
+ supportedProps.put(property, value);
+ }
}
if(equivalentProperty != null){
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XML11NSDocumentScannerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -108,6 +108,7 @@
* @author Elena Litani, IBM
* @author Michael Glavassevich, IBM
* @author Sunitha Reddy, Sun Microsystems
+ * @version $Id: XML11NSDocumentScannerImpl.java,v 1.6 2010-11-01 04:39:40 joehw Exp $
*/
public class XML11NSDocumentScannerImpl extends XML11DocumentScannerImpl {
@@ -236,7 +237,8 @@
// attributes
scanAttribute(fAttributes);
- if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
+ if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) &&
+ fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fElementAttributeLimit) },
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -44,6 +44,8 @@
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.XMLSecurityManager;
+import com.sun.xml.internal.stream.Entity;
/**
* This class is responsible for scanning the declarations found
@@ -66,7 +68,7 @@
* @author Glenn Marcy, IBM
* @author Eric Ye, IBM
*
- * @version $Id: XMLDTDScannerImpl.java,v 1.7 2007/09/26 12:52:40 ndw Exp $
+ * @version $Id: XMLDTDScannerImpl.java,v 1.8 2010-11-01 04:39:41 joehw Exp $
*/
public class XMLDTDScannerImpl
extends XMLScanner
@@ -1545,7 +1547,7 @@
// internal entity
if (systemId == null) {
- scanEntityValue(fLiteral, fLiteral2);
+ scanEntityValue(name, isPEDecl, fLiteral, fLiteral2);
// since we need it's value anyway, let's snag it so it doesn't get corrupted
// if a new load takes place before we store the entity values
fStringBuffer.clear();
@@ -1610,7 +1612,7 @@
* the use of scanCharReferenceValue), and fStringBuffer2, anything in them
* at the time of calling is lost.
*/
- protected final void scanEntityValue(XMLString value,
+ protected final void scanEntityValue(String entityName, boolean isPEDecl, XMLString value,
XMLString nonNormalizedValue)
throws IOException, XNIException {
int quote = fEntityScanner.scanChar();
@@ -1622,10 +1624,20 @@
XMLString literal = fString;
XMLString literal2 = fString;
+ int countChar = 0;
+ if (fLimitAnalyzer == null && fSecurityManager != null) {
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+ fLimitAnalyzer.startEntity(entityName);
+ }
+
if (fEntityScanner.scanLiteral(quote, fString) != quote) {
fStringBuffer.clear();
fStringBuffer2.clear();
do {
+ if (isPEDecl && fLimitAnalyzer != null) {
+ checkLimit("%" + entityName, fString.length + countChar);
+ }
+ countChar = 0;
fStringBuffer.append(fString);
fStringBuffer2.append(fString);
if (fEntityScanner.skipChar('&')) {
@@ -1685,6 +1697,7 @@
}
}
else {
+ countChar++;
int c = fEntityScanner.peekChar();
if (XMLChar.isHighSurrogate(c)) {
scanSurrogates(fStringBuffer2);
@@ -1708,9 +1721,17 @@
fStringBuffer2.append(fString);
literal = fStringBuffer;
literal2 = fStringBuffer2;
+ } else {
+ if (isPEDecl) {
+ checkLimit("%" + entityName, literal);
+ }
}
value.setValues(literal);
nonNormalizedValue.setValues(literal2);
+ if (fLimitAnalyzer != null) {
+ fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName);
+ }
+
if (!fEntityScanner.skipChar(quote)) {
reportFatalError("CloseQuoteMissingInDecl", null);
}
@@ -2126,6 +2147,43 @@
//new SymbolTable());
}
+ /**
+ * Add the count of the content buffer and check if the accumulated
+ * value exceeds the limit
+ * @param entityName entity name
+ * @param buffer content buffer
+ */
+ private void checkLimit(String entityName, XMLString buffer) {
+ checkLimit(entityName, buffer.length);
+ }
+
+ /**
+ * Add the count and check limit
+ * @param entityName entity name
+ * @param len length of the buffer
+ */
+ private void checkLimit(String entityName, int len) {
+ if (fLimitAnalyzer == null) {
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+ }
+ fLimitAnalyzer.addValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT, entityName, len);
+ if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)) {
+ fSecurityManager.debugPrint();
+ reportFatalError("MaxEntitySizeLimit", new Object[]{entityName,
+ fLimitAnalyzer.getValue(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getLimit(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.PARAMETER_ENTITY_SIZE_LIMIT)});
+ }
+ if (fSecurityManager.isOverLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
+ fSecurityManager.debugPrint();
+ reportFatalError("TotalEntitySizeLimit",
+ new Object[]{fLimitAnalyzer.getTotalValue(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getLimit(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getStateLiteral(XMLSecurityManager.Limit.TOTAL_ENTITY_SIZE_LIMIT)});
+ }
+
+ }
+
public DTDGrammar getGrammar(){
return nvGrammarInfo;
}
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -50,12 +50,14 @@
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+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.utils.XMLSecurityManager.Limit;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.State;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
-import com.sun.xml.internal.stream.Entity;
import javax.xml.XMLConstants;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.events.XMLEvent;
@@ -213,11 +215,8 @@
};
private static final char [] cdata = {'[','C','D','A','T','A','['};
+ static final char [] xmlDecl = {'<','?','x','m','l'};
private static final char [] endTag = {'<','/'};
-
- //this variable is also used by XMLDocumentScannerImpl in the same package
- static final char [] xmlDecl = {'<','?','x','m','l'};
-
// debugging
/** Debug scanner state. */
@@ -316,6 +315,7 @@
protected String fDeclaredEncoding = null;
/** Xerces Feature: Disallow doctype declaration. */
protected boolean fDisallowDoctype = false;
+
/**
* comma-delimited list of protocols that are allowed for the purpose
* of accessing external dtd or entity references
@@ -384,7 +384,6 @@
protected boolean foundBuiltInRefs = false;
- protected SecurityManager fSecurityManager = null;
//skip element algorithm
static final short MAX_DEPTH_LIMIT = 5 ;
@@ -571,8 +570,11 @@
// xerces features
fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT, true);
- fSecurityManager = (SecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
- fElementAttributeLimit = (fSecurityManager != null)?fSecurityManager.getElementAttrLimit():0;
+ fSecurityManager = (XMLSecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER, null);
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+
+ fElementAttributeLimit = (fSecurityManager != null)?
+ fSecurityManager.getLimit(XMLSecurityManager.Limit.ELEMENT_ATTRIBUTE_LIMIT):0;
fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS, false);
@@ -598,9 +600,6 @@
//xxx: external entities are supported in Xerces
// it would be good to define feature for this case
fSupportExternalEntities = true;
- fSupportExternalEntities = true;
- fSupportExternalEntities = true;
- fSupportExternalEntities = true;
fReplaceEntityReferences = true;
fIsCoalesce = false;
@@ -671,6 +670,9 @@
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)
propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
+
+ fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(Constants.SECURITY_MANAGER);
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
} // reset(XMLComponentManager)
/**
@@ -1322,7 +1324,8 @@
fAddDefaultAttr = true;
do {
scanAttribute(fAttributes);
- if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
+ if (fSecurityManager != null && !fSecurityManager.isNoLimit(fElementAttributeLimit) &&
+ fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) },
@@ -2036,6 +2039,13 @@
} // getDriverName():String
+ /**
+ * Check the protocol used in the systemId against allowed protocols
+ *
+ * @param systemId the Id of the URI
+ * @param allowedProtocols a list of allowed protocols separated by comma
+ * @return the name of the protocol if rejected, null otherwise
+ */
String checkAccess(String systemId, String allowedProtocols) throws IOException {
String baseSystemId = fEntityScanner.getBaseSystemId();
String expandedSystemId = fEntityManager.expandSystemId(systemId, baseSystemId,fStrictURI);
@@ -2833,6 +2843,8 @@
if(DEBUG){
System.out.println("NOT USING THE BUFFER, STRING = " + fTempString.toString());
}
+ //check limit before returning event
+ checkLimit(fContentBuffer);
if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){
if(DEBUG)System.out.println("Return SPACE EVENT");
return XMLEvent.SPACE;
@@ -2931,6 +2943,8 @@
fLastSectionWasCharacterData = true ;
continue;
}else{
+ //check limit before returning event
+ checkLimit(fContentBuffer);
if(dtdGrammarUtil!= null && dtdGrammarUtil.isIgnorableWhiteSpace(fContentBuffer)){
if(DEBUG)System.out.println("Return SPACE EVENT");
return XMLEvent.SPACE;
@@ -3141,6 +3155,30 @@
} //while loop
}//next
+ /**
+ * Add the count of the content buffer and check if the accumulated
+ * value exceeds the limit
+ * @param buffer content buffer
+ */
+ protected void checkLimit(XMLStringBuffer buffer) {
+ if (fLimitAnalyzer.isTracking(fCurrentEntityName)) {
+ fLimitAnalyzer.addValue(Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntityName, buffer.length);
+ if (fSecurityManager.isOverLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT)) {
+ fSecurityManager.debugPrint();
+ reportFatalError("MaxEntitySizeLimit", new Object[]{fCurrentEntityName,
+ fLimitAnalyzer.getValue(Limit.GENEAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getLimit(Limit.GENEAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getStateLiteral(Limit.GENEAL_ENTITY_SIZE_LIMIT)});
+ }
+ if (fSecurityManager.isOverLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT)) {
+ fSecurityManager.debugPrint();
+ reportFatalError("TotalEntitySizeLimit",
+ new Object[]{fLimitAnalyzer.getTotalValue(Limit.TOTAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getLimit(Limit.TOTAL_ENTITY_SIZE_LIMIT),
+ fSecurityManager.getStateLiteral(Limit.TOTAL_ENTITY_SIZE_LIMIT)});
+ }
+ }
+ }
//
// Protected methods
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,9 +28,10 @@
import com.sun.org.apache.xerces.internal.impl.XMLEntityHandler;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.util.*;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
+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.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@@ -174,7 +175,6 @@
/** access external dtd: file protocol */
static final String EXTERNAL_ACCESS_DEFAULT = Constants.EXTERNAL_ACCESS_DEFAULT;
-
// recognized features and properties
/** Recognized features. */
@@ -307,6 +307,7 @@
/** used to restrict external access */
protected String fAccessExternalDTD = EXTERNAL_ACCESS_DEFAULT;
+
// settings
/**
@@ -324,9 +325,12 @@
*/
protected int fBufferSize = DEFAULT_BUFFER_SIZE;
- // stores defaults for entity expansion limit if it has
- // been set on the configuration.
- protected SecurityManager fSecurityManager = null;
+ /** Security Manager */
+ protected XMLSecurityManager fSecurityManager = null;
+
+ protected XMLLimitAnalyzer fLimitAnalyzer = null;
+
+ protected int entityExpansionIndex;
/**
* True if the document entity is standalone. This should really
@@ -352,10 +356,6 @@
/** XML 1.1 entity scanner. */
protected XMLEntityScanner fXML11EntityScanner;
- /** entity expansion limit (contains useful data if and only if
- fSecurityManager is non-null) */
- protected int fEntityExpansionLimit = 0;
-
/** count of entities expanded: */
protected int fEntityExpansionCount = 0;
@@ -833,6 +833,9 @@
fCurrentEntity.setEncodingExternallySpecified(encodingExternallySpecified);
fEntityScanner.setCurrentEntity(fCurrentEntity);
fResourceIdentifier.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
+ if (fLimitAnalyzer != null) {
+ fLimitAnalyzer.startEntity(name);
+ }
return encoding;
} //setupCurrentEntity(String, XMLInputSource, boolean, boolean): String
@@ -1294,10 +1297,13 @@
//expansions exceeds the entity expansion limit, parser will throw fatal error.
// Note that this represents the nesting level of open entities.
fEntityExpansionCount++;
- if( fSecurityManager != null && fEntityExpansionCount > fEntityExpansionLimit ){
- fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
- "EntityExpansionLimitExceeded",
- new Object[]{new Integer(fEntityExpansionLimit) },
+ if(fLimitAnalyzer != null) {
+ fLimitAnalyzer.addValue(entityExpansionIndex, name, 1);
+ }
+ if( fSecurityManager != null && fSecurityManager.isOverLimit(entityExpansionIndex)){
+ fSecurityManager.debugPrint();
+ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,"EntityExpansionLimitExceeded",
+ new Object[]{fSecurityManager.getLimitValueByIndex(entityExpansionIndex)},
XMLErrorReporter.SEVERITY_FATAL_ERROR );
// is there anything better to do than reset the counter?
// at least one can envision debugging applications where this might
@@ -1361,6 +1367,12 @@
if(fCurrentEntity != null){
//close the reader
try{
+ if (fLimitAnalyzer != null) {
+ fLimitAnalyzer.endEntity(XMLSecurityManager.Limit.GENEAL_ENTITY_SIZE_LIMIT, fCurrentEntity.name);
+ if (fCurrentEntity.name.equals("[xml]")) {
+ fSecurityManager.debugPrint();
+ }
+ }
fCurrentEntity.close();
}catch(IOException ex){
throw new XNIException(ex);
@@ -1426,6 +1438,9 @@
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) propertyManager.getProperty(XML_SECURITY_PROPERTY_MANAGER);
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
+ fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER);
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+
// initialize state
//fStandalone = false;
fEntities.clear();
@@ -1485,7 +1500,9 @@
fEntityResolver = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER, null);
fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER, null);
fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER, null);
- fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
+ fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER, null);
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
+ entityExpansionIndex = fSecurityManager.getIndex(Constants.JDK_ENTITY_EXPANSION_LIMIT);
// JAXP 1.5 feature
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager) componentManager.getProperty(XML_SECURITY_PROPERTY_MANAGER, null);
@@ -1506,7 +1523,6 @@
// a class acting as a component manager but not
// implementing that interface for whatever reason.
public void reset() {
- fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
// initialize state
fStandalone = false;
@@ -1642,8 +1658,8 @@
}
if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
- fSecurityManager = (SecurityManager)value;
- fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
+ fSecurityManager = (XMLSecurityManager)value;
+ fLimitAnalyzer = fSecurityManager.getLimitAnalyzer();
}
}
@@ -1652,9 +1668,8 @@
{
XMLSecurityPropertyManager spm = (XMLSecurityPropertyManager)value;
fAccessExternalDTD = spm.getValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD);
+ }
}
- }
-
/**
* Returns a list of property identifiers that are recognized by
* this component. This method may return null if no properties
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -58,6 +58,7 @@
* @author Neeraj Bajaj, Sun Microsystems
* @author Venugopal Rao K, Sun Microsystems
* @author Elena Litani, IBM
+ * @version $Id: XMLNSDocumentScannerImpl.java,v 1.11 2010-11-01 04:39:41 joehw Exp $
*/
public class XMLNSDocumentScannerImpl
extends XMLDocumentScannerImpl {
@@ -251,7 +252,8 @@
do {
scanAttribute(fAttributes);
- if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
+ if (fSecurityManager != null && (!fSecurityManager.isNoLimit(fElementAttributeLimit)) &&
+ fAttributes.getLength() > fElementAttributeLimit){
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ElementAttributeLimit",
new Object[]{rawname, new Integer(fAttributes.getLength()) },
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java Mon Oct 28 12:28:57 2013 -0700
@@ -32,6 +32,8 @@
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLResourceIdentifierImpl;
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.Augmentations;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.XMLResourceIdentifier;
@@ -106,6 +108,9 @@
protected static final String ENTITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
+
// debugging
/** Debug attribute normalization. */
@@ -159,6 +164,12 @@
/** xxx this should be available from EntityManager Entity storage */
protected XMLEntityStorage fEntityStore = null ;
+ /** Security manager. */
+ protected XMLSecurityManager fSecurityManager = null;
+
+ /** Limit analyzer. */
+ protected XMLLimitAnalyzer fLimitAnalyzer = null;
+
// protected data
/** event type */
@@ -256,6 +267,7 @@
fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER);
+ fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);
//this step is extra because we have separated the storage of entity
fEntityStore = fEntityManager.getEntityStore() ;
@@ -293,6 +305,10 @@
fEntityManager = (XMLEntityManager)value;
}
}
+
+ if (propertyId.equals(SECURITY_MANAGER)) {
+ fSecurityManager = (XMLSecurityManager)value;
+ }
/*else if(propertyId.equals(Constants.STAX_PROPERTIES)){
fStaxProperties = (HashMap)value;
//TODO::discuss with neeraj what are his thoughts on passing properties.
@@ -352,6 +368,8 @@
fEntityManager = (XMLEntityManager)propertyManager.getProperty(ENTITY_MANAGER);
fEntityStore = fEntityManager.getEntityStore() ;
fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner() ;
+ fSecurityManager = (XMLSecurityManager)propertyManager.getProperty(SECURITY_MANAGER);
+
//fEntityManager.reset();
// DTD preparsing defaults:
fValidation = false;
@@ -499,7 +517,7 @@
reportFatalError("SDDeclInvalid", new Object[] {standalone});
}
} else {
- reportFatalError("EncodingDeclRequired", null);
+ reportFatalError("SDDeclNameInvalid", null);
}
break;
}
@@ -510,8 +528,9 @@
sawSpace = fEntityScanner.skipSpaces();
}
// restore original literal value
- if(currLiteral)
+ if(currLiteral) {
currEnt.literal = true;
+ }
// REVISIT: should we remove this error reporting?
if (scanningTextDecl && state != STATE_DONE) {
reportFatalError("MorePseudoAttributes", null);
@@ -564,7 +583,7 @@
XMLString value)
throws IOException, XNIException {
- String name = fEntityScanner.scanName();
+ String name = scanPseudoAttributeName();
// XMLEntityManager.print(fEntityManager.getCurrentEntity());
if (name == null) {
@@ -617,6 +636,35 @@
} // scanPseudoAttribute(XMLString):String
/**
+ * Scans the name of a pseudo attribute. The only legal names
+ * in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'.
+ *
+ * @return the name of the pseudo attribute or <code>null</code>
+ * if a legal pseudo attribute name could not be scanned.
+ */
+ private String scanPseudoAttributeName() throws IOException, XNIException {
+ final int ch = fEntityScanner.peekChar();
+ switch (ch) {
+ case 'v':
+ if (fEntityScanner.skipString(fVersionSymbol)) {
+ return fVersionSymbol;
+ }
+ break;
+ case 'e':
+ if (fEntityScanner.skipString(fEncodingSymbol)) {
+ return fEncodingSymbol;
+ }
+ break;
+ case 's':
+ if (fEntityScanner.skipString(fStandaloneSymbol)) {
+ return fStandaloneSymbol;
+ }
+ break;
+ }
+ return null;
+ } // scanPseudoAttributeName()
+
+ /**
* Scans a processing instruction.
* <p>
* <pre>
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties Mon Oct 28 12:28:57 2013 -0700
@@ -44,6 +44,7 @@
# 2.9 Standalone Document Declaration
SDDeclInvalid = The standalone document declaration value must be \"yes\" or \"no\", not \"{0}\".
+ SDDeclNameInvalid = The standalone name in XML declaration may be misspelled.
# 2.12 Language Identification
XMLLangInvalid = The xml:lang attribute value \"{0}\" is an invalid language identifier.
# 3. Logical Structures
@@ -292,8 +293,10 @@
InvalidCharInLiteral=InvalidCharInLiteral
-#Application can set the limit of number of entities that should be expanded by the parser.
-EntityExpansionLimitExceeded=The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the application.
+# Implementation limits
+ EntityExpansionLimitExceeded=JAXP00010001: The parser has encountered more than \"{0}\" entity expansions in this document; this is the limit imposed by the JDK.
+ ElementAttributeLimit=JAXP00010002: Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the JDK.
+ MaxEntitySizeLimit=JAXP00010003: The length of entity \"{0}\" is \"{1}\" that exceeds the \"{2}\" limit set by \"{3}\".
+ TotalEntitySizeLimit=JAXP00010004: The accumulated size \"{0}\" of entities exceeded the \"{1}\" limit set by \"{2}\".
+ MaxXMLNameLimit=JAXP00010005: The name \"{0}\" exceeded the \"{1}\" limit set by \"{2}\".
-# Application can set the limit of number of attributes of entity that should be expanded by the parser.
-ElementAttributeLimit= Element \"{0}\" has more than \"{1}\" attributes, \"{1}\" is the limit imposed by the application.
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/XPath.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xpath/XPath.java Mon Oct 28 12:28:57 2013 -0700
@@ -1422,7 +1422,7 @@
}
ch = data.charAt(currentOffset);
} while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D);
- if (currentOffset == endOffset || ch == '|') {
+ if (currentOffset == endOffset || ch == '|' || ch == '/') {
addToken(tokens, XPath.Tokens.EXPRTOKEN_PERIOD);
starIsMultiplyOperator = true;
break;
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMNodeFactory.java Mon Oct 28 12:28:57 2013 -0700
@@ -21,13 +21,13 @@
package com.sun.org.apache.xerces.internal.impl.xs.models;
+import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
-import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
-import com.sun.org.apache.xerces.internal.util.SecurityManager ;
import com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode;
+import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
-import com.sun.org.apache.xerces.internal.impl.xs.XSMessageFormatter;
-import com.sun.org.apache.xerces.internal.impl.Constants;
/**
*
@@ -68,7 +68,7 @@
// stores defaults for different security holes (maxOccurLimit in current context) if it has
// been set on the configuration.
- private SecurityManager fSecurityManager = null;
+ private XMLSecurityManager fSecurityManager = null;
/** default constructor */
public CMNodeFactory() {
@@ -77,10 +77,10 @@
public void reset(XMLComponentManager componentManager){
fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
try {
- fSecurityManager = (SecurityManager)componentManager.getProperty(SECURITY_MANAGER);
+ fSecurityManager = (XMLSecurityManager)componentManager.getProperty(SECURITY_MANAGER);
//we are setting the limit of number of nodes to 3times the maxOccur value..
if(fSecurityManager != null){
- maxNodeLimit = fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY ;
+ maxNodeLimit = fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY ;
}
}
catch (XMLConfigurationException e) {
@@ -109,7 +109,8 @@
}
public void nodeCountCheck(){
- if( fSecurityManager != null && nodeCount++ > maxNodeLimit){
+ if( fSecurityManager != null && !fSecurityManager.isNoLimit(maxNodeLimit) &&
+ nodeCount++ > maxNodeLimit){
if(DEBUG){
System.out.println("nodeCount = " + nodeCount ) ;
System.out.println("nodeLimit = " + maxNodeLimit ) ;
@@ -150,8 +151,9 @@
if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
- fSecurityManager = (SecurityManager)value;
- maxNodeLimit = (fSecurityManager != null) ? fSecurityManager.getMaxOccurNodeLimit() * MULTIPLICITY : 0 ;
+ fSecurityManager = (XMLSecurityManager)value;
+ maxNodeLimit = (fSecurityManager != null) ?
+ fSecurityManager.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT) * MULTIPLICITY : 0 ;
return;
}
if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() &&
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java Mon Oct 28 12:28:57 2013 -0700
@@ -40,6 +40,7 @@
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xs.XSConstants;
import java.util.HashMap;
@@ -1194,8 +1195,8 @@
if (!optimize) {
//Revisit :: IMO this is not right place to check
// maxOccurNodeLimit.
- int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit();
- if (max > maxOccurNodeLimit) {
+ int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getLimit(XMLSecurityManager.Limit.MAX_OCCUR_NODE_LIMIT);
+ if (max > maxOccurNodeLimit && !fSchemaHandler.fSecureProcessing.isNoLimit(maxOccurNodeLimit)) {
reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
// reset max values in case processing continues on error
--- a/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Mon Oct 28 12:28:57 2013 -0700
@@ -70,7 +70,6 @@
import com.sun.org.apache.xerces.internal.util.DefaultErrorHandler;
import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper;
import com.sun.org.apache.xerces.internal.util.SAXInputSource;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.StAXInputSource;
import com.sun.org.apache.xerces.internal.util.StAXLocationWrapper;
import com.sun.org.apache.xerces.internal.util.SymbolHash;
@@ -79,6 +78,7 @@
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
import com.sun.org.apache.xerces.internal.utils.SecuritySupport;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@@ -257,7 +257,7 @@
*
* <p>Protected to allow access by any traverser.</p>
*/
- protected SecurityManager fSecureProcessing = null;
+ protected XMLSecurityManager fSecureProcessing = null;
private String fAccessExternalSchema;
private String fAccessExternalDTD;
@@ -3509,7 +3509,7 @@
fSecureProcessing = null;
if( componentManager!=null ) {
- fSecureProcessing = (SecurityManager) componentManager.getProperty(SECURE_PROCESSING, null);
+ fSecureProcessing = (XMLSecurityManager) componentManager.getProperty(SECURE_PROCESSING, null);
}
//set entity resolver
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DefaultValidationErrorHandler.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DefaultValidationErrorHandler.java Mon Oct 28 12:28:57 2013 -0700
@@ -20,6 +20,8 @@
package com.sun.org.apache.xerces.internal.jaxp;
+import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
+import java.util.Locale;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
@@ -30,6 +32,11 @@
class DefaultValidationErrorHandler extends DefaultHandler {
static private int ERROR_COUNT_LIMIT = 10;
private int errorCount = 0;
+ private Locale locale = Locale.getDefault();
+
+ public DefaultValidationErrorHandler(Locale locale) {
+ this.locale = locale;
+ }
// XXX Fix message i18n
public void error(SAXParseException e) throws SAXException {
@@ -38,11 +45,8 @@
return;
} else if (errorCount == 0) {
// Print a warning before the first error
- System.err.println("Warning: validation was turned on but an org.xml.sax.ErrorHandler was not");
- System.err.println("set, which is probably not what is desired. Parser will use a default");
- System.err.println("ErrorHandler to print the first " +
- ERROR_COUNT_LIMIT + " errors. Please call");
- System.err.println("the 'setErrorHandler' method to fix this.");
+ System.err.println(SAXMessageFormatter.formatMessage(locale,
+ "errorHandlerNotSet", new Object [] {errorCount}));
}
String systemId = e.getSystemId();
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -36,7 +36,7 @@
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.Property;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager.State;
@@ -46,7 +46,6 @@
import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
-import javax.xml.XMLConstants;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.xml.sax.EntityResolver;
@@ -125,6 +124,7 @@
/** Initial EntityResolver */
private final EntityResolver fInitEntityResolver;
+ private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
DocumentBuilderImpl(DocumentBuilderFactoryImpl dbf, Hashtable dbfAttrs, Hashtable features)
@@ -141,7 +141,7 @@
// validation errors with a warning telling the user to set an
// ErrorHandler
if (dbf.isValidating()) {
- fInitErrorHandler = new DefaultValidationErrorHandler();
+ fInitErrorHandler = new DefaultValidationErrorHandler(domParser.getXMLParserConfiguration().getLocale());
setErrorHandler(fInitErrorHandler);
}
else {
@@ -173,10 +173,10 @@
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
domParser.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
- // If the secure processing feature is on set a security manager.
+ fSecurityManager = new XMLSecurityManager(secureProcessing);
+ domParser.setProperty(SECURITY_MANAGER, fSecurityManager);
+
if (secureProcessing) {
- domParser.setProperty(SECURITY_MANAGER, new SecurityManager());
-
/**
* If secure processing is explicitly set on the factory, the
* access properties will be set unless the corresponding
@@ -250,9 +250,9 @@
String feature = (String) entry.getKey();
boolean value = ((Boolean) entry.getValue()).booleanValue();
domParser.setFeature(feature, value);
- }
}
}
+ }
/**
* Set any DocumentBuilderFactory attributes of our underlying DOMParser
@@ -303,14 +303,17 @@
}
}
} else {
- int index = fSecurityPropertyMgr.getIndex(name);
- if (index > -1) {
- fSecurityPropertyMgr.setValue(index,
- XMLSecurityPropertyManager.State.APIPROPERTY, (String)val);
- } else {
- // Let Xerces code handle the property
- domParser.setProperty(name, val);
- }
+ //check if the property is managed by security manager
+ if (fSecurityManager == null ||
+ !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, val)) {
+ //check if the property is managed by security property manager
+ if (fSecurityPropertyMgr == null ||
+ !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, val)) {
+ //fall back to the existing property manager
+ domParser.setProperty(name, val);
+ }
+ }
+
}
}
}
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -20,22 +20,13 @@
package com.sun.org.apache.xerces.internal.jaxp;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.validation.Schema;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager;
import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator;
import com.sun.org.apache.xerces.internal.jaxp.validation.XSGrammarPoolContainer;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.Status;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
@@ -46,6 +37,14 @@
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import javax.xml.XMLConstants;
+import javax.xml.validation.Schema;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.HandlerBase;
@@ -112,6 +111,7 @@
/** Initial EntityResolver */
private final EntityResolver fInitEntityResolver;
+ private final XMLSecurityManager fSecurityManager;
private final XMLSecurityPropertyManager fSecurityPropertyMgr;
/**
@@ -130,10 +130,10 @@
SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing)
throws SAXException
{
+ fSecurityManager = new XMLSecurityManager(secureProcessing);
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
-
// Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader
- xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr);
+ xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr, fSecurityManager);
// JAXP "namespaceAware" == SAX Namespaces feature
// Note: there is a compatibility problem here with default values:
@@ -154,9 +154,9 @@
xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
- // If the secure processing feature is on set a security manager.
+ xmlReader.setProperty0(SECURITY_MANAGER, fSecurityManager);
+
if (secureProcessing) {
- xmlReader.setProperty0(SECURITY_MANAGER, new SecurityManager());
/**
* By default, secure processing is set, no external access is allowed.
* However, we need to check if it is actively set on the factory since we
@@ -164,6 +164,7 @@
* the default value
*/
if (features != null) {
+
Object temp = features.get(XMLConstants.FEATURE_SECURE_PROCESSING);
if (temp != null) {
boolean value = ((Boolean) temp).booleanValue();
@@ -185,7 +186,7 @@
// validation errors with a warning telling the user to set an
// ErrorHandler.
if (spf.isValidating()) {
- fInitErrorHandler = new DefaultValidationErrorHandler();
+ fInitErrorHandler = new DefaultValidationErrorHandler(xmlReader.getLocale());
xmlReader.setErrorHandler(fInitErrorHandler);
}
else {
@@ -398,28 +399,42 @@
private final HashMap fInitFeatures = new HashMap();
private final HashMap fInitProperties = new HashMap();
private final SAXParserImpl fSAXParser;
+ private XMLSecurityManager fSecurityManager;
private XMLSecurityPropertyManager fSecurityPropertyMgr;
public JAXPSAXParser() {
- this(null, null);
+ this(null, null, null);
}
- JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager spm) {
+ JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager securityPropertyMgr,
+ XMLSecurityManager securityManager) {
super();
fSAXParser = saxParser;
- fSecurityPropertyMgr = spm;
-
+ fSecurityManager = securityManager;
+ fSecurityPropertyMgr = securityPropertyMgr;
/**
* This class may be used directly. So initialize the security manager if
* it is null.
*/
+ if (fSecurityManager == null) {
+ fSecurityManager = new XMLSecurityManager(true);
+ try {
+ super.setProperty(SECURITY_MANAGER, fSecurityManager);
+ } catch (SAXException e) {
+ throw new UnsupportedOperationException(
+ SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+ "property-not-recognized", new Object [] {SECURITY_MANAGER}), e);
+ }
+ }
if (fSecurityPropertyMgr == null) {
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
try {
super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
- } catch (Exception ex) {
- //shall not happen
+ } catch (SAXException e) {
+ throw new UnsupportedOperationException(
+ SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+ "property-not-recognized", new Object [] {SECURITY_MANAGER}), e);
}
}
}
@@ -437,7 +452,8 @@
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
try {
- setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
+ fSecurityManager.setSecureProcessing(value);
+ setProperty(SECURITY_MANAGER, fSecurityManager);
}
catch (SAXNotRecognizedException exc) {
// If the property is not supported
@@ -473,13 +489,7 @@
throw new NullPointerException();
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
- try {
- return (super.getProperty(SECURITY_MANAGER) != null);
- }
- // If the property is not supported the value must be false.
- catch (SAXException exc) {
- return false;
- }
+ return fSecurityManager.isSecureProcessing();
}
return super.getFeature(name);
}
@@ -558,17 +568,21 @@
if (fSAXParser != null && fSAXParser.fSchemaValidator != null) {
setSchemaValidatorProperty(name, value);
}
- /** Check to see if the property is managed by the property manager **/
- int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
- if (index > -1) {
- fSecurityPropertyMgr.setValue(index,
- XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
- } else {
- if (!fInitProperties.containsKey(name)) {
- fInitProperties.put(name, super.getProperty(name));
+
+ //check if the property is managed by security manager
+ if (fSecurityManager == null ||
+ !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
+ //check if the property is managed by security property manager
+ if (fSecurityPropertyMgr == null ||
+ !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
+ //fall back to the existing property manager
+ if (!fInitProperties.containsKey(name)) {
+ fInitProperties.put(name, super.getProperty(name));
+ }
+ super.setProperty(name, value);
}
- super.setProperty(name, value);
}
+
}
public synchronized Object getProperty(String name)
@@ -581,9 +595,18 @@
// JAXP 1.2 support
return fSAXParser.schemaLanguage;
}
- int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
- if (index > -1) {
- return fSecurityPropertyMgr.getValueByIndex(index);
+
+ /** Check to see if the property is managed by the security manager **/
+ String propertyValue = (fSecurityManager != null) ?
+ fSecurityManager.getLimitAsString(name) : null;
+ if (propertyValue != null) {
+ return propertyValue;
+ } else {
+ propertyValue = (fSecurityPropertyMgr != null) ?
+ fSecurityPropertyMgr.getValue(name) : null;
+ if (propertyValue != null) {
+ return propertyValue;
+ }
}
return super.getProperty(name);
@@ -662,6 +685,10 @@
return super.getProperty(name);
}
+ Locale getLocale() {
+ return fConfiguration.getLocale();
+ }
+
private void setSchemaValidatorFeature(String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
try {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java Mon Oct 28 12:28:57 2013 -0700
@@ -26,6 +26,7 @@
package com.sun.org.apache.xerces.internal.jaxp.validation;
import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import java.io.IOException;
import javax.xml.transform.Result;
@@ -73,6 +74,19 @@
SAXTransformerFactory tf = fComponentManager.getFeature(Constants.ORACLE_FEATURE_SERVICE_MECHANISM) ?
(SAXTransformerFactory)SAXTransformerFactory.newInstance()
: (SAXTransformerFactory) TransformerFactory.newInstance(DEFAULT_TRANSFORMER_IMPL, StAXValidatorHelper.class.getClassLoader());
+ XMLSecurityManager securityManager = (XMLSecurityManager)fComponentManager.getProperty(Constants.SECURITY_MANAGER);
+ if (securityManager != null) {
+ for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
+ if (securityManager.isSet(limit.ordinal())){
+ tf.setAttribute(limit.apiProperty(),
+ securityManager.getLimitValueAsString(limit));
+ }
+ }
+ if (securityManager.printEntityCountInfo()) {
+ tf.setAttribute(Constants.JDK_ENTITY_COUNT_INFO, "yes");
+ }
+ }
+
identityTransformer1 = tf.newTransformer();
identityTransformer2 = tf.newTransformerHandler();
} catch (TransformerConfigurationException e) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/StreamValidatorHelper.java Mon Oct 28 12:28:57 2013 -0700
@@ -20,28 +20,27 @@
package com.sun.org.apache.xerces.internal.jaxp.validation;
-import java.lang.ref.SoftReference;
-import java.io.IOException;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.XMLConstants;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter;
import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter;
import com.sun.org.apache.xerces.internal.parsers.XML11Configuration;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
+import java.io.IOException;
+import java.lang.ref.SoftReference;
+import javax.xml.XMLConstants;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
import org.xml.sax.SAXException;
/**
@@ -86,6 +85,11 @@
Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
private static final String DEFAULT_TRANSFORMER_IMPL = "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl";
+
+ /** Property id: security manager. */
+ private static final String SECURITY_MANAGER =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+
//
// Data
//
@@ -165,6 +169,9 @@
private XMLParserConfiguration initialize() {
XML11Configuration config = new XML11Configuration();
+ if (fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+ config.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
+ }
config.setProperty(ENTITY_RESOLVER, fComponentManager.getProperty(ENTITY_RESOLVER));
config.setProperty(ERROR_HANDLER, fComponentManager.getProperty(ERROR_HANDLER));
XMLErrorReporter errorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
@@ -182,6 +189,8 @@
config.setDTDContentModelHandler(null);
config.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER,
fComponentManager.getProperty(Constants.XML_SECURITY_PROPERTY_MANAGER));
+ config.setProperty(Constants.SECURITY_MANAGER,
+ fComponentManager.getProperty(Constants.SECURITY_MANAGER));
fConfiguration = new SoftReference(config);
return config;
}
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -49,11 +49,11 @@
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.QName;
@@ -679,10 +679,12 @@
SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
spf.setNamespaceAware(true);
try {
+ spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING,
+ fComponentManager.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING));
reader = spf.newSAXParser().getXMLReader();
// If this is a Xerces SAX parser, set the security manager if there is one
if (reader instanceof com.sun.org.apache.xerces.internal.parsers.SAXParser) {
- SecurityManager securityManager = (SecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
+ XMLSecurityManager securityManager = (XMLSecurityManager) fComponentManager.getProperty(SECURITY_MANAGER);
if (securityManager != null) {
try {
reader.setProperty(SECURITY_MANAGER, securityManager);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java Mon Oct 28 12:28:57 2013 -0700
@@ -41,10 +41,10 @@
import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper;
import com.sun.org.apache.xerces.internal.util.SAXInputSource;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.StAXInputSource;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.XMLGrammarPoolImpl;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.Grammar;
@@ -79,7 +79,7 @@
private static final String XMLGRAMMAR_POOL =
Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
- /** Property identifier: SecurityManager. */
+ /** Property identifier: XMLSecurityManager. */
private static final String SECURITY_MANAGER =
Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
@@ -108,7 +108,7 @@
private ErrorHandlerWrapper fErrorHandlerWrapper;
/** The SecurityManager. */
- private SecurityManager fSecurityManager;
+ private XMLSecurityManager fSecurityManager;
/** The Security property manager. */
private XMLSecurityPropertyManager fSecurityPropertyMgr;
@@ -141,7 +141,7 @@
fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
// Enable secure processing feature by default
- fSecurityManager = new SecurityManager();
+ fSecurityManager = new XMLSecurityManager(true);
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
fSecurityPropertyMgr = new XMLSecurityPropertyManager();
@@ -301,7 +301,7 @@
"FeatureNameNull", null));
}
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
- return (fSecurityManager != null);
+ return (fSecurityManager != null && fSecurityManager.isSecureProcessing());
}
try {
return fXMLSchemaLoader.getFeature(name);
@@ -365,17 +365,15 @@
SAXMessageFormatter.formatMessage(null,
"jaxp-secureprocessing-feature", null));
}
+
+ fSecurityManager.setSecureProcessing(value);
if (value) {
- fSecurityManager = new SecurityManager();
-
if (Constants.IS_JDK8_OR_ABOVE) {
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_SCHEMA,
XMLSecurityPropertyManager.State.FSP, Constants.EXTERNAL_ACCESS_DEFAULT_FSP);
}
- } else {
- fSecurityManager = null;
}
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
@@ -410,9 +408,17 @@
"ProperyNameNull", null));
}
if (name.equals(SECURITY_MANAGER)) {
- fSecurityManager = (SecurityManager) object;
+ fSecurityManager = XMLSecurityManager.convert(object, fSecurityManager);
fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
return;
+ } else if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) {
+ if (object == null) {
+ fSecurityPropertyMgr = new XMLSecurityPropertyManager();
+ } else {
+ fSecurityPropertyMgr = (XMLSecurityPropertyManager)object;
+ }
+ fXMLSchemaLoader.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+ return;
}
else if (name.equals(XMLGRAMMAR_POOL)) {
throw new SAXNotSupportedException(
@@ -420,12 +426,15 @@
"property-not-supported", new Object [] {name}));
}
try {
- int index = fSecurityPropertyMgr.getIndex(name);
- if (index > -1) {
- fSecurityPropertyMgr.setValue(index,
- XMLSecurityPropertyManager.State.APIPROPERTY, (String)object);
- } else {
- fXMLSchemaLoader.setProperty(name, object);
+ //check if the property is managed by security manager
+ if (fSecurityManager == null ||
+ !fSecurityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, object)) {
+ //check if the property is managed by security property manager
+ if (fSecurityPropertyMgr == null ||
+ !fSecurityPropertyMgr.setValue(name, XMLSecurityPropertyManager.State.APIPROPERTY, object)) {
+ //fall back to the existing property manager
+ fXMLSchemaLoader.setProperty(name, object);
+ }
}
}
catch (XMLConfigurationException e) {
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -39,10 +39,10 @@
import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
import com.sun.org.apache.xerces.internal.util.PropertyState;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponent;
@@ -181,7 +181,7 @@
private final HashMap fInitProperties = new HashMap();
/** Stores the initial security manager. */
- private final SecurityManager fInitSecurityManager;
+ private XMLSecurityManager fInitSecurityManager;
/** Stores the initial security property manager. */
private final XMLSecurityPropertyManager fSecurityPropertyMgr;
@@ -221,12 +221,6 @@
fComponents.put(ENTITY_RESOLVER, null);
fComponents.put(ERROR_HANDLER, null);
- if (System.getSecurityManager() != null) {
- _isSecureMode = true;
- setProperty(SECURITY_MANAGER, new SecurityManager());
- } else {
- fComponents.put(SECURITY_MANAGER, null);
- }
fComponents.put(SYMBOL_TABLE, new SymbolTable());
// setup grammar pool
@@ -241,15 +235,21 @@
addRecognizedParamsAndSetDefaults(fErrorReporter, grammarContainer);
addRecognizedParamsAndSetDefaults(fSchemaValidator, grammarContainer);
- // if the secure processing feature is set to true, add a security manager to the configuration
- Boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
- if (Boolean.TRUE.equals(secureProcessing)) {
- fInitSecurityManager = new SecurityManager();
+ boolean secureProcessing = grammarContainer.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING);
+ if (System.getSecurityManager() != null) {
+ _isSecureMode = true;
+ secureProcessing = true;
}
- else {
- fInitSecurityManager = null;
+
+ fInitSecurityManager = (XMLSecurityManager)
+ grammarContainer.getProperty(SECURITY_MANAGER);
+ if (fInitSecurityManager != null ) {
+ fInitSecurityManager.setSecureProcessing(secureProcessing);
+ } else {
+ fInitSecurityManager = new XMLSecurityManager(secureProcessing);
}
- fComponents.put(SECURITY_MANAGER, fInitSecurityManager);
+
+ setProperty(SECURITY_MANAGER, fInitSecurityManager);
//pass on properties set on SchemaFactory
fSecurityPropertyMgr = (XMLSecurityPropertyManager)
@@ -281,7 +281,7 @@
return FeatureState.is(fUseGrammarPoolOnly);
}
else if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
- return FeatureState.is(getProperty(SECURITY_MANAGER) != null);
+ return FeatureState.is(fInitSecurityManager.isSecureProcessing());
}
else if (SCHEMA_ELEMENT_DEFAULT.equals(featureId)) {
return FeatureState.is(true); //pre-condition: VALIDATION and SCHEMA_VALIDATION are always true
@@ -311,7 +311,9 @@
if (_isSecureMode && !value) {
throw new XMLConfigurationException(Status.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
}
- setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
+
+ fInitSecurityManager.setSecureProcessing(value);
+ setProperty(SECURITY_MANAGER, fInitSecurityManager);
if (value && Constants.IS_JDK8_OR_ABOVE) {
fSecurityPropertyMgr.setValue(XMLSecurityPropertyManager.Property.ACCESS_EXTERNAL_DTD,
@@ -390,10 +392,19 @@
fComponents.put(propertyId, value);
return;
}
- if (!fInitProperties.containsKey(propertyId)) {
- fInitProperties.put(propertyId, super.getProperty(propertyId));
+ //check if the property is managed by security manager
+ if (fInitSecurityManager == null ||
+ !fInitSecurityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) {
+ //check if the property is managed by security property manager
+ if (fSecurityPropertyMgr == null ||
+ !fSecurityPropertyMgr.setValue(propertyId, XMLSecurityPropertyManager.State.APIPROPERTY, value)) {
+ //fall back to the existing property manager
+ if (!fInitProperties.containsKey(propertyId)) {
+ fInitProperties.put(propertyId, super.getProperty(propertyId));
+ }
+ super.setProperty(propertyId, value);
+ }
}
- super.setProperty(propertyId, value);
}
/**
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/AbstractSAXParser.java Mon Oct 28 12:28:57 2013 -0700
@@ -20,18 +20,15 @@
package com.sun.org.apache.xerces.internal.parsers;
-import java.io.IOException;
-import java.util.Locale;
-
import com.sun.org.apache.xerces.internal.impl.Constants;
-import com.sun.org.apache.xerces.internal.util.Status;
-import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
+import com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper;
import com.sun.org.apache.xerces.internal.util.EntityResolverWrapper;
-import com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper;
import com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper;
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
+import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.SymbolHash;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.QName;
@@ -48,15 +45,17 @@
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
import com.sun.org.apache.xerces.internal.xs.ElementPSVI;
+import com.sun.org.apache.xerces.internal.xs.PSVIProvider;
+import java.io.IOException;
+import java.util.Locale;
+import javax.xml.XMLConstants;
import org.xml.sax.AttributeList;
-import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
import org.xml.sax.DocumentHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
import org.xml.sax.Parser;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
@@ -131,6 +130,10 @@
protected static final String DOM_NODE =
Constants.SAX_PROPERTY_PREFIX + Constants.DOM_NODE_PROPERTY;
+ /** Property id: security manager. */
+ private static final String SECURITY_MANAGER =
+ Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
+
/** Recognized properties. */
private static final String[] RECOGNIZED_PROPERTIES = {
LEXICAL_HANDLER,
@@ -1645,19 +1648,13 @@
// Drop through and perform default processing
//
}
-
- //
- // Xerces Features
- //
-
- /*
- else if (featureId.startsWith(XERCES_FEATURES_PREFIX)) {
- String feature = featureId.substring(XERCES_FEATURES_PREFIX.length());
- //
- // Drop through and perform default processing
- //
+ else if (featureId.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+ if (state) {
+ if (fConfiguration.getProperty(SECURITY_MANAGER )==null) {
+ fConfiguration.setProperty(SECURITY_MANAGER, new XMLSecurityManager());
+ }
+ }
}
- */
//
// Default handling
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java Mon Oct 28 12:28:57 2013 -0700
@@ -29,6 +29,7 @@
import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
import com.sun.org.apache.xerces.internal.util.Status;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
@@ -531,7 +532,54 @@
*/
public void setProperty(String propertyId, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
+ /**
+ * It's possible for users to set a security manager through the interface.
+ * If it's the old SecurityManager, convert it to the new XMLSecurityManager
+ */
+ if (propertyId.equals(Constants.SECURITY_MANAGER)) {
+ securityManager = XMLSecurityManager.convert(value, securityManager);
+ setProperty0(Constants.SECURITY_MANAGER, securityManager);
+ return;
+ }
+ if (propertyId.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) {
+ if (value == null) {
+ securityPropertyManager = new XMLSecurityPropertyManager();
+ } else {
+ securityPropertyManager = (XMLSecurityPropertyManager)value;
+ }
+ setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
+ return;
+ }
+ if (securityManager == null) {
+ securityManager = new XMLSecurityManager(true);
+ setProperty0(Constants.SECURITY_MANAGER, securityManager);
+ }
+
+ if (securityPropertyManager == null) {
+ securityPropertyManager = new XMLSecurityPropertyManager();
+ setProperty0(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
+ }
+ int index = securityPropertyManager.getIndex(propertyId);
+
+ if (index > -1) {
+ /**
+ * this is a direct call to this parser, not a subclass since
+ * internally the support of this property is done through
+ * XMLSecurityPropertyManager
+ */
+ securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
+ } else {
+ //check if the property is managed by security manager
+ if (!securityManager.setLimit(propertyId, XMLSecurityManager.State.APIPROPERTY, value)) {
+ //fall back to the default configuration to handle the property
+ setProperty0(propertyId, value);
+ }
+ }
+ }
+
+ public void setProperty0(String propertyId, Object value)
+ throws SAXNotRecognizedException, SAXNotSupportedException {
try {
fConfiguration.setProperty(propertyId, value);
}
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java Mon Oct 28 12:28:57 2013 -0700
@@ -185,9 +185,12 @@
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
- /** Property identifier: Security property manager. */
- protected static final String XML_SECURITY_PROPERTY_MANAGER =
- Constants.XML_SECURITY_PROPERTY_MANAGER;
+ /** Property identifier: Security property manager. */
+ protected static final String XML_SECURITY_PROPERTY_MANAGER =
+ Constants.XML_SECURITY_PROPERTY_MANAGER;
+
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
// debugging
@@ -334,6 +337,7 @@
JAXP_SCHEMA_SOURCE,
JAXP_SCHEMA_LANGUAGE,
LOCALE,
+ SECURITY_MANAGER,
XML_SECURITY_PROPERTY_MANAGER
};
addRecognizedProperties(recognizedProperties);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/NonValidatingConfiguration.java Mon Oct 28 12:28:57 2013 -0700
@@ -158,9 +158,12 @@
protected static final String LOCALE =
Constants.XERCES_PROPERTY_PREFIX + Constants.LOCALE_PROPERTY;
- /** Property identifier: Security property manager. */
- protected static final String XML_SECURITY_PROPERTY_MANAGER =
- Constants.XML_SECURITY_PROPERTY_MANAGER;
+ /** Property identifier: Security property manager. */
+ protected static final String XML_SECURITY_PROPERTY_MANAGER =
+ Constants.XML_SECURITY_PROPERTY_MANAGER;
+
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
// debugging
@@ -316,6 +319,7 @@
DATATYPE_VALIDATOR_FACTORY,
VALIDATION_MANAGER,
LOCALE,
+ SECURITY_MANAGER,
XML_SECURITY_PROPERTY_MANAGER
};
addRecognizedProperties(recognizedProperties);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java Mon Oct 28 12:28:57 2013 -0700
@@ -22,6 +22,7 @@
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
@@ -76,7 +77,7 @@
XMLGRAMMAR_POOL,
};
- XMLSecurityPropertyManager securityPropertyManager;
+
//
// Constructors
//
@@ -130,11 +131,36 @@
*/
public void setProperty(String name, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException {
+ /**
+ * It's possible for users to set a security manager through the interface.
+ * If it's the old SecurityManager, convert it to the new XMLSecurityManager
+ */
+ if (name.equals(Constants.SECURITY_MANAGER)) {
+ securityManager = XMLSecurityManager.convert(value, securityManager);
+ super.setProperty(Constants.SECURITY_MANAGER, securityManager);
+ return;
+ }
+ if (name.equals(Constants.XML_SECURITY_PROPERTY_MANAGER)) {
+ if (value == null) {
+ securityPropertyManager = new XMLSecurityPropertyManager();
+ } else {
+ securityPropertyManager = (XMLSecurityPropertyManager)value;
+ }
+ super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
+ return;
+ }
+
+ if (securityManager == null) {
+ securityManager = new XMLSecurityManager(true);
+ super.setProperty(Constants.SECURITY_MANAGER, securityManager);
+ }
+
if (securityPropertyManager == null) {
securityPropertyManager = new XMLSecurityPropertyManager();
+ super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
}
+
int index = securityPropertyManager.getIndex(name);
-
if (index > -1) {
/**
* this is a direct call to this parser, not a subclass since
@@ -142,9 +168,12 @@
* XMLSecurityPropertyManager
*/
securityPropertyManager.setValue(index, XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
- super.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
} else {
- super.setProperty(name, value);
+ //check if the property is managed by security manager
+ if (!securityManager.setLimit(name, XMLSecurityManager.State.APIPROPERTY, value)) {
+ //fall back to the default configuration to handle the property
+ super.setProperty(name, value);
+ }
}
}
} // class SAXParser
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/SecurityConfiguration.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,8 +23,8 @@
import com.sun.org.apache.xerces.internal.impl.Constants;
import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool;
import com.sun.org.apache.xerces.internal.xni.parser.XMLComponentManager;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
/**
* This configuration allows Xerces to behave in a security-conscious manner; that is,
@@ -44,6 +44,7 @@
*
* @author Neil Graham, IBM
*
+ * @version $Id: SecurityConfiguration.java,v 1.6 2010-11-01 04:40:09 joehw Exp $
*/
public class SecurityConfiguration extends XIncludeAwareParserConfiguration
{
@@ -107,7 +108,7 @@
super(symbolTable, grammarPool, parentSettings);
// create the SecurityManager property:
- setProperty(SECURITY_MANAGER_PROPERTY, new SecurityManager());
+ setProperty(SECURITY_MANAGER_PROPERTY, new XMLSecurityManager(true));
} // <init>(SymbolTable,XMLGrammarPool)
} // class SecurityConfiguration
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java Mon Oct 28 12:28:57 2013 -0700
@@ -52,6 +52,7 @@
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
import com.sun.org.apache.xerces.internal.util.PropertyState;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler;
import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler;
@@ -279,6 +280,8 @@
private static final String XML_SECURITY_PROPERTY_MANAGER =
Constants.XML_SECURITY_PROPERTY_MANAGER;
+ /** Property identifier: Security manager. */
+ private static final String SECURITY_MANAGER = Constants.SECURITY_MANAGER;
// debugging
@@ -449,26 +452,26 @@
XMLGrammarPool grammarPool,
XMLComponentManager parentSettings) {
- super(parentSettings);
+ super(parentSettings);
- // create a vector to hold all the components in use
- // XML 1.0 specialized components
- fComponents = new ArrayList();
- // XML 1.1 specialized components
- fXML11Components = new ArrayList();
- // Common components for XML 1.1. and XML 1.0
- fCommonComponents = new ArrayList();
+ // create a vector to hold all the components in use
+ // XML 1.0 specialized components
+ fComponents = new ArrayList();
+ // XML 1.1 specialized components
+ fXML11Components = new ArrayList();
+ // Common components for XML 1.1. and XML 1.0
+ fCommonComponents = new ArrayList();
- // create table for features and properties
- fFeatures = new HashMap();
- fProperties = new HashMap();
+ // create table for features and properties
+ fFeatures = new HashMap();
+ fProperties = new HashMap();
// add default recognized features
final String[] recognizedFeatures =
{
CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
- VALIDATION,
- NAMESPACES,
+ VALIDATION,
+ NAMESPACES,
NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
HONOUR_ALL_SCHEMALOCATIONS, NAMESPACE_GROWTH,
@@ -479,47 +482,47 @@
// features might not have been set and it would cause a
// not-recognized exception to be thrown. -Ac
XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING,
- EXTERNAL_GENERAL_ENTITIES,
- EXTERNAL_PARAMETER_ENTITIES,
- PARSER_SETTINGS,
- XMLConstants.FEATURE_SECURE_PROCESSING
+ EXTERNAL_GENERAL_ENTITIES,
+ EXTERNAL_PARAMETER_ENTITIES,
+ PARSER_SETTINGS,
+ XMLConstants.FEATURE_SECURE_PROCESSING
};
addRecognizedFeatures(recognizedFeatures);
- // set state for default features
- fFeatures.put(VALIDATION, Boolean.FALSE);
- fFeatures.put(NAMESPACES, Boolean.TRUE);
- fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
- fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
- fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
- fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
- fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
- fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
- fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
- fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
- fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
- fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
- fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
- fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
- fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
- fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
- fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+ // set state for default features
+ fFeatures.put(VALIDATION, Boolean.FALSE);
+ fFeatures.put(NAMESPACES, Boolean.TRUE);
+ fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
+ fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
+ fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
+ fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
+ fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
+ fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
+ fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
+ fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
+ fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
+ fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
+ fFeatures.put(NAMESPACE_GROWTH, Boolean.FALSE);
+ fFeatures.put(TOLERATE_DUPLICATES, Boolean.FALSE);
+ fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
+ fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
+ fFeatures.put(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
// add default recognized properties
final String[] recognizedProperties =
{
- SYMBOL_TABLE,
- ERROR_HANDLER,
- ENTITY_RESOLVER,
+ SYMBOL_TABLE,
+ ERROR_HANDLER,
+ ENTITY_RESOLVER,
ERROR_REPORTER,
ENTITY_MANAGER,
DOCUMENT_SCANNER,
DTD_SCANNER,
DTD_PROCESSOR,
DTD_VALIDATOR,
- DATATYPE_VALIDATOR_FACTORY,
- VALIDATION_MANAGER,
- SCHEMA_VALIDATOR,
- XML_STRING,
+ DATATYPE_VALIDATOR_FACTORY,
+ VALIDATION_MANAGER,
+ SCHEMA_VALIDATOR,
+ XML_STRING,
XMLGRAMMAR_POOL,
JAXP_SCHEMA_SOURCE,
JAXP_SCHEMA_LANGUAGE,
@@ -531,19 +534,20 @@
SCHEMA_NONS_LOCATION,
LOCALE,
SCHEMA_DV_FACTORY,
+ SECURITY_MANAGER,
XML_SECURITY_PROPERTY_MANAGER
};
addRecognizedProperties(recognizedProperties);
- if (symbolTable == null) {
- symbolTable = new SymbolTable();
- }
- fSymbolTable = symbolTable;
- fProperties.put(SYMBOL_TABLE, fSymbolTable);
+ if (symbolTable == null) {
+ symbolTable = new SymbolTable();
+ }
+ fSymbolTable = symbolTable;
+ fProperties.put(SYMBOL_TABLE, fSymbolTable);
fGrammarPool = grammarPool;
if (fGrammarPool != null) {
- fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
+ fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
}
fEntityManager = new XMLEntityManager();
@@ -579,8 +583,6 @@
fVersionDetector = new XMLVersionDetector();
- fProperties.put(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager());
-
// add message formatters
if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
--- a/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,6 +23,8 @@
import java.io.IOException;
import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager;
import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
@@ -78,6 +80,13 @@
/** The parser configuration. */
protected XMLParserConfiguration fConfiguration;
+ /** The XML Security Manager. */
+ XMLSecurityManager securityManager;
+
+ /** The XML Security Property Manager. */
+ XMLSecurityPropertyManager securityPropertyManager;
+
+
//
// Constructors
//
@@ -118,6 +127,15 @@
*/
public void parse(XMLInputSource inputSource)
throws XNIException, IOException {
+ // null indicates that the parser is called directly, initialize them
+ if (securityManager == null) {
+ securityManager = new XMLSecurityManager(true);
+ fConfiguration.setProperty(Constants.SECURITY_MANAGER, securityManager);
+ }
+ if (securityPropertyManager == null) {
+ securityPropertyManager = new XMLSecurityPropertyManager();
+ fConfiguration.setProperty(Constants.XML_SECURITY_PROPERTY_MANAGER, securityPropertyManager);
+ }
reset();
fConfiguration.parse(inputSource);
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SecurityManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -61,8 +61,6 @@
package com.sun.org.apache.xerces.internal.util;
import com.sun.org.apache.xerces.internal.impl.Constants;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
/**
* This class is a container for parser settings that relate to
* security, or more specifically, it is intended to be used to prevent denial-of-service
@@ -79,7 +77,6 @@
*
* @author Neil Graham, IBM
*
- * @version $Id: SecurityManager.java,v 1.5 2010-11-01 04:40:14 joehw Exp $
*/
public final class SecurityManager {
@@ -179,48 +176,40 @@
private void readSystemProperties(){
- //TODO: also read SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT
- try {
- String value = getSystemProperty(Constants.ENTITY_EXPANSION_LIMIT);
- if(value != null && !value.equals("")){
- entityExpansionLimit = Integer.parseInt(value);
- if (entityExpansionLimit < 0)
- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
- }
- else
- entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
- }catch(Exception ex){}
+ try {
+ String value = System.getProperty(Constants.ENTITY_EXPANSION_LIMIT);
+ if(value != null && !value.equals("")){
+ entityExpansionLimit = Integer.parseInt(value);
+ if (entityExpansionLimit < 0)
+ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+ }
+ else
+ entityExpansionLimit = DEFAULT_ENTITY_EXPANSION_LIMIT;
+ }catch(Exception ex){}
- try {
- String value = getSystemProperty(Constants.MAX_OCCUR_LIMIT);
- if(value != null && !value.equals("")){
- maxOccurLimit = Integer.parseInt(value);
- if (maxOccurLimit < 0)
- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
- }
- else
- maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
- }catch(Exception ex){}
+ try {
+ String value = System.getProperty(Constants.MAX_OCCUR_LIMIT);
+ if(value != null && !value.equals("")){
+ maxOccurLimit = Integer.parseInt(value);
+ if (maxOccurLimit < 0)
+ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+ }
+ else
+ maxOccurLimit = DEFAULT_MAX_OCCUR_NODE_LIMIT;
+ }catch(Exception ex){}
- try {
- String value = getSystemProperty(Constants.SYSTEM_PROPERTY_ELEMENT_ATTRIBUTE_LIMIT);
- if(value != null && !value.equals("")){
- fElementAttributeLimit = Integer.parseInt(value);
- if ( fElementAttributeLimit < 0)
- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
- }
- else
- fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+ try {
+ String value = System.getProperty(Constants.ELEMENT_ATTRIBUTE_LIMIT);
+ if(value != null && !value.equals("")){
+ fElementAttributeLimit = Integer.parseInt(value);
+ if ( fElementAttributeLimit < 0)
+ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
+ }
+ else
+ fElementAttributeLimit = DEFAULT_ELEMENT_ATTRIBUTE_LIMIT;
}catch(Exception ex){}
}
- private String getSystemProperty(final String propName) {
- return AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty(propName);
- }
- });
- }
} // class SecurityManager
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/SymbolTable.java Mon Oct 28 12:28:57 2013 -0700
@@ -173,7 +173,7 @@
for (int i = 0; i < length; i++) {
code = code * 37 + symbol.charAt(i);
}
- return code & 0x7FFFFFF;
+ return code & 0x7FFFFFFF;
} // hash(String):int
@@ -194,7 +194,7 @@
for (int i = 0; i < length; i++) {
code = code * 37 + buffer[offset + i];
}
- return code & 0x7FFFFFF;
+ return code & 0x7FFFFFFF;
} // hash(char[],int,int):int
--- a/jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java Mon Oct 28 12:28:57 2013 -0700
@@ -689,9 +689,13 @@
if (!initializeAuthority(uriSpec.substring(startPos, index))) {
index = startPos - 2;
}
- }
- else {
+ } else if (index < uriSpecLen) {
+ //Same as java.net.URI:
+ // DEVIATION: Allow empty authority prior to non-empty
+ // path, query component or fragment identifier
m_host = "";
+ } else {
+ throw new MalformedURIException("Expected authority.");
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLLimitAnalyzer.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,239 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can
+ * obtain a copy of the License at
+ * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
+ * or packager/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at packager/legal/LICENSE.txt.
+ *
+ * GPL Classpath Exception:
+ * Oracle designates this particular file as subject to the "Classpath"
+ * exception as provided by Oracle in the GPL Version 2 section of the License
+ * file that accompanied this code.
+ *
+ * Modifications:
+ * If applicable, add the following below the License Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyright [year] [name of copyright owner]"
+ *
+ * Contributor(s):
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.org.apache.xerces.internal.utils;
+
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager.Limit;
+import java.util.Formatter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A helper for analyzing entity expansion limits
+ *
+ * @author Joe Wang Oracle Corp.
+ *
+ */
+public final class XMLLimitAnalyzer {
+
+ /**
+ * Map old property names with the new ones
+ */
+ public static enum NameMap {
+ ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT),
+ MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT),
+ ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT);
+
+ final String newName;
+ final String oldName;
+
+ NameMap(String newName, String oldName) {
+ this.newName = newName;
+ this.oldName = oldName;
+ }
+
+ String getOldName(String newName) {
+ if (newName.equals(this.newName)) {
+ return oldName;
+ }
+ return null;
+ }
+ }
+
+ private XMLSecurityManager securityManager;
+ /**
+ * Max value accumulated for each property
+ */
+ private final int[] values;
+ /**
+ * Names of the entities corresponding to their max values
+ */
+ private final String[] names;
+ /**
+ * Total value of accumulated entities
+ */
+ private final int[] totalValue;
+
+ /**
+ * Maintain values of the top 10 elements in the process of parsing
+ */
+ private final Map[] caches;
+
+ private String entityStart, entityEnd;
+ /**
+ * Default constructor. Establishes default values for known security
+ * vulnerabilities.
+ */
+ public XMLLimitAnalyzer(XMLSecurityManager securityManager) {
+ this.securityManager = securityManager;
+ values = new int[Limit.values().length];
+ totalValue = new int[Limit.values().length];
+ names = new String[Limit.values().length];
+ caches = new Map[Limit.values().length];
+ }
+
+ /**
+ * Add the value to the current max count for the specified property
+ * To find the max value of all entities, set no limit
+ *
+ * @param limit the type of the property
+ * @param entityName the name of the entity
+ * @param value the value of the entity
+ */
+ public void addValue(Limit limit, String entityName, int value) {
+ addValue(limit.ordinal(), entityName, value);
+ }
+
+ /**
+ * Add the value to the current count by the index of the property
+ * @param index the index of the property
+ * @param entityName the name of the entity
+ * @param value the value of the entity
+ */
+ public void addValue(int index, String entityName, int value) {
+ if (index == Limit.ENTITY_EXPANSION_LIMIT.ordinal() ||
+ index == Limit.MAX_OCCUR_NODE_LIMIT.ordinal() ||
+ index == Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal()) {
+ totalValue[index] += value;
+ return;
+ }
+
+ Map<String, Integer> cache;
+ if (caches[index] == null) {
+ cache = new HashMap<String, Integer>(10);
+ caches[index] = cache;
+ } else {
+ cache = caches[index];
+ }
+
+ int accumulatedValue = value;
+ if (cache.containsKey(entityName)) {
+ accumulatedValue += cache.get(entityName).intValue();
+ cache.put(entityName, Integer.valueOf(accumulatedValue));
+ } else {
+ cache.put(entityName, Integer.valueOf(value));
+ }
+
+ if (accumulatedValue > values[index]) {
+ values[index] = accumulatedValue;
+ names[index] = entityName;
+ }
+
+
+ if (index == Limit.GENEAL_ENTITY_SIZE_LIMIT.ordinal() ||
+ index == Limit.PARAMETER_ENTITY_SIZE_LIMIT.ordinal()) {
+ totalValue[Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()] += value;
+ }
+ }
+
+ /**
+ * Return the value of the current max count for the specified property
+ *
+ * @param limit the property
+ * @return the value of the property
+ */
+ public int getValue(Limit limit) {
+ return values[limit.ordinal()];
+ }
+
+ public int getValue(int index) {
+ return values[index];
+ }
+ /**
+ * Return the total value accumulated so far
+ *
+ * @param limit the property
+ * @return the accumulated value of the property
+ */
+ public int getTotalValue(Limit limit) {
+ return totalValue[limit.ordinal()];
+ }
+
+ public int getTotalValue(int index) {
+ return totalValue[index];
+ }
+ /**
+ * Return the current max value (count or length) by the index of a property
+ * @param index the index of a property
+ * @return count of a property
+ */
+ public int getValueByIndex(int index) {
+ return values[index];
+ }
+
+ public void startEntity(String name) {
+ entityStart = name;
+ }
+
+ public boolean isTracking(String name) {
+ if (entityStart == null) {
+ return false;
+ }
+ return entityStart.equals(name);
+ }
+ /**
+ * Stop tracking the entity
+ * @param limit the limit property
+ * @param name the name of an entity
+ */
+ public void endEntity(Limit limit, String name) {
+ entityStart = "";
+ Map<String, Integer> cache = caches[limit.ordinal()];
+ if (cache != null) {
+ cache.remove(name);
+ }
+ }
+
+ public void debugPrint() {
+ Formatter formatter = new Formatter();
+ System.out.println(formatter.format("%30s %15s %15s %15s %30s",
+ "Property","Limit","Total size","Size","Entity Name"));
+
+ for (Limit limit : Limit.values()) {
+ formatter = new Formatter();
+ System.out.println(formatter.format("%30s %15d %15d %15d %30s",
+ limit.name(),
+ securityManager.getLimit(limit),
+ totalValue[limit.ordinal()],
+ values[limit.ordinal()],
+ names[limit.ordinal()]));
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,555 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.org.apache.xerces.internal.utils;
+
+import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.util.SecurityManager;
+
+/**
+ * This class manages standard and implementation-specific limitations.
+ *
+ */
+public final class XMLSecurityManager {
+
+ /**
+ * States of the settings of a property, in the order: default value, value
+ * set by FEATURE_SECURE_PROCESSING, jaxp.properties file, jaxp system
+ * properties, and jaxp api properties
+ */
+ public static enum State {
+ //this order reflects the overriding order
+
+ DEFAULT("default"), FSP("FEATURE_SECURE_PROCESSING"),
+ JAXPDOTPROPERTIES("jaxp.properties"), SYSTEMPROPERTY("system property"),
+ APIPROPERTY("property");
+
+ final String literal;
+ State(String literal) {
+ this.literal = literal;
+ }
+
+ String literal() {
+ return literal;
+ }
+ }
+
+ /**
+ * Limits managed by the security manager
+ */
+ public static enum Limit {
+
+ ENTITY_EXPANSION_LIMIT(Constants.JDK_ENTITY_EXPANSION_LIMIT, Constants.SP_ENTITY_EXPANSION_LIMIT, 0, 64000),
+ MAX_OCCUR_NODE_LIMIT(Constants.JDK_MAX_OCCUR_LIMIT, Constants.SP_MAX_OCCUR_LIMIT, 0, 5000),
+ ELEMENT_ATTRIBUTE_LIMIT(Constants.JDK_ELEMENT_ATTRIBUTE_LIMIT, Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, 0, 10000),
+ TOTAL_ENTITY_SIZE_LIMIT(Constants.JDK_TOTAL_ENTITY_SIZE_LIMIT, Constants.SP_TOTAL_ENTITY_SIZE_LIMIT, 0, 50000000),
+ GENEAL_ENTITY_SIZE_LIMIT(Constants.JDK_GENEAL_ENTITY_SIZE_LIMIT, Constants.SP_GENEAL_ENTITY_SIZE_LIMIT, 0, 0),
+ PARAMETER_ENTITY_SIZE_LIMIT(Constants.JDK_PARAMETER_ENTITY_SIZE_LIMIT, Constants.SP_PARAMETER_ENTITY_SIZE_LIMIT, 0, 1000000);
+
+ final String apiProperty;
+ final String systemProperty;
+ final int defaultValue;
+ final int secureValue;
+
+ Limit(String apiProperty, String systemProperty, int value, int secureValue) {
+ this.apiProperty = apiProperty;
+ this.systemProperty = systemProperty;
+ this.defaultValue = value;
+ this.secureValue = secureValue;
+ }
+
+ public boolean equalsAPIPropertyName(String propertyName) {
+ return (propertyName == null) ? false : apiProperty.equals(propertyName);
+ }
+
+ public boolean equalsSystemPropertyName(String propertyName) {
+ return (propertyName == null) ? false : systemProperty.equals(propertyName);
+ }
+
+ public String apiProperty() {
+ return apiProperty;
+ }
+
+ String systemProperty() {
+ return systemProperty;
+ }
+
+ int defaultValue() {
+ return defaultValue;
+ }
+
+ int secureValue() {
+ return secureValue;
+ }
+ }
+
+ /**
+ * Map old property names with the new ones
+ */
+ public static enum NameMap {
+
+ ENTITY_EXPANSION_LIMIT(Constants.SP_ENTITY_EXPANSION_LIMIT, Constants.ENTITY_EXPANSION_LIMIT),
+ MAX_OCCUR_NODE_LIMIT(Constants.SP_MAX_OCCUR_LIMIT, Constants.MAX_OCCUR_LIMIT),
+ ELEMENT_ATTRIBUTE_LIMIT(Constants.SP_ELEMENT_ATTRIBUTE_LIMIT, Constants.ELEMENT_ATTRIBUTE_LIMIT);
+ final String newName;
+ final String oldName;
+
+ NameMap(String newName, String oldName) {
+ this.newName = newName;
+ this.oldName = oldName;
+ }
+
+ String getOldName(String newName) {
+ if (newName.equals(this.newName)) {
+ return oldName;
+ }
+ return null;
+ }
+ }
+ private static final int NO_LIMIT = 0;
+ /**
+ * Values of the properties
+ */
+ private final int[] values;
+ /**
+ * States of the settings for each property
+ */
+ private State[] states;
+ /**
+ * Flag indicating if secure processing is set
+ */
+ boolean secureProcessing;
+
+ /**
+ * States that determine if properties are set explicitly
+ */
+ private boolean[] isSet;
+
+
+ private XMLLimitAnalyzer limitAnalyzer;
+ /**
+ * Index of the special entityCountInfo property
+ */
+ private int indexEntityCountInfo = 10000;
+ private String printEntityCountInfo = "";
+
+ /**
+ * Default constructor. Establishes default values for known security
+ * vulnerabilities.
+ */
+ public XMLSecurityManager() {
+ this(false);
+ }
+
+ /**
+ * Instantiate Security Manager in accordance with the status of
+ * secure processing
+ * @param secureProcessing
+ */
+ public XMLSecurityManager(boolean secureProcessing) {
+ limitAnalyzer = new XMLLimitAnalyzer(this);
+ values = new int[Limit.values().length];
+ states = new State[Limit.values().length];
+ isSet = new boolean[Limit.values().length];
+ this.secureProcessing = secureProcessing;
+ for (Limit limit : Limit.values()) {
+ if (secureProcessing) {
+ values[limit.ordinal()] = limit.secureValue;
+ states[limit.ordinal()] = State.FSP;
+ } else {
+ values[limit.ordinal()] = limit.defaultValue();
+ states[limit.ordinal()] = State.DEFAULT;
+ }
+ }
+ //read system properties or jaxp.properties
+ readSystemProperties();
+ }
+
+ /**
+ * Setting FEATURE_SECURE_PROCESSING explicitly
+ */
+ public void setSecureProcessing(boolean secure) {
+ secureProcessing = secure;
+ for (Limit limit : Limit.values()) {
+ if (secure) {
+ setLimit(limit.ordinal(), State.FSP, limit.secureValue());
+ } else {
+ setLimit(limit.ordinal(), State.FSP, limit.defaultValue());
+ }
+ }
+ }
+
+ /**
+ * Return the state of secure processing
+ * @return the state of secure processing
+ */
+ public boolean isSecureProcessing() {
+ return secureProcessing;
+ }
+
+
+ /**
+ * Set limit by property name and state
+ * @param propertyName property name
+ * @param state the state of the property
+ * @param value the value of the property
+ * @return true if the property is managed by the security manager; false
+ * if otherwise.
+ */
+ public boolean setLimit(String propertyName, State state, Object value) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ setLimit(index, state, value);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Set the value for a specific limit.
+ *
+ * @param limit the limit
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(Limit limit, State state, int value) {
+ setLimit(limit.ordinal(), state, value);
+ }
+
+ /**
+ * Set the value of a property by its index
+ *
+ * @param index the index of the property
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(int index, State state, Object value) {
+ if (index == indexEntityCountInfo) {
+ printEntityCountInfo = (String)value;
+ } else {
+ int temp = 0;
+ try {
+ temp = Integer.parseInt((String) value);
+ if (temp < 0) {
+ temp = 0;
+ }
+ } catch (NumberFormatException e) {}
+ setLimit(index, state, temp);
+ }
+ }
+
+ /**
+ * Set the value of a property by its index
+ *
+ * @param index the index of the property
+ * @param state the state of the property
+ * @param value the value of the property
+ */
+ public void setLimit(int index, State state, int value) {
+ if (index == indexEntityCountInfo) {
+ //if it's explicitly set, it's treated as yes no matter the value
+ printEntityCountInfo = Constants.JDK_YES;
+ } else {
+ //only update if it shall override
+ if (state.compareTo(states[index]) >= 0) {
+ values[index] = value;
+ states[index] = state;
+ isSet[index] = true;
+ }
+ }
+ }
+
+ /**
+ * Return the value of the specified property
+ *
+ * @param propertyName the property name
+ * @return the value of the property as a string. If a property is managed
+ * by this manager, its value shall not be null.
+ */
+ public String getLimitAsString(String propertyName) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ return getLimitValueByIndex(index);
+ }
+
+ return null;
+ }
+ /**
+ * Return the value of the specified property
+ *
+ * @param limit the property
+ * @return the value of the property
+ */
+ public int getLimit(Limit limit) {
+ return values[limit.ordinal()];
+ }
+
+ /**
+ * Return the value of a property by its ordinal
+ *
+ * @param limit the property
+ * @return value of a property
+ */
+ public String getLimitValueAsString(Limit limit) {
+ return Integer.toString(values[limit.ordinal()]);
+ }
+
+ /**
+ * Return the value of a property by its ordinal
+ *
+ * @param index the index of a property
+ * @return limit of a property as a string
+ */
+ public String getLimitValueByIndex(int index) {
+ if (index == indexEntityCountInfo) {
+ return printEntityCountInfo;
+ }
+
+ return Integer.toString(values[index]);
+ }
+
+ /**
+ * Return the state of the limit property
+ *
+ * @param limit the limit
+ * @return the state of the limit property
+ */
+ public State getState(Limit limit) {
+ return states[limit.ordinal()];
+ }
+
+ /**
+ * Return the state of the limit property
+ *
+ * @param limit the limit
+ * @return the state of the limit property
+ */
+ public String getStateLiteral(Limit limit) {
+ return states[limit.ordinal()].literal();
+ }
+
+ /**
+ * Get the index by property name
+ *
+ * @param propertyName property name
+ * @return the index of the property if found; return -1 if not
+ */
+ public int getIndex(String propertyName) {
+ for (Limit limit : Limit.values()) {
+ if (limit.equalsAPIPropertyName(propertyName)) {
+ //internally, ordinal is used as index
+ return limit.ordinal();
+ }
+ }
+ //special property to return entity count info
+ if (propertyName.equals(Constants.JDK_ENTITY_COUNT_INFO)) {
+ return indexEntityCountInfo;
+ }
+ return -1;
+ }
+
+ /**
+ * Check if there's no limit defined by the Security Manager
+ * @param limit
+ * @return
+ */
+ public boolean isNoLimit(int limit) {
+ return limit==NO_LIMIT;
+ }
+ /**
+ * Check if the size (length or count) of the specified limit property is
+ * over the limit
+ *
+ * @param limit the type of the limit property
+ * @param entityName the name of the entity
+ * @param size the size (count or length) of the entity
+ * @return true if the size is over the limit, false otherwise
+ */
+ public boolean isOverLimit(Limit limit, String entityName, int size) {
+ return isOverLimit(limit.ordinal(), entityName, size);
+ }
+
+ /**
+ * Check if the value (length or count) of the specified limit property is
+ * over the limit
+ *
+ * @param index the index of the limit property
+ * @param entityName the name of the entity
+ * @param size the size (count or length) of the entity
+ * @return true if the size is over the limit, false otherwise
+ */
+ public boolean isOverLimit(int index, String entityName, int size) {
+ if (values[index] == NO_LIMIT) {
+ return false;
+ }
+ if (size > values[index]) {
+ limitAnalyzer.addValue(index, entityName, size);
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check against cumulated value
+ *
+ * @param limit the type of the limit property
+ * @param size the size (count or length) of the entity
+ * @return true if the size is over the limit, false otherwise
+ */
+ public boolean isOverLimit(Limit limit) {
+ return isOverLimit(limit.ordinal());
+ }
+
+ public boolean isOverLimit(int index) {
+ if (values[index] == NO_LIMIT) {
+ return false;
+ }
+
+ if (index==Limit.ELEMENT_ATTRIBUTE_LIMIT.ordinal() ||
+ index==Limit.ENTITY_EXPANSION_LIMIT.ordinal() ||
+ index==Limit.TOTAL_ENTITY_SIZE_LIMIT.ordinal()) {
+ return (limitAnalyzer.getTotalValue(index) > values[index]);
+ } else {
+ return (limitAnalyzer.getValue(index) > values[index]);
+ }
+ }
+
+ public void debugPrint() {
+ if (printEntityCountInfo.equals(Constants.JDK_YES)) {
+ limitAnalyzer.debugPrint();
+ }
+ }
+
+ /**
+ * Return the limit analyzer
+ *
+ * @return the limit analyzer
+ */
+ public XMLLimitAnalyzer getLimitAnalyzer() {
+ return limitAnalyzer;
+ }
+
+ /**
+ * Set limit analyzer
+ *
+ * @param analyzer a limit analyzer
+ */
+ public void setLimitAnalyzer(XMLLimitAnalyzer analyzer) {
+ limitAnalyzer = analyzer;
+ }
+
+ /**
+ * Indicate if a property is set explicitly
+ * @param index
+ * @return
+ */
+ public boolean isSet(int index) {
+ return isSet[index];
+ }
+
+ public boolean printEntityCountInfo() {
+ return printEntityCountInfo.equals(Constants.JDK_YES);
+ }
+
+ /**
+ * Read from system properties, or those in jaxp.properties
+ */
+ private void readSystemProperties() {
+
+ for (Limit limit : Limit.values()) {
+ if (!getSystemProperty(limit, limit.systemProperty())) {
+ //if system property is not found, try the older form if any
+ for (NameMap nameMap : NameMap.values()) {
+ String oldName = nameMap.getOldName(limit.systemProperty());
+ if (oldName != null) {
+ getSystemProperty(limit, oldName);
+ }
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Read from system properties, or those in jaxp.properties
+ *
+ * @param property the type of the property
+ * @param sysPropertyName the name of system property
+ */
+ private boolean getSystemProperty(Limit limit, String sysPropertyName) {
+ try {
+ String value = SecuritySupport.getSystemProperty(sysPropertyName);
+ if (value != null && !value.equals("")) {
+ values[limit.ordinal()] = Integer.parseInt(value);
+ states[limit.ordinal()] = State.SYSTEMPROPERTY;
+ return true;
+ }
+
+ value = SecuritySupport.readJAXPProperty(sysPropertyName);
+ if (value != null && !value.equals("")) {
+ values[limit.ordinal()] = Integer.parseInt(value);
+ states[limit.ordinal()] = State.JAXPDOTPROPERTIES;
+ return true;
+ }
+ } catch (NumberFormatException e) {
+ //invalid setting
+ throw new NumberFormatException("Invalid setting for system property: " + limit.systemProperty());
+ }
+ return false;
+ }
+
+
+ /**
+ * Convert a value set through setProperty to XMLSecurityManager.
+ * If the value is an instance of XMLSecurityManager, use it to override the default;
+ * If the value is an old SecurityManager, convert to the new XMLSecurityManager.
+ *
+ * @param value user specified security manager
+ * @param securityManager an instance of XMLSecurityManager
+ * @return an instance of the new security manager XMLSecurityManager
+ */
+ static public XMLSecurityManager convert(Object value, XMLSecurityManager securityManager) {
+ if (value == null) {
+ if (securityManager == null) {
+ securityManager = new XMLSecurityManager(true);
+ }
+ return securityManager;
+ }
+ if (XMLSecurityManager.class.isAssignableFrom(value.getClass())) {
+ return (XMLSecurityManager)value;
+ } else {
+ if (securityManager == null) {
+ securityManager = new XMLSecurityManager(true);
+ }
+ if (SecurityManager.class.isAssignableFrom(value.getClass())) {
+ SecurityManager origSM = (SecurityManager)value;
+ securityManager.setLimit(Limit.MAX_OCCUR_NODE_LIMIT, State.APIPROPERTY, origSM.getMaxOccurNodeLimit());
+ securityManager.setLimit(Limit.ENTITY_EXPANSION_LIMIT, State.APIPROPERTY, origSM.getEntityExpansionLimit());
+ securityManager.setLimit(Limit.ELEMENT_ATTRIBUTE_LIMIT, State.APIPROPERTY, origSM.getElementAttrLimit());
+ }
+ return securityManager;
+ }
+ }
+}
--- a/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/utils/XMLSecurityPropertyManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -91,6 +91,24 @@
readSystemProperties();
}
+
+ /**
+ * Set limit by property name and state
+ * @param propertyName property name
+ * @param state the state of the property
+ * @param value the value of the property
+ * @return true if the property is managed by the security property manager;
+ * false if otherwise.
+ */
+ public boolean setValue(String propertyName, State state, Object value) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ setValue(index, state, (String)value);
+ return true;
+ }
+ return false;
+ }
+
/**
* Set the value for a specific property.
*
@@ -119,6 +137,23 @@
states[index] = state;
}
}
+
+
+ /**
+ * Return the value of the specified property
+ *
+ * @param propertyName the property name
+ * @return the value of the property as a string
+ */
+ public String getValue(String propertyName) {
+ int index = getIndex(propertyName);
+ if (index > -1) {
+ return getValueByIndex(index);
+ }
+
+ return null;
+ }
+
/**
* Return the value of the specified property
*
--- a/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java Mon Oct 28 12:28:57 2013 -0700
@@ -37,7 +37,6 @@
import com.sun.org.apache.xerces.internal.util.HTTPInputSource;
import com.sun.org.apache.xerces.internal.util.IntStack;
import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings;
-import com.sun.org.apache.xerces.internal.util.SecurityManager;
import com.sun.org.apache.xerces.internal.util.SymbolTable;
import com.sun.org.apache.xerces.internal.util.URI;
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl;
@@ -45,6 +44,7 @@
import com.sun.org.apache.xerces.internal.util.XMLChar;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.util.URI.MalformedURIException;
+import com.sun.org.apache.xerces.internal.utils.XMLSecurityManager;
import com.sun.org.apache.xerces.internal.xni.Augmentations;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.QName;
@@ -289,7 +289,7 @@
protected SymbolTable fSymbolTable;
protected XMLErrorReporter fErrorReporter;
protected XMLEntityResolver fEntityResolver;
- protected SecurityManager fSecurityManager;
+ protected XMLSecurityManager fSecurityManager;
protected XMLSecurityPropertyManager fSecurityPropertyMgr;
// these are needed for text include processing
@@ -517,8 +517,8 @@
// Get security manager.
try {
- SecurityManager value =
- (SecurityManager)componentManager.getProperty(
+ XMLSecurityManager value =
+ (XMLSecurityManager)componentManager.getProperty(
SECURITY_MANAGER);
if (value != null) {
@@ -674,7 +674,7 @@
return;
}
if (propertyId.equals(SECURITY_MANAGER)) {
- fSecurityManager = (SecurityManager)value;
+ fSecurityManager = (XMLSecurityManager)value;
if (fChildConfig != null) {
fChildConfig.setProperty(propertyId, value);
}
--- a/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,12 +25,15 @@
import com.sun.org.apache.xalan.internal.XalanConstants;
import com.sun.org.apache.xalan.internal.utils.FactoryImpl;
import com.sun.org.apache.xalan.internal.utils.SecuritySupport;
+import com.sun.org.apache.xalan.internal.utils.XMLSecurityManager;
import java.util.HashMap;
+
import javax.xml.XMLConstants;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
@@ -63,11 +66,15 @@
private HashMap m_inUse;
private boolean m_useServicesMechanism = true;
+
+ private boolean _secureProcessing;
/**
* protocols allowed for external DTD references in source file and/or stylesheet.
*/
private String _accessExternalDTD = XalanConstants.EXTERNAL_ACCESS_DEFAULT;
+ private XMLSecurityManager _xmlSecurityManager;
+
/**
* Hidden constructor
*/
@@ -118,7 +125,12 @@
// TransformerFactory creates a reader via the
// XMLReaderFactory if setXMLReader is not used
reader = XMLReaderFactory.createXMLReader();
-
+ try {
+ reader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, _secureProcessing);
+ } catch (SAXNotRecognizedException e) {
+ System.err.println("Warning: " + reader.getClass().getName() + ": "
+ + e.getMessage());
+ }
} catch (Exception e) {
try {
// If unable to create an instance, let's try to use
@@ -164,6 +176,21 @@
+ se.getMessage());
}
+ try {
+ if (_xmlSecurityManager != null) {
+ for (XMLSecurityManager.Limit limit : XMLSecurityManager.Limit.values()) {
+ reader.setProperty(limit.apiProperty(),
+ _xmlSecurityManager.getLimitValueAsString(limit));
+ }
+ if (_xmlSecurityManager.printEntityCountInfo()) {
+ reader.setProperty(XalanConstants.JDK_ENTITY_COUNT_INFO, XalanConstants.JDK_YES);
+ }
+ }
+ } catch (SAXException se) {
+ System.err.println("Warning: " + reader.getClass().getName() + ": "
+ + se.getMessage());
+ }
+
return reader;
}
@@ -195,11 +222,22 @@
}
/**
+ * Set feature
+ */
+ public void setFeature(String name, boolean value) {
+ if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+ _secureProcessing = value;
+ }
+ }
+
+ /**
* Get property value
*/
- public String getProperty(String name) {
+ public Object getProperty(String name) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
return _accessExternalDTD;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ return _xmlSecurityManager;
}
return null;
}
@@ -207,9 +245,11 @@
/**
* Set property.
*/
- public void setProperty(String name, String value) {
+ public void setProperty(String name, Object value) {
if (name.equals(XMLConstants.ACCESS_EXTERNAL_DTD)) {
_accessExternalDTD = (String)value;
+ } else if (name.equals(XalanConstants.SECURITY_MANAGER)) {
+ _xmlSecurityManager = (XMLSecurityManager)value;
}
}
}
--- a/jaxp/src/com/sun/org/apache/xpath/internal/XPathContext.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/com/sun/org/apache/xpath/internal/XPathContext.java Mon Oct 28 12:28:57 2013 -0700
@@ -99,8 +99,7 @@
* the DTMManager, it really is a proxy for this object, which
* is the real DTMManager.
*/
- protected DTMManager m_dtmManager = DTMManager.newInstance(
- com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory());
+ protected DTMManager m_dtmManager = null;
/**
* Return the DTMManager object. Though XPathContext context extends
--- a/jaxp/src/javax/xml/stream/FactoryFinder.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxp/src/javax/xml/stream/FactoryFinder.java Mon Oct 28 12:28:57 2013 -0700
@@ -253,7 +253,13 @@
// Use the system property first
try {
- String systemProp = ss.getSystemProperty(factoryId);
+
+ final String systemProp;
+ if (type.getName().equals(factoryId)) {
+ systemProp = ss.getSystemProperty(factoryId);
+ } else {
+ systemProp = System.getProperty(factoryId);
+ }
if (systemProp != null) {
dPrint("found system property, value=" + systemProp);
// There's a bug here - because 'cl' is ignored.
@@ -262,7 +268,8 @@
}
}
catch (SecurityException se) {
- if (debug) se.printStackTrace();
+ throw new FactoryConfigurationError(
+ "Failed to read factoryId '" + factoryId + "'", se);
}
// Try read $java.home/lib/stax.properties followed by
--- a/jaxws/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
df5d4d01642572e77fd3c01e4c8703ed3f6eec87 jdk8-b109
cc682329886be2fc26220fc30597ee4e5bba43ed jdk8-b110
32edc7a2c86696dfcbdb6ffae641ff153f8e34bd jdk8-b111
+dbdd5c76250928582cb5342bcf7b299a6007d538 jdk8-b112
--- a/jaxws/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
--- a/jaxws/makefiles/BuildJaxws.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/makefiles/BuildJaxws.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -57,7 +57,7 @@
COPY_FILES := $(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/JAXBContextFactory.java \
$(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/internal/xjc/runtime/ZeroOneBooleanAdapter.java \
$(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/xml/internal/ws/assembler/jaxws-tubes-default.xml, \
- ADD_JAVAC_FLAGS = -cp $(OUTPUT_ROOT)/jaxp/dist/lib/classes.jar))
+ ADD_JAVAC_FLAGS = -Xbootclasspath/p:$(OUTPUT_ROOT)/jaxp/dist/lib/classes.jar))
$(JAXWS_OUTPUTDIR)/jaxws_classes/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin: \
$(JAXWS_TOPDIR)/src/share/jaxws_classes/com/sun/tools/etc/META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/AbstractInstanceResolver.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
if (!method.isAccessible()) {
method.setAccessible(true);
}
- method.invoke(instance,args);
+ MethodUtil.invoke(instance,method, args);
} catch (IllegalAccessException e) {
throw new ServerRtException("server.rt.err",e);
} catch (InvocationTargetException e) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/InstanceResolver.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -232,7 +232,7 @@
public Object invoke(Packet p, Method m, Object... args) throws InvocationTargetException, IllegalAccessException {
T t = resolve(p);
try {
- return m.invoke(t, args );
+ return MethodUtil.invoke(t, m, args );
} finally {
postInvoke(p,t);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/server/MethodUtil.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * to java.lang,reflect.Method.invoke()
+ *
+ * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too!
+ */
+class MethodUtil {
+
+ private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
+ private static final Method INVOKE_METHOD;
+
+ static {
+ Method method;
+ try {
+ Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
+ method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
+ }
+ } catch (Throwable t) {
+ method = null;
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
+ }
+ }
+ INVOKE_METHOD = method;
+ }
+
+ static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
+ if (INVOKE_METHOD != null) {
+ // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
+ }
+ try {
+ return INVOKE_METHOD.invoke(null, method, target, args);
+ } catch (InvocationTargetException ite) {
+ // unwrap invocation exception added by reflection code ...
+ throw unwrapException(ite);
+ }
+ } else {
+ // other then Oracle JDK ...
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
+ }
+ return method.invoke(target, args);
+ }
+ }
+
+ private static InvocationTargetException unwrapException(InvocationTargetException ite) {
+ Throwable targetException = ite.getTargetException();
+ if (targetException != null && targetException instanceof InvocationTargetException) {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Unwrapping invocation target exception");
+ }
+ return (InvocationTargetException) targetException;
+ } else {
+ return ite;
+ }
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/MethodUtil.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.client.sei;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * to java.lang,reflect.Method.invoke()
+ * <p/>
+ * Be careful, copy of this class exists in several packages, iny modification must be done to other copies too!
+ */
+class MethodUtil {
+
+ private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
+ private static final Method INVOKE_METHOD;
+
+ static {
+ Method method;
+ try {
+ Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
+ method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
+ }
+ } catch (Throwable t) {
+ method = null;
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
+ }
+ }
+ INVOKE_METHOD = method;
+ }
+
+ static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
+ if (INVOKE_METHOD != null) {
+ // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
+ }
+ try {
+ return INVOKE_METHOD.invoke(null, method, target, args);
+ } catch (InvocationTargetException ite) {
+ // unwrap invocation exception added by reflection code ...
+ throw unwrapException(ite);
+ }
+ } else {
+ // other then Oracle JDK ...
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
+ }
+ return method.invoke(target, args);
+ }
+ }
+
+ private static InvocationTargetException unwrapException(InvocationTargetException ite) {
+ Throwable targetException = ite.getTargetException();
+ if (targetException != null && targetException instanceof InvocationTargetException) {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Unwrapping invocation target exception");
+ }
+ return (InvocationTargetException) targetException;
+ } else {
+ return ite;
+ }
+ }
+
+}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/sei/SEIStub.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,6 +28,7 @@
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import com.sun.xml.internal.ws.api.SOAPVersion;
+import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
import com.sun.xml.internal.ws.api.client.WSPortInfo;
import com.sun.xml.internal.ws.api.databinding.Databinding;
import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
@@ -36,12 +37,16 @@
import com.sun.xml.internal.ws.api.message.Packet;
import com.sun.xml.internal.ws.api.model.MEP;
import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
+import com.sun.xml.internal.ws.api.pipe.Fiber;
import com.sun.xml.internal.ws.api.pipe.Tube;
-import com.sun.xml.internal.ws.api.pipe.Fiber;
import com.sun.xml.internal.ws.api.server.Container;
import com.sun.xml.internal.ws.api.server.ContainerResolver;
import com.sun.xml.internal.ws.binding.BindingImpl;
-import com.sun.xml.internal.ws.client.*;
+import com.sun.xml.internal.ws.client.AsyncResponseImpl;
+import com.sun.xml.internal.ws.client.RequestContext;
+import com.sun.xml.internal.ws.client.ResponseContextReceiver;
+import com.sun.xml.internal.ws.client.Stub;
+import com.sun.xml.internal.ws.client.WSServiceDelegate;
import com.sun.xml.internal.ws.model.JavaMethodImpl;
import com.sun.xml.internal.ws.model.SOAPSEIModel;
import com.sun.xml.internal.ws.wsdl.OperationDispatcher;
@@ -50,6 +55,8 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.Map;
@@ -132,6 +139,7 @@
private final Map<Method, MethodHandler> methodHandlers = new HashMap<Method, MethodHandler>();
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ validateInputs(proxy, method);
Container old = ContainerResolver.getDefault().enterContainer(owner.getContainer());
try {
MethodHandler handler = methodHandlers.get(method);
@@ -155,6 +163,17 @@
}
}
+ private void validateInputs(Object proxy, Method method) {
+ if (proxy == null || !Proxy.isProxyClass(proxy.getClass())) {
+ throw new IllegalStateException("Passed object is not proxy!");
+ }
+ Class<?> declaringClass = method.getDeclaringClass();
+ if (method == null || declaringClass == null
+ || Modifier.isStatic(method.getModifiers())) {
+ throw new IllegalStateException("Invoking static method is not allowed!");
+ }
+ }
+
public final Packet doProcess(Packet request, RequestContext rc, ResponseContextReceiver receiver) {
return super.process(request, rc, receiver);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/MethodUtil.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.policy.privateutil;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Utility class to invoke sun.reflect.misc.MethodUtil.invoke() if available. If not (other then Oracle JDK) fallbacks
+ * to java.lang,reflect.Method.invoke()
+ */
+class MethodUtil {
+
+ private static final Logger LOGGER = Logger.getLogger(MethodUtil.class.getName());
+ private static final Method INVOKE_METHOD;
+
+ static {
+ Method method;
+ try {
+ Class<?> clazz = Class.forName("sun.reflect.misc.MethodUtil");
+ method = clazz.getMethod("invoke", Method.class, Object.class, Object[].class);
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil found; it will be used to invoke methods.");
+ }
+ } catch (Throwable t) {
+ method = null;
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Class sun.reflect.misc.MethodUtil not found, probably non-Oracle JVM");
+ }
+ }
+ INVOKE_METHOD = method;
+ }
+
+ static Object invoke(Object target, Method method, Object[] args) throws IllegalAccessException, InvocationTargetException {
+ if (INVOKE_METHOD != null) {
+ // sun.reflect.misc.MethodUtil.invoke(method, owner, args)
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method using sun.reflect.misc.MethodUtil");
+ }
+ try {
+ return INVOKE_METHOD.invoke(null, method, target, args);
+ } catch (InvocationTargetException ite) {
+ // unwrap invocation exception added by reflection code ...
+ throw unwrapException(ite);
+ }
+ } else {
+ // other then Oracle JDK ...
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Invoking method directly, probably non-Oracle JVM");
+ }
+ return method.invoke(target, args);
+ }
+ }
+
+ private static InvocationTargetException unwrapException(InvocationTargetException ite) {
+ Throwable targetException = ite.getTargetException();
+ if (targetException != null && targetException instanceof InvocationTargetException) {
+ if (LOGGER.isLoggable(Level.FINE)) {
+ LOGGER.log(Level.FINE, "Unwrapping invocation target exception");
+ }
+ return (InvocationTargetException) targetException;
+ } else {
+ return ite;
+ }
+ }
+
+}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java Mon Oct 28 10:52:07 2013 +0100
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/privateutil/PolicyUtils.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -282,13 +282,13 @@
/**
* Reflection utilities wrapper
*/
- public static class Reflection {
+ static class Reflection {
private static final PolicyLogger LOGGER = PolicyLogger.getLogger(PolicyUtils.Reflection.class);
/**
* Reflectively invokes specified method on the specified target
*/
- public static <T> T invoke(final Object target, final String methodName,
+ static <T> T invoke(final Object target, final String methodName,
final Class<T> resultClass, final Object... parameters) throws RuntimePolicyUtilsException {
Class[] parameterTypes;
if (parameters != null && parameters.length > 0) {
@@ -311,7 +311,7 @@
final Object[] parameters, final Class[] parameterTypes) throws RuntimePolicyUtilsException {
try {
final Method method = target.getClass().getMethod(methodName, parameterTypes);
- final Object result = method.invoke(target, parameters);
+ final Object result = MethodUtil.invoke(target, method,parameters);
return resultClass.cast(result);
} catch (IllegalArgumentException e) {
--- a/jdk/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -234,3 +234,4 @@
54e099776f08430d3a7f4feabd9f2ba886b55320 jdk8-b110
719befd87c7b96ae103c05730ca555227bfc0116 jdk8-b111
f002f5f3a16cca62e139cb8eed05ffaeb373587d jdk8-b112
+5b4261b4b72af53e8e178933ef6bc6c7f8cdbc60 jdk8-b113
--- a/jdk/make/common/Defs-macosx.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/make/common/Defs-macosx.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -85,6 +85,100 @@
CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
+# The Full Debug Symbols (FDS) default for VARIANT == OPT builds is
+# enabled with debug info files ZIP'ed to save space. For VARIANT !=
+# OPT builds, FDS is always enabled, after all a debug build without
+# debug info isn't very useful. The ZIP_DEBUGINFO_FILES option only has
+# meaning when FDS is enabled.
+#
+# If you invoke a build with FULL_DEBUG_SYMBOLS=0, then FDS will be
+# disabled for a VARIANT == OPT build.
+#
+# Note: Use of a different variable name for the FDS override option
+# versus the FDS enabled check is intentional (FULL_DEBUG_SYMBOLS
+# versus ENABLE_FULL_DEBUG_SYMBOLS). For auto build systems that pass
+# in options via environment variables, use of distinct variables
+# prevents strange behaviours. For example, in a VARIANT != OPT build,
+# the FULL_DEBUG_SYMBOLS environment variable will be 0, but the
+# ENABLE_FULL_DEBUG_SYMBOLS make variable will be 1. If the same
+# variable name is used, then different values can be picked up by
+# different parts of the build. Just to be clear, we only need two
+# variable names because the incoming option value can be overridden
+# in some situations, e.g., a VARIANT != OPT build.
+
+ifeq ($(VARIANT), OPT)
+ FULL_DEBUG_SYMBOLS ?= 1
+ ENABLE_FULL_DEBUG_SYMBOLS = $(FULL_DEBUG_SYMBOLS)
+else
+ # debug variants always get Full Debug Symbols (if available)
+ ENABLE_FULL_DEBUG_SYMBOLS = 1
+endif
+_JUNK_ := $(shell \
+ echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)")
+# since objcopy is optional, we set ZIP_DEBUGINFO_FILES later
+
+ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
+ ifeq ($(OS_NAME),darwin)
+ # MacOS X doesn't use OBJCOPY or STRIP_POLICY
+ OBJCOPY=
+ STRIP_POLICY=
+ ZIP_DEBUGINFO_FILES ?= 1
+ else
+ ifndef CROSS_COMPILE_ARCH
+ # Default OBJCOPY comes from GNU Binutils on Linux:
+ DEF_OBJCOPY=/usr/bin/objcopy
+ else
+ # Assume objcopy is part of the cross-compilation toolkit
+ DEF_OBJCOPY=$(COMPILER_PATH)/objcopy
+ endif
+ OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
+ ifneq ($(ALT_OBJCOPY),)
+ _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
+ # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
+ OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
+ endif
+
+ # Setting ENABLE_FULL_DEBUG_SYMBOLS=1 (and OBJCOPY) above enables the
+ # JDK build to import .debuginfo or .diz files from the HotSpot build.
+ # However, adding FDS support to the JDK build will occur in phases
+ # so a different make variable (LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
+ # and PROGRAM_SUPPORTS_FULL_DEBUG_SYMBOLS) is used to indicate that a
+ # particular library or program supports FDS.
+
+ ifeq ($(OBJCOPY),)
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo" \
+ "files. You may need to set ALT_OBJCOPY.")
+ ENABLE_FULL_DEBUG_SYMBOLS=0
+ else
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
+
+ # Library stripping policies for .debuginfo configs:
+ # all_strip - strips everything from the library
+ # min_strip - strips most stuff from the library; leaves
+ # minimum symbols
+ # no_strip - does not strip the library at all
+ #
+ # Oracle security policy requires "all_strip". A waiver was granted
+ # on 2011.09.01 that permits using "min_strip" in the Java JDK and
+ # Java JRE.
+ #
+ # Currently, STRIP_POLICY is only used when Full Debug Symbols
+ # is enabled.
+ STRIP_POLICY ?= min_strip
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
+
+ ZIP_DEBUGINFO_FILES ?= 1
+ endif
+ endif
+
+ _JUNK_ := $(shell \
+ echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)")
+endif
+
#
# Default optimization
#
--- a/jdk/make/common/Defs.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/make/common/Defs.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -508,12 +508,18 @@
# Convenient macros
#
-# Prepare $@ target, remove old one and making sure directory exists
+# Prepare $@ target, remove old one and making sure containing dir exists
define prep-target
$(MKDIR) -p $(@D)
$(RM) $@
endef
+# Prepare $@ target dir, remove old one and making sure containing dir exists
+define prep-target-dir
+$(MKDIR) -p $(@D)
+$(RM) -r $@
+endef
+
# Simple install of $< file to $@
define install-file
$(prep-target)
@@ -616,6 +622,26 @@
fi
endef
+# MacOS X strongly discourages 'cp -r' and provides 'cp -R' instead.
+# May need to have a MacOS X specific definition of install-import-dir
+# sometime in the future.
+define install-import-dir
+@$(ECHO) "ASSEMBLY_IMPORT: $@"
+$(prep-target-dir)
+$(CP) -r $< $@
+endef
+
+ifeq ($(PLATFORM), macosx)
+# On MacOS X, debug info is in .dSYM directories
+define install-import-debuginfo
+$(install-import-dir)
+endef
+else
+define install-import-debuginfo
+$(install-import-file)
+endef
+endif
+
define install-import-file
$(install-importonly-file)
endef
--- a/jdk/make/java/redist/Makefile Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/make/java/redist/Makefile Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -60,15 +60,24 @@
JVMDB_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).$(LIBRARY_SUFFIX)
JVMDTRACE_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).$(LIBRARY_SUFFIX)
-JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.debuginfo
JVM_DIZ_NAME = $(LIB_PREFIX)jvm.diz
-LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.debuginfo
LIBJSIG_DIZ_NAME = $(LIB_PREFIX)jsig.diz
-JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).debuginfo
JVMDB_DIZ_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).diz
-JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).debuginfo
JVMDTRACE_DIZ_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).diz
+ifeq ($(PLATFORM), macosx)
+ # Note: *.dSYM is a directory
+ JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.dSYM
+ LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.dSYM
+ JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).dSYM
+ JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).dSYM
+else
+ JVM_DEBUGINFO_NAME = $(LIB_PREFIX)jvm.debuginfo
+ LIBJSIG_DEBUGINFO_NAME = $(LIB_PREFIX)jsig.debuginfo
+ JVMDB_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DB_SUFFIX).debuginfo
+ JVMDTRACE_DEBUGINFO_NAME = $(LIB_PREFIX)jvm$(DTRACE_SUFFIX).debuginfo
+endif
+
CLASSSHARINGDATA_DIR = $(BUILDDIR)/tools/sharing
# Needed to do file copy
@@ -441,7 +450,7 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVM_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVM_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -459,7 +468,7 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(LIBJSIG_DEBUGINFO_NAME): $(HOTSPOT_IMPORT_PATH)/$(ARCH_VM_SUBDIR)/$(LIBJSIG_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -471,8 +480,8 @@
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# We don't create a symlink to a libjsig.diz file, but we do put
-# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
-# system does not like dangling symlinks.
+# the $(LIBJSIG_DEBUGINFO_NAME) symlink into a libjsig.diz file.
+# The aurora system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME) \
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(LIBJSIG_DIZ_NAME):
@@ -496,8 +505,8 @@
ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
# We don't create a symlink to a libjsig.diz file, but we do put
-# the libjsig.debuginfo symlink into a libjsig.diz file. The aurora
-# system does not like dangling symlinks.
+# the $(LIBJSIG_DEBUGINFO_NAME) symlink into a libjsig.diz file.
+# The aurora system does not like dangling symlinks.
ifeq ($(ZIP_DEBUGINFO_FILES),1)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(LIBJSIG_DIZ_NAME):
@$(prep-target)
@@ -531,10 +540,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -556,10 +565,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDB_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDB_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
endif
@@ -581,10 +590,10 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(CLIENT_LOCATION)/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(CLIENT_LOCATION)/64/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_CLIENT_PATH)/64/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
@@ -613,13 +622,13 @@
$(install-import-file)
else
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/64/$(JVMDTRACE_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/64/$(JVMDTRACE_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
$(LIB_LOCATION)/$(SERVER_LOCATION)/$(JVM_DEBUGINFO_NAME): $(HOTSPOT_SERVER_PATH)/$(JVM_DEBUGINFO_NAME)
- $(install-import-file)
+ $(install-import-debuginfo)
endif
endif
--- a/jdk/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
@@ -48,9 +46,7 @@
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
- solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
- solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
@@ -112,9 +108,7 @@
# JCK test targets in test/Makefile (no windows)
jprt.my.jck.test.target.set= \
- solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
- solaris_i586_5.10-product-c1-JCK7TESTRULE, \
solaris_x64_5.10-product-c2-JCK7TESTRULE, \
linux_i586_2.6-product-c1-JCK7TESTRULE, \
linux_x64_2.6-product-c2-JCK7TESTRULE
--- a/jdk/makefiles/CompileLaunchers.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/CompileLaunchers.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -574,9 +574,7 @@
BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
- BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
- endif
+ BUILD_LAUNCHERS += $(JAVA_RMI_CGI)
endif
# TODO:
--- a/jdk/makefiles/CompileNativeLibraries.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/CompileNativeLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -56,9 +56,7 @@
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
# elegant solution to this.
-WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
-WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
# not on other platforms.
@@ -71,3382 +69,23 @@
DEBUG_ALL_BINARIES := true
endif
-#
-# TODO replace with X_FLAGS / X_LIBS
-# and add them to configure
-#
-OPENWIN_LIB := $(OPENWIN_HOME)/lib
-
-##########################################################################################
-
-BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
-
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- BUILD_LIBFDLIBM_OPTIMIZATION := NONE
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
- STATIC_LIBRARY := fdlibm, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
- SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
- LANG := C, \
- OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
- CFLAGS_windows_debug := -DLOGGING, \
- ARFLAGS := $(ARFLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-else
-
-# On macosx the old build does partial (incremental) linking of fdlibm instead of
-# a plain static library.
- $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
- LIBRARY := fdlibm, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
- SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
- LANG := C, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
- LDFLAGS := -nostdlib -r -arch x86_64, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
- $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
- $(call install-file)
-
-endif
-BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
-
-##########################################################################################
-
-BUILD_LIBVERIFY_SRC := check_code.c check_format.c
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- BUILD_LIBVERIFY_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
- endif
-endif
-
-LIBVERIFY_OPTIMIZATION := HIGH
-ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
- LIBVERIFY_OPTIMIZATION := LOW
- endif
-endif
-
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
- LIBRARY := verify, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/common, \
- INCLUDE_FILES := $(BUILD_LIBVERIFY_SRC), \
- LANG := C, \
- OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
- CFLAGS := $(CFLAGS_JDKLIB), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libverify/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_posix := -ljvm -lc, \
- LDFLAGS_SUFFIX_windows := jvm.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=verify.dll" \
- -D "JDK_INTERNAL_NAME=verify" \
- -D "JDK_FTYPE=0x2L", \
- REORDER := $(BUILD_LIBVERIFY_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libverify, \
- DEBUG_SYMBOLS := true))
-
-BUILD_LIBRARIES += $(BUILD_LIBVERIFY)
-
-##########################################################################################
-
-LIBJAVA_SRC_DIRS := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
- $(JDK_TOPDIR)/src/share/native/java/lang \
- $(JDK_TOPDIR)/src/share/native/java/lang/ref \
- $(JDK_TOPDIR)/src/share/native/java/lang/reflect \
- $(JDK_TOPDIR)/src/share/native/java/io \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
- $(JDK_TOPDIR)/src/share/native/java/nio \
- $(JDK_TOPDIR)/src/share/native/java/security \
- $(JDK_TOPDIR)/src/share/native/common \
- $(JDK_TOPDIR)/src/share/native/sun/misc \
- $(JDK_TOPDIR)/src/share/native/sun/reflect \
- $(JDK_TOPDIR)/src/share/native/java/util \
- $(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
-else
- LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
-endif
-
-LIBJAVA_CFLAGS := $(foreach dir, $(LIBJAVA_SRC_DIRS), -I$(dir)) \
- -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
- -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
-
-LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
- -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
- -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
- -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"'
-
-ifneq (, $(JDK_UPDATE_VERSION))
- LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
-endif
-
-LIBJAVA_EXCLUDE_FILES := check_code.c check_format.c jspawnhelper.c
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
-else
- BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
- BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBJAVA_EXCLUDE_FILES += \
- UNIXProcess_md.c \
- UnixFileSystem_md.c \
- FileSystemPreferences.c
-else
- LIBJAVA_EXCLUDE_FILES += \
- ProcessImpl_md.c \
- WinNTFileSystem_md.c \
- dirent_md.c \
- WindowsPreferences.c \
- sun/security/provider/WinCAPISeedGenerator.c \
- sun/io/Win32ErrorMode.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- LIBJAVA_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
- endif
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
- LIBRARY := java, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBJAVA_SRC_DIRS), \
- EXCLUDES := fdlibm/src zip, \
- EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
- LANG := C, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBJAVA_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjava/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_posix := -ljvm -lverify, \
- LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
- LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
- LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
- -framework CoreFoundation \
- -framework Foundation \
- -framework Security -framework SystemConfiguration, \
- LDFLAGS_SUFFIX_windows := -export:winFileHandleOpen -export:handleLseek \
- jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
- shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \
- advapi32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=java.dll" \
- -D "JDK_INTERNAL_NAME=java" \
- -D "JDK_FTYPE=0x2L", \
- REORDER := $(LIBJAVA_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBJAVA)
-
-$(BUILD_LIBJAVA): $(LIBJLI_BINARY)
-
-$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
-
-$(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
-
-##########################################################################################
-
-BUILD_LIBMLIB_SRC := $(JDK_TOPDIR)/src/share/native/sun/awt/medialib
-BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
- -I$(BUILD_LIBMLIB_SRC) \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/medialib
-
-BUILD_LIBMLIB_LDLIBS :=
-BUILD_LIBMLIB_IMAGE_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libmlib_image/mapfile-vers
-
-BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
-
-ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
- BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
- LIBRARY := mlib_image, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBMLIB_SRC), \
- EXCLUDE_FILES := awt_ImagingLib.c mlib_c_ImageBlendTable.c, \
- LANG := C, \
- OPTIMIZATION := HIGHEST, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(BUILD_LIBMLIB_CFLAGS), \
- MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(BUILD_LIBMLIB_LDLIBS) \
- $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=mlib_image.dll" \
- -D "JDK_INTERNAL_NAME=mlib_image" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBMLIB_IMAGE): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE)
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
-
- BUILD_LIBMLIB_IMAGE_V_FILES := \
- mlib_v_ImageLookUp.c \
- mlib_ImageCreate.c \
- mlib_ImageAffine.c \
- mlib_ImageConvMxN.c \
- mlib_ImageConvKernelConvert.c \
- mlib_sys.c \
- mlib_ImageLookUp_64.c \
- mlib_ImageLookUp_Bit.c \
- mlib_ImageColorTrue2Index.c \
- mlib_c_ImageThresh1_U8.c \
- mlib_v_ImageLookUpS16S16Func.c \
- mlib_v_ImageLookUpS16S32Func.c \
- mlib_v_ImageLookUpS16U16Func.c \
- mlib_v_ImageLookUpS16U8Func.c \
- mlib_v_ImageLookUpS32S16Func.c \
- mlib_v_ImageLookUpS32S32Func.c \
- mlib_v_ImageLookUpS32U16Func.c \
- mlib_v_ImageLookUpS32U8Func.c \
- mlib_v_ImageLookUpSIS16S16Func.c \
- mlib_v_ImageLookUpSIS16S32Func.c \
- mlib_v_ImageLookUpSIS16U16Func.c \
- mlib_v_ImageLookUpSIS16U8Func.c \
- mlib_v_ImageLookUpSIS32S16Func.c \
- mlib_v_ImageLookUpSIS32S32Func.c \
- mlib_v_ImageLookUpSIS32U16Func.c \
- mlib_v_ImageLookUpSIS32U8Func.c \
- mlib_v_ImageLookUpSIU16S16Func.c \
- mlib_v_ImageLookUpSIU16S32Func.c \
- mlib_v_ImageLookUpSIU16U16Func.c \
- mlib_v_ImageLookUpSIU16U8Func.c \
- mlib_v_ImageLookUpSIU8S16Func.c \
- mlib_v_ImageLookUpSIU8S32Func.c \
- mlib_v_ImageLookUpSIU8U16Func.c \
- mlib_v_ImageLookUpSIU8U8Func.c \
- mlib_v_ImageLookUpU16S16Func.c \
- mlib_v_ImageLookUpU16S32Func.c \
- mlib_v_ImageLookUpU16U16Func.c \
- mlib_v_ImageLookUpU16U8Func.c \
- mlib_v_ImageLookUpU8S16Func.c \
- mlib_v_ImageLookUpU8S32Func.c \
- mlib_v_ImageLookUpU8U16Func.c \
- mlib_v_ImageLookUpU8U8Func.c \
- mlib_v_ImageAffineIndex_BC.c \
- mlib_v_ImageAffine_BC.c \
- mlib_v_ImageAffine_BC_S16.c \
- mlib_v_ImageAffine_BC_U16.c \
- mlib_v_ImageAffine_BL.c \
- mlib_v_ImageAffine_BL_S16.c \
- mlib_v_ImageAffine_BL_U16.c \
- mlib_v_ImageAffine_NN.c \
- mlib_v_ImageFilters.c \
- mlib_ImageAffineEdge.c \
- mlib_ImageAffine_BC_D64.c \
- mlib_ImageAffine_BC_F32.c \
- mlib_ImageAffine_BC_S32.c \
- mlib_ImageAffine_BL_D64.c \
- mlib_ImageAffine_BL_F32.c \
- mlib_ImageAffine_BL_S32.c \
- mlib_ImageAffine_NN.c \
- mlib_ImageAffine_NN_Bit.c \
- mlib_ImageFilters.c \
- mlib_ImageScanPoly.c \
- mlib_ImageConv_8nw.c \
- mlib_ImageConv_8ext.c \
- mlib_ImageConv_16nw.c \
- mlib_ImageConv_16ext.c \
- mlib_ImageConv_u16nw.c \
- mlib_ImageConv_u16ext.c \
- mlib_ImageConv_32nw.c \
- mlib_ImageConv_F32nw.c \
- mlib_ImageConvMxN_Fp.c \
- mlib_ImageConvMxN_ext.c \
- mlib_ImageConv_D64nw.c \
- mlib_ImageClipping.c \
- mlib_ImageConvCopyEdge_Bit.c \
- mlib_ImageConvClearEdge_Bit.c \
- mlib_ImageConv2x2_f.c \
- mlib_ImageConvClearEdge_Fp.c \
- mlib_v_ImageConvMxN_8.c \
- mlib_v_ImageConvClearEdge.c \
- mlib_v_ImageConvCopyEdge.c \
- mlib_v_ImageConvMxN_8ext.c \
- mlib_v_ImageConvVersion.c \
- mlib_v_ImageConv_8nw.c \
- mlib_ImageConvCopyEdge_Fp.c \
- mlib_v_ImageChannelInsert_1.c \
- mlib_v_ImageChannelExtract_43.c \
- mlib_v_ImageChannelExtract_1.c \
- mlib_ImageCopy_Bit.c \
- mlib_v_ImageCopy_f.c \
- mlib_ImageUtils.c \
- mlib_ImageDivTables.c
-
- BUILD_LIBMLIB_V_CFLAGS := $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V, \
- LIBRARY := mlib_image_v, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
- $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib, \
- LANG := C, \
- INCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_FILES), \
- OPTIMIZATION := HIGHEST, \
- CFLAGS := -xarch=sparcvis \
- $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il \
- $(BUILD_LIBMLIB_V_CFLAGS) \
- $(CFLAGS_JDKLIB), \
- MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image_v, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE_V)
-
-endif
-
-##########################################################################################
-
-LIBAWT_DIRS := \
- $(JDK_TOPDIR)/src/share/native/sun/awt \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/gif \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- $(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
- $(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- $(JDK_TOPDIR)/src/share/native/sun/awt/utility \
- $(JDK_TOPDIR)/src/share/native/sun/java2d \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/share/native/sun/font
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBAWT_DIRS += \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
-else
- LIBAWT_DIRS += \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
-endif
-
-LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES \
- $(X_CFLAGS) \
- $(foreach dir, $(LIBAWT_DIRS), -I$(dir))
-
-LIBAWT_FILES := \
- gifdecoder.c \
- imageInitIDs.c \
- img_globals.c \
- SurfaceData.c \
- Region.c \
- BufImgSurfaceData.c \
- Disposer.c \
- Trace.c \
- GraphicsPrimitiveMgr.c \
- Blit.c \
- BlitBg.c \
- ScaledBlit.c \
- FillRect.c \
- FillSpans.c \
- FillParallelogram.c \
- DrawParallelogram.c \
- DrawLine.c \
- DrawRect.c \
- DrawPolygons.c \
- DrawPath.c \
- FillPath.c \
- ProcessPath.c \
- MaskBlit.c \
- MaskFill.c \
- TransformHelper.c \
- AlphaMath.c \
- AlphaMacros.c \
- AnyByte.c \
- ByteBinary1Bit.c \
- ByteBinary2Bit.c \
- ByteBinary4Bit.c \
- ByteIndexed.c \
- ByteGray.c \
- Index8Gray.c \
- Index12Gray.c \
- AnyShort.c \
- Ushort555Rgb.c \
- Ushort565Rgb.c \
- Ushort4444Argb.c \
- Ushort555Rgbx.c \
- UshortGray.c \
- UshortIndexed.c \
- Any3Byte.c \
- ThreeByteBgr.c \
- AnyInt.c \
- IntArgb.c \
- IntArgbPre.c \
- IntArgbBm.c \
- IntRgb.c \
- IntBgr.c \
- IntRgbx.c \
- Any4Byte.c \
- FourByteAbgr.c \
- FourByteAbgrPre.c \
- BufferedMaskBlit.c \
- BufferedRenderPipe.c \
- ShapeSpanIterator.c \
- SpanClipRenderer.c \
- awt_ImageRep.c \
- awt_ImagingLib.c \
- awt_Mlib.c \
- awt_parseImage.c \
- DataBufferNative.c \
- dither.c \
- debug_assert.c \
- debug_mem.c \
- debug_trace.c \
- debug_util.c
-
-ifneq (, $(filter $(OPENJDK_TARGET_OS), solaris linux))
- LIBAWT_FILES += awt_LoadLibrary.c initIDs.c img_colors.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
- LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
-endif
-
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
- LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
- LIBAWT_CFLAGS += -xarch=sparcvis
- LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il
- LIBAWT_CFLAGS += \
- -I$(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
- -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/medialib \
- -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops
-
- LIBAWT_DIRS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
- $(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops
-
- LIBAWT_FILES += \
- vis_FuncArray.c \
- java2d_Mlib.c \
- mlib_ImageCreate.c \
- mlib_ImageZoom_NN.c \
- mlib_ImageCopy_Bit.c \
- mlib_sys.c \
- mlib_v_ImageClear.c \
- mlib_v_ImageClear_f.c \
- mlib_v_ImageConstXor.c \
- mlib_v_ImageCopy.c \
- mlib_v_ImageCopy_f.c \
- mlib_v_ImageXor.c \
- mlib_v_ImageZoom_NN_f.c \
- vis_Interp.c \
- vis_AlphaMacros.c \
- vis_AlphaMaskBlit.c \
- vis_AlphaMaskFill.c \
- vis_ByteGray.c \
- vis_ByteGray_FromRgb.c \
- vis_ByteGray_Mask.c \
- vis_ByteIndexed.c \
- vis_DrawLine.c \
- vis_FourByteAbgr.c \
- vis_IntArgb.c \
- vis_IntArgbPre.c \
- vis_IntArgbPre_Mask.c \
- vis_IntBgr.c \
- vis_IntRgb.c \
- vis_IntRgbx.c \
- vis_SrcMaskFill.c \
- vis_SrcOverMaskBlit.c \
- vis_SrcOverMaskFill.c \
- vis_FourByteAbgrPre.c \
- vis_GlyphList.c \
- vis_GlyphListXor.c \
- vis_IntArgbBm.c \
- vis_ThreeByteBgr.c \
- vis_UshortGray.c \
- vis_UshortGray_FromRgb.c \
- vis_XorBlit.c \
- mlib_v_ImageCopy_blk.s
-
- ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
- LIBAWT_ASFLAGS = -P -xarch=v9a
- else
- LIBAWT_ASFLAGS = -P -xarch=v8plusa
- endif
-else
- LIBAWT_FILES += MapAccelFunc.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
-endif
-
-LIBAWT_LANG := C
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBAWT_FILES += AccelGlyphCache.c \
- ShaderList.c \
- CmdIDList.cpp \
- Hashtable.cpp \
- GDIHashtable.cpp \
- Devices.cpp \
- ObjectList.cpp \
- GDIBlitLoops.cpp \
- GDIRenderer.cpp \
- GDIWindowSurfaceData.cpp \
- WindowsFlags.cpp \
- WPrinterJob.cpp \
- awt_%.cpp \
- D3DBlitLoops.cpp \
- D3DBufImgOps.cpp \
- D3DContext.cpp \
- D3DGlyphCache.cpp \
- D3DGraphicsDevice.cpp \
- D3DMaskBlit.cpp \
- D3DMaskCache.cpp \
- D3DMaskFill.cpp \
- D3DPipelineManager.cpp \
- D3DPaints.cpp \
- D3DRenderer.cpp \
- D3DRenderQueue.cpp \
- D3DResourceManager.cpp \
- D3DSurfaceData.cpp \
- D3DTextRenderer.cpp \
- D3DVertexCacher.cpp \
- ShellFolder2.cpp \
- ThemeReader.cpp \
- ComCtl32Util.cpp \
- DllUtil.cpp \
- initIDs.cpp \
- MouseInfo.cpp \
- rect.c \
- OGLBlitLoops.c \
- OGLBufImgOps.c \
- OGLContext.c \
- OGLFuncs.c \
- OGLMaskBlit.c \
- OGLMaskFill.c \
- OGLPaints.c \
- OGLRenderQueue.c \
- OGLRenderer.c \
- OGLSurfaceData.c \
- OGLTextRenderer.c \
- OGLVertexCache.c \
- WGLGraphicsConfig.c \
- WGLSurfaceData.c
-
- LIBAWT_LANG := C++
- LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
- ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
- LIBAWT_CFLAGS += -DMLIB_OS64BIT
- endif
-
- ifdef OPENJDK
- LIBAWT_RC_FLAGS := -i "$(JDK_TOPDIR)/src/windows/resource/icons"
- else
- LIBAWT_RC_FLAGS := -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
- endif
- LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/native/sun/windows/awt.rc
-endif
-
-ifeq ($(MILESTONE), internal)
- LIBAWT_CFLAGS += -DINTERNAL_BUILD
-endif
-
-LIBAWT_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt/mapfile-vers
-ifeq ($(OPENJDK_TARGET_OS), linux)
- LIBAWT_MAPFILE :=
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
- LIBRARY := awt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBAWT_DIRS), \
- INCLUDE_FILES := $(LIBAWT_FILES), \
- LANG := $(LIBAWT_LANG), \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
- ASFLAGS := $(LIBAWT_ASFLAGS), \
- MAPFILE := $(LIBAWT_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_solaris := -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
- LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
- LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
- LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
- -framework Cocoa \
- -framework OpenGL \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -framework ApplicationServices \
- -framework AudioToolbox \
- -ljava, \
- LDFLAGS_SUFFIX_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
- imm32.lib ole32.lib uuid.lib shell32.lib \
- comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
- delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
- -DELAYLOAD:user32.dll -DELAYLOAD:gdi32.dll \
- -DELAYLOAD:shell32.dll -DELAYLOAD:winmm.dll \
- -DELAYLOAD:winspool.drv -DELAYLOAD:imm32.dll \
- -DELAYLOAD:ole32.dll -DELAYLOAD:comdlg32.dll \
- -DELAYLOAD:comctl32.dll -DELAYLOAD:shlwapi.dll, \
- VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
- RC_FLAGS := $(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
- -D "JDK_FNAME=awt.dll" \
- -D "JDK_INTERNAL_NAME=awt" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBAWT): $(BUILD_LIBJAVA)
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
-endif
-
-BUILD_LIBRARIES += $(BUILD_LIBAWT)
-
-##########################################################################################
-
-# TODO!!
-# Even though this variable as a general name, it is
-# only used on macos, in fontpath.c, as prefix for where to find fonts.
-#
-# It's used for libawt_headless _and_ libawt_xawt
-#
-X11_PATH := /usr/X11R6
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
- ifndef BUILD_HEADLESS_ONLY
-
- LIBAWT_XAWT_DIRS := \
- $(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- $(JDK_TOPDIR)/src/share/native/sun/awt/utility \
- $(JDK_TOPDIR)/src/share/native/sun/font \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
-
- LIBAWT_XAWT_CFLAGS := -DXAWT -DXAWT_HACK \
- -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
- $(CUPS_CFLAGS) \
- $(foreach dir, $(LIBAWT_XAWT_DIRS), -I$(dir)) \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga
-
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), linux)
- ifndef OPENJDK
- include $(JDK_TOPDIR)/make/closed/xawt.gmk
- endif
-
- ifeq ($(DISABLE_XRENDER), true)
- LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
- endif
- endif
-
- ifeq ($(MILESTONE), internal)
- LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
- endif
-
- LIBAWT_XAWT_FILES := \
- XlibWrapper.c \
- XWindow.c \
- XToolkit.c \
- X11Color.c \
- X11SurfaceData.c \
- awt_GraphicsEnv.c \
- awt_InputMethod.c \
- robot_common.c \
- awt_Robot.c \
- list.c \
- multiVis.c \
- initIDs.c \
- awt_util.c \
- awt_Desktop.c \
- awt_UNIXToolkit.c \
- X11FontScaler_md.c \
- X11TextRenderer_md.c \
- fontpath.c \
- awt_Insets.c \
- awt_Event.c \
- X11Renderer.c \
- X11PMBlitLoops.c \
- OGLBlitLoops.c \
- OGLBufImgOps.c \
- OGLContext.c \
- OGLFuncs.c \
- OGLMaskBlit.c \
- OGLMaskFill.c \
- OGLPaints.c \
- OGLRenderQueue.c \
- OGLRenderer.c \
- OGLSurfaceData.c \
- OGLTextRenderer.c \
- OGLVertexCache.c \
- GLXGraphicsConfig.c \
- GLXSurfaceData.c \
- AccelGlyphCache.c \
- awt_Font.c \
- multi_font.c \
- awt_AWTEvent.c \
- awt_DrawingSurface.c \
- jawt.c \
- CUPSfuncs.c \
- debug_assert.c \
- debug_mem.c \
- debug_trace.c \
- debug_util.c \
- awt_Plugin.c \
- gnome_interface.c \
- gtk2_interface.c \
- swing_GTKEngine.c \
- swing_GTKStyle.c \
- rect.c \
- sun_awt_X11_GtkFileDialogPeer.c \
- XRSurfaceData.c \
- XRBackendNative.c
-
- LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
-
- ifeq ($(OPENJDK_TARGET_OS), linux)
- # To match old build, add this to LDFLAGS instead of suffix.
- LIBAWT_XAWT_LDFLAGS += -lpthread
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
- endif
-
- # On macosx, the shared library origin is set twice for this lib.
- $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
- LIBRARY := awt_xawt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBAWT_XAWT_DIRS), \
- INCLUDE_FILES := $(LIBAWT_XAWT_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
- $(X_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_xawt/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS), \
- LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
- LDFLAGS_solaris := -L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
- -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
- -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
- -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
- -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
- $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
- LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(call SET_SHARED_LIBRARY_ORIGIN). \
- $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(call SET_SHARED_LIBRARY_ORIGIN)., \
- LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=xawt.dll" \
- -D "JDK_INTERNAL_NAME=xawt" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_xawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBAWT_XAWT): $(BUILD_LIBJAVA)
-
- $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
-
- BUILD_LIBRARIES += $(BUILD_LIBAWT_XAWT)
-
- endif
-endif
-
-##########################################################################################
-
-BUILD_LIBZIP_EXCLUDES :=
-ifeq ($(USE_EXTERNAL_LIBZ), true)
- LIBZ := -lz
- LIBZIP_EXCLUDES += zlib-1.2.5
-else
- ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
-endif
-
-BUILD_LIBZIP_REORDER :=
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
- endif
-endif
-
-ifeq ($(LIBZIP_CAN_USE_MMAP), true)
- BUILD_LIBZIP_MMAP := -DUSE_MMAP
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
- LIBRARY := zip, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
- EXCLUDES := $(LIBZIP_EXCLUDES), \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(ZLIB_CPPFLAGS) \
- -I$(JDK_TOPDIR)/src/share/native/java/io \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
- CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/mapfile-vers, \
- REORDER := $(BUILD_LIBZIP_REORDER), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(EXPORT_ZIP_FUNCS), \
- LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
- -export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
- $(WIN_JAVA_LIB), \
- LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
- LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
- LDFLAGS_SUFFIX_macosx := $(LIBZ) -ljava -ljvm, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=zip.dll" \
- -D "JDK_INTERNAL_NAME=zip" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-
-$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBZIP)
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
- LIBRARY := unpack, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
- EXCLUDE_FILES := main.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CXXFLAGS_JDKLIB) \
- -DNO_ZLIB -DUNPACK_JNI -DFULL, \
- CFLAGS_release := -DPRODUCT, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
- jvm.lib $(WIN_JAVA_LIB), \
- LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=unpack.dll" \
- -D "JDK_INTERNAL_NAME=unpack" \
- -D "JDK_FTYPE=0x2L", \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
- $(ECHO) Copying $(@F)
- $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.map, $<) $@
-
- $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
- $(ECHO) Copying $(@F)
- $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.pdb, $<) $@
-endif
-
-##########################################################################################
-
-LIBATTACH_EXCLUDE_FILES :=
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- LIBATTACH_EXCLUDE_FILES += SolarisVirtualMachine.c
-endif
-ifneq ($(OPENJDK_TARGET_OS), linux)
- LIBATTACH_EXCLUDE_FILES += LinuxVirtualMachine.c
-endif
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- LIBATTACH_EXCLUDE_FILES += BsdVirtualMachine.c
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
- LIBRARY := attach, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tools/attach, \
- EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB), \
- CFLAGS_windows := /Gy, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=attach.dll" \
- -D "JDK_INTERNAL_NAME=attach" \
- -D "JDK_FTYPE=0x2L", \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_solaris := -ldoor, \
- LDFLAGS_windows := /ORDER:@$(JDK_TOPDIR)/makefiles/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libattach, \
- DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBATTACH): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBATTACH)
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \
- LIBRARY := dt_socket, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/transport/socket \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
- -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
- -I$(JDK_TOPDIR)/src/share/transport/socket \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \
- -I$(JDK_TOPDIR)/src/share/back/export \
- -I$(JDK_TOPDIR)/src/share/back, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libdt_socket/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := -lpthread, \
- LDFLAGS_SUFFIX_solaris := -lnsl -lsocket -lc, \
- LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=dt_socket.dll" \
- -D "JDK_INTERNAL_NAME=dt_socket" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_socket, \
- DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBDT_SOCKET): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBDT_SOCKET)
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM, \
- LIBRARY := dt_shmem, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/com/sun/tools/jdi \
- $(JDK_TOPDIR)/src/share/transport/shmem \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
- -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
- -I$(JDK_TOPDIR)/src/share/transport/shmem \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \
- -I$(JDK_TOPDIR)/src/share/back/export, \
- LDFLAGS := $(LDFLAGS_JDKLIB), \
- LDFLAGS_windows := -export:jdwpTransport_OnLoad, \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=dt_shmem.dll" \
- -D "JDK_INTERNAL_NAME=dt_shmem" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_shmem, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
-
-endif # OPENJDK_TARGET_OS
-
-##########################################################################################
-# JDWP_LOGGING causes log messages to be compiled into the library.
-$(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
- LIBRARY := jdwp, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
- -I$(JDK_TOPDIR)/src/share/transport/export \
- -I$(JDK_TOPDIR)/src/share/back/export \
- -I$(JDK_TOPDIR)/src/share/npt \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
- -I$(JDK_TOPDIR)/src/share/back \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
- -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjdwp/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jdwp.dll" \
- -D "JDK_INTERNAL_NAME=jdwp" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjdwp, \
- DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBJDWP): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBJDWP)
-
-##########################################################################################
-
-LIBJAAS_MAPFILE :=
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- LIBJAAS_EXCLUDE_FILES := Solaris.c
-else
- # only on solaris...wonder why
- LIBJAAS_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjaas/mapfile-vers
-endif
-
-LIBJAAS_NAME := jaas_unix
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBJAAS_NAME := jaas_nt
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
- LIBRARY := $(LIBJAAS_NAME), \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB), \
- MAPFILE := $(LIBJAAS_MAPFILE), \
- LDFLAGS := $(filter-out -ljava, $(LDFLAGS_JDKLIB)) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib, \
- LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- EXCLUDE_FILES := $(LIBJAAS_EXCLUDE_FILES), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
- -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjaas, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBJAAS): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBJAAS)
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
- LIBRARY := jsdt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsdt/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := $(LIBDL), \
- LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL), \
- LDFLAGS_SUFFIX_macosx := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jsdt.dll" \
- -D "JDK_INTERNAL_NAME=jsdt" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsdt, \
- DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBJSDT): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBJSDT)
-
-##########################################################################################
-
-# TODO: Update awt lib path when awt is converted
-$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
- LIBRARY := lcms, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
- LANG := C, \
- OPTIMIZATION := HIGHEST, \
- CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
- $(SHARED_LIBRARY_FLAGS) \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
- CFLAGS_solaris := -xc99=no_lib, \
- CFLAGS_windows := -DCMS_IS_WINDOWS_, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/liblcms/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
- LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
- LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
- LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
- LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=lcms.dll" \
- -D "JDK_INTERNAL_NAME=lcms" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/liblcms, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBLCMS)
-
-$(BUILD_LIBLCMS): $(BUILD_LIBAWT)
-
-##########################################################################################
-
-ifdef OPENJDK
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers
-else
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers-closed
- BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
- BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
-endif
-
-BUILD_LIBJPEG_REORDER :=
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
- endif
-endif
-
-# Suppress gcc warnings like "variable might be clobbered by 'longjmp'
-# or 'vfork'": this warning indicates that some variable is placed to
-# a register by optimized compiler and it's value might be lost on longjmp().
-# Recommended way to avoid such warning is to declare the variable as
-# volatile to prevent the optimization. However, this approach does not
-# work because we have to declare all variables as volatile in result.
-#ifndef CROSS_COMPILE_ARCH
-# CC_43_OR_NEWER := \
-# $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
-# \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
-# ifeq ($(CC_43_OR_NEWER), 1)
-# BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
-# endif
-#endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
- LIBRARY := jpeg, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
- LANG := C, \
- OPTIMIZATION := HIGHEST, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
- MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jpeg.dll" \
- -D "JDK_INTERNAL_NAME=jpeg" \
- -D "JDK_FTYPE=0x2L", \
- REORDER := $(BUILD_LIBJPEG_REORDER), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBJPEG)
-
-##########################################################################################
-
-ifndef OPENJDK
- FONT_HEADERS := -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k
- BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers
- LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c
-else
- FONT_HEADERS := $(FREETYPE2_CFLAGS)
- BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers.openjdk
- BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE2_LIBS)
-endif
-
-LIBFONTMANAGER_OPTIMIZATION := HIGH
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
- X11TextRenderer.c
- LIBFONTMANAGER_OPTIMIZATION := HIGHEST
-else
- LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
- lcdglyph.c
-endif
-
-BUILD_LIBFONTMANAGER_CFLAGS_COMMON := \
- $(X_CFLAGS) \
- -DLE_STANDALONE -DHEADLESS \
- $(FONT_HEADERS) \
- -I$(JDK_TOPDIR)/src/share/native/sun/font \
- -I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d
-
-# Turn off aliasing with GCC for ExtensionSubtables.cpp
-ifeq ($(OPENJDK_TARGET_OS), linux)
- BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
- LIBRARY := fontmanager, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/font \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font, \
- EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
- AccelGlyphCache.c, \
- LANG := C++, \
- CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
- CXXFLAGS := $(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
- OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
- CFLAGS_windows = -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
- -DCC_NOEX, \
- MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
- LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
- LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
- LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
- LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
- -ljava -ljvm, \
- LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
- $(WIN_AWT_LIB), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=fontmanager.dll" \
- -D "JDK_INTERNAL_NAME=fontmanager" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfontmanager, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
-
-ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris macosx))
- $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
-endif
-
-BUILD_LIBRARIES += $(BUILD_LIBFONTMANAGER)
-
-##########################################################################################
-
-ifndef OPENJDK
-
- #ifeq ($(OPENJDK_TARGET_OS), linux)
- # ifeq ("$(CC_VER_MAJOR)", "3")
- # OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
- # endif
- #endif
- #
- # The resulting size of the t2k lib file is (at least on linux) dependant on the order of
- # the input .o files. Because of this the new build will differ in size to the old build.
- BUILD_LIBT2K_CFLAGS_COMMON := -I$(JDK_TOPDIR)/src/share/native/sun/font \
- -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
- -I$(JDK_TOPDIR)/src/closed/share/native/sun/font \
- -I$(JDK_TOPDIR)/src/share/share/native/sun/font \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBT2K, \
- LIBRARY := t2k, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/font \
- $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
- $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k/ttHints, \
- EXCLUDE_FILES := orion.c, \
- LANG := C++, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON), \
- CXXFLAGS := $(CXXFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON), \
- CFLAGS_windows = -DCC_NOEX, \
- CXXFLAGS_windows = -DCC_NOEX, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libt2k/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := user32.lib $(JDK_OUTPUTDIR)/objs/libfontmanager/fontmanager.lib, \
- LDFLAGS_SUFFIX_posix := $(LIBM) $(LIBCXX) -lfontmanager -ljava -ljvm -lc, \
- LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=t2k.dll" \
- -D "JDK_INTERNAL_NAME=t2k" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libt2k, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- # t2k is linked against fontmanager
- $(BUILD_LIBT2K): $(BUILD_LIBFONTMANAGER)
-
- BUILD_LIBRARIES += $(BUILD_LIBT2K)
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- ifeq ($(OPENJDK_TARGET_CPU), x86)
- KERNEL32_LIB := kernel32.lib
- endif
- $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
- LIBRARY := jawt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows, \
- INCLUDE_FILES := jawt.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CXXFLAGS_JDKLIB) \
- -EHsc -DUNICODE -D_UNICODE \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(KERNEL32_LIB) $(LDFLAGS_CXX_JDK) \
- advapi32.lib $(WIN_AWT_LIB), \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jawt.dll" \
- -D "JDK_INTERNAL_NAME=jawt" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
-
- $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
- $(ECHO) Copying $(@F)
- $(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
-
- BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
-
-else # OPENJDK_TARGET_OS not windows
-
- JAWT_LIBS :=
- ifneq ($(OPENJDK_TARGET_OS), solaris)
- JAWT_LIBS += -lawt
- endif
-
- ifndef BUILD_HEADLESS_ONLY
- JAWT_LIBS += -lawt_xawt
- else
- JAWT_LIBS += -lawt_headless
- HEADLESS_CFLAG += -DHEADLESS
- endif
-
- JAWT_FILES := jawt.c
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- JAWT_FILES := jawt.m
- JAWT_LIBS := -lawt_lwawt
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
- LIBRARY := jawt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
- $(JDK_TOPDIR)/src/macosx/native/sun/awt, \
- INCLUDE_FILES := $(JAWT_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB), \
- CFLAGS_linux := $(HEADLESS_CFLAG), \
- CFLAGS_macosx := -I$(JDK_TOPDIR)/src/solaris/native/sun/awt, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjawt/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_solaris := -L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
- LDFLAGS_SUFFIX_linux := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_solaris := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender, \
- LDFLAGS_SUFFIX_macosx := -Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
- -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- ifndef BUILD_HEADLESS_ONLY
- $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
- else
- $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
- endif
-
-endif # OPENJDK_TARGET_OS
-
-BUILD_LIBRARIES += $(BUILD_LIBJAWT)
-
-##########################################################################################
-
-LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
-
-LIBINSTRUMENT_FILES := \
- EncodingSupport.c \
- EncodingSupport_md.c \
- FileSystemSupport_md.c \
- InstrumentationImplNativeMethods.c \
- InvocationAdapter.c \
- JarFacade.c \
- JPLISAgent.c \
- JPLISAssert.c \
- JavaExceptions.c \
- PathCharsValidator.c \
- Reentrancy.c \
- Utilities.c \
- canonicalize_md.c
-
-LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
-LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/instrument \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument \
- -I$(JDK_TOPDIR)/src/share/bin
-
-LIBINSTRUMENT_LDFLAGS :=
-LIBINSTRUMENT_LDFLAGS_SUFFIX :=
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
- -export:Agent_OnAttach advapi32.lib
- # Statically link the C runtime so that there are not dependencies on modules
- # not on the search patch when invoked from the Windows system directory
- # (or elsewhere).
- LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
- # equivalent of strcasecmp is stricmp on Windows
- LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
- LIBRARY := instrument, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBINSTRUMENT_SRC), \
- INCLUDE_FILES := $(LIBINSTRUMENT_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
- CFLAGS_debug := -DJPLIS_LOGGING, \
- CFLAGS_release := -DNO_JPLIS_LOGGING, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libinstrument/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN) \
- $(LIBINSTRUMENT_LDFLAGS), \
- LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
- LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
- LDFLAGS_macosx := -Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
- -framework Cocoa -framework Security -framework ApplicationServices, \
- LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
- LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
- LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=instrument.dll" \
- -D "JDK_INTERNAL_NAME=instrument" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(LIBINSTRUMENT_DIR), \
- DEBUG_SYMBOLS := true))
-
-ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows))
- $(BUILD_LIBINSTRUMENT): $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
-else
- $(BUILD_LIBINSTRUMENT): $(INSTALL_LIBRARIES_HERE)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX)
-endif
-$(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBINSTRUMENT)
-
-##########################################################################################
-
-BUILD_LIBMANAGEMENT_SRC := $(JDK_TOPDIR)/src/share/native/sun/management \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/management
-
-BUILD_LIBMANAGEMENT_EXCLUDES :=
-
-BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/management
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBMANAGEMENT_EXCLUDES += OperatingSystem_md.c
-else
- BUILD_LIBMANAGEMENT_EXCLUDES += UnixOperatingSystem_md.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), solaris)
- BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), linux)
- BUILD_LIBMANAGEMENT_EXCLUDES += LinuxOperatingSystem.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
-endif
-
-LIBMANAGEMENT_OPTIMIZATION := HIGH
-ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
- LIBMANAGEMENT_OPTIMIZATION := LOW
- endif
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
- LIBRARY := management, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBMANAGEMENT_SRC), \
- EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \
- LANG := C, \
- OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
- CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libmanagement/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_solaris := -lkstat, \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=management.dll" \
- -D "JDK_INTERNAL_NAME=management" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmanagement, \
- DEBUG_SYMBOLS := true))
-
-$(BUILD_LIBMANAGEMENT): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBMANAGEMENT)
-
-##########################################################################################
-
-BUILD_LIBHPROF_SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
-BUILD_LIBHPROF_CFLAGS := -I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
- -I$(JDK_TOPDIR)/src/share/npt \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
- -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo
-
-BUILD_LIBHPROF_LDFLAGS :=
-
-LIBHPROF_OPTIMIZATION := HIGHEST
-ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
- ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
- LIBHPROF_OPTIMIZATION := LOW
- endif
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \
- LIBRARY := hprof, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBHPROF_SRC), \
- LANG := C, \
- OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(BUILD_LIBHPROF_CFLAGS), \
- CFLAGS_debug := -DHPROF_LOGGING, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libhprof/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_windows := wsock32.lib winmm.lib advapi32.lib, \
- LDFLAGS_SUFFIX_linux := $(LIBDL), \
- LDFLAGS_SUFFIX_macosx := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -lsocket -lnsl $(LIBDL) -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=hprof.dll" \
- -D "JDK_INTERNAL_NAME=hprof" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libhprof_jvmti, \
- DEBUG_SYMBOLS := true))
-
-BUILD_LIBRARIES += $(BUILD_LIBHPROF)
-
##########################################################################################
-$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO, \
- LIBRARY := java_crw_demo, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=java_crw_demo.dll" \
- -D "JDK_INTERNAL_NAME=java_crw_demo" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava_crw_demo, \
- DEBUG_SYMBOLS := true))
-
-BUILD_LIBRARIES += $(BUILD_LIBJAVA_CRW_DEMO)
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \
- LIBRARY := npt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/npt \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnpt/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_macosx := -liconv, \
- LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=npt.dll" \
- -D "JDK_INTERNAL_NAME=npt" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \
- DEBUG_SYMBOLS := true))
-
-BUILD_LIBRARIES += $(BUILD_LIBNPT)
-
-##########################################################################################
-
-LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/share/native/java/net \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/dns \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/spi
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBNET_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/www/protocol/http/ntlm
-else
- LIBNET_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/sdp
-endif
-
-LIBNET_CFLAGS := $(foreach dir, $(LIBNET_SRC_DIRS), -I$(dir))
-
-LIBNET_EXCLUDE_FILES :=
-ifneq ($(OPENJDK_TARGET_OS), linux)
- LIBNET_EXCLUDE_FILES += linux_close.c
-endif
-
-ifneq ($(OPENJDK_TARGET_OS), macosx)
- LIBNET_EXCLUDE_FILES += bsd_close.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBNET_EXCLUDE_FILES += PlainSocketImpl.c PlainDatagramSocketImpl.c SdpSupport.c
-else
- LIBNET_EXCLUDE_FILES += TwoStacksPlainSocketImpl.c DualStackPlainSocketImpl.c \
- TwoStacksPlainDatagramSocketImpl.c DualStackPlainDatagramSocketImpl.c \
- NTLMAuthSequence.c NetworkInterface_winXP.c
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
- LIBRARY := net, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBNET_SRC_DIRS), \
- EXCLUDE_FILES := $(LIBNET_EXCLUDE_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBNET_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnet/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_macosx := -ljvm -ljava, \
- LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lnsl -lsocket $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_linux := $(LIBDL) -ljvm -lpthread -ljava, \
- LDFLAGS_SUFFIX_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib \
- delayimp.lib $(WIN_JAVA_LIB) advapi32.lib \
- -DELAYLOAD:secur32.dll -DELAYLOAD:iphlpapi.dll, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=net.dll" \
- -D "JDK_INTERNAL_NAME=net" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnet, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBNET): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBNET)
-
-$(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/share/lib/net.properties
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
-
-COPY_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/${OPENJDK_TARGET_OS_API_DIR}/lib/sdp/sdp.conf.template
- $(ECHO) $(LOG_INFO) Copying $(@F)
- $(call install-file)
-
- COPY_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
-endif
-
-##########################################################################################
-
-BUILD_LIBNIO_SRC := \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/nio \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
-
-BUILD_LIBNIO_CFLAGS := \
- -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
- -I$(JDK_TOPDIR)/src/share/native/java/io \
- -I$(JDK_TOPDIR)/src/share/native/java/net \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net
-
-BUILD_LIBNIO_FILES := \
- DatagramChannelImpl.c \
- DatagramDispatcher.c \
- FileChannelImpl.c \
- FileDispatcherImpl.c \
- FileKey.c \
- IOUtil.c \
- MappedByteBuffer.c \
- Net.c \
- ServerSocketChannelImpl.c \
- SocketChannelImpl.c \
- SocketDispatcher.c
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBNIO_FILES += \
- Iocp.c \
- RegistryFileTypeDetector.c \
- WindowsAsynchronousFileChannelImpl.c \
- WindowsAsynchronousServerSocketChannelImpl.c \
- WindowsAsynchronousSocketChannelImpl.c \
- WindowsNativeDispatcher.c \
- WindowsSelectorImpl.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), linux)
- BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
- BUILD_LIBNIO_FILES += \
- EPoll.c \
- EPollArrayWrapper.c \
- EPollPort.c \
- InheritedChannel.c \
- NativeThread.c \
- PollArrayWrapper.c \
- UnixAsynchronousServerSocketChannelImpl.c \
- UnixAsynchronousSocketChannelImpl.c \
- GnomeFileTypeDetector.c \
- MagicFileTypeDetector.c \
- LinuxNativeDispatcher.c \
- LinuxWatchService.c \
- UnixCopyFile.c \
- UnixNativeDispatcher.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
- BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/macosx/native/sun/nio/ch
- BUILD_LIBNIO_FILES += \
- InheritedChannel.c \
- NativeThread.c \
- PollArrayWrapper.c \
- UnixAsynchronousServerSocketChannelImpl.c \
- UnixAsynchronousSocketChannelImpl.c \
- BsdNativeDispatcher.c \
- MacOSXNativeDispatcher.c \
- UnixCopyFile.c \
- UnixNativeDispatcher.c \
- KQueue.c \
- KQueuePort.c \
- KQueueArrayWrapper.c
-endif
+include lib/CoreLibraries.gmk
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
- BUILD_LIBNIO_FILES += \
- DevPollArrayWrapper.c \
- InheritedChannel.c \
- NativeThread.c \
- PollArrayWrapper.c \
- SolarisEventPort.c \
- UnixAsynchronousServerSocketChannelImpl.c \
- UnixAsynchronousSocketChannelImpl.c \
- GnomeFileTypeDetector.c \
- SolarisNativeDispatcher.c \
- SolarisWatchService.c \
- UnixCopyFile.c \
- UnixNativeDispatcher.c
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
- LIBRARY := nio, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBNIO_SRC), \
- INCLUDE_FILES := $(BUILD_LIBNIO_FILES), \
- LANG := C, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(BUILD_LIBNIO_CFLAGS), \
- MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := -ljava -lnet -lpthread $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
- -lsendfile -ljava -lnet -lc, \
- LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
- $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
- advapi32.lib, \
- LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread -framework CoreFoundation, \
- LDFLAGS_SUFFIX :=, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=nio.dll" \
- -D "JDK_INTERNAL_NAME=nio" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnio, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBNIO)
-
-$(BUILD_LIBNIO): $(BUILD_LIBNET)
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
-
- ifneq ($(OPENJDK_TARGET_OS), macosx)
-
- SCTP_WERROR := -Werror
- ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
- SCTP_WERROR :=
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \
- LIBRARY := sctp, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch/sctp, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
- -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch/sctp \
- -I$(JDK_TOPDIR)/src/share/native/java/net \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net, \
- CFLAGS_linux := $(SCTP_WERROR), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsctp/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := -lpthread $(LIBDL) -ljava -ljvm, \
- LDFLAGS_SUFFIX_posix := -lnio -lnet, \
- LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \
- LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBSCTP)
-
- $(BUILD_LIBSCTP): $(BUILD_LIBNIO)
- endif
-endif
-
-##########################################################################################
-
-BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
-LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) $(foreach dir, $(BUILD_LIBJLI_SRC_DIRS), -I$(dir))
-
-BUILD_LIBJLI_FILES := \
- java.c \
- splashscreen_stubs.c \
- parse_manifest.c \
- version_comp.c \
- wildcard.c \
- jli_util.c
-
-ifeq ($(JVM_VARIANT_ZERO), true)
- ERGO_FAMILY := zero
-else
- ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
- ERGO_FAMILY := i586
- else
- ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
- endif
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
- BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
- BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
-
- BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
- BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBJLI_FILES += java_md.c \
- cmdtoargs.c
- # Staticically link with c runtime on windows.
- LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
-else ifneq ($(OPENJDK_TARGET_OS), macosx)
-
- BUILD_LIBJLI_FILES += java_md_common.c
- BUILD_LIBJLI_FILES += java_md_solinux.c ergo.c
-
- ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
-
- # if the architecture specific ergo file exists then
- # use it, else use the generic definitions from ergo.c
- ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)), )
- BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
- else # !ERGO_ARCH_FILE
- LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
- endif # ERGO_ARCH_FILE
-endif #WINDOWS
-
-# Append defines depending on target platform
-LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
-endif
-
-ifneq ($(USE_EXTERNAL_LIBZ), true)
- BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
- LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
- BUILD_LIBJLI_FILES += \
- inflate.c \
- inftrees.c \
- inffast.c \
- zadler32.c \
- zcrc32.c \
- zutil.c
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
- LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
-else
- LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
-endif
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
- LIBRARY := jli, \
- OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
- SRC := $(BUILD_LIBJLI_SRC_DIRS), \
- INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
- LANG := C, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(LIBJLI_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjli/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
- LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
- LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
- LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \
- LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \
- LDFLAGS_SUFFIX_macosx := $(LIBZ), \
- LDFLAGS_SUFFIX_windows := \
- -export:JLI_Launch \
- -export:JLI_ManifestIterate \
- -export:JLI_SetTraceLauncher \
- -export:JLI_ReportErrorMessage \
- -export:JLI_ReportErrorMessageSys \
- -export:JLI_ReportMessage \
- -export:JLI_ReportExceptionDescription \
- -export:JLI_MemAlloc \
- -export:JLI_CmdToArgs \
- -export:JLI_GetStdArgc \
- -export:JLI_GetStdArgs \
- advapi32.lib \
- comctl32.lib \
- user32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jli.dll" \
- -D "JDK_INTERNAL_NAME=jli" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBJLI)
-
-# On windows, the static library has the same suffix as the import library created by
-# with the shared library, so the static library is given a different name. No harm
-# in doing it for all platform to reduce complexity.
-ifeq ($(OPENJDK_TARGET_OS), windows)
- $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
- STATIC_LIBRARY := jli_static, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
- SRC := $(BUILD_LIBJLI_SRC_DIRS), \
- INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
- LANG := C, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
- ARFLAGS := $(ARFLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+include lib/PlatformLibraries.gmk
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
- #
- # On macosx they do partial (incremental) linking of libjli_static.a
- # code it here...rather than add support to NativeCompilation
- # as this is first time I see it
- $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
- LIBRARY := jli_static, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
- SRC := $(BUILD_LIBJLI_SRC_DIRS), \
- INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
- LANG := C, \
- OPTIMIZATION := HIGH, \
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
- LDFLAGS := -nostdlib -r, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
- $(call install-file)
-
- BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
-endif
-
-##########################################################################################
-
-ifndef OPENJDK
- ifeq ($(ENABLE_JFR), true)
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJFR, \
- LIBRARY := jfr, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/closed/share/native/oracle/jfr, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jfr.dll" \
- -D "JDK_INTERNAL_NAME=jfr" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjfr, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBJFR)
-
-endif
-endif
-
-##########################################################################################
-
-ifndef OPENJDK
-
- BUILD_LIBKCMS_EXCLUDE_FILES :=
- ifeq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBKCMS_EXCLUDE_FILES += ukcpmgr.c unixmem.c
- else
- BUILD_LIBKCMS_EXCLUDE_FILES += cmmdll.c registry.c spxffile.c sysinfo.c winmem.c wkcpmgr.c
- endif
-
- BUILD_LIBKCMS_FLAGS := $(CFLAGS_JDKLIB)
-
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- # This particular library uses a feature called PIC_CODE_SMALL (on solaris)
- # implement it like this...since it's only used here
- BUILD_LIBKCMS_FLAGS := $(patsubst -KPIC, -Kpic, $(BUILD_LIBKCMS_FLAGS))
- else ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
- BUILD_LIBKCMS_FLAGS := $(patsubst -fPIC, -fpic, $(BUILD_LIBKCMS_FLAGS))
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS, \
- LIBRARY := kcms, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms, \
- LANG := C, \
- EXCLUDE_FILES := $(BUILD_LIBKCMS_EXCLUDE_FILES), \
- OPTIMIZATION := LOW, \
- CFLAGS := $(BUILD_LIBKCMS_FLAGS) \
- -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST, \
- CFLAGS_linux := -Wno-missing-field-initializers, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libkcms/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_linux := -lc -lpthread, \
- LDFLAGS_SUFFIX_solaris := -lc, \
- LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
- LDFLAGS_SUFFIX_posix := -lm -ljava -ljvm, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=kcms.dll" \
- -D "JDK_INTERNAL_NAME=kcms" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkcms, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBKCMS): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBKCMS)
-
-endif
-
-##########################################################################################
-
-ifndef OPENJDK
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
-
- ifeq ($(shell if test "$(OS_VERSION_MAJOR)" -eq 5 -a "$(OS_VERSION_MINOR)" -le 10; then $(ECHO) ok; fi), ok)
-
- SUNWJDGA_MAPFILE :=
- ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
- SUNWJDGA_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjdga/mapfile-vers
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBSUNWJDGA, \
- LIBRARY := sunwjdga, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/solaris/native/sun/jdga, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/javavm/export \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
- -I$(OPENWIN_HOME)/include, \
- MAPFILE := $(SUNWJDGA_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunwjdga, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
-
- endif
- endif
- endif
-endif
-
-##########################################################################################
-
-ifeq ($(BUILD_HEADLESS), true)
- ifneq ($(OPENJDK_TARGET_OS), windows)
-
- LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/solaris/native/sun/font \
- $(JDK_TOPDIR)/src/solaris/native/sun/awt \
- $(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBAWT_HEADLESS_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/font
- endif
-
- LIBAWT_HEADLESS_CFLAGS := -DHEADLESS=true \
- -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
- $(CUPS_CFLAGS) \
- $(X_CFLAGS) \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
- $(foreach dir, $(LIBAWT_HEADLESS_DIRS), -I$(dir))
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBAWT_HEADLESS_CFLAGS += \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
- endif
-
- LIBAWT_HEADLESS_FILES := \
- awt_Font.c \
- HeadlessToolkit.c \
- fontpath.c \
- VDrawingArea.c \
- X11Color.c \
- X11Renderer.c \
- X11PMBlitLoops.c \
- X11SurfaceData.c \
- X11FontScaler_md.c \
- X11TextRenderer_md.c \
- OGLBlitLoops.c \
- OGLBufImgOps.c \
- OGLContext.c \
- OGLFuncs.c \
- OGLMaskBlit.c \
- OGLMaskFill.c \
- OGLPaints.c \
- OGLRenderQueue.c \
- OGLRenderer.c \
- OGLSurfaceData.c \
- OGLTextRenderer.c \
- OGLVertexCache.c \
- GLXGraphicsConfig.c \
- GLXSurfaceData.c \
- AccelGlyphCache.c \
- CUPSfuncs.c
+include lib/NetworkingLibraries.gmk
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBAWT_HEADLESS_FILES += \
- AWTFont.m \
- AWTStrike.m \
- CCharToGlyphMapper.m \
- CGGlyphImages.m \
- CGGlyphOutlines.m \
- CoreTextSupport.m
- endif
-
- LIBAWT_HEADLESS_REORDER :=
- ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
- endif
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
- LIBRARY := awt_headless, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBAWT_HEADLESS_DIRS), \
- INCLUDE_FILES := $(LIBAWT_HEADLESS_FILES), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_HEADLESS_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
- LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
- -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
- -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
- LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
- REORDER := $(LIBAWT_HEADLESS_REORDER), \
- LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
- LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
- LDFLAGS_SUFFIX_macosx := -ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
- -framework Accelerate \
- -framework ApplicationServices \
- -framework Cocoa \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
-
- BUILD_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
-
- endif
-endif
-
-##########################################################################################
-
-ifndef BUILD_HEADLESS_ONLY
- LIBSPLASHSCREEN_DIRS := \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
- $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
- $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
-
- ifeq ($(USE_EXTERNAL_LIBGIF), true)
- GIFLIB_LDFLAGS := -lgif
- else
- LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/giflib
- GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
- endif
-
- ifneq ($(OPENJDK_TARGET_OS), macosx)
- LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
- else
- LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
- endif
-
- LIBSPLASHSCREEN_CFLAGS := -DSPLASHSCREEN -DPNG_NO_MMX_CODE \
- $(foreach dir, $(LIBSPLASHSCREEN_DIRS), -I$(dir))
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBSPLASHSCREEN_CFLAGS := -I$(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen \
- $(LIBSPLASHSCREEN_CFLAGS) \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks
- LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
- LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp
-
- LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
- LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
-
- else ifneq ($(OPENJDK_TARGET_OS), windows)
- LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions
- else
- LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
- endif
-
- LIBSPLASHSCREEN_LDFLAGS_SUFFIX :=
-
- ifneq ($(USE_EXTERNAL_LIBZ), true)
- LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
- LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
- endif
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
- -framework ApplicationServices \
- -framework Foundation \
- -framework Cocoa \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation
- else ifneq ($(OPENJDK_TARGET_OS), windows)
- LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -lX11 -lXext $(LIBM) -lpthread
- else # OPENJDK_TARGET_OS
- LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib -DELAYLOAD:user32.dll
- endif # OPENJDK_TARGET_OS
-
- $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN, \
- LIBRARY := splashscreen, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBSPLASHSCREEN_DIRS), \
- EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=splashscreen.dll" \
- -D "JDK_INTERNAL_NAME=splashscreen" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsplashscreen, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
-
- ifeq ($(OPENJDK_TARGET_OS), macosx)
- $(LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
- endif
-
-endif
-
-##########################################################################################
-
-ifndef OPENJDK
-
- LIBDCPR_SRC_DIRS := \
- $(JDK_TOPDIR)/src/closed/share/native/sun/dc/doe \
- $(JDK_TOPDIR)/src/closed/share/native/sun/dc/path \
- $(JDK_TOPDIR)/src/closed/share/native/sun/dc/pr \
- $(JDK_TOPDIR)/src/closed/share/native/sun/dc/util
-
- LIBDCPR_CFLAGS := $(foreach dir, $(LIBDCPR_SRC_DIRS), -I$(dir)) \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBDCPR, \
- LIBRARY := dcpr, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBDCPR_SRC_DIRS), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBDCPR_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libdcpr/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(LIBM) $(LDFLAGS_JDKLIB_SUFFIX), \
- LDFLAGS_SUFFIX_posix := -lm, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=dcpr.dll" \
- -D "JDK_INTERNAL_NAME=dcpr" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdcpr, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBDCPR): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBDCPR)
-
-endif
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
- LIBRARY := j2pcsc, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio, \
- LANG := C, \
- CFLAGS_posix := -D__sun_jdk, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2pcsc/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_posix := $(LIBDL), \
- LDFLAGS_SUFFIX_windows := winscard.lib, \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=j2pcsc.dll" \
- -D "JDK_INTERNAL_NAME=j2pcsc" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pcsc, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
-
-##########################################################################################
+include lib/NioLibraries.gmk
-ifneq ($(OPENJDK_TARGET_OS), windows)
- $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \
- LIBRARY := j2gss, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
-endif
-
-##########################################################################################
-
-ifneq ($(BUILD_CRYPTO), no)
- BUILD_LIBKRB5_NAME :=
- ifeq ($(OPENJDK_TARGET_OS), windows)
- BUILD_LIBKRB5_NAME := w2k_lsa_auth
- BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
- BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
- gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
- else ifeq ($(OPENJDK_TARGET_OS), macosx)
- BUILD_LIBKRB5_NAME := osxkrb5
- BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5
- BUILD_LIBKRB5_LIBS := -framework Kerberos
- endif
-
- ifneq ($(BUILD_LIBKRB5_NAME), )
- $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5, \
- LIBRARY := $(BUILD_LIBKRB5_NAME), \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBKRB5_SRC), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
- -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkrb5, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBKRB5)
- endif
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \
- LIBRARY := sunmscapi, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := Crypt32.Lib advapi32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=sunmscapi.dll" \
- -D "JDK_INTERNAL_NAME=sunmscapi" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunmscapi, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
-endif
-
-##########################################################################################
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
- LIBRARY := j2pkcs11, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
- $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
- -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_posix := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=j2pkcs11.dll" \
- -D "JDK_INTERNAL_NAME=j2pkcs11" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pkcs11, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
-
-##########################################################################################
-
-ifeq ($(ENABLE_INTREE_EC), yes)
-
- BUILD_LIBSUNEC_FLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/security/ec \
- -I$(JDK_TOPDIR)/src/share/native/sun/security/ec/impl
-
- #
- # On sol-sparc...all libraries are compiled with -xregs=no%appl
- # (set in CFLAGS_REQUIRED_sparc)
- #
- # except!!! libsunec.so
- #
- ECC_JNI_SOLSPARC_FILTER :=
- ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
- ECC_JNI_SOLSPARC_FILTER := -xregs=no%appl
- endif
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC, \
- LIBRARY := sunec, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/share/native/sun/security/ec \
- $(JDK_TOPDIR)/src/share/native/sun/security/ec/impl, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB)) \
- $(BUILD_LIBSUNEC_FLAGS) \
- -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
- CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
- $(BUILD_LIBSUNEC_FLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsunec/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
- LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(LIBCXX), \
- LDFLAGS_SUFFIX_linux := -lc, \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=sunec.dll" \
- -D "JDK_INTERNAL_NAME=sunec" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunec, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
-endif
-
-##########################################################################################
-
-LIBJSOUND_SRC_DIRS := \
- $(JDK_TOPDIR)/src/share/native/com/sun/media/sound \
- $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound
-
-LIBJSOUND_SRC_FILES := Utilities.c Platform.c
-
-LIBJSOUND_LANG := C
-LIBJSOUND_CFLAGS := $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir))
-
-EXTRA_SOUND_JNI_LIBS :=
-
-LIBJSOUND_MIDIFILES := \
- MidiInDevice.c \
- MidiInDeviceProvider.c \
- MidiOutDevice.c \
- MidiOutDeviceProvider.c \
- PlatformMidi.c
-
-# files needed for ports
-LIBJSOUND_PORTFILES := \
- PortMixerProvider.c \
- PortMixer.c
-
-# files needed for direct audio
-LIBJSOUND_DAUDIOFILES := \
- DirectAudioDeviceProvider.c \
- DirectAudioDevice.c
+include lib/SecurityLibraries.gmk
-ifeq ($(OPENJDK_TARGET_OS), windows)
- EXTRA_SOUND_JNI_LIBS += jsoundds
- LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \
- -DUSE_PLATFORM_MIDI_OUT=TRUE \
- -DUSE_PLATFORM_MIDI_IN=TRUE \
- -DUSE_PORTS=TRUE
- LIBJSOUND_SRC_FILES += \
- PLATFORM_API_WinOS_MidiIn.cpp \
- PLATFORM_API_WinOS_MidiOut.c \
- PLATFORM_API_WinOS_Util.c \
- PLATFORM_API_WinOS_Ports.c
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
-endif # OPENJDK_TARGET_OS windows
-
-ifeq ($(OPENJDK_TARGET_OS), linux)
- EXTRA_SOUND_JNI_LIBS += jsoundalsa
- LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
-endif # OPENJDK_TARGET_OS linux
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
- LIBJSOUND_LANG := C++
- LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
- -DUSE_PORTS=TRUE \
- -DUSE_DAUDIO=TRUE \
- -DUSE_PLATFORM_MIDI_OUT=TRUE \
- -DUSE_PLATFORM_MIDI_IN=TRUE
- LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/sun/media/sound
- LIBJSOUND_SRC_FILES += \
- PLATFORM_API_MacOSX_Utils.cpp \
- PLATFORM_API_MacOSX_PCM.cpp \
- PLATFORM_API_MacOSX_Ports.cpp \
- PLATFORM_API_MacOSX_MidiIn.c \
- PLATFORM_API_MacOSX_MidiOut.c \
- PLATFORM_API_MacOSX_MidiUtils.c
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
-endif # OPENJDK_TARGET_OS macosx
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
- -DUSE_PORTS=TRUE \
- -DUSE_DAUDIO=TRUE
- LIBJSOUND_SRC_FILES += \
- PLATFORM_API_SolarisOS_Utils.c \
- PLATFORM_API_SolarisOS_Ports.c \
- PLATFORM_API_SolarisOS_PCM.c
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
- LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
-endif # OPENJDK_TARGET_OS solaris
-
-
-ifeq ($(JVM_VARIANT_ZERO), true)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
-else
- ifeq ($(OPENJDK_TARGET_CPU), x86)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
- endif
-
- ifeq ($(OPENJDK_TARGET_CPU), sparc)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
- endif
-
- ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
- endif
-
- ifeq ($(OPENJDK_TARGET_CPU), x86_64)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
- endif
-
- ifeq ($(OPENJDK_TARGET_CPU), arm)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
- endif
-
- ifeq ($(OPENJDK_TARGET_CPU), ppc)
- LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
- endif
-endif
-
-LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
-
-$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
- LIBRARY := jsound, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBJSOUND_SRC_DIRS), \
- INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
- LANG := $(LIBJSOUND_LANG), \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBJSOUND_CFLAGS), \
- CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsound/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_macosx := -framework CoreAudio -framework CoreFoundation \
- -framework CoreServices -framework AudioUnit $(LIBCXX) \
- -framework CoreMIDI -framework AudioToolbox, \
- LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
- LDFLAGS_SUFFIX_posix := -ljava -ljvm, \
- LDFLAGS_SUFFIX_solaris := -lc, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jsound.dll" \
- -D "JDK_INTERNAL_NAME=jsound" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsound, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
-$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
-
-BUILD_LIBRARIES += $(BUILD_LIBJSOUND)
-
-##########################################################################################
-
-ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \
- LIBRARY := jsoundalsa, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBJSOUND_SRC_DIRS), \
- INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
- $(LIBJSOUND_DAUDIOFILES) \
- PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \
- PLATFORM_API_LinuxOS_ALSA_PCM.c \
- PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \
- PLATFORM_API_LinuxOS_ALSA_MidiIn.c \
- PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
- PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
- PLATFORM_API_LinuxOS_ALSA_Ports.c, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
- $(LIBJSOUND_CFLAGS) \
- -DUSE_DAUDIO=TRUE \
- -DUSE_PORTS=TRUE \
- -DUSE_PLATFORM_MIDI_OUT=TRUE \
- -DUSE_PLATFORM_MIDI_IN=TRUE, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(ALSA_LIBS) -ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundalsa, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
-
-endif
-
-##########################################################################################
-
-ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \
- LIBRARY := jsoundds, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBJSOUND_SRC_DIRS), \
- INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
- PLATFORM_API_WinOS_DirectSound.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(LIBJSOUND_CFLAGS) \
- -DUSE_DAUDIO=TRUE, \
- LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib, \
- VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
- RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jsoundds.dll" \
- -D "JDK_INTERNAL_NAME=jsoundds" \
- -D "JDK_FTYPE=0x2L", \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundds, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBJSOUNDDS)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- ifndef OPENJDK
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO, \
- LIBRARY := j2ucrypto, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
- MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
- LDFLAGS := $(LDFLAGS_JDKLIB), \
- LDFLAGS_SUFFIX := $(LIBDL), \
- LDFLAGS_SUFFIX_solaris := -lc, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2ucrypto, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)
-
- endif
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
+include lib/ServiceabilityLibraries.gmk
- $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE, \
- LIBRARY := AppleScriptEngine, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/macosx/native/apple/applescript, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := -framework Cocoa \
- -framework Carbon \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- $(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libAppleScriptEngine, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(BUILD_LIBAPPLESCRIPTENGINE): $(BUILD_LIBJAVA)
-
- BUILD_LIBRARIES += $(BUILD_LIBAPPLESCRIPTENGINE)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP, \
- LIBRARY := osxapp, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/macosx/native/sun/osxapp, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
- -I$(JDK_OUTPUTDIR)/gensrc/sun/osxapp \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_macosx := \
- -framework Accelerate \
- -framework ApplicationServices \
- -framework AudioToolbox \
- -framework Carbon \
- -framework Cocoa \
- -framework Security \
- -framework ExceptionHandling \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -framework OpenGL \
- -framework IOSurface \
- -framework QuartzCore, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxapp, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- LIBOSX_DIRS := \
- $(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
- $(JDK_TOPDIR)/src/macosx/native/java/util \
- $(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
- $(JDK_TOPDIR)/src/macosx/native/apple/security \
- $(JDK_TOPDIR)/src/macosx/native/apple/launcher
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
- LIBRARY := osx, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBOSX_DIRS), \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(foreach dir, $(LIBOSX_DIRS), -I$(dir)) \
- -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_macosx := \
- -losxapp \
- -framework Cocoa \
- -framework ApplicationServices \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -framework Security \
- -framework SystemConfiguration \
- $(LDFLAGS_JDKLIB_SUFFIX), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosx, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBOSX)
-
- $(BUILD_LIBOSX): $(BUILD_LIBOSXAPP)
-
- $(BUILD_LIBOSX): $(BUILD_LIBJAVA)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- LIBAWT_LWAWT_FILES := \
- awt.m \
- ApplicationDelegate.m \
- CFRetainedResource.m \
- CGLGraphicsConfig.m \
- CGLSurfaceData.m \
- CGLLayer.m \
- CGraphicsConfig.m \
- CGraphicsDevice.m \
- CGraphicsEnv.m \
- CCharToGlyphMapper.m \
- CSystemColors.m \
- AWTFont.m \
- CGGlyphOutlines.m \
- CGGlyphImages.m \
- CoreTextSupport.m \
- AWTStrike.m \
- InitIDs.m \
- AWTEvent.m \
- AWTView.m \
- AWTWindow.m \
- AWTSurfaceLayers.m \
- CCursorManager.m \
- CClipboard.m \
- CDataTransferer.m \
- CDragSource.m \
- CDragSourceContextPeer.m \
- CDropTarget.m \
- CDropTargetContextPeer.m \
- CInputMethod.m \
- CDesktopPeer.m \
- OSVersion.m \
- DnDUtilities.m \
- CFileDialog.m \
- CImage.m \
- CMenu.m \
- CMenuBar.m \
- CMenuComponent.m \
- CMenuItem.m \
- CPopupMenu.m \
- CRobot.m \
- CTrayIcon.m \
- CWrapper.m \
- JavaAccessibilityAction.m \
- JavaAccessibilityUtilities.m \
- JavaComponentAccessibility.m \
- JavaTextAccessibility.m \
- LWCToolkit.m \
- GeomUtilities.m \
- CPrinterJob.m \
- PrintModel.m \
- PrinterSurfaceData.m \
- PrinterView.m \
- QuartzSurfaceData.m \
- QuartzRenderer.m \
- CTextPipe.m \
- ImageSurfaceData.m \
- awt_DrawingSurface.m \
- \
- OGLBlitLoops.c \
- OGLBufImgOps.c \
- OGLContext.c \
- OGLFuncs.c \
- OGLMaskBlit.c \
- OGLMaskFill.c \
- OGLPaints.c \
- OGLRenderQueue.c \
- OGLRenderer.c \
- OGLSurfaceData.c \
- OGLTextRenderer.c \
- OGLVertexCache.c \
- AccelGlyphCache.c \
- CUPSfuncs.c
-
-
- LIBAWT_LWAWT_DIRS := \
- $(JDK_TOPDIR)/src/macosx/native/sun/awt \
- $(JDK_TOPDIR)/src/macosx/native/sun/font \
- $(JDK_TOPDIR)/src/macosx/native/sun/java2d/opengl \
- $(JDK_TOPDIR)/src/solaris/native/sun/awt \
- $(JDK_TOPDIR)/src/share/native/sun/font \
- $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
+include lib/Awt2dLibraries.gmk
- $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \
- LIBRARY := awt_lwawt, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(LIBAWT_LWAWT_DIRS), \
- LANG := C, \
- INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- $(X_CFLAGS) \
- $(X_LIBS) \
- $(foreach dir, $(LIBAWT_LWAWT_DIRS), -I$(dir)) \
- -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
- -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
- -framework Accelerate \
- -framework ApplicationServices \
- -framework AudioToolbox \
- -framework Carbon \
- -framework Cocoa \
- -framework Security \
- -framework ExceptionHandling \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -framework OpenGL \
- -framework QuartzCore -ljava, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_lwawt, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
-
- $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
-
- $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
-
- $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
-
- $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBJAVA)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
- LIBRARY := osxui, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(JDK_TOPDIR)/src/macosx/native/com/apple/laf, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
- -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
- -I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN) \
- -Xlinker -rpath -Xlinker @loader_path, \
- LDFLAGS_SUFFIX_macosx := -lawt -losxapp -lawt_lwawt \
- -framework Cocoa \
- -framework Carbon \
- -framework ApplicationServices \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -framework JavaRuntimeSupport \
- -ljava -ljvm, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxui, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
-
- $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
-
- $(BUILD_LIBOSXUI): $(BUILD_LIBOSXAPP)
-
- $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
-
- #$(BUILD_LIBOSXUI): $(BUILD_LIBJAVA)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
- # Ugly hack to mimic behaviour in old build where this is built as an xcode project.
- SET_SHARED_LIBRARY_NAME = -Xlinker -install_name -Xlinker /usr/local/lib/libJObjC.dylib
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32, \
- LIBRARY := JObjC, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc32, \
- SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
- $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := -fpascal-strings \
- -fobjc-gc \
- -gdwarf-2 \
- $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -m32, \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
- -m32, \
- LDFLAGS_SUFFIX := -framework Foundation -framework JavaVM \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -lffi, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc32, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64, \
- LIBRARY := JObjC, \
- OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc64, \
- SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
- $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native, \
- LANG := C, \
- OPTIMIZATION := LOW, \
- CFLAGS := -fpascal-strings \
- -fobjc-gc \
- -gdwarf-2 \
- $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- , \
- LDFLAGS := -fpascal-strings \
- -fobjc-gc \
- -gdwarf-2 \
- $(LDFLAGS_JDKLIB) \
- $(call SET_SHARED_LIBRARY_ORIGIN), \
- LDFLAGS_SUFFIX := -framework Foundation -framework JavaVM \
- -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
- -framework JavaNativeFoundation \
- -lffi, \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc64, \
- DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-
- $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
- $(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
-
- BUILD_LIBRARIES += $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX)
-
-endif
-
-##########################################################################################
-
-ifndef OPENJDK
- ifeq ($(OPENJDK_TARGET_OS), windows)
-
- ACCESSBRIDGE_SRCDIR := $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge
-
- define SetupAccessBridge
- # Parameter 1 Suffix
- # Parameter 2 Machine
- # Parameter 3 ACCESSBRIDGE_ARCH_ suffix
-
- $(call SetupNativeCompilation,BUILD_JAWTACCESSBRIDGE$1, \
- LIBRARY = JAWTAccessBridge$1, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(ACCESSBRIDGE_SRCDIR), \
- INCLUDE_FILES := JAWTAccessBridge.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -DACCESSBRIDGE_ARCH_$3, \
- LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
- winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
- -subsystem:windows -machine:$2 \
- -def:$(ACCESSBRIDGE_SRCDIR)/JAWTAccessBridge.DEF, \
- VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
- RC_FLAGS := $(RC_FLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawtaccessbridge$1, \
- DEBUG_SYMBOLS := true)
-
- $$(BUILD_JAWTACCESSBRIDGE$1): $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
-
- $(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1, \
- LIBRARY = JavaAccessBridge$1, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(ACCESSBRIDGE_SRCDIR), \
- INCLUDE_FILES := AccessBridgeATInstance.cpp AccessBridgeDebug.cpp \
- AccessBridgeJavaEntryPoints.cpp \
- AccessBridgeMessages.cpp JavaAccessBridge.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKLIB) \
- -DACCESSBRIDGE_ARCH_$3, \
- LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
- winspool.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
- -subsystem:windows -machine:$2 \
- -def:$(ACCESSBRIDGE_SRCDIR)/JavaAccessBridge.DEF, \
- VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
- RC_FLAGS := $(RC_FLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjavaaccessbridge$1, \
- DEBUG_SYMBOLS := true)
-
- $(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1, \
- LIBRARY = WindowsAccessBridge$1, \
- OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(ACCESSBRIDGE_SRCDIR), \
- INCLUDE_FILES := AccessBridgeJavaVMInstance.cpp AccessBridgeMessageQueue.cpp \
- AccessBridgeMessages.cpp AccessBridgeWindowsEntryPoints.cpp \
- WinAccessBridge.cpp AccessBridgeDebug.cpp \
- AccessBridgeEventHandler.cpp, \
- LANG := C++, \
- OPTIMIZATION := LOW, \
- CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT \
- -DACCESSBRIDGE_ARCH_$3, \
- LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
- winspool.lib comdlg32.lib advapi32.lib shell32.lib \
- ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
- -subsystem:windows -machine:$2 \
- -def:$(ACCESSBRIDGE_SRCDIR)/WinAccessBridge.DEF, \
- VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
- RC_FLAGS := $(RC_FLAGS), \
- OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libwindowsaccessbridge$1, \
- DEBUG_SYMBOLS := true)
-
- BUILD_LIBRARIES += $$(BUILD_JAWTACCESSBRIDGE$1) $$(BUILD_JAVAACCESSBRIDGE$1) \
- $$(BUILD_WINDOWSACCESSBRIDGE$1)
-
- endef
-
- ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
- $(eval $(call SetupAccessBridge,-32,I386,32))
- $(eval $(call SetupAccessBridge,,I386,LEGACY))
- else
- $(eval $(call SetupAccessBridge,-64,X64,64))
- endif
- endif
-endif
-
+include lib/SoundLibraries.gmk
##########################################################################################
--- a/jdk/makefiles/CopyFiles.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/CopyFiles.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -215,39 +215,37 @@
##########################################################################################
-# make sure freetype dll will be available at runtime as well as link time
-#
-# NB: Default freetype build system uses -h linker option and
-# result .so contains hardcoded library name that is later
-# used for adding dependencies to other objects
-# (e.g. libfontmanager.so).
-#
-# It is not obvious how to extract that hardcoded name (libfreetype.so.6)
-# without overcomplicating logic here.
-# To workaround this we hardcode .6 suffix for now.
-#
-# Note that .so.6 library will not be found by System.loadLibrary()
-# but fortunately we need to load FreeType library explicitly
-# on windows only
-#
-#TODO: rework this to avoid hardcoding library name in the makefile
-#
-ifdef OPENJDK
+ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
+ # We need to bundle the freetype library, so it will be available at runtime as well as link time.
+ #
+ # NB: Default freetype build system uses -h linker option and
+ # result .so contains hardcoded library name that is later
+ # used for adding dependencies to other objects
+ # (e.g. libfontmanager.so).
+ #
+ # It is not obvious how to extract that hardcoded name (libfreetype.so.6)
+ # without overcomplicating logic here.
+ # To workaround this we hardcode .6 suffix for now.
+ #
+ # Note that .so.6 library will not be found by System.loadLibrary()
+ # but fortunately we need to load FreeType library explicitly
+ # on windows only
+ #
+ #TODO: rework this to avoid hardcoding library name in the makefile
+ #
ifeq ($(OPENJDK_TARGET_OS), windows)
- FREETYPE_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
+ FREETYPE_TARGET_LIB = $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
else
- ifeq ($(USING_SYSTEM_FT_LIB), false)
- FREETYPE_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
- endif
+ FREETYPE_TARGET_LIB = $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
endif
- $(FREETYPE_LIB): $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype)
- $(CP) $(FREETYPE2_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@
+ $(FREETYPE_TARGET_LIB): $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype)
+ $(CP) $(FREETYPE_BUNDLE_LIB_PATH)/$(call SHARED_LIBRARY,freetype) $@
ifeq ($(OPENJDK_BUILD_OS), windows)
$(CHMOD) +rx $@
endif
- COPY_FILES += $(FREETYPE_LIB)
+ COPY_FILES += $(FREETYPE_TARGET_LIB)
endif
##########################################################################################
--- a/jdk/makefiles/CopyIntoClasses.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/CopyIntoClasses.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -91,7 +91,7 @@
$(SWING_PLAF_WINDOWS_RESOURCES_DIR_CLOSED)/icons/JavaCup32.png
endif
-ifndef OPENJDK
+ifeq ($(ENABLE_JFR), true)
JFR_CONFIGURATION_DIR_CLOSED = $(JDK_TOPDIR)/src/closed/share/classes/oracle/jrockit/jfr/settings
COPY_FILES += \
$(JFR_CONFIGURATION_DIR_CLOSED)/jfc.xsd
--- a/jdk/makefiles/Import.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/Import.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -119,8 +119,13 @@
$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
-JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
- $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.dSYM) \
+ $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+else
+ JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
+ $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
+endif
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(JVM_VARIANT_SERVER), true)
@@ -135,12 +140,14 @@
IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
- ifeq ($(JVM_VARIANT_MINIMAL1), true)
- IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
- ifneq (, $(JSIG_DEBUGINFO))
- IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ ifneq ($(OPENJDK_TARGET_OS), macosx)
+ ifeq ($(JVM_VARIANT_MINIMAL1), true)
+ IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+ ifneq (,$(JSIG_DEBUGINFO))
+ IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+ endif
+ endif
endif
- endif
endif
$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
@@ -148,6 +155,21 @@
$(RM) $@
$(LN) -s ../$(@F) $@
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+$(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(RM) $@.tmp $(basename $@).dSYM
+ $(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
+ $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
+ $(RM) $(basename $@).dSYM
+ $(MV) $@.tmp $@
+else
$(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -161,12 +183,28 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+$(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(LN) -s ../$(@F) $@
+
+$(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+ $(MKDIR) -p $(@D)
+ $(RM) $@
+ $(RM) $@.tmp $(basename $@).dSYM
+ $(LN) -s ../$(basename $(@F)).dSYM $(basename $@).dSYM
+ $(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).dSYM
+ $(RM) $(basename $@).dSYM
+ $(MV) $@.tmp $@
+else
$(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -180,12 +218,14 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
+ifneq ($(OPENJDK_TARGET_OS), macosx)
$(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
@@ -199,6 +239,7 @@
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
+endif
##########################################################################################
# Unpack the binary distributions of the crypto classes if they exist.
--- a/jdk/makefiles/Tools.gmk Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/Tools.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -156,6 +156,7 @@
# Tools needed on solaris because OBJCOPY is broken.
+ifeq ($(OPENJDK_TARGET_OS), solaris)
$(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
SRC := $(JDK_TOPDIR)/make/tools/add_gnu_debuglink, \
LANG := C, \
@@ -175,3 +176,4 @@
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
OUTPUT_DIR := $(JDK_OUTPUTDIR)/btbin, \
PROGRAM := fix_empty_sec_hdr_flags))
+endif
--- a/jdk/makefiles/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/jdk/makefiles/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
@@ -47,9 +45,7 @@
# Standard vm test target
jprt.vm.default.test.targets= \
- solaris_sparc_5.10-product-c1-jvm98, \
solaris_sparcv9_5.10-product-c2-jvm98, \
- solaris_i586_5.10-product-c1-jvm98, \
solaris_x64_5.10-product-c2-jvm98, \
linux_i586_2.6-product-{c1|c2}-jvm98, \
linux_x64_2.6-product-c2-jvm98, \
@@ -64,117 +60,91 @@
# Default jdk test targets in test/Makefile (no fastdebug & limited c2)
jprt.make.rule.default.test.targets= \
\
- solaris_sparc_5.10-product-c1-jdk_beans1, \
solaris_sparcv9_5.10-product-c2-jdk_beans1, \
- solaris_i586_5.10-product-c1-jdk_beans1, \
solaris_x64_5.10-product-c2-jdk_beans1, \
linux_i586_2.6-product-{c1|c2}-jdk_beans1, \
linux_x64_2.6-product-c2-jdk_beans1, \
windows_i586_6.1-product-c1-jdk_beans1, \
windows_x64_6.1-product-c2-jdk_beans1, \
\
- solaris_sparc_5.10-product-c1-jdk_io, \
solaris_sparcv9_5.10-product-c2-jdk_io, \
- solaris_i586_5.10-product-c1-jdk_io, \
solaris_x64_5.10-product-c2-jdk_io, \
linux_i586_2.6-product-{c1|c2}-jdk_io, \
linux_x64_2.6-product-c2-jdk_io, \
windows_i586_6.1-product-c1-jdk_io, \
windows_x64_6.1-product-c2-jdk_io, \
\
- solaris_sparc_5.10-product-c1-jdk_lang, \
solaris_sparcv9_5.10-product-c2-jdk_lang, \
- solaris_i586_5.10-product-c1-jdk_lang, \
solaris_x64_5.10-product-c2-jdk_lang, \
linux_i586_2.6-product-{c1|c2}-jdk_lang, \
linux_x64_2.6-product-c2-jdk_lang, \
windows_i586_6.1-product-c1-jdk_lang, \
windows_x64_6.1-product-c2-jdk_lang, \
\
- solaris_sparc_5.10-product-c1-jdk_math, \
solaris_sparcv9_5.10-product-c2-jdk_math, \
- solaris_i586_5.10-product-c1-jdk_math, \
solaris_x64_5.10-product-c2-jdk_math, \
linux_i586_2.6-product-{c1|c2}-jdk_math, \
linux_x64_2.6-product-c2-jdk_math, \
windows_i586_6.1-product-c1-jdk_math, \
windows_x64_6.1-product-c2-jdk_math, \
\
- solaris_sparc_5.10-product-c1-jdk_misc, \
solaris_sparcv9_5.10-product-c2-jdk_misc, \
- solaris_i586_5.10-product-c1-jdk_misc, \
solaris_x64_5.10-product-c2-jdk_misc, \
linux_i586_2.6-product-{c1|c2}-jdk_misc, \
linux_x64_2.6-product-c2-jdk_misc, \
windows_i586_6.1-product-c1-jdk_misc, \
windows_x64_6.1-product-c2-jdk_misc, \
\
- solaris_sparc_5.10-product-c1-jdk_net, \
solaris_sparcv9_5.10-product-c2-jdk_net, \
- solaris_i586_5.10-product-c1-jdk_net, \
solaris_x64_5.10-product-c2-jdk_net, \
linux_i586_2.6-product-{c1|c2}-jdk_net, \
linux_x64_2.6-product-c2-jdk_net, \
windows_i586_6.1-product-c1-jdk_net, \
windows_x64_6.1-product-c2-jdk_net, \
\
- solaris_sparc_5.10-product-c1-jdk_nio1, \
solaris_sparcv9_5.10-product-c2-jdk_nio1, \
- solaris_i586_5.10-product-c1-jdk_nio1, \
solaris_x64_5.10-product-c2-jdk_nio1, \
linux_i586_2.6-product-{c1|c2}-jdk_nio1, \
linux_x64_2.6-product-c2-jdk_nio1, \
windows_i586_6.1-product-c1-jdk_nio1, \
windows_x64_6.1-product-c2-jdk_nio1, \
\
- solaris_sparc_5.10-product-c1-jdk_nio2, \
solaris_sparcv9_5.10-product-c2-jdk_nio2, \
- solaris_i586_5.10-product-c1-jdk_nio2, \
solaris_x64_5.10-product-c2-jdk_nio2, \
linux_i586_2.6-product-{c1|c2}-jdk_nio2, \
linux_x64_2.6-product-c2-jdk_nio2, \
windows_i586_6.1-product-c1-jdk_nio2, \
windows_x64_6.1-product-c2-jdk_nio2, \
\
- solaris_sparc_5.10-product-c1-jdk_nio3, \
solaris_sparcv9_5.10-product-c2-jdk_nio3, \
- solaris_i586_5.10-product-c1-jdk_nio3, \
solaris_x64_5.10-product-c2-jdk_nio3, \
linux_i586_2.6-product-{c1|c2}-jdk_nio3, \
linux_x64_2.6-product-c2-jdk_nio3, \
windows_i586_6.1-product-c1-jdk_nio3, \
windows_x64_6.1-product-c2-jdk_nio3, \
\
- solaris_sparc_5.10-product-c1-jdk_security1, \
solaris_sparcv9_5.10-product-c2-jdk_security1, \
- solaris_i586_5.10-product-c1-jdk_security1, \
solaris_x64_5.10-product-c2-jdk_security1, \
linux_i586_2.6-product-{c1|c2}-jdk_security1, \
linux_x64_2.6-product-c2-jdk_security1, \
windows_i586_6.1-product-c1-jdk_security1, \
windows_x64_6.1-product-c2-jdk_security1, \
\
- solaris_sparc_5.10-product-c1-jdk_text, \
solaris_sparcv9_5.10-product-c2-jdk_text, \
- solaris_i586_5.10-product-c1-jdk_text, \
solaris_x64_5.10-product-c2-jdk_text, \
linux_i586_2.6-product-{c1|c2}-jdk_text, \
linux_x64_2.6-product-c2-jdk_text, \
windows_i586_6.1-product-c1-jdk_text, \
windows_x64_6.1-product-c2-jdk_text, \
\
- solaris_sparc_5.10-product-c1-jdk_tools1, \
solaris_sparcv9_5.10-product-c2-jdk_tools1, \
- solaris_i586_5.10-product-c1-jdk_tools1, \
solaris_x64_5.10-product-c2-jdk_tools1, \
linux_i586_2.6-product-{c1|c2}-jdk_tools1, \
linux_x64_2.6-product-c2-jdk_tools1, \
windows_i586_6.1-product-c1-jdk_tools1, \
windows_x64_6.1-product-c2-jdk_tools1, \
\
- solaris_sparc_5.10-product-c1-jdk_util, \
solaris_sparcv9_5.10-product-c2-jdk_util, \
- solaris_i586_5.10-product-c1-jdk_util, \
solaris_x64_5.10-product-c2-jdk_util, \
linux_i586_2.6-product-{c1|c2}-jdk_util, \
linux_x64_2.6-product-c2-jdk_util, \
@@ -186,99 +156,77 @@
\
${jprt.make.rule.default.test.targets}, \
\
- solaris_sparc_5.10-product-c1-jdk_awt, \
solaris_sparcv9_5.10-product-c2-jdk_awt, \
- solaris_i586_5.10-product-c1-jdk_awt, \
solaris_x64_5.10-product-c2-jdk_awt, \
linux_i586_2.6-product-{c1|c2}-jdk_awt, \
linux_x64_2.6-product-c2-jdk_awt, \
windows_i586_6.1-product-c1-jdk_awt, \
windows_x64_6.1-product-c2-jdk_awt, \
\
- solaris_sparc_5.10-product-c1-jdk_beans2, \
solaris_sparcv9_5.10-product-c2-jdk_beans2, \
- solaris_i586_5.10-product-c1-jdk_beans2, \
solaris_x64_5.10-product-c2-jdk_beans2, \
linux_i586_2.6-product-{c1|c2}-jdk_beans2, \
linux_x64_2.6-product-c2-jdk_beans2, \
windows_i586_6.1-product-c1-jdk_beans2, \
windows_x64_6.1-product-c2-jdk_beans2, \
\
- solaris_sparc_5.10-product-c1-jdk_beans3, \
solaris_sparcv9_5.10-product-c2-jdk_beans3, \
- solaris_i586_5.10-product-c1-jdk_beans3, \
solaris_x64_5.10-product-c2-jdk_beans3, \
linux_i586_2.6-product-{c1|c2}-jdk_beans3, \
linux_x64_2.6-product-c2-jdk_beans3, \
windows_i586_6.1-product-c1-jdk_beans3, \
windows_x64_6.1-product-c2-jdk_beans3, \
\
- solaris_sparc_5.10-product-c1-jdk_management1, \
solaris_sparcv9_5.10-product-c2-jdk_management1, \
- solaris_i586_5.10-product-c1-jdk_management1, \
solaris_x64_5.10-product-c2-jdk_management1, \
linux_i586_2.6-product-{c1|c2}-jdk_management1, \
linux_x64_2.6-product-c2-jdk_management1, \
windows_i586_6.1-product-c1-jdk_management1, \
windows_x64_6.1-product-c2-jdk_management1, \
\
- solaris_sparc_5.10-product-c1-jdk_management2, \
solaris_sparcv9_5.10-product-c2-jdk_management2, \
- solaris_i586_5.10-product-c1-jdk_management2, \
solaris_x64_5.10-product-c2-jdk_management2, \
linux_i586_2.6-product-{c1|c2}-jdk_management2, \
linux_x64_2.6-product-c2-jdk_management2, \
windows_i586_6.1-product-c1-jdk_management2, \
windows_x64_6.1-product-c2-jdk_management2, \
\
- solaris_sparc_5.10-product-c1-jdk_rmi, \
solaris_sparcv9_5.10-product-c2-jdk_rmi, \
- solaris_i586_5.10-product-c1-jdk_rmi, \
solaris_x64_5.10-product-c2-jdk_rmi, \
linux_i586_2.6-product-{c1|c2}-jdk_rmi, \
linux_x64_2.6-product-c2-jdk_rmi, \
windows_i586_6.1-product-c1-jdk_rmi, \
windows_x64_6.1-product-c2-jdk_rmi, \
\
- solaris_sparc_5.10-product-c1-jdk_security2, \
solaris_sparcv9_5.10-product-c2-jdk_security2, \
- solaris_i586_5.10-product-c1-jdk_security2, \
solaris_x64_5.10-product-c2-jdk_security2, \
linux_i586_2.6-product-{c1|c2}-jdk_security2, \
linux_x64_2.6-product-c2-jdk_security2, \
windows_i586_6.1-product-c1-jdk_security2, \
windows_x64_6.1-product-c2-jdk_security2, \
\
- solaris_sparc_5.10-product-c1-jdk_security3, \
solaris_sparcv9_5.10-product-c2-jdk_security3, \
- solaris_i586_5.10-product-c1-jdk_security3, \
solaris_x64_5.10-product-c2-jdk_security3, \
linux_i586_2.6-product-{c1|c2}-jdk_security3, \
linux_x64_2.6-product-c2-jdk_security3, \
windows_i586_6.1-product-c1-jdk_security3, \
windows_x64_6.1-product-c2-jdk_security3, \
\
- solaris_sparc_5.10-product-c1-jdk_sound, \
solaris_sparcv9_5.10-product-c2-jdk_sound, \
- solaris_i586_5.10-product-c1-jdk_sound, \
solaris_x64_5.10-product-c2-jdk_sound, \
linux_i586_2.6-product-{c1|c2}-jdk_sound, \
linux_x64_2.6-product-c2-jdk_sound, \
windows_i586_6.1-product-c1-jdk_sound, \
windows_x64_6.1-product-c2-jdk_sound, \
\
- solaris_sparc_5.10-product-c1-jdk_swing, \
solaris_sparcv9_5.10-product-c2-jdk_swing, \
- solaris_i586_5.10-product-c1-jdk_swing, \
solaris_x64_5.10-product-c2-jdk_swing, \
linux_i586_2.6-product-{c1|c2}-jdk_swing, \
linux_x64_2.6-product-c2-jdk_swing, \
windows_i586_6.1-product-c1-jdk_swing, \
windows_x64_6.1-product-c2-jdk_swing, \
\
- solaris_sparc_5.10-product-c1-jdk_tools2, \
solaris_sparcv9_5.10-product-c2-jdk_tools2, \
- solaris_i586_5.10-product-c1-jdk_tools2, \
solaris_x64_5.10-product-c2-jdk_tools2, \
linux_i586_2.6-product-{c1|c2}-jdk_tools2, \
linux_x64_2.6-product-c2-jdk_tools2, \
@@ -287,9 +235,7 @@
# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
jprt.my.jck.test.target.set= \
- solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
- solaris_i586_5.10-product-c1-JCK7TESTRULE, \
solaris_x64_5.10-product-c2-JCK7TESTRULE, \
linux_i586_2.6-product-c1-JCK7TESTRULE, \
linux_x64_2.6-product-c2-JCK7TESTRULE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/Awt2dLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,1527 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+# Openwin is defined on Solaris.
+OPENWIN_LIB := $(OPENWIN_HOME)/lib
+
+WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
+
+##########################################################################################
+
+BUILD_LIBMLIB_SRC := $(JDK_TOPDIR)/src/share/native/sun/awt/medialib
+BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
+ -I$(BUILD_LIBMLIB_SRC) \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/medialib
+
+BUILD_LIBMLIB_LDLIBS :=
+BUILD_LIBMLIB_IMAGE_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libmlib_image/mapfile-vers
+
+BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
+
+ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
+ BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
+ LIBRARY := mlib_image, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBMLIB_SRC), \
+ EXCLUDE_FILES := awt_ImagingLib.c mlib_c_ImageBlendTable.c, \
+ LANG := C, \
+ OPTIMIZATION := HIGHEST, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(BUILD_LIBMLIB_CFLAGS), \
+ MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(BUILD_LIBMLIB_LDLIBS) \
+ $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=mlib_image.dll" \
+ -D "JDK_INTERNAL_NAME=mlib_image" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBMLIB_IMAGE): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE)
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
+
+ BUILD_LIBMLIB_IMAGE_V_FILES := \
+ mlib_v_ImageLookUp.c \
+ mlib_ImageCreate.c \
+ mlib_ImageAffine.c \
+ mlib_ImageConvMxN.c \
+ mlib_ImageConvKernelConvert.c \
+ mlib_sys.c \
+ mlib_ImageLookUp_64.c \
+ mlib_ImageLookUp_Bit.c \
+ mlib_ImageColorTrue2Index.c \
+ mlib_c_ImageThresh1_U8.c \
+ mlib_v_ImageLookUpS16S16Func.c \
+ mlib_v_ImageLookUpS16S32Func.c \
+ mlib_v_ImageLookUpS16U16Func.c \
+ mlib_v_ImageLookUpS16U8Func.c \
+ mlib_v_ImageLookUpS32S16Func.c \
+ mlib_v_ImageLookUpS32S32Func.c \
+ mlib_v_ImageLookUpS32U16Func.c \
+ mlib_v_ImageLookUpS32U8Func.c \
+ mlib_v_ImageLookUpSIS16S16Func.c \
+ mlib_v_ImageLookUpSIS16S32Func.c \
+ mlib_v_ImageLookUpSIS16U16Func.c \
+ mlib_v_ImageLookUpSIS16U8Func.c \
+ mlib_v_ImageLookUpSIS32S16Func.c \
+ mlib_v_ImageLookUpSIS32S32Func.c \
+ mlib_v_ImageLookUpSIS32U16Func.c \
+ mlib_v_ImageLookUpSIS32U8Func.c \
+ mlib_v_ImageLookUpSIU16S16Func.c \
+ mlib_v_ImageLookUpSIU16S32Func.c \
+ mlib_v_ImageLookUpSIU16U16Func.c \
+ mlib_v_ImageLookUpSIU16U8Func.c \
+ mlib_v_ImageLookUpSIU8S16Func.c \
+ mlib_v_ImageLookUpSIU8S32Func.c \
+ mlib_v_ImageLookUpSIU8U16Func.c \
+ mlib_v_ImageLookUpSIU8U8Func.c \
+ mlib_v_ImageLookUpU16S16Func.c \
+ mlib_v_ImageLookUpU16S32Func.c \
+ mlib_v_ImageLookUpU16U16Func.c \
+ mlib_v_ImageLookUpU16U8Func.c \
+ mlib_v_ImageLookUpU8S16Func.c \
+ mlib_v_ImageLookUpU8S32Func.c \
+ mlib_v_ImageLookUpU8U16Func.c \
+ mlib_v_ImageLookUpU8U8Func.c \
+ mlib_v_ImageAffineIndex_BC.c \
+ mlib_v_ImageAffine_BC.c \
+ mlib_v_ImageAffine_BC_S16.c \
+ mlib_v_ImageAffine_BC_U16.c \
+ mlib_v_ImageAffine_BL.c \
+ mlib_v_ImageAffine_BL_S16.c \
+ mlib_v_ImageAffine_BL_U16.c \
+ mlib_v_ImageAffine_NN.c \
+ mlib_v_ImageFilters.c \
+ mlib_ImageAffineEdge.c \
+ mlib_ImageAffine_BC_D64.c \
+ mlib_ImageAffine_BC_F32.c \
+ mlib_ImageAffine_BC_S32.c \
+ mlib_ImageAffine_BL_D64.c \
+ mlib_ImageAffine_BL_F32.c \
+ mlib_ImageAffine_BL_S32.c \
+ mlib_ImageAffine_NN.c \
+ mlib_ImageAffine_NN_Bit.c \
+ mlib_ImageFilters.c \
+ mlib_ImageScanPoly.c \
+ mlib_ImageConv_8nw.c \
+ mlib_ImageConv_8ext.c \
+ mlib_ImageConv_16nw.c \
+ mlib_ImageConv_16ext.c \
+ mlib_ImageConv_u16nw.c \
+ mlib_ImageConv_u16ext.c \
+ mlib_ImageConv_32nw.c \
+ mlib_ImageConv_F32nw.c \
+ mlib_ImageConvMxN_Fp.c \
+ mlib_ImageConvMxN_ext.c \
+ mlib_ImageConv_D64nw.c \
+ mlib_ImageClipping.c \
+ mlib_ImageConvCopyEdge_Bit.c \
+ mlib_ImageConvClearEdge_Bit.c \
+ mlib_ImageConv2x2_f.c \
+ mlib_ImageConvClearEdge_Fp.c \
+ mlib_v_ImageConvMxN_8.c \
+ mlib_v_ImageConvClearEdge.c \
+ mlib_v_ImageConvCopyEdge.c \
+ mlib_v_ImageConvMxN_8ext.c \
+ mlib_v_ImageConvVersion.c \
+ mlib_v_ImageConv_8nw.c \
+ mlib_ImageConvCopyEdge_Fp.c \
+ mlib_v_ImageChannelInsert_1.c \
+ mlib_v_ImageChannelExtract_43.c \
+ mlib_v_ImageChannelExtract_1.c \
+ mlib_ImageCopy_Bit.c \
+ mlib_v_ImageCopy_f.c \
+ mlib_ImageUtils.c \
+ mlib_ImageDivTables.c
+
+ BUILD_LIBMLIB_V_CFLAGS := $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE_V, \
+ LIBRARY := mlib_image_v, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
+ $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib, \
+ LANG := C, \
+ INCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_FILES), \
+ OPTIMIZATION := HIGHEST, \
+ CFLAGS := -xarch=sparcvis \
+ $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il \
+ $(BUILD_LIBMLIB_V_CFLAGS) \
+ $(CFLAGS_JDKLIB), \
+ MAPFILE := $(BUILD_LIBMLIB_IMAGE_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image_v, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBMLIB_IMAGE_V)
+
+endif
+
+##########################################################################################
+
+LIBAWT_DIRS := \
+ $(JDK_TOPDIR)/src/share/native/sun/awt \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image/gif \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/medialib \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/utility \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/share/native/sun/font
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBAWT_DIRS += \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/d3d
+else
+ LIBAWT_DIRS += \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11
+endif
+
+LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES \
+ $(X_CFLAGS) \
+ $(foreach dir, $(LIBAWT_DIRS), -I$(dir))
+
+LIBAWT_FILES := \
+ gifdecoder.c \
+ imageInitIDs.c \
+ img_globals.c \
+ SurfaceData.c \
+ Region.c \
+ BufImgSurfaceData.c \
+ Disposer.c \
+ Trace.c \
+ GraphicsPrimitiveMgr.c \
+ Blit.c \
+ BlitBg.c \
+ ScaledBlit.c \
+ FillRect.c \
+ FillSpans.c \
+ FillParallelogram.c \
+ DrawParallelogram.c \
+ DrawLine.c \
+ DrawRect.c \
+ DrawPolygons.c \
+ DrawPath.c \
+ FillPath.c \
+ ProcessPath.c \
+ MaskBlit.c \
+ MaskFill.c \
+ TransformHelper.c \
+ AlphaMath.c \
+ AlphaMacros.c \
+ AnyByte.c \
+ ByteBinary1Bit.c \
+ ByteBinary2Bit.c \
+ ByteBinary4Bit.c \
+ ByteIndexed.c \
+ ByteGray.c \
+ Index8Gray.c \
+ Index12Gray.c \
+ AnyShort.c \
+ Ushort555Rgb.c \
+ Ushort565Rgb.c \
+ Ushort4444Argb.c \
+ Ushort555Rgbx.c \
+ UshortGray.c \
+ UshortIndexed.c \
+ Any3Byte.c \
+ ThreeByteBgr.c \
+ AnyInt.c \
+ IntArgb.c \
+ IntArgbPre.c \
+ IntArgbBm.c \
+ IntRgb.c \
+ IntBgr.c \
+ IntRgbx.c \
+ Any4Byte.c \
+ FourByteAbgr.c \
+ FourByteAbgrPre.c \
+ BufferedMaskBlit.c \
+ BufferedRenderPipe.c \
+ ShapeSpanIterator.c \
+ SpanClipRenderer.c \
+ awt_ImageRep.c \
+ awt_ImagingLib.c \
+ awt_Mlib.c \
+ awt_parseImage.c \
+ DataBufferNative.c \
+ dither.c \
+ debug_assert.c \
+ debug_mem.c \
+ debug_trace.c \
+ debug_util.c
+
+ifneq (, $(filter $(OPENJDK_TARGET_OS), solaris linux))
+ LIBAWT_FILES += awt_LoadLibrary.c initIDs.c img_colors.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBAWT_FILES += awt_LoadLibrary.c img_colors.c
+ LIBAWT_CFLAGS += -F/System/Library/Frameworks/JavaVM.framework/Frameworks
+endif
+
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
+ LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
+ LIBAWT_CFLAGS += -xarch=sparcvis
+ LIBAWT_CFLAGS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib/vis_$(OPENJDK_TARGET_CPU_BITS).il
+ LIBAWT_CFLAGS += \
+ -I$(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
+ -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/medialib \
+ -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops
+
+ LIBAWT_DIRS += $(JDK_TOPDIR)/src/solaris/native/sun/awt/medialib \
+ $(JDK_TOPDIR)/src/solaris/native/sun/java2d/loops
+
+ LIBAWT_FILES += \
+ vis_FuncArray.c \
+ java2d_Mlib.c \
+ mlib_ImageCreate.c \
+ mlib_ImageZoom_NN.c \
+ mlib_ImageCopy_Bit.c \
+ mlib_sys.c \
+ mlib_v_ImageClear.c \
+ mlib_v_ImageClear_f.c \
+ mlib_v_ImageConstXor.c \
+ mlib_v_ImageCopy.c \
+ mlib_v_ImageCopy_f.c \
+ mlib_v_ImageXor.c \
+ mlib_v_ImageZoom_NN_f.c \
+ vis_Interp.c \
+ vis_AlphaMacros.c \
+ vis_AlphaMaskBlit.c \
+ vis_AlphaMaskFill.c \
+ vis_ByteGray.c \
+ vis_ByteGray_FromRgb.c \
+ vis_ByteGray_Mask.c \
+ vis_ByteIndexed.c \
+ vis_DrawLine.c \
+ vis_FourByteAbgr.c \
+ vis_IntArgb.c \
+ vis_IntArgbPre.c \
+ vis_IntArgbPre_Mask.c \
+ vis_IntBgr.c \
+ vis_IntRgb.c \
+ vis_IntRgbx.c \
+ vis_SrcMaskFill.c \
+ vis_SrcOverMaskBlit.c \
+ vis_SrcOverMaskFill.c \
+ vis_FourByteAbgrPre.c \
+ vis_GlyphList.c \
+ vis_GlyphListXor.c \
+ vis_IntArgbBm.c \
+ vis_ThreeByteBgr.c \
+ vis_UshortGray.c \
+ vis_UshortGray_FromRgb.c \
+ vis_XorBlit.c \
+ mlib_v_ImageCopy_blk.s
+
+ ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
+ LIBAWT_ASFLAGS = -P -xarch=v9a
+ else
+ LIBAWT_ASFLAGS = -P -xarch=v8plusa
+ endif
+else
+ LIBAWT_FILES += MapAccelFunc.c
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), solaris)
+ LIBAWT_CFLAGS += -DMLIB_NO_LIBSUNMATH
+endif
+
+LIBAWT_LANG := C
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBAWT_FILES += AccelGlyphCache.c \
+ ShaderList.c \
+ CmdIDList.cpp \
+ Hashtable.cpp \
+ GDIHashtable.cpp \
+ Devices.cpp \
+ ObjectList.cpp \
+ GDIBlitLoops.cpp \
+ GDIRenderer.cpp \
+ GDIWindowSurfaceData.cpp \
+ WindowsFlags.cpp \
+ WPrinterJob.cpp \
+ awt_%.cpp \
+ D3DBlitLoops.cpp \
+ D3DBufImgOps.cpp \
+ D3DContext.cpp \
+ D3DGlyphCache.cpp \
+ D3DGraphicsDevice.cpp \
+ D3DMaskBlit.cpp \
+ D3DMaskCache.cpp \
+ D3DMaskFill.cpp \
+ D3DPipelineManager.cpp \
+ D3DPaints.cpp \
+ D3DRenderer.cpp \
+ D3DRenderQueue.cpp \
+ D3DResourceManager.cpp \
+ D3DSurfaceData.cpp \
+ D3DTextRenderer.cpp \
+ D3DVertexCacher.cpp \
+ ShellFolder2.cpp \
+ ThemeReader.cpp \
+ ComCtl32Util.cpp \
+ DllUtil.cpp \
+ initIDs.cpp \
+ MouseInfo.cpp \
+ rect.c \
+ OGLBlitLoops.c \
+ OGLBufImgOps.c \
+ OGLContext.c \
+ OGLFuncs.c \
+ OGLMaskBlit.c \
+ OGLMaskFill.c \
+ OGLPaints.c \
+ OGLRenderQueue.c \
+ OGLRenderer.c \
+ OGLSurfaceData.c \
+ OGLTextRenderer.c \
+ OGLVertexCache.c \
+ WGLGraphicsConfig.c \
+ WGLSurfaceData.c
+
+ LIBAWT_LANG := C++
+ LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
+ ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
+ LIBAWT_CFLAGS += -DMLIB_OS64BIT
+ endif
+
+ ifdef OPENJDK
+ LIBAWT_RC_FLAGS := -i "$(JDK_TOPDIR)/src/windows/resource/icons"
+ else
+ LIBAWT_RC_FLAGS := -i "$(JDK_TOPDIR)/src/closed/windows/native/sun/windows"
+ endif
+ LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/native/sun/windows/awt.rc
+endif
+
+ifeq ($(MILESTONE), internal)
+ LIBAWT_CFLAGS += -DINTERNAL_BUILD
+endif
+
+LIBAWT_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt/mapfile-vers
+ifeq ($(OPENJDK_TARGET_OS), linux)
+ LIBAWT_MAPFILE :=
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
+ LIBRARY := awt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBAWT_DIRS), \
+ INCLUDE_FILES := $(LIBAWT_FILES), \
+ LANG := $(LIBAWT_LANG), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+ ASFLAGS := $(LIBAWT_ASFLAGS), \
+ MAPFILE := $(LIBAWT_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
+ LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
+ LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
+ LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
+ -framework Cocoa \
+ -framework OpenGL \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -framework ApplicationServices \
+ -framework AudioToolbox \
+ -ljava, \
+ LDFLAGS_SUFFIX_windows := kernel32.lib user32.lib gdi32.lib winspool.lib \
+ imm32.lib ole32.lib uuid.lib shell32.lib \
+ comdlg32.lib winmm.lib comctl32.lib shlwapi.lib \
+ delayimp.lib jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
+ -DELAYLOAD:user32.dll -DELAYLOAD:gdi32.dll \
+ -DELAYLOAD:shell32.dll -DELAYLOAD:winmm.dll \
+ -DELAYLOAD:winspool.drv -DELAYLOAD:imm32.dll \
+ -DELAYLOAD:ole32.dll -DELAYLOAD:comdlg32.dll \
+ -DELAYLOAD:comctl32.dll -DELAYLOAD:shlwapi.dll, \
+ VERSIONINFO_RESOURCE := $(LIBAWT_VERSIONINFO_RESOURCE), \
+ RC_FLAGS := $(RC_FLAGS) $(LIBAWT_RC_FLAGS) \
+ -D "JDK_FNAME=awt.dll" \
+ -D "JDK_INTERNAL_NAME=awt" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBAWT): $(BUILD_LIBJAVA)
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
+endif
+
+BUILD_LIBRARIES += $(BUILD_LIBAWT)
+
+##########################################################################################
+
+# TODO!!
+# Even though this variable as a general name, it is
+# only used on macos, in fontpath.c, as prefix for where to find fonts.
+#
+# It's used for libawt_headless _and_ libawt_xawt
+#
+X11_PATH := /usr/X11R6
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ ifndef BUILD_HEADLESS_ONLY
+
+ LIBAWT_XAWT_DIRS := \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/utility \
+ $(JDK_TOPDIR)/src/share/native/sun/font \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/x11 \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/xawt \
+
+ LIBAWT_XAWT_CFLAGS := -DXAWT -DXAWT_HACK \
+ -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
+ $(CUPS_CFLAGS) \
+ $(foreach dir, $(LIBAWT_XAWT_DIRS), -I$(dir)) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ LIBAWT_XAWT_CFLAGS += -DFUNCPROTO=15
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+ ifndef OPENJDK
+ include $(JDK_TOPDIR)/make/closed/xawt.gmk
+ endif
+
+ ifeq ($(DISABLE_XRENDER), true)
+ LIBAWT_XAWT_CFLAGS += -DDISABLE_XRENDER_BY_DEFAULT=true
+ endif
+ endif
+
+ ifeq ($(MILESTONE), internal)
+ LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
+ endif
+
+ LIBAWT_XAWT_FILES := \
+ XlibWrapper.c \
+ XWindow.c \
+ XToolkit.c \
+ X11Color.c \
+ X11SurfaceData.c \
+ awt_GraphicsEnv.c \
+ awt_InputMethod.c \
+ robot_common.c \
+ awt_Robot.c \
+ list.c \
+ multiVis.c \
+ initIDs.c \
+ awt_util.c \
+ awt_Desktop.c \
+ awt_UNIXToolkit.c \
+ X11FontScaler_md.c \
+ X11TextRenderer_md.c \
+ fontpath.c \
+ awt_Insets.c \
+ awt_Event.c \
+ X11Renderer.c \
+ X11PMBlitLoops.c \
+ OGLBlitLoops.c \
+ OGLBufImgOps.c \
+ OGLContext.c \
+ OGLFuncs.c \
+ OGLMaskBlit.c \
+ OGLMaskFill.c \
+ OGLPaints.c \
+ OGLRenderQueue.c \
+ OGLRenderer.c \
+ OGLSurfaceData.c \
+ OGLTextRenderer.c \
+ OGLVertexCache.c \
+ GLXGraphicsConfig.c \
+ GLXSurfaceData.c \
+ AccelGlyphCache.c \
+ awt_Font.c \
+ multi_font.c \
+ awt_AWTEvent.c \
+ awt_DrawingSurface.c \
+ jawt.c \
+ CUPSfuncs.c \
+ debug_assert.c \
+ debug_mem.c \
+ debug_trace.c \
+ debug_util.c \
+ awt_Plugin.c \
+ gnome_interface.c \
+ gtk2_interface.c \
+ swing_GTKEngine.c \
+ swing_GTKStyle.c \
+ rect.c \
+ sun_awt_X11_GtkFileDialogPeer.c \
+ XRSurfaceData.c \
+ XRBackendNative.c
+
+ LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
+
+ ifeq ($(OPENJDK_TARGET_OS), linux)
+ # To match old build, add this to LDFLAGS instead of suffix.
+ LIBAWT_XAWT_LDFLAGS += -lpthread
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBAWT_XAWT_LDFLAGS_SUFFIX += -lpthread
+ endif
+
+ # On macosx, the shared library origin is set twice for this lib.
+ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_XAWT, \
+ LIBRARY := awt_xawt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBAWT_XAWT_DIRS), \
+ INCLUDE_FILES := $(LIBAWT_XAWT_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
+ $(X_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_xawt/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_solaris := -L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+ -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+ -R$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+ -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) \
+ -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN). \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(call SET_SHARED_LIBRARY_ORIGIN)., \
+ LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=xawt.dll" \
+ -D "JDK_INTERNAL_NAME=xawt" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_xawt, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBAWT_XAWT): $(BUILD_LIBJAVA)
+
+ $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
+
+ BUILD_LIBRARIES += $(BUILD_LIBAWT_XAWT)
+
+ endif
+endif
+
+##########################################################################################
+
+# TODO: Update awt lib path when awt is converted
+$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
+ LIBRARY := lcms, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/java2d/cmm/lcms, \
+ LANG := C, \
+ OPTIMIZATION := HIGHEST, \
+ CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
+ $(SHARED_LIBRARY_FLAGS) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug, \
+ CFLAGS_solaris := -xc99=no_lib, \
+ CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/liblcms/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
+ LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
+ LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc, \
+ LDFLAGS_SUFFIX_macosx := $(LIBM) -lawt -ljava -ljvm, \
+ LDFLAGS_SUFFIX_linux := -lm -lawt -ljava -ljvm, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=lcms.dll" \
+ -D "JDK_INTERNAL_NAME=lcms" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/liblcms, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBLCMS)
+
+$(BUILD_LIBLCMS): $(BUILD_LIBAWT)
+
+##########################################################################################
+
+ifdef OPENJDK
+ BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers
+else
+ BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/mapfile-vers-closed
+ BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
+ BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
+endif
+
+BUILD_LIBJPEG_REORDER :=
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+ BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
+ endif
+endif
+
+# Suppress gcc warnings like "variable might be clobbered by 'longjmp'
+# or 'vfork'": this warning indicates that some variable is placed to
+# a register by optimized compiler and it's value might be lost on longjmp().
+# Recommended way to avoid such warning is to declare the variable as
+# volatile to prevent the optimization. However, this approach does not
+# work because we have to declare all variables as volatile in result.
+#ifndef CROSS_COMPILE_ARCH
+# CC_43_OR_NEWER := \
+# $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
+# \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
+# ifeq ($(CC_43_OR_NEWER), 1)
+# BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
+# endif
+#endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
+ LIBRARY := jpeg, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
+ LANG := C, \
+ OPTIMIZATION := HIGHEST, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
+ MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jpeg.dll" \
+ -D "JDK_INTERNAL_NAME=jpeg" \
+ -D "JDK_FTYPE=0x2L", \
+ REORDER := $(BUILD_LIBJPEG_REORDER), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBJPEG)
+
+##########################################################################################
+
+ifndef OPENJDK
+ FONT_HEADERS := -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k
+ BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers
+ LIBFONTMANAGER_EXCLUDE_FILES += freetypeScaler.c
+else
+ FONT_HEADERS := $(FREETYPE_CFLAGS)
+ BUILD_LIBFONTMANAGER_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libfontmanager/mapfile-vers.openjdk
+ BUILD_LIBFONTMANAGER_FONTLIB := $(FREETYPE_LIBS)
+endif
+
+LIBFONTMANAGER_OPTIMIZATION := HIGH
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
+ X11TextRenderer.c
+ LIBFONTMANAGER_OPTIMIZATION := HIGHEST
+else
+ LIBFONTMANAGER_EXCLUDE_FILES += fontpath.c \
+ lcdglyph.c
+endif
+
+BUILD_LIBFONTMANAGER_CFLAGS_COMMON := \
+ $(X_CFLAGS) \
+ -DLE_STANDALONE -DHEADLESS \
+ $(FONT_HEADERS) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/font \
+ -I$(JDK_TOPDIR)/src/share/native/sun/font/layout \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d
+
+# Turn off aliasing with GCC for ExtensionSubtables.cpp
+ifeq ($(OPENJDK_TARGET_OS), linux)
+ BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
+ LIBRARY := fontmanager, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/font \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font, \
+ EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
+ AccelGlyphCache.c, \
+ LANG := C++, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(BUILD_LIBFONTMANAGER_CFLAGS_COMMON), \
+ OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
+ CFLAGS_windows = -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
+ -DCC_NOEX, \
+ MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
+ LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
+ LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
+ LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+ LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
+ -ljava -ljvm, \
+ LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
+ $(WIN_AWT_LIB), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=fontmanager.dll" \
+ -D "JDK_INTERNAL_NAME=fontmanager" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfontmanager, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
+
+ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris macosx))
+ $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
+endif
+
+BUILD_LIBRARIES += $(BUILD_LIBFONTMANAGER)
+
+##########################################################################################
+
+ifndef OPENJDK
+
+ #ifeq ($(OPENJDK_TARGET_OS), linux)
+ # ifeq ("$(CC_VER_MAJOR)", "3")
+ # OTHER_LDLIBS += -Wl,-Bstatic -lgcc_eh -Wl,-Bdynamic
+ # endif
+ #endif
+ #
+ # The resulting size of the t2k lib file is (at least on linux) dependant on the order of
+ # the input .o files. Because of this the new build will differ in size to the old build.
+ BUILD_LIBT2K_CFLAGS_COMMON := -I$(JDK_TOPDIR)/src/share/native/sun/font \
+ -I$(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
+ -I$(JDK_TOPDIR)/src/closed/share/native/sun/font \
+ -I$(JDK_TOPDIR)/src/share/share/native/sun/font \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/font \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBT2K, \
+ LIBRARY := t2k, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/font \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/font/t2k/ttHints, \
+ EXCLUDE_FILES := orion.c, \
+ LANG := C++, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON), \
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(BUILD_LIBT2K_CFLAGS_COMMON), \
+ CFLAGS_windows = -DCC_NOEX, \
+ CXXFLAGS_windows = -DCC_NOEX, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libt2k/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_windows := user32.lib $(JDK_OUTPUTDIR)/objs/libfontmanager/fontmanager.lib, \
+ LDFLAGS_SUFFIX_posix := $(LIBM) $(LIBCXX) -lfontmanager -ljava -ljvm -lc, \
+ LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=t2k.dll" \
+ -D "JDK_INTERNAL_NAME=t2k" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libt2k, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ # t2k is linked against fontmanager
+ $(BUILD_LIBT2K): $(BUILD_LIBFONTMANAGER)
+
+ BUILD_LIBRARIES += $(BUILD_LIBT2K)
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ ifeq ($(OPENJDK_TARGET_CPU), x86)
+ KERNEL32_LIB := kernel32.lib
+ endif
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
+ LIBRARY := jawt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows, \
+ INCLUDE_FILES := jawt.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CXXFLAGS_JDKLIB) \
+ -EHsc -DUNICODE -D_UNICODE \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/windows \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d/windows, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(KERNEL32_LIB) $(LDFLAGS_CXX_JDK) \
+ advapi32.lib $(WIN_AWT_LIB), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jawt.dll" \
+ -D "JDK_INTERNAL_NAME=jawt" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
+
+ $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
+ $(ECHO) Copying $(@F)
+ $(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
+
+ BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
+
+else # OPENJDK_TARGET_OS not windows
+
+ JAWT_LIBS :=
+ ifneq ($(OPENJDK_TARGET_OS), solaris)
+ JAWT_LIBS += -lawt
+ endif
+
+ ifndef BUILD_HEADLESS_ONLY
+ JAWT_LIBS += -lawt_xawt
+ else
+ JAWT_LIBS += -lawt_headless
+ HEADLESS_CFLAG += -DHEADLESS
+ endif
+
+ JAWT_FILES := jawt.c
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ JAWT_FILES := jawt.m
+ JAWT_LIBS := -lawt_lwawt
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJAWT, \
+ LIBRARY := jawt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt \
+ $(JDK_TOPDIR)/src/macosx/native/sun/awt, \
+ INCLUDE_FILES := $(JAWT_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB), \
+ CFLAGS_linux := $(HEADLESS_CFLAG), \
+ CFLAGS_macosx := -I$(JDK_TOPDIR)/src/solaris/native/sun/awt, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjawt/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := -L$(OPENWIN_HOME)/sfw/lib$(OPENJDK_TARGET_CPU_ISADIR) -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
+ LDFLAGS_SUFFIX_linux := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_solaris := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender, \
+ LDFLAGS_SUFFIX_macosx := -Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
+ -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ ifndef BUILD_HEADLESS_ONLY
+ $(BUILD_LIBJAWT): $(BUILD_LIBAWT_XAWT)
+ else
+ $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX)
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $(BUILD_LIBJAWT): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)awt_lwawt$(SHARED_LIBRARY_SUFFIX)
+ endif
+
+endif # OPENJDK_TARGET_OS
+
+BUILD_LIBRARIES += $(BUILD_LIBJAWT)
+
+##########################################################################################
+
+ifndef OPENJDK
+
+ BUILD_LIBKCMS_EXCLUDE_FILES :=
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBKCMS_EXCLUDE_FILES += ukcpmgr.c unixmem.c
+ else
+ BUILD_LIBKCMS_EXCLUDE_FILES += cmmdll.c registry.c spxffile.c sysinfo.c winmem.c wkcpmgr.c
+ endif
+
+ BUILD_LIBKCMS_FLAGS := $(CFLAGS_JDKLIB)
+
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # This particular library uses a feature called PIC_CODE_SMALL (on solaris)
+ # implement it like this...since it's only used here
+ BUILD_LIBKCMS_FLAGS := $(patsubst -KPIC, -Kpic, $(BUILD_LIBKCMS_FLAGS))
+ else ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
+ BUILD_LIBKCMS_FLAGS := $(patsubst -fPIC, -fpic, $(BUILD_LIBKCMS_FLAGS))
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBKCMS, \
+ LIBRARY := kcms, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms, \
+ LANG := C, \
+ EXCLUDE_FILES := $(BUILD_LIBKCMS_EXCLUDE_FILES), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(BUILD_LIBKCMS_FLAGS) \
+ -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST, \
+ CFLAGS_linux := -Wno-missing-field-initializers, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libkcms/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := -lc -lpthread, \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib version.lib, \
+ LDFLAGS_SUFFIX_posix := -lm -ljava -ljvm, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/closed/share/native/sun/java2d/cmm/kcms/cmm.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=kcms.dll" \
+ -D "JDK_INTERNAL_NAME=kcms" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkcms, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBKCMS): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBKCMS)
+
+endif
+
+##########################################################################################
+
+ifndef OPENJDK
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+
+ ifeq ($(shell if test "$(OS_VERSION_MAJOR)" -eq 5 -a "$(OS_VERSION_MINOR)" -le 10; then $(ECHO) ok; fi), ok)
+
+ SUNWJDGA_MAPFILE :=
+ ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
+ SUNWJDGA_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjdga/mapfile-vers
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNWJDGA, \
+ LIBRARY := sunwjdga, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/solaris/native/sun/jdga, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/javavm/export \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/javavm/export \
+ -I$(OPENWIN_HOME)/include, \
+ MAPFILE := $(SUNWJDGA_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -ldga -lX11 $(LIBDL) -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunwjdga, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBSUNWJDGA)
+
+ endif
+ endif
+ endif
+endif
+
+##########################################################################################
+
+ifeq ($(BUILD_HEADLESS), true)
+ ifneq ($(OPENJDK_TARGET_OS), windows)
+
+ LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/share/native/sun/font \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/solaris/native/sun/font \
+ $(JDK_TOPDIR)/src/solaris/native/sun/awt \
+ $(JDK_TOPDIR)/src/solaris/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/solaris/native/sun/java2d/x11
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBAWT_HEADLESS_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/font
+ endif
+
+ LIBAWT_HEADLESS_CFLAGS := -DHEADLESS=true \
+ -DX11_PATH=\"$(X11_PATH)\" -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
+ $(CUPS_CFLAGS) \
+ $(X_CFLAGS) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/jdga \
+ $(foreach dir, $(LIBAWT_HEADLESS_DIRS), -I$(dir))
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBAWT_HEADLESS_CFLAGS += \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks
+ endif
+
+ LIBAWT_HEADLESS_FILES := \
+ awt_Font.c \
+ HeadlessToolkit.c \
+ fontpath.c \
+ VDrawingArea.c \
+ X11Color.c \
+ X11Renderer.c \
+ X11PMBlitLoops.c \
+ X11SurfaceData.c \
+ X11FontScaler_md.c \
+ X11TextRenderer_md.c \
+ OGLBlitLoops.c \
+ OGLBufImgOps.c \
+ OGLContext.c \
+ OGLFuncs.c \
+ OGLMaskBlit.c \
+ OGLMaskFill.c \
+ OGLPaints.c \
+ OGLRenderQueue.c \
+ OGLRenderer.c \
+ OGLSurfaceData.c \
+ OGLTextRenderer.c \
+ OGLVertexCache.c \
+ GLXGraphicsConfig.c \
+ GLXSurfaceData.c \
+ AccelGlyphCache.c \
+ CUPSfuncs.c
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBAWT_HEADLESS_FILES += \
+ AWTFont.m \
+ AWTStrike.m \
+ CCharToGlyphMapper.m \
+ CGGlyphImages.m \
+ CGGlyphOutlines.m \
+ CoreTextSupport.m
+ endif
+
+ LIBAWT_HEADLESS_REORDER :=
+ ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+ LIBAWT_HEADLESS_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/reorder-$(OPENJDK_TARGET_CPU)
+ endif
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_HEADLESS, \
+ LIBRARY := awt_headless, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBAWT_HEADLESS_DIRS), \
+ INCLUDE_FILES := $(LIBAWT_HEADLESS_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_HEADLESS_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libawt_headless/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+ -R/usr/dt/lib$(OPENJDK_TARGET_CPU_ISADIR) \
+ -R$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR), \
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
+ REORDER := $(LIBAWT_HEADLESS_REORDER), \
+ LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
+ LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
+ LDFLAGS_SUFFIX_macosx := -ljvm $(LIBCXX) -lawt $(LIBDL) -ljava \
+ -framework Accelerate \
+ -framework ApplicationServices \
+ -framework Cocoa \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
+
+ BUILD_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
+
+ endif
+endif
+
+##########################################################################################
+
+ifndef BUILD_HEADLESS_ONLY
+ LIBSPLASHSCREEN_DIRS := \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/libpng \
+ $(JDK_TOPDIR)/src/share/native/sun/awt/splashscreen
+
+ ifeq ($(USE_EXTERNAL_LIBGIF), true)
+ GIFLIB_LDFLAGS := -lgif
+ else
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/giflib
+ GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
+ endif
+
+ ifneq ($(OPENJDK_TARGET_OS), macosx)
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/awt/splashscreen
+ else
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen
+ endif
+
+ LIBSPLASHSCREEN_CFLAGS := -DSPLASHSCREEN -DPNG_NO_MMX_CODE \
+ $(foreach dir, $(LIBSPLASHSCREEN_DIRS), -I$(dir))
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBSPLASHSCREEN_CFLAGS := -I$(JDK_TOPDIR)/src/macosx/native/sun/awt/splashscreen \
+ $(LIBSPLASHSCREEN_CFLAGS) \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks
+ LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
+ LIBSPLASHSCREEN_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp
+
+ LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_gif.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_impl.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_jpeg.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_png.c_CFLAGS := -x objective-c -O0
+ LIBSPLASHSCREEN_splashscreen_sys.m_CFLAGS := -O0
+
+ else ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBSPLASHSCREEN_CFLAGS += -DWITH_WIN32
+ else ifeq ($(OPENJDK_TARGET_OS), solaris)
+ LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 -I$(OPENWIN_HOME)/include -I$(OPENWIN_HOME)/include/X11/extensions
+ else
+ LIBSPLASHSCREEN_CFLAGS += -DWITH_X11 $(X_CFLAGS)
+ endif
+
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX :=
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
+ LIBSPLASHSCREEN_CFLAGS += $(ZLIB_CPPFLAGS)
+ endif
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
+ -framework ApplicationServices \
+ -framework Foundation \
+ -framework Cocoa \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation
+ else ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX += kernel32.lib user32.lib gdi32.lib delayimp.lib -DELAYLOAD:user32.dll
+ else ifeq ($(OPENJDK_TARGET_OS), solaris)
+ # Solaris still uses OPENWIN_LIB ..
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX += -L$(OPENWIN_LIB)$(OPENJDK_TARGET_CPU_ISADIR) -lX11 -lXext $(LIBM) -lpthread
+ else # .. all other Unixes can use X_LIBS
+ LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread
+ endif
+
+ $(eval $(call SetupNativeCompilation,LIBSPLASHSCREEN, \
+ LIBRARY := splashscreen, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBSPLASHSCREEN_DIRS), \
+ EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) $(GIFLIB_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsplashscreen/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) $(GIFLIB_LDFLAGS), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=splashscreen.dll" \
+ -D "JDK_INTERNAL_NAME=splashscreen" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsplashscreen, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(LIBSPLASHSCREEN)
+
+ ifeq ($(OPENJDK_TARGET_OS), macosx)
+ $(LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
+ endif
+
+endif
+
+##########################################################################################
+
+ifndef OPENJDK
+
+ LIBDCPR_SRC_DIRS := \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/dc/doe \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/dc/path \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/dc/pr \
+ $(JDK_TOPDIR)/src/closed/share/native/sun/dc/util
+
+ LIBDCPR_CFLAGS := $(foreach dir, $(LIBDCPR_SRC_DIRS), -I$(dir)) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBDCPR, \
+ LIBRARY := dcpr, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBDCPR_SRC_DIRS), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBDCPR_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libdcpr/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(LIBM) $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_posix := -lm, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=dcpr.dll" \
+ -D "JDK_INTERNAL_NAME=dcpr" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdcpr, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBDCPR): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBDCPR)
+
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ LIBAWT_LWAWT_FILES := \
+ awt.m \
+ ApplicationDelegate.m \
+ CFRetainedResource.m \
+ CGLGraphicsConfig.m \
+ CGLSurfaceData.m \
+ CGLLayer.m \
+ CGraphicsConfig.m \
+ CGraphicsDevice.m \
+ CGraphicsEnv.m \
+ CCharToGlyphMapper.m \
+ CSystemColors.m \
+ AWTFont.m \
+ CGGlyphOutlines.m \
+ CGGlyphImages.m \
+ CoreTextSupport.m \
+ AWTStrike.m \
+ InitIDs.m \
+ AWTEvent.m \
+ AWTView.m \
+ AWTWindow.m \
+ AWTSurfaceLayers.m \
+ CCursorManager.m \
+ CClipboard.m \
+ CDataTransferer.m \
+ CDragSource.m \
+ CDragSourceContextPeer.m \
+ CDropTarget.m \
+ CDropTargetContextPeer.m \
+ CInputMethod.m \
+ CDesktopPeer.m \
+ OSVersion.m \
+ DnDUtilities.m \
+ CFileDialog.m \
+ CImage.m \
+ CMenu.m \
+ CMenuBar.m \
+ CMenuComponent.m \
+ CMenuItem.m \
+ CPopupMenu.m \
+ CRobot.m \
+ CTrayIcon.m \
+ CWrapper.m \
+ JavaAccessibilityAction.m \
+ JavaAccessibilityUtilities.m \
+ JavaComponentAccessibility.m \
+ JavaTextAccessibility.m \
+ LWCToolkit.m \
+ GeomUtilities.m \
+ CPrinterJob.m \
+ PrintModel.m \
+ PrinterSurfaceData.m \
+ PrinterView.m \
+ QuartzSurfaceData.m \
+ QuartzRenderer.m \
+ CTextPipe.m \
+ ImageSurfaceData.m \
+ awt_DrawingSurface.m \
+ \
+ OGLBlitLoops.c \
+ OGLBufImgOps.c \
+ OGLContext.c \
+ OGLFuncs.c \
+ OGLMaskBlit.c \
+ OGLMaskFill.c \
+ OGLPaints.c \
+ OGLRenderQueue.c \
+ OGLRenderer.c \
+ OGLSurfaceData.c \
+ OGLTextRenderer.c \
+ OGLVertexCache.c \
+ AccelGlyphCache.c \
+ CUPSfuncs.c
+
+
+ LIBAWT_LWAWT_DIRS := \
+ $(JDK_TOPDIR)/src/macosx/native/sun/awt \
+ $(JDK_TOPDIR)/src/macosx/native/sun/font \
+ $(JDK_TOPDIR)/src/macosx/native/sun/java2d/opengl \
+ $(JDK_TOPDIR)/src/solaris/native/sun/awt \
+ $(JDK_TOPDIR)/src/share/native/sun/font \
+ $(JDK_TOPDIR)/src/share/native/sun/java2d/opengl \
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT_LWAWT, \
+ LIBRARY := awt_lwawt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBAWT_LWAWT_DIRS), \
+ LANG := C, \
+ INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(X_CFLAGS) \
+ $(X_LIBS) \
+ $(foreach dir, $(LIBAWT_LWAWT_DIRS), -I$(dir)) \
+ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/solaris/native/sun/java2d \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/cvutils \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/loops \
+ -I$(JDK_TOPDIR)/src/share/native/sun/java2d/pipe \
+ -I$(JDK_TOPDIR)/src/share/native/sun/awt/debug \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
+ -framework Accelerate \
+ -framework ApplicationServices \
+ -framework AudioToolbox \
+ -framework Carbon \
+ -framework Cocoa \
+ -framework Security \
+ -framework ExceptionHandling \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -framework OpenGL \
+ -framework QuartzCore -ljava, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_lwawt, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
+
+ $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
+
+ $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
+
+ $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
+
+ $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBJAVA)
+
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXUI, \
+ LIBRARY := osxui, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/macosx/native/com/apple/laf, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/macosx/native/com/apple/laf \
+ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
+ -I$(JDK_TOPDIR)/src/macosx/native/sun/awt \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ -Xlinker -rpath -Xlinker @loader_path, \
+ LDFLAGS_SUFFIX_macosx := -lawt -losxapp -lawt_lwawt \
+ -framework Cocoa \
+ -framework Carbon \
+ -framework ApplicationServices \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -ljava -ljvm, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxui, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBOSXUI)
+
+ $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
+
+ $(BUILD_LIBOSXUI): $(BUILD_LIBOSXAPP)
+
+ $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
+
+ #$(BUILD_LIBOSXUI): $(BUILD_LIBJAVA)
+
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/CoreLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,510 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
+
+##########################################################################################
+
+BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
+
+ifneq ($(OPENJDK_TARGET_OS), solaris)
+ BUILD_LIBFDLIBM_OPTIMIZATION := NONE
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
+ STATIC_LIBRARY := fdlibm, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
+ LANG := C, \
+ OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
+ CFLAGS_windows_debug := -DLOGGING, \
+ ARFLAGS := $(ARFLAGS), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+else
+
+ # On macosx the old build does partial (incremental) linking of fdlibm instead of
+ # a plain static library.
+ $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
+ LIBRARY := fdlibm, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ SRC := $(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/src, \
+ LANG := C, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include, \
+ LDFLAGS := -nostdlib -r -arch x86_64, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
+ $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
+ $(call install-file)
+
+endif
+
+BUILD_LIBRARIES += $(BUILD_LIBFDLIBM)
+
+##########################################################################################
+
+BUILD_LIBVERIFY_SRC := check_code.c check_format.c
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+ BUILD_LIBVERIFY_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libverify/reorder-$(OPENJDK_TARGET_CPU)
+ endif
+endif
+
+LIBVERIFY_OPTIMIZATION := HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ LIBVERIFY_OPTIMIZATION := LOW
+ endif
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
+ LIBRARY := verify, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/common, \
+ INCLUDE_FILES := $(BUILD_LIBVERIFY_SRC), \
+ LANG := C, \
+ OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
+ CFLAGS := $(CFLAGS_JDKLIB), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libverify/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_posix := -ljvm -lc, \
+ LDFLAGS_SUFFIX_windows := jvm.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=verify.dll" \
+ -D "JDK_INTERNAL_NAME=verify" \
+ -D "JDK_FTYPE=0x2L", \
+ REORDER := $(BUILD_LIBVERIFY_REORDER), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libverify, \
+ DEBUG_SYMBOLS := true))
+
+BUILD_LIBRARIES += $(BUILD_LIBVERIFY)
+
+##########################################################################################
+
+LIBJAVA_SRC_DIRS := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/lang \
+ $(JDK_TOPDIR)/src/share/native/java/lang \
+ $(JDK_TOPDIR)/src/share/native/java/lang/ref \
+ $(JDK_TOPDIR)/src/share/native/java/lang/reflect \
+ $(JDK_TOPDIR)/src/share/native/java/io \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
+ $(JDK_TOPDIR)/src/share/native/java/nio \
+ $(JDK_TOPDIR)/src/share/native/java/security \
+ $(JDK_TOPDIR)/src/share/native/common \
+ $(JDK_TOPDIR)/src/share/native/sun/misc \
+ $(JDK_TOPDIR)/src/share/native/sun/reflect \
+ $(JDK_TOPDIR)/src/share/native/java/util \
+ $(JDK_TOPDIR)/src/share/native/java/util/concurrent/atomic \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/common \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/util
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/util/locale/provider
+else
+ LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/sun/util/locale/provider
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBJAVA_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/provider \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/io
+endif
+
+LIBJAVA_CFLAGS := $(foreach dir, $(LIBJAVA_SRC_DIRS), -I$(dir)) \
+ -I$(JDK_TOPDIR)/src/share/native/java/lang/fdlibm/include \
+ -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+
+LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
+ -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
+ -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
+ -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"'
+
+ifneq (, $(JDK_UPDATE_VERSION))
+ LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
+endif
+
+LIBJAVA_EXCLUDE_FILES := check_code.c check_format.c jspawnhelper.c
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ LIBJAVA_EXCLUDE_FILES += java_props_macosx.c
+else
+ BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
+ BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBJAVA_EXCLUDE_FILES += \
+ UNIXProcess_md.c \
+ UnixFileSystem_md.c \
+ FileSystemPreferences.c
+else
+ LIBJAVA_EXCLUDE_FILES += \
+ ProcessImpl_md.c \
+ WinNTFileSystem_md.c \
+ dirent_md.c \
+ WindowsPreferences.c \
+ sun/security/provider/WinCAPISeedGenerator.c \
+ sun/io/Win32ErrorMode.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+ LIBJAVA_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libjava/reorder-$(OPENJDK_TARGET_CPU)
+ endif
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
+ LIBRARY := java, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBJAVA_SRC_DIRS), \
+ EXCLUDES := fdlibm/src zip, \
+ EXCLUDE_FILES := $(LIBJAVA_EXCLUDE_FILES), \
+ LANG := C, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBJAVA_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjava/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_posix := -ljvm -lverify, \
+ LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
+ LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
+ -framework CoreFoundation \
+ -framework Foundation \
+ -framework Security -framework SystemConfiguration, \
+ LDFLAGS_SUFFIX_windows := -export:winFileHandleOpen -export:handleLseek \
+ jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
+ shell32.lib delayimp.lib -DELAYLOAD:shell32.dll \
+ advapi32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=java.dll" \
+ -D "JDK_INTERNAL_NAME=java" \
+ -D "JDK_FTYPE=0x2L", \
+ REORDER := $(LIBJAVA_REORDER), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBJAVA)
+
+$(BUILD_LIBJAVA): $(LIBJLI_BINARY)
+
+$(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
+
+$(BUILD_LIBJAVA): $(BUILD_LIBFDLIBM)
+
+##########################################################################################
+
+BUILD_LIBZIP_EXCLUDES :=
+ifeq ($(USE_EXTERNAL_LIBZ), true)
+ LIBZ := -lz
+ LIBZIP_EXCLUDES += zlib-1.2.5
+else
+ ZLIB_CPPFLAGS := -I$(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
+endif
+
+BUILD_LIBZIP_REORDER :=
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifneq ($(OPENJDK_TARGET_CPU), x86_64)
+ BUILD_LIBZIP_REORDER := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/reorder-$(OPENJDK_TARGET_CPU)
+ endif
+endif
+
+ifeq ($(LIBZIP_CAN_USE_MMAP), true)
+ BUILD_LIBZIP_MMAP := -DUSE_MMAP
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
+ LIBRARY := zip, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ SRC := $(JDK_TOPDIR)/src/share/native/java/util/zip, \
+ EXCLUDES := $(LIBZIP_EXCLUDES), \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(ZLIB_CPPFLAGS) \
+ -I$(JDK_TOPDIR)/src/share/native/java/io \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io, \
+ CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libzip/mapfile-vers, \
+ REORDER := $(BUILD_LIBZIP_REORDER), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(EXPORT_ZIP_FUNCS), \
+ LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
+ -export:ZIP_ReadEntry -export:ZIP_GetNextEntry jvm.lib \
+ $(WIN_JAVA_LIB), \
+ LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
+ LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
+ LDFLAGS_SUFFIX_macosx := $(LIBZ) -ljava -ljvm, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=zip.dll" \
+ -D "JDK_INTERNAL_NAME=zip" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+
+$(BUILD_LIBZIP): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBZIP)
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
+ LIBRARY := unpack, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/com/sun/java/util/jar/pack, \
+ EXCLUDE_FILES := main.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CXXFLAGS_JDKLIB) \
+ -DNO_ZLIB -DUNPACK_JNI -DFULL, \
+ CFLAGS_release := -DPRODUCT, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libunpack/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
+ jvm.lib $(WIN_JAVA_LIB), \
+ LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=unpack.dll" \
+ -D "JDK_INTERNAL_NAME=unpack" \
+ -D "JDK_FTYPE=0x2L", \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBUNPACK)
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.map: $(BUILD_LIBUNPACK)
+ $(ECHO) Copying $(@F)
+ $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.map, $<) $@
+
+ $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)unpack.pdb: $(BUILD_LIBUNPACK)
+ $(ECHO) Copying $(@F)
+ $(CP) $(patsubst %$(SHARED_LIBRARY_SUFFIX), %.pdb, $<) $@
+endif
+
+##########################################################################################
+
+BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/share/bin $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin
+LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) $(foreach dir, $(BUILD_LIBJLI_SRC_DIRS), -I$(dir))
+
+BUILD_LIBJLI_FILES := \
+ java.c \
+ splashscreen_stubs.c \
+ parse_manifest.c \
+ version_comp.c \
+ wildcard.c \
+ jli_util.c
+
+ifeq ($(JVM_VARIANT_ZERO), true)
+ ERGO_FAMILY := zero
+else
+ ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
+ ERGO_FAMILY := i586
+ else
+ ERGO_FAMILY := $(OPENJDK_TARGET_CPU_ARCH)
+ endif
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBJLI_CFLAGS += -I$(JDK_TOPDIR)/src/macosx/bin
+ BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/bin
+ BUILD_LIBJLI_FILES += java_md_common.c java_md_macosx.c
+
+ BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
+ BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBJLI_FILES += java_md.c \
+ cmdtoargs.c
+ # Staticically link with c runtime on windows.
+ LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
+else ifneq ($(OPENJDK_TARGET_OS), macosx)
+
+ BUILD_LIBJLI_FILES += java_md_common.c
+ BUILD_LIBJLI_FILES += java_md_solinux.c ergo.c
+
+ ERGO_ARCH_FILE = ergo_$(ERGO_FAMILY).c
+
+ # if the architecture specific ergo file exists then
+ # use it, else use the generic definitions from ergo.c
+ ifneq ($(wildcard $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/bin/$(ERGO_ARCH_FILE)), )
+ BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
+ else # !ERGO_ARCH_FILE
+ LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
+ endif # ERGO_ARCH_FILE
+endif #WINDOWS
+
+# Append defines depending on target platform
+LIBJLI_CFLAGS += $(OPENJDK_TARGET_CPU_JLI_CFLAGS)
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
+endif
+
+ifneq ($(USE_EXTERNAL_LIBZ), true)
+ BUILD_LIBJLI_SRC_DIRS += $(JDK_TOPDIR)/src/share/native/java/util/zip/zlib-1.2.5
+ LIBJLI_CFLAGS += $(ZLIB_CPPFLAGS)
+ BUILD_LIBJLI_FILES += \
+ inflate.c \
+ inftrees.c \
+ inffast.c \
+ zadler32.c \
+ zcrc32.c \
+ zutil.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
+else
+ LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
+ LIBRARY := jli, \
+ OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
+ SRC := $(BUILD_LIBJLI_SRC_DIRS), \
+ INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
+ LANG := C, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(LIBJLI_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjli/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+ LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \
+ LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \
+ LDFLAGS_SUFFIX_macosx := $(LIBZ), \
+ LDFLAGS_SUFFIX_windows := \
+ -export:JLI_Launch \
+ -export:JLI_ManifestIterate \
+ -export:JLI_SetTraceLauncher \
+ -export:JLI_ReportErrorMessage \
+ -export:JLI_ReportErrorMessageSys \
+ -export:JLI_ReportMessage \
+ -export:JLI_ReportExceptionDescription \
+ -export:JLI_MemAlloc \
+ -export:JLI_CmdToArgs \
+ -export:JLI_GetStdArgc \
+ -export:JLI_GetStdArgs \
+ advapi32.lib \
+ comctl32.lib \
+ user32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jli.dll" \
+ -D "JDK_INTERNAL_NAME=jli" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBJLI)
+
+# On windows, the static library has the same suffix as the import library created by
+# with the shared library, so the static library is given a different name. No harm
+# in doing it for all platform to reduce complexity.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
+ STATIC_LIBRARY := jli_static, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ SRC := $(BUILD_LIBJLI_SRC_DIRS), \
+ INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
+ LANG := C, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+ ARFLAGS := $(ARFLAGS), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+
+else ifeq ($(OPENJDK_TARGET_OS), macosx)
+ #
+ # On macosx they do partial (incremental) linking of libjli_static.a
+ # code it here...rather than add support to NativeCompilation
+ # as this is first time I see it
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
+ LIBRARY := jli_static, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+ SRC := $(BUILD_LIBJLI_SRC_DIRS), \
+ INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
+ LANG := C, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+ LDFLAGS := -nostdlib -r, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
+ $(call install-file)
+
+ BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
+endif
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBNPT, \
+ LIBRARY := npt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/npt $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/npt \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnpt/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_macosx := -liconv, \
+ LDFLAGS_SUFFIX_windows := -export:nptInitialize -export:nptTerminate, \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=npt.dll" \
+ -D "JDK_INTERNAL_NAME=npt" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnpt, \
+ DEBUG_SYMBOLS := true))
+
+BUILD_LIBRARIES += $(BUILD_LIBNPT)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/NetworkingLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,98 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/share/native/java/net \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/dns \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/spi
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBNET_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/www/protocol/http/ntlm
+else
+ LIBNET_SRC_DIRS += $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/net/sdp
+endif
+
+LIBNET_CFLAGS := $(foreach dir, $(LIBNET_SRC_DIRS), -I$(dir))
+
+LIBNET_EXCLUDE_FILES :=
+ifneq ($(OPENJDK_TARGET_OS), linux)
+ LIBNET_EXCLUDE_FILES += linux_close.c
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ LIBNET_EXCLUDE_FILES += bsd_close.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBNET_EXCLUDE_FILES += PlainSocketImpl.c PlainDatagramSocketImpl.c SdpSupport.c
+else
+ LIBNET_EXCLUDE_FILES += TwoStacksPlainSocketImpl.c DualStackPlainSocketImpl.c \
+ TwoStacksPlainDatagramSocketImpl.c DualStackPlainDatagramSocketImpl.c \
+ NTLMAuthSequence.c NetworkInterface_winXP.c
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
+ LIBRARY := net, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBNET_SRC_DIRS), \
+ EXCLUDE_FILES := $(LIBNET_EXCLUDE_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBNET_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnet/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_macosx := -ljvm -ljava, \
+ LDFLAGS_SUFFIX_solaris := -ljvm -ljava -lnsl -lsocket $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBDL) -ljvm -lpthread -ljava, \
+ LDFLAGS_SUFFIX_windows := ws2_32.lib jvm.lib secur32.lib iphlpapi.lib \
+ delayimp.lib $(WIN_JAVA_LIB) advapi32.lib \
+ -DELAYLOAD:secur32.dll -DELAYLOAD:iphlpapi.dll, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=net.dll" \
+ -D "JDK_INTERNAL_NAME=net" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnet, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBNET): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBNET)
+
+$(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/share/lib/net.properties
+ $(ECHO) $(LOG_INFO) Copying $(@F)
+ $(call install-file)
+
+COPY_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/${OPENJDK_TARGET_OS_API_DIR}/lib/sdp/sdp.conf.template
+ $(ECHO) $(LOG_INFO) Copying $(@F)
+ $(call install-file)
+
+ COPY_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/NioLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,186 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+BUILD_LIBNIO_SRC := \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/nio \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/fs
+
+BUILD_LIBNIO_CFLAGS := \
+ -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
+ -I$(JDK_TOPDIR)/src/share/native/java/io \
+ -I$(JDK_TOPDIR)/src/share/native/java/net \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net
+
+BUILD_LIBNIO_FILES := \
+ DatagramChannelImpl.c \
+ DatagramDispatcher.c \
+ FileChannelImpl.c \
+ FileDispatcherImpl.c \
+ FileKey.c \
+ IOUtil.c \
+ MappedByteBuffer.c \
+ Net.c \
+ ServerSocketChannelImpl.c \
+ SocketChannelImpl.c \
+ SocketDispatcher.c
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBNIO_FILES += \
+ Iocp.c \
+ RegistryFileTypeDetector.c \
+ WindowsAsynchronousFileChannelImpl.c \
+ WindowsAsynchronousServerSocketChannelImpl.c \
+ WindowsAsynchronousSocketChannelImpl.c \
+ WindowsNativeDispatcher.c \
+ WindowsSelectorImpl.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+ BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
+ BUILD_LIBNIO_FILES += \
+ EPoll.c \
+ EPollArrayWrapper.c \
+ EPollPort.c \
+ InheritedChannel.c \
+ NativeThread.c \
+ PollArrayWrapper.c \
+ UnixAsynchronousServerSocketChannelImpl.c \
+ UnixAsynchronousSocketChannelImpl.c \
+ GnomeFileTypeDetector.c \
+ MagicFileTypeDetector.c \
+ LinuxNativeDispatcher.c \
+ LinuxWatchService.c \
+ UnixCopyFile.c \
+ UnixNativeDispatcher.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
+ BUILD_LIBNIO_SRC += $(JDK_TOPDIR)/src/macosx/native/sun/nio/ch
+ BUILD_LIBNIO_FILES += \
+ InheritedChannel.c \
+ NativeThread.c \
+ PollArrayWrapper.c \
+ UnixAsynchronousServerSocketChannelImpl.c \
+ UnixAsynchronousSocketChannelImpl.c \
+ BsdNativeDispatcher.c \
+ MacOSXNativeDispatcher.c \
+ UnixCopyFile.c \
+ UnixNativeDispatcher.c \
+ KQueue.c \
+ KQueuePort.c \
+ KQueueArrayWrapper.c
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ BUILD_LIBNIO_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libnio/mapfile-$(OPENJDK_TARGET_OS)
+ BUILD_LIBNIO_FILES += \
+ DevPollArrayWrapper.c \
+ InheritedChannel.c \
+ NativeThread.c \
+ PollArrayWrapper.c \
+ SolarisEventPort.c \
+ UnixAsynchronousServerSocketChannelImpl.c \
+ UnixAsynchronousSocketChannelImpl.c \
+ GnomeFileTypeDetector.c \
+ SolarisNativeDispatcher.c \
+ SolarisWatchService.c \
+ UnixCopyFile.c \
+ UnixNativeDispatcher.c
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
+ LIBRARY := nio, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBNIO_SRC), \
+ INCLUDE_FILES := $(BUILD_LIBNIO_FILES), \
+ LANG := C, \
+ OPTIMIZATION := HIGH, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(BUILD_LIBNIO_CFLAGS), \
+ MAPFILE := $(BUILD_LIBNIO_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(BUILD_LIBNIO_LDFLAGS) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := -ljava -lnet -lpthread $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
+ -lsendfile -ljava -lnet -lc, \
+ LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
+ $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
+ advapi32.lib, \
+ LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread -framework CoreFoundation, \
+ LDFLAGS_SUFFIX :=, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=nio.dll" \
+ -D "JDK_INTERNAL_NAME=nio" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnio, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBNIO)
+
+$(BUILD_LIBNIO): $(BUILD_LIBNET)
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS_API), posix)
+
+ ifneq ($(OPENJDK_TARGET_OS), macosx)
+
+ # Suppress unused parameters required by exported JNI functions.
+ SCTP_WERROR := -Werror -Wno-error=unused-parameter
+ ifeq ($(OPENJDK_TARGET_CPU_ARCH), ppc)
+ SCTP_WERROR :=
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \
+ LIBRARY := sctp, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch/sctp, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch \
+ -I$(JDK_TOPDIR)/src/share/native/sun/nio/ch/sctp \
+ -I$(JDK_TOPDIR)/src/share/native/java/net \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/nio/ch \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/net, \
+ CFLAGS_linux := $(SCTP_WERROR), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsctp/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := -lpthread $(LIBDL) -ljava -ljvm, \
+ LDFLAGS_SUFFIX_posix := -lnio -lnet, \
+ LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \
+ LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBSCTP)
+
+ $(BUILD_LIBSCTP): $(BUILD_LIBNIO)
+ endif
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/PlatformLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,283 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBAPPLESCRIPTENGINE, \
+ LIBRARY := AppleScriptEngine, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/macosx/native/apple/applescript, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/macosx/native/apple/applescript \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := -framework Cocoa \
+ -framework Carbon \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ $(LDFLAGS_JDKLIB_SUFFIX), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libAppleScriptEngine, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBAPPLESCRIPTENGINE): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBAPPLESCRIPTENGINE)
+
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBOSXAPP, \
+ LIBRARY := osxapp, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/macosx/native/sun/osxapp, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
+ -I$(JDK_OUTPUTDIR)/gensrc/sun/osxapp \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_macosx := \
+ -framework Accelerate \
+ -framework ApplicationServices \
+ -framework AudioToolbox \
+ -framework Carbon \
+ -framework Cocoa \
+ -framework Security \
+ -framework ExceptionHandling \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -framework OpenGL \
+ -framework IOSurface \
+ -framework QuartzCore, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxapp, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBOSXAPP)
+
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ LIBOSX_DIRS := \
+ $(JDK_TOPDIR)/src/macosx/native/com/apple/concurrent \
+ $(JDK_TOPDIR)/src/macosx/native/java/util \
+ $(JDK_TOPDIR)/src/macosx/native/com/apple/eio \
+ $(JDK_TOPDIR)/src/macosx/native/apple/security \
+ $(JDK_TOPDIR)/src/macosx/native/apple/launcher
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
+ LIBRARY := osx, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBOSX_DIRS), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(foreach dir, $(LIBOSX_DIRS), -I$(dir)) \
+ -I$(JDK_TOPDIR)/src/macosx/native/sun/osxapp \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_macosx := \
+ -losxapp \
+ -framework Cocoa \
+ -framework ApplicationServices \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -framework JavaRuntimeSupport \
+ -framework Security \
+ -framework SystemConfiguration \
+ $(LDFLAGS_JDKLIB_SUFFIX), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosx, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBOSX)
+
+ $(BUILD_LIBOSX): $(BUILD_LIBOSXAPP)
+
+ $(BUILD_LIBOSX): $(BUILD_LIBJAVA)
+
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC32, \
+ LIBRARY := JObjC, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc32, \
+ SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
+ $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := -fpascal-strings \
+ -fobjc-gc \
+ -gdwarf-2 \
+ $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -m32, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ -m32, \
+ LDFLAGS_SUFFIX := -framework Foundation -framework JavaVM \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -lffi, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc32, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJOBJC64, \
+ LIBRARY := JObjC, \
+ OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc64, \
+ SRC := $(JDK_TOPDIR)/src/macosx/native/jobjc/src/core/native \
+ $(JDK_TOPDIR)/src/macosx/native/jobjc/src/runtime-additions/native, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := -fpascal-strings \
+ -fobjc-gc \
+ -gdwarf-2 \
+ $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers_jobjc \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ , \
+ LDFLAGS := -fpascal-strings \
+ -fobjc-gc \
+ -gdwarf-2 \
+ $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := -framework Foundation -framework JavaVM \
+ -F/System/Library/Frameworks/JavaVM.framework/Frameworks \
+ -framework JavaNativeFoundation \
+ -lffi, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjobjc64, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX): $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+ $(LIPO) -create -output $@ $(BUILD_LIBJOBJC32) $(BUILD_LIBJOBJC64)
+
+ BUILD_LIBRARIES += $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)JObjC$(SHARED_LIBRARY_SUFFIX)
+
+endif
+
+##########################################################################################
+
+ifndef OPENJDK
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ ACCESSBRIDGE_SRCDIR := $(JDK_TOPDIR)/src/closed/windows/native/sun/bridge
+
+ define SetupAccessBridge
+ # Parameter 1 Suffix
+ # Parameter 2 Machine
+ # Parameter 3 ACCESSBRIDGE_ARCH_ suffix
+
+ $(call SetupNativeCompilation,BUILD_JAWTACCESSBRIDGE$1, \
+ LIBRARY = JAWTAccessBridge$1, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(ACCESSBRIDGE_SRCDIR), \
+ INCLUDE_FILES := JAWTAccessBridge.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -DACCESSBRIDGE_ARCH_$3, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib jawt.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/JAWTAccessBridge.DEF, \
+ VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
+ RC_FLAGS := $(RC_FLAGS), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawtaccessbridge$1, \
+ DEBUG_SYMBOLS := true)
+
+ $$(BUILD_JAWTACCESSBRIDGE$1): $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
+
+ $(call SetupNativeCompilation,BUILD_JAVAACCESSBRIDGE$1, \
+ LIBRARY = JavaAccessBridge$1, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(ACCESSBRIDGE_SRCDIR), \
+ INCLUDE_FILES := AccessBridgeATInstance.cpp AccessBridgeDebug.cpp \
+ AccessBridgeJavaEntryPoints.cpp \
+ AccessBridgeMessages.cpp JavaAccessBridge.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -DACCESSBRIDGE_ARCH_$3, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/JavaAccessBridge.DEF, \
+ VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
+ RC_FLAGS := $(RC_FLAGS), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjavaaccessbridge$1, \
+ DEBUG_SYMBOLS := true)
+
+ $(call SetupNativeCompilation,BUILD_WINDOWSACCESSBRIDGE$1, \
+ LIBRARY = WindowsAccessBridge$1, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(ACCESSBRIDGE_SRCDIR), \
+ INCLUDE_FILES := AccessBridgeJavaVMInstance.cpp AccessBridgeMessageQueue.cpp \
+ AccessBridgeMessages.cpp AccessBridgeWindowsEntryPoints.cpp \
+ WinAccessBridge.cpp AccessBridgeDebug.cpp \
+ AccessBridgeEventHandler.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT \
+ -DACCESSBRIDGE_ARCH_$3, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) kernel32.lib user32.lib gdi32.lib \
+ winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib \
+ -subsystem:windows -machine:$2 \
+ -def:$(ACCESSBRIDGE_SRCDIR)/WinAccessBridge.DEF, \
+ VERSIONINFO_RESOURCE := $(ACCESSBRIDGE_SRCDIR)/AccessBridgeStatusWindow.rc, \
+ RC_FLAGS := $(RC_FLAGS), \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libwindowsaccessbridge$1, \
+ DEBUG_SYMBOLS := true)
+
+ BUILD_LIBRARIES += $$(BUILD_JAWTACCESSBRIDGE$1) $$(BUILD_JAVAACCESSBRIDGE$1) \
+ $$(BUILD_WINDOWSACCESSBRIDGE$1)
+
+ endef
+
+ ifeq ($(OPENJDK_TARGET_CPU_BITS), 32)
+ $(eval $(call SetupAccessBridge,-32,I386,32))
+ $(eval $(call SetupAccessBridge,,I386,LEGACY))
+ else
+ $(eval $(call SetupAccessBridge,-64,X64,64))
+ endif
+ endif
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/SecurityLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,289 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+LIBJAAS_MAPFILE :=
+ifneq ($(OPENJDK_TARGET_OS), solaris)
+ LIBJAAS_EXCLUDE_FILES := Solaris.c
+else
+ # only on solaris...wonder why
+ LIBJAAS_MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjaas/mapfile-vers
+endif
+
+LIBJAAS_NAME := jaas_unix
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBJAAS_NAME := jaas_nt
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
+ LIBRARY := $(LIBJAAS_NAME), \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/security/auth/module, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB), \
+ MAPFILE := $(LIBJAAS_MAPFILE), \
+ LDFLAGS := $(filter-out -ljava, $(LDFLAGS_JDKLIB)) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib, \
+ LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ EXCLUDE_FILES := $(LIBJAAS_EXCLUDE_FILES), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
+ -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjaas, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBJAAS): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBJAAS)
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
+ LIBRARY := j2pcsc, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio, \
+ LANG := C, \
+ CFLAGS_posix := -D__sun_jdk, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/smartcardio \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/smartcardio/MUSCLE, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2pcsc/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_posix := $(LIBDL), \
+ LDFLAGS_SUFFIX_windows := winscard.lib, \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=j2pcsc.dll" \
+ -D "JDK_INTERNAL_NAME=j2pcsc" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pcsc, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBJ2PCSC)
+
+##########################################################################################
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \
+ LIBRARY := j2gss, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/jgss/wrapper \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/jgss/wrapper, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2gss/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
+endif
+
+##########################################################################################
+
+ifneq ($(BUILD_CRYPTO), no)
+ BUILD_LIBKRB5_NAME :=
+ ifeq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBKRB5_NAME := w2k_lsa_auth
+ BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5
+ BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
+ gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
+ ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
+ else ifeq ($(OPENJDK_TARGET_OS), macosx)
+ BUILD_LIBKRB5_NAME := osxkrb5
+ BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/share/native/sun/security/krb5
+ BUILD_LIBKRB5_LIBS := -framework Kerberos
+ endif
+
+ ifneq ($(BUILD_LIBKRB5_NAME), )
+ $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5, \
+ LIBRARY := $(BUILD_LIBKRB5_NAME), \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBKRB5_SRC), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/krb5 \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/krb5, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
+ -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkrb5, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBKRB5)
+ endif
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \
+ LIBRARY := sunmscapi, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/mscapi, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := Crypt32.Lib advapi32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=sunmscapi.dll" \
+ -D "JDK_INTERNAL_NAME=sunmscapi" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunmscapi, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
+endif
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
+ LIBRARY := j2pkcs11, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
+ $(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11 \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11 \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/pkcs11/wrapper \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/security/pkcs11/wrapper, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2pkcs11/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_posix := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=j2pkcs11.dll" \
+ -D "JDK_INTERNAL_NAME=j2pkcs11" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pkcs11, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+BUILD_LIBRARIES += $(BUILD_LIBJ2PKCS11)
+
+##########################################################################################
+
+ifeq ($(ENABLE_INTREE_EC), yes)
+
+ BUILD_LIBSUNEC_FLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/security/ec \
+ -I$(JDK_TOPDIR)/src/share/native/sun/security/ec/impl
+
+ #
+ # On sol-sparc...all libraries are compiled with -xregs=no%appl
+ # (set in CFLAGS_REQUIRED_sparc)
+ #
+ # except!!! libsunec.so
+ #
+ ECC_JNI_SOLSPARC_FILTER :=
+ ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
+ ECC_JNI_SOLSPARC_FILTER := -xregs=no%appl
+ endif
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBSUNEC, \
+ LIBRARY := sunec, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/security/ec \
+ $(JDK_TOPDIR)/src/share/native/sun/security/ec/impl, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB)) \
+ $(BUILD_LIBSUNEC_FLAGS) \
+ -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
+ CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
+ $(BUILD_LIBSUNEC_FLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libsunec/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
+ LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(LIBCXX), \
+ LDFLAGS_SUFFIX_linux := -lc, \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=sunec.dll" \
+ -D "JDK_INTERNAL_NAME=sunec" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunec, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBSUNEC)
+endif
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ ifndef OPENJDK
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2UCRYPTO, \
+ LIBRARY := j2ucrypto, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/closed/solaris/native/com/oracle/security/ucrypto, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libj2ucrypto/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB), \
+ LDFLAGS_SUFFIX := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2ucrypto, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)
+
+ endif
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/ServiceabilityLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,431 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+LIBATTACH_EXCLUDE_FILES :=
+ifneq ($(OPENJDK_TARGET_OS), solaris)
+ LIBATTACH_EXCLUDE_FILES += SolarisVirtualMachine.c
+endif
+ifneq ($(OPENJDK_TARGET_OS), linux)
+ LIBATTACH_EXCLUDE_FILES += LinuxVirtualMachine.c
+endif
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ LIBATTACH_EXCLUDE_FILES += BsdVirtualMachine.c
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
+ LIBRARY := attach, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tools/attach, \
+ EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB), \
+ CFLAGS_windows := /Gy, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=attach.dll" \
+ -D "JDK_INTERNAL_NAME=attach" \
+ -D "JDK_FTYPE=0x2L", \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := -ldoor, \
+ LDFLAGS_windows := /ORDER:@$(JDK_TOPDIR)/makefiles/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libattach, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBATTACH): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBATTACH)
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \
+ LIBRARY := dt_socket, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/transport/socket \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
+ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
+ -I$(JDK_TOPDIR)/src/share/transport/socket \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \
+ -I$(JDK_TOPDIR)/src/share/back/export \
+ -I$(JDK_TOPDIR)/src/share/back, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libdt_socket/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := -lpthread, \
+ LDFLAGS_SUFFIX_solaris := -lnsl -lsocket -lc, \
+ LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) -export:jdwpTransport_OnLoad ws2_32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=dt_socket.dll" \
+ -D "JDK_INTERNAL_NAME=dt_socket" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_socket, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBDT_SOCKET): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBDT_SOCKET)
+
+##########################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM, \
+ LIBRARY := dt_shmem, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/com/sun/tools/jdi \
+ $(JDK_TOPDIR)/src/share/transport/shmem \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
+ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
+ -I$(JDK_TOPDIR)/src/share/transport/shmem \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \
+ -I$(JDK_TOPDIR)/src/share/back/export, \
+ LDFLAGS := $(LDFLAGS_JDKLIB), \
+ LDFLAGS_windows := -export:jdwpTransport_OnLoad, \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=dt_shmem.dll" \
+ -D "JDK_INTERNAL_NAME=dt_shmem" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_shmem, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBDT_SHMEM)
+
+endif # OPENJDK_TARGET_OS
+
+##########################################################################################
+
+# JDWP_LOGGING causes log messages to be compiled into the library.
+$(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
+ LIBRARY := jdwp, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
+ -I$(JDK_TOPDIR)/src/share/transport/export \
+ -I$(JDK_TOPDIR)/src/share/back/export \
+ -I$(JDK_TOPDIR)/src/share/npt \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
+ -I$(JDK_TOPDIR)/src/share/back \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back \
+ -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjdwp/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jdwp.dll" \
+ -D "JDK_INTERNAL_NAME=jdwp" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjdwp, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBJDWP): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBJDWP)
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
+ LIBRARY := jsdt, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsdt/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_linux := $(LIBDL), \
+ LDFLAGS_SUFFIX_windows := $(LDFLAGS_JDKLIB_SUFFIX) $(LIBDL), \
+ LDFLAGS_SUFFIX_macosx := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jsdt.dll" \
+ -D "JDK_INTERNAL_NAME=jsdt" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsdt, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBJSDT): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBJSDT)
+
+##########################################################################################
+
+LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/share/instrument \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/java/io \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument
+
+LIBINSTRUMENT_FILES := \
+ EncodingSupport.c \
+ EncodingSupport_md.c \
+ FileSystemSupport_md.c \
+ InstrumentationImplNativeMethods.c \
+ InvocationAdapter.c \
+ JarFacade.c \
+ JPLISAgent.c \
+ JPLISAssert.c \
+ JavaExceptions.c \
+ PathCharsValidator.c \
+ Reentrancy.c \
+ Utilities.c \
+ canonicalize_md.c
+
+LIBINSTRUMENT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument
+LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/instrument \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/instrument \
+ -I$(JDK_TOPDIR)/src/share/bin
+
+LIBINSTRUMENT_LDFLAGS :=
+LIBINSTRUMENT_LDFLAGS_SUFFIX :=
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
+ -export:Agent_OnAttach advapi32.lib
+ # Statically link the C runtime so that there are not dependencies on modules
+ # not on the search patch when invoked from the Windows system directory
+ # (or elsewhere).
+ LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
+ # equivalent of strcasecmp is stricmp on Windows
+ LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
+ LIBRARY := instrument, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBINSTRUMENT_SRC), \
+ INCLUDE_FILES := $(LIBINSTRUMENT_FILES), \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
+ CFLAGS_debug := -DJPLIS_LOGGING, \
+ CFLAGS_release := -DNO_JPLIS_LOGGING, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libinstrument/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN) \
+ $(LIBINSTRUMENT_LDFLAGS), \
+ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
+ LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
+ LDFLAGS_macosx := -Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+ -framework Cocoa -framework Security -framework ApplicationServices, \
+ LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
+ LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
+ LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc, \
+ LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL), \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=instrument.dll" \
+ -D "JDK_INTERNAL_NAME=instrument" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(LIBINSTRUMENT_DIR), \
+ DEBUG_SYMBOLS := true))
+
+ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows))
+ $(BUILD_LIBINSTRUMENT): $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
+else
+ $(BUILD_LIBINSTRUMENT): $(INSTALL_LIBRARIES_HERE)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX)
+endif
+$(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBINSTRUMENT)
+
+##########################################################################################
+
+BUILD_LIBMANAGEMENT_SRC := $(JDK_TOPDIR)/src/share/native/sun/management \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/management \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/management
+
+BUILD_LIBMANAGEMENT_EXCLUDES :=
+
+BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/management
+
+ifneq ($(OPENJDK_TARGET_OS), windows)
+ BUILD_LIBMANAGEMENT_EXCLUDES += OperatingSystem_md.c
+else
+ BUILD_LIBMANAGEMENT_EXCLUDES += UnixOperatingSystem_md.c
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), solaris)
+ BUILD_LIBMANAGEMENT_EXCLUDES += SolarisOperatingSystem.c
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), linux)
+ BUILD_LIBMANAGEMENT_EXCLUDES += LinuxOperatingSystem.c
+endif
+
+ifneq ($(OPENJDK_TARGET_OS), macosx)
+ BUILD_LIBMANAGEMENT_EXCLUDES += MacosxOperatingSystem.c
+endif
+
+LIBMANAGEMENT_OPTIMIZATION := HIGH
+ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ LIBMANAGEMENT_OPTIMIZATION := LOW
+ endif
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
+ LIBRARY := management, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBMANAGEMENT_SRC), \
+ EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \
+ LANG := C, \
+ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
+ CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libmanagement/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_solaris := -lkstat, \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
+ LDFLAGS_SUFFIX_windows := jvm.lib psapi.lib $(WIN_JAVA_LIB) advapi32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=management.dll" \
+ -D "JDK_INTERNAL_NAME=management" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmanagement, \
+ DEBUG_SYMBOLS := true))
+
+$(BUILD_LIBMANAGEMENT): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBMANAGEMENT)
+
+##########################################################################################
+
+BUILD_LIBHPROF_SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/hprof $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/demo/jvmti/hprof
+BUILD_LIBHPROF_CFLAGS := -I$(JDK_TOPDIR)/src/share/demo/jvmti/hprof \
+ -I$(JDK_TOPDIR)/src/share/npt \
+ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/npt \
+ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo
+
+BUILD_LIBHPROF_LDFLAGS :=
+
+LIBHPROF_OPTIMIZATION := HIGHEST
+ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
+ ifeq ($(ENABLE_DEBUG_SYMBOLS), true)
+ LIBHPROF_OPTIMIZATION := LOW
+ endif
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \
+ LIBRARY := hprof, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(BUILD_LIBHPROF_SRC), \
+ LANG := C, \
+ OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(BUILD_LIBHPROF_CFLAGS), \
+ CFLAGS_debug := -DHPROF_LOGGING, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libhprof/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_windows := wsock32.lib winmm.lib advapi32.lib, \
+ LDFLAGS_SUFFIX_linux := $(LIBDL), \
+ LDFLAGS_SUFFIX_macosx := $(LIBDL), \
+ LDFLAGS_SUFFIX_solaris := -lsocket -lnsl $(LIBDL) -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=hprof.dll" \
+ -D "JDK_INTERNAL_NAME=hprof" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libhprof_jvmti, \
+ DEBUG_SYMBOLS := true))
+
+BUILD_LIBRARIES += $(BUILD_LIBHPROF)
+
+##########################################################################################
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO, \
+ LIBRARY := java_crw_demo, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjava_crw_demo/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=java_crw_demo.dll" \
+ -D "JDK_INTERNAL_NAME=java_crw_demo" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava_crw_demo, \
+ DEBUG_SYMBOLS := true))
+
+BUILD_LIBRARIES += $(BUILD_LIBJAVA_CRW_DEMO)
+
+##########################################################################################
+
+ifndef OPENJDK
+ ifeq ($(ENABLE_JFR), true)
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJFR, \
+ LIBRARY := jfr, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(JDK_TOPDIR)/src/closed/share/native/oracle/jfr, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjfr/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jfr.dll" \
+ -D "JDK_INTERNAL_NAME=jfr" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjfr, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ BUILD_LIBRARIES += $(BUILD_LIBJFR)
+
+ endif
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/makefiles/lib/SoundLibraries.gmk Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,237 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute 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.
+#
+
+LIBJSOUND_SRC_DIRS := \
+ $(JDK_TOPDIR)/src/share/native/com/sun/media/sound \
+ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/com/sun/media/sound
+
+LIBJSOUND_SRC_FILES := Utilities.c Platform.c
+
+LIBJSOUND_LANG := C
+LIBJSOUND_CFLAGS := $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir))
+
+EXTRA_SOUND_JNI_LIBS :=
+
+LIBJSOUND_MIDIFILES := \
+ MidiInDevice.c \
+ MidiInDeviceProvider.c \
+ MidiOutDevice.c \
+ MidiOutDeviceProvider.c \
+ PlatformMidi.c
+
+# files needed for ports
+LIBJSOUND_PORTFILES := \
+ PortMixerProvider.c \
+ PortMixer.c
+
+# files needed for direct audio
+LIBJSOUND_DAUDIOFILES := \
+ DirectAudioDeviceProvider.c \
+ DirectAudioDevice.c
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+ EXTRA_SOUND_JNI_LIBS += jsoundds
+ LIBJSOUND_CFLAGS += -DX_PLATFORM=X_WINDOWS \
+ -DUSE_PLATFORM_MIDI_OUT=TRUE \
+ -DUSE_PLATFORM_MIDI_IN=TRUE \
+ -DUSE_PORTS=TRUE
+ LIBJSOUND_SRC_FILES += \
+ PLATFORM_API_WinOS_MidiIn.cpp \
+ PLATFORM_API_WinOS_MidiOut.c \
+ PLATFORM_API_WinOS_Util.c \
+ PLATFORM_API_WinOS_Ports.c
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
+endif # OPENJDK_TARGET_OS windows
+
+ifeq ($(OPENJDK_TARGET_OS), linux)
+ EXTRA_SOUND_JNI_LIBS += jsoundalsa
+ LIBJSOUND_CFLAGS += -DX_PLATFORM=X_LINUX
+endif # OPENJDK_TARGET_OS linux
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+ LIBJSOUND_LANG := C++
+ LIBJSOUND_CFLAGS += -DX_PLATFORM=X_MACOSX \
+ -DUSE_PORTS=TRUE \
+ -DUSE_DAUDIO=TRUE \
+ -DUSE_PLATFORM_MIDI_OUT=TRUE \
+ -DUSE_PLATFORM_MIDI_IN=TRUE
+ LIBJSOUND_SRC_DIRS += $(JDK_TOPDIR)/src/macosx/native/com/sun/media/sound
+ LIBJSOUND_SRC_FILES += \
+ PLATFORM_API_MacOSX_Utils.cpp \
+ PLATFORM_API_MacOSX_PCM.cpp \
+ PLATFORM_API_MacOSX_Ports.cpp \
+ PLATFORM_API_MacOSX_MidiIn.c \
+ PLATFORM_API_MacOSX_MidiOut.c \
+ PLATFORM_API_MacOSX_MidiUtils.c
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
+endif # OPENJDK_TARGET_OS macosx
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+ LIBJSOUND_CFLAGS += -DX_PLATFORM=X_SOLARIS \
+ -DUSE_PORTS=TRUE \
+ -DUSE_DAUDIO=TRUE
+ LIBJSOUND_SRC_FILES += \
+ PLATFORM_API_SolarisOS_Utils.c \
+ PLATFORM_API_SolarisOS_Ports.c \
+ PLATFORM_API_SolarisOS_PCM.c
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_MIDIFILES)
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_PORTFILES)
+ LIBJSOUND_SRC_FILES += $(LIBJSOUND_DAUDIOFILES)
+endif # OPENJDK_TARGET_OS solaris
+
+
+ifeq ($(JVM_VARIANT_ZERO), true)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_ZERO
+else
+ ifeq ($(OPENJDK_TARGET_CPU), x86)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_I586
+ endif
+
+ ifeq ($(OPENJDK_TARGET_CPU), sparc)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARC
+ endif
+
+ ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_SPARCV9
+ endif
+
+ ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_AMD64
+ endif
+
+ ifeq ($(OPENJDK_TARGET_CPU), arm)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_ARM
+ endif
+
+ ifeq ($(OPENJDK_TARGET_CPU), ppc)
+ LIBJSOUND_CFLAGS += -DX_ARCH=X_PPC
+ endif
+endif
+
+LIBJSOUND_CFLAGS += -DEXTRA_SOUND_JNI_LIBS='"$(EXTRA_SOUND_JNI_LIBS)"'
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
+ LIBRARY := jsound, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBJSOUND_SRC_DIRS), \
+ INCLUDE_FILES := $(LIBJSOUND_SRC_FILES), \
+ LANG := $(LIBJSOUND_LANG), \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBJSOUND_CFLAGS), \
+ CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBJSOUND_CFLAGS), \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsound/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_macosx := -framework CoreAudio -framework CoreFoundation \
+ -framework CoreServices -framework AudioUnit $(LIBCXX) \
+ -framework CoreMIDI -framework AudioToolbox, \
+ LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
+ LDFLAGS_SUFFIX_posix := -ljava -ljvm, \
+ LDFLAGS_SUFFIX_solaris := -lc, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jsound.dll" \
+ -D "JDK_INTERNAL_NAME=jsound" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsound, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+$(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
+
+BUILD_LIBRARIES += $(BUILD_LIBJSOUND)
+
+##########################################################################################
+
+ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDALSA, \
+ LIBRARY := jsoundalsa, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBJSOUND_SRC_DIRS), \
+ INCLUDE_FILES := Utilities.c $(LIBJSOUND_MIDIFILES) $(LIBJSOUND_PORTFILES) \
+ $(LIBJSOUND_DAUDIOFILES) \
+ PLATFORM_API_LinuxOS_ALSA_CommonUtils.c \
+ PLATFORM_API_LinuxOS_ALSA_PCM.c \
+ PLATFORM_API_LinuxOS_ALSA_PCMUtils.c \
+ PLATFORM_API_LinuxOS_ALSA_MidiIn.c \
+ PLATFORM_API_LinuxOS_ALSA_MidiOut.c \
+ PLATFORM_API_LinuxOS_ALSA_MidiUtils.c \
+ PLATFORM_API_LinuxOS_ALSA_Ports.c, \
+ LANG := C, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) $(ALSA_CFLAGS) \
+ $(LIBJSOUND_CFLAGS) \
+ -DUSE_DAUDIO=TRUE \
+ -DUSE_PORTS=TRUE \
+ -DUSE_PLATFORM_MIDI_OUT=TRUE \
+ -DUSE_PLATFORM_MIDI_IN=TRUE, \
+ MAPFILE := $(JDK_TOPDIR)/makefiles/mapfiles/libjsoundalsa/mapfile-vers, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(ALSA_LIBS) -ljava -ljvm, \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundalsa, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
+
+endif
+
+##########################################################################################
+
+ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
+
+ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUNDDS, \
+ LIBRARY := jsoundds, \
+ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
+ SRC := $(LIBJSOUND_SRC_DIRS), \
+ INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \
+ PLATFORM_API_WinOS_DirectSound.cpp, \
+ LANG := C++, \
+ OPTIMIZATION := LOW, \
+ CFLAGS := $(CFLAGS_JDKLIB) \
+ $(LIBJSOUND_CFLAGS) \
+ -DUSE_DAUDIO=TRUE, \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
+ $(call SET_SHARED_LIBRARY_ORIGIN), \
+ LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX) dsound.lib winmm.lib user32.lib ole32.lib, \
+ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
+ RC_FLAGS := $(RC_FLAGS) \
+ -D "JDK_FNAME=jsoundds.dll" \
+ -D "JDK_INTERNAL_NAME=jsoundds" \
+ -D "JDK_FTYPE=0x2L", \
+ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundds, \
+ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
+
+ $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
+
+ BUILD_LIBRARIES += $(BUILD_LIBJSOUNDDS)
+
+endif
--- a/langtools/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -233,3 +233,4 @@
985abf1cd327169a317d4ff4f318a8162a5cd47d jdk8-b109
41541097533aa3933a018c8c1c426c1871dfd76e jdk8-b110
af6244ba81b6b8d1bf4ab06587a2067e021e4570 jdk8-b111
+954dd199d6ff3e4cfc42b894c1f611150526eecd jdk8-b112
--- a/langtools/make/build.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/make/build.properties Mon Oct 28 12:28:57 2013 -0700
@@ -163,11 +163,11 @@
#
sjavac.includes = \
- com/sun/tools/sjavac/
+ com/sun/tools/sjavac/
sjavac.tests = \
tools/sjavac
-
+
#
# The following files require the latest JDK to be available.
--- a/langtools/make/build.xml Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/make/build.xml Mon Oct 28 12:28:57 2013 -0700
@@ -89,7 +89,7 @@
build-classes-TOOL build the classes for the tool
build-TOOL build the jar file and script for the tool
jtreg-TOOL build the tool and run the appropriate tests
- findbugs-TOOL run findbugs on the tool's source oode
+ findbugs-TOOL run findbugs on the tool's source code
TOOL build the tool, run the tests, and run findbugs
- utility definitions
-->
@@ -360,7 +360,7 @@
datafile="${build.coverage.dir}/cobertura.ser"/>
</target>
- <target name="diags-examples" depends="build-javac">
+ <target name="diags-examples" depends="build-javac,build-javap">
<!-- can override the following on the command line if desired. -->
<property name="diags.examples.out" location="${build.dir}/diag-examples/diags-examples.html"/>
<mkdir dir="${build.dir}/diag-examples/classes"/>
@@ -370,7 +370,7 @@
destdir="${build.dir}/diag-examples/classes"
includes="ArgTypeCompilerFactory.java,Example.java,FileManager.java,HTMLWriter.java,RunExamples.java,DocCommentProcessor.java"
sourcepath=""
- classpath="${dist.lib.dir}/javac.jar"
+ classpath="${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
includeAntRuntime="no"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}">
@@ -379,7 +379,7 @@
<java fork="true"
jvm="${target.java.home}/bin/java"
dir="test/tools/javac/diags"
- classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar"
+ classpath="${build.dir}/diag-examples/classes;${dist.lib.dir}/javac.jar;${dist.lib.dir}/javap.jar"
classname="RunExamples">
<jvmarg value="-Dtest.classes=${build.dir}/diag-examples/classes"/>
<arg value="-examples"/>
--- a/langtools/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -33,9 +33,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
@@ -45,9 +43,7 @@
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
- solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
- solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
@@ -64,9 +60,7 @@
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
- solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
- solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/javadoc/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+The Doclet API (also called the Javadoc API) provides a mechanism
+for clients to inspect the source-level structure of programs and
+libraries, including javadoc comments embedded in the source.
+This is useful for documentation, program checking, automatic
+code generation and many other tools.
+<p>
+
+Doclets are invoked by javadoc and use this API to write out
+program information to files. For example, the standard doclet is called
+by default and writes out documentation to HTML files.
+<p>
+
+The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
+-- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
+<pre>
+ public static boolean <b>start</b>(RootDoc root)
+</pre>
+The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure
+information. From this root all other program structure
+information can be extracted.
+<p>
+
+<a name="terminology"></a>
+<h3>Terminology</h3>
+
+<a name="included"></a>
+When calling javadoc, you pass in package names and source file names --
+these are called the <em>specified</em> packages and classes.
+You also pass in Javadoc options; the <em>access control</em> Javadoc options
+(<code>-public</code>, <code>-protected</code>, <code>-package</code>,
+and <code>-private</code>) filter program elements, producing a
+result set, called the <em>included</em> set, or "documented" set.
+(The unfiltered set is also available through
+{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
+<p>
+
+<a name="class"></a>
+Throughout this API, the term <em>class</em> is normally a
+shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
+{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
+{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
+In only a couple of other places, it means "class, as opposed to interface",
+as in: {@link com.sun.javadoc.Doc#isClass()}.
+In the second sense, this API calls out four kinds of classes:
+{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
+{@linkplain com.sun.javadoc.Doc#isEnum() enums},
+{@linkplain com.sun.javadoc.Doc#isError() errors} and
+{@linkplain com.sun.javadoc.Doc#isException() exceptions}.
+Throughout the API, the detailed description of each program element
+describes explicitly which meaning is being used.
+<p>
+
+<a name="qualified"></a>
+A <em>qualified</em> class or interface name is one that has its package
+name prepended to it, such as <code>java.lang.String</code>. A non-qualified
+name has no package name, such as <code>String</code>.
+<p>
+
+<a name="example"></a>
+<h3>Example</h3>
+
+The following is an example doclet that
+displays information in the <code>@param</code> tags of the processed
+classes:
+<pre>
+import com.sun.javadoc.*;
+
+public class ListParams extends <font color=red title="Doclet API">Doclet</font> {
+
+ public static boolean start(<font color=red title="Doclet API">RootDoc</font> root) {
+ <font color=red title="Doclet API">ClassDoc</font>[] classes = root.<font color=red title="Doclet API">classes</font>();
+ for (int i = 0; i < classes.length; ++i) {
+ <font color=red title="Doclet API">ClassDoc</font> cd = classes[i];
+ printMembers(cd.<font color=red title="Doclet API">constructors</font>());
+ printMembers(cd.<font color=red title="Doclet API">methods</font>());
+ }
+ return true;
+ }
+
+ static void printMembers(<font color=red title="Doclet API">ExecutableMemberDoc</font>[] mems) {
+ for (int i = 0; i < mems.length; ++i) {
+ <font color=red title="Doclet API">ParamTag</font>[] params = mems[i].<font color=red title="Doclet API">paramTags</font>();
+ System.out.println(mems[i].<font color=red title="Doclet API">qualifiedName</font>());
+ for (int j = 0; j < params.length; ++j) {
+ System.out.println(" " + params[j].<font color=red title="Doclet API">parameterName</font>()
+ + " - " + params[j].<font color=red title="Doclet API">parameterComment</font>());
+ }
+ }
+ }
+}
+</pre>
+Interfaces and methods from the Javadoc API are marked in
+<font color=red title="Doclet API">red</font>.
+{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies
+the invocation interface for doclets,
+{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
+{@link com.sun.javadoc.ExecutableMemberDoc} is a
+superinterface of {@link com.sun.javadoc.MethodDoc} and
+{@link com.sun.javadoc.ConstructorDoc},
+and {@link com.sun.javadoc.ParamTag} holds information
+from "<code>@param</code>" tags.
+<p>
+This doclet when invoked with a command line like:
+<pre>
+ javadoc -doclet ListParams -sourcepath <source-location> java.util
+</pre>
+producing output like:
+<pre>
+ ...
+ java.util.ArrayList.add
+ index - index at which the specified element is to be inserted.
+ element - element to be inserted.
+ java.util.ArrayList.remove
+ index - the index of the element to removed.
+ ...
+
+</pre>
+@see com.sun.javadoc.Doclet
+@see com.sun.javadoc.RootDoc
+*/
+@jdk.Exported
+package com.sun.javadoc;
--- a/langtools/src/share/classes/com/sun/javadoc/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-<html>
-<head>
-<TITLE>Doclet API Package</TITLE>
-<!--
-
-Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute 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.
--->
-</head>
-<body bgcolor="white">
-
-The Doclet API (also called the Javadoc API) provides a mechanism
-for clients to inspect the source-level structure of programs and
-libraries, including javadoc comments embedded in the source.
-This is useful for documentation, program checking, automatic
-code generation and many other tools.
-<p>
-
-Doclets are invoked by javadoc and use this API to write out
-program information to files. For example, the standard doclet is called
-by default and writes out documentation to HTML files.
-<p>
-
-The invocation is defined by the abstract {@link com.sun.javadoc.Doclet} class
--- the entry point is the {@link com.sun.javadoc.Doclet#start(RootDoc) start} method:
-<pre>
- public static boolean <b>start</b>(RootDoc root)
-</pre>
-The {@link com.sun.javadoc.RootDoc} instance holds the root of the program structure
-information. From this root all other program structure
-information can be extracted.
-<p>
-
-<a name="terminology"></a>
-<h3>Terminology</h3>
-
-<a name="included"></a>
-When calling javadoc, you pass in package names and source file names --
-these are called the <em>specified</em> packages and classes.
-You also pass in Javadoc options; the <em>access control</em> Javadoc options
-(<code>-public</code>, <code>-protected</code>, <code>-package</code>,
-and <code>-private</code>) filter program elements, producing a
-result set, called the <em>included</em> set, or "documented" set.
-(The unfiltered set is also available through
-{@link com.sun.javadoc.PackageDoc#allClasses(boolean) allClasses(false)}.)
-<p>
-
-<a name="class"></a>
-Throughout this API, the term <em>class</em> is normally a
-shorthand for "class or interface", as in: {@link com.sun.javadoc.ClassDoc},
-{@link com.sun.javadoc.PackageDoc#allClasses() allClasses()}, and
-{@link com.sun.javadoc.PackageDoc#findClass(String) findClass(String)}.
-In only a couple of other places, it means "class, as opposed to interface",
-as in: {@link com.sun.javadoc.Doc#isClass()}.
-In the second sense, this API calls out four kinds of classes:
-{@linkplain com.sun.javadoc.Doc#isOrdinaryClass() ordinary classes},
-{@linkplain com.sun.javadoc.Doc#isEnum() enums},
-{@linkplain com.sun.javadoc.Doc#isError() errors} and
-{@linkplain com.sun.javadoc.Doc#isException() exceptions}.
-Throughout the API, the detailed description of each program element
-describes explicitly which meaning is being used.
-<p>
-
-<a name="qualified"></a>
-A <em>qualified</em> class or interface name is one that has its package
-name prepended to it, such as <code>java.lang.String</code>. A non-qualified
-name has no package name, such as <code>String</code>.
-<p>
-
-<a name="example"></a>
-<h3>Example</h3>
-
-The following is an example doclet that
-displays information in the <code>@param</code> tags of the processed
-classes:
-<pre>
-import com.sun.javadoc.*;
-
-public class ListParams extends <font color=red title="Doclet API">Doclet</font> {
-
- public static boolean start(<font color=red title="Doclet API">RootDoc</font> root) {
- <font color=red title="Doclet API">ClassDoc</font>[] classes = root.<font color=red title="Doclet API">classes</font>();
- for (int i = 0; i < classes.length; ++i) {
- <font color=red title="Doclet API">ClassDoc</font> cd = classes[i];
- printMembers(cd.<font color=red title="Doclet API">constructors</font>());
- printMembers(cd.<font color=red title="Doclet API">methods</font>());
- }
- return true;
- }
-
- static void printMembers(<font color=red title="Doclet API">ExecutableMemberDoc</font>[] mems) {
- for (int i = 0; i < mems.length; ++i) {
- <font color=red title="Doclet API">ParamTag</font>[] params = mems[i].<font color=red title="Doclet API">paramTags</font>();
- System.out.println(mems[i].<font color=red title="Doclet API">qualifiedName</font>());
- for (int j = 0; j < params.length; ++j) {
- System.out.println(" " + params[j].<font color=red title="Doclet API">parameterName</font>()
- + " - " + params[j].<font color=red title="Doclet API">parameterComment</font>());
- }
- }
- }
-}
-</pre>
-Interfaces and methods from the Javadoc API are marked in
-<font color=red title="Doclet API">red</font>.
-{@link com.sun.javadoc.Doclet Doclet} is an abstract class that specifies
-the invocation interface for doclets,
-{@link com.sun.javadoc.Doclet Doclet} holds class or interface information,
-{@link com.sun.javadoc.ExecutableMemberDoc} is a
-superinterface of {@link com.sun.javadoc.MethodDoc} and
-{@link com.sun.javadoc.ConstructorDoc},
-and {@link com.sun.javadoc.ParamTag} holds information
-from "<code>@param</code>" tags.
-<p>
-This doclet when invoked with a command line like:
-<pre>
- javadoc -doclet ListParams -sourcepath <source-location> java.util
-</pre>
-producing output like:
-<pre>
- ...
- java.util.ArrayList.add
- index - index at which the specified element is to be inserted.
- element - element to be inserted.
- java.util.ArrayList.remove
- index - the index of the element to removed.
- ...
-
-</pre>
-@see com.sun.javadoc.Doclet
-@see com.sun.javadoc.RootDoc
-</BODY>
-</HTML>
--- a/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,7 @@
package com.sun.source.tree;
-import com.sun.tools.javac.util.List;
+import java.util.List;
/**
* A tree node for an expression to create a new instance of an array.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/classfile/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ A minimalist library to read and write class files into objects closely
+ based on the corresponding definitions in
+ <cite>The Java™ Virtual Machine Specification</cite> (JVMS).
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.classfile;
--- a/langtools/src/share/classes/com/sun/tools/classfile/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- </head>
- <body>
- A minimalist library to read and write class files into objects closely
- based on the corresponding definitions in
- <cite>The Java™ Virtual Machine Specification</cite> (JVMS).
- </body>
-</html>
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -305,6 +305,6 @@
buf.append(t.dimension());
}
buf.append(")");
- return foundTypeVariable ? buf.toString() : null;
+ return foundTypeVariable ? writer.getName(buf.toString()) : null;
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -89,10 +89,11 @@
* @param memberlist List of members for the unicode character
* @param contentTree the content tree to which the information will be added
*/
- protected void addContents(Character unicode, List<? extends Doc> memberlist,
+ protected void addContents(Character uc, List<? extends Doc> memberlist,
Content contentTree) {
- contentTree.addContent(getMarkerAnchor("_" + unicode + "_"));
- Content headContent = new StringContent(unicode.toString());
+ String unicode = uc.toString();
+ contentTree.addContent(getMarkerAnchorForIndex(unicode));
+ Content headContent = new StringContent(unicode);
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, false,
HtmlStyle.title, headContent);
contentTree.addContent(heading);
@@ -253,4 +254,24 @@
addPreQualifiedClassLink(LinkInfoImpl.Kind.INDEX, containing,
false, contentTree);
}
+
+ /**
+ * Get the marker anchor which will be added to the index documentation tree.
+ *
+ * @param anchorNameForIndex the anchor name attribute for index page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchorForIndex(String anchorNameForIndex) {
+ return getMarkerAnchor(getNameForIndex(anchorNameForIndex), null);
+ }
+
+ /**
+ * Generate a valid HTML name for member index page.
+ *
+ * @param unicode the string that needs to be converted to valid HTML name.
+ * @return a valid HTML name string.
+ */
+ public String getNameForIndex(String unicode) {
+ return "I:" + getName(unicode);
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeFieldWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -88,7 +88,7 @@
Content memberDetailsTree) {
if (!writer.printedAnnotationFieldHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
- "annotation_type_field_detail"));
+ SectionName.ANNOTATION_TYPE_FIELD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.fieldDetailsLabel);
memberDetailsTree.addContent(heading);
@@ -217,7 +217,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_field_summary"));
+ SectionName.ANNOTATION_TYPE_FIELD_SUMMARY));
}
/**
@@ -272,7 +272,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_field_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_FIELD_SUMMARY,
writer.getResource("doclet.navField"));
} else {
return writer.getResource("doclet.navField");
@@ -284,7 +285,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("annotation_type_field_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_FIELD_DETAIL,
writer.getResource("doclet.navField")));
} else {
liNav.addContent(writer.getResource("doclet.navField"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeOptionalMemberWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -133,7 +133,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_optional_element_summary"));
+ SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY));
}
/**
@@ -141,7 +141,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_optional_element_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY,
writer.getResource("doclet.navAnnotationTypeOptionalMember"));
} else {
return writer.getResource("doclet.navAnnotationTypeOptionalMember");
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeRequiredMemberWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -89,7 +89,7 @@
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
- "annotation_type_element_detail"));
+ SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading);
@@ -219,7 +219,7 @@
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
memberTree.addContent(writer.getMarkerAnchor(
- "annotation_type_required_element_summary"));
+ SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY));
}
/**
@@ -274,7 +274,8 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("annotation_type_required_element_summary",
+ return writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY,
writer.getResource("doclet.navAnnotationTypeRequiredMember"));
} else {
return writer.getResource("doclet.navAnnotationTypeRequiredMember");
@@ -286,7 +287,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("annotation_type_element_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL,
writer.getResource("doclet.navAnnotationTypeMember")));
} else {
liNav.addContent(writer.getResource("doclet.navAnnotationTypeMember"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstantsSummaryWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -107,7 +107,8 @@
//add link to summary
Content link;
if (packageName.length() == 0) {
- link = getHyperLink(DocLink.fragment(DocletConstants.UNNAMED_PACKAGE_ANCHOR),
+ link = getHyperLink(getDocLink(
+ SectionName.UNNAMED_PACKAGE_ANCHOR),
defaultPackageLabel, "", "");
} else {
Content packageNameContent = getPackageLabel(parsedPackageName);
@@ -153,7 +154,7 @@
Content pkgNameContent;
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
- DocletConstants.UNNAMED_PACKAGE_ANCHOR));
+ SectionName.UNNAMED_PACKAGE_ANCHOR));
pkgNameContent = defaultPackageLabel;
} else {
summariesTree.addContent(getMarkerAnchor(
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -97,7 +97,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_CONSTRUCTOR_DETAILS);
Content constructorDetailsTree = writer.getMemberTreeHeader();
- constructorDetailsTree.addContent(writer.getMarkerAnchor("constructor_detail"));
+ constructorDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.CONSTRUCTOR_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.constructorDetailsLabel);
constructorDetailsTree.addContent(heading);
@@ -256,7 +257,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("constructor_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.CONSTRUCTOR_SUMMARY));
}
/**
@@ -280,7 +282,7 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink("constructor_summary",
+ return writer.getHyperLink(SectionName.CONSTRUCTOR_SUMMARY,
writer.getResource("doclet.navConstructor"));
} else {
return writer.getResource("doclet.navConstructor");
@@ -292,7 +294,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("constructor_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.CONSTRUCTOR_DETAIL,
writer.getResource("doclet.navConstructor")));
} else {
liNav.addContent(writer.getResource("doclet.navConstructor"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/DeprecatedListWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -48,8 +48,8 @@
private static final String[] ANCHORS = new String[] {
"package", "interface", "class", "enum", "exception", "error",
- "annotation_type", "field", "method", "constructor", "enum_constant",
- "annotation_type_member"
+ "annotation.type", "field", "method", "constructor", "enum.constant",
+ "annotation.type.member"
};
private static final String[] HEADING_KEYS = new String[] {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/EnumConstantWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -73,7 +73,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_ENUM_CONSTANT_DETAILS);
Content enumConstantsDetailsTree = writer.getMemberTreeHeader();
- enumConstantsDetailsTree.addContent(writer.getMarkerAnchor("enum_constant_detail"));
+ enumConstantsDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.ENUM_CONSTANT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.enumConstantsDetailsLabel);
enumConstantsDetailsTree.addContent(heading);
@@ -202,7 +203,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("enum_constant_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.ENUM_CONSTANT_SUMMARY));
}
/**
@@ -263,11 +265,14 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "enum_constant_summary":
- "enum_constants_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navEnum"));
+ if (cd == null) {
+ return writer.getHyperLink(SectionName.ENUM_CONSTANT_SUMMARY,
+ writer.getResource("doclet.navEnum"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.ENUM_CONSTANTS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navEnum"));
+ }
} else {
return writer.getResource("doclet.navEnum");
}
@@ -278,7 +283,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("enum_constant_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.ENUM_CONSTANT_DETAIL,
writer.getResource("doclet.navEnum")));
} else {
liNav.addContent(writer.getResource("doclet.navEnum"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FieldWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -74,7 +74,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_FIELD_DETAILS);
Content fieldDetailsTree = writer.getMemberTreeHeader();
- fieldDetailsTree.addContent(writer.getMarkerAnchor("field_detail"));
+ fieldDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.FIELD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.fieldDetailsLabel);
fieldDetailsTree.addContent(heading);
@@ -224,7 +225,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("field_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.FIELD_SUMMARY));
}
/**
@@ -232,7 +234,7 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "fields_inherited_from_class_" + configuration.getClassName(cd)));
+ SectionName.FIELDS_INHERITANCE, configuration.getClassName(cd)));
}
/**
@@ -293,11 +295,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "field_summary":
- "fields_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navField"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.FIELD_SUMMARY,
+ writer.getResource("doclet.navField"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.FIELDS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navField"));
+ }
} else {
return writer.getResource("doclet.navField");
}
@@ -308,7 +314,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("field_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.FIELD_DETAIL,
writer.getResource("doclet.navField")));
} else {
liNav.addContent(writer.getResource("doclet.navField"));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -509,28 +509,28 @@
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
navDiv.addStyle(HtmlStyle.topNav);
allClassesId += "navbar_top";
- Content a = getMarkerAnchor("navbar_top");
+ Content a = getMarkerAnchor(SectionName.NAVBAR_TOP);
//WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
navDiv.addContent(a);
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
- DocLink.fragment("skip-navbar_top"), skipNavLinks,
+ getDocLink(SectionName.SKIP_NAVBAR_TOP), skipNavLinks,
skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
} else {
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
navDiv.addStyle(HtmlStyle.bottomNav);
allClassesId += "navbar_bottom";
- Content a = getMarkerAnchor("navbar_bottom");
+ Content a = getMarkerAnchor(SectionName.NAVBAR_BOTTOM);
navDiv.addContent(a);
Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
- DocLink.fragment("skip-navbar_bottom"), skipNavLinks,
+ getDocLink(SectionName.SKIP_NAVBAR_BOTTOM), skipNavLinks,
skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
}
if (header) {
- navDiv.addContent(getMarkerAnchor("navbar_top_firstrow"));
+ navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_TOP_FIRSTROW));
} else {
- navDiv.addContent(getMarkerAnchor("navbar_bottom_firstrow"));
+ navDiv.addContent(getMarkerAnchor(SectionName.NAVBAR_BOTTOM_FIRSTROW));
}
HtmlTree navList = new HtmlTree(HtmlTag.UL);
navList.addStyle(HtmlStyle.navList);
@@ -577,11 +577,11 @@
subDiv.addContent(getAllClassesLinkScript(allClassesId.toString()));
addSummaryDetailLinks(subDiv);
if (header) {
- subDiv.addContent(getMarkerAnchor("skip-navbar_top"));
+ subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_TOP));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_TOP_NAVBAR);
} else {
- subDiv.addContent(getMarkerAnchor("skip-navbar_bottom"));
+ subDiv.addContent(getMarkerAnchor(SectionName.SKIP_NAVBAR_BOTTOM));
body.addContent(subDiv);
body.addContent(HtmlConstants.END_OF_BOTTOM_NAVBAR);
}
@@ -886,7 +886,28 @@
* @return a content tree for the marker anchor
*/
public Content getMarkerAnchor(String anchorName) {
- return getMarkerAnchor(anchorName, null);
+ return getMarkerAnchor(getName(anchorName), null);
+ }
+
+ /**
+ * Get the marker anchor which will be added to the documentation tree.
+ *
+ * @param sectionName the section name anchor attribute for page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchor(SectionName sectionName) {
+ return getMarkerAnchor(sectionName.getName(), null);
+ }
+
+ /**
+ * Get the marker anchor which will be added to the documentation tree.
+ *
+ * @param sectionName the section name anchor attribute for page
+ * @param anchorName the anchor name combined with section name attribute for the page
+ * @return a content tree for the marker anchor
+ */
+ public Content getMarkerAnchor(SectionName sectionName, String anchorName) {
+ return getMarkerAnchor(sectionName.getName() + getName(anchorName), null);
}
/**
@@ -1291,10 +1312,10 @@
} else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc)doc;
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(getAnchor(emd, isProperty)).strong(strong));
+ .label(label).where(getName(getAnchor(emd, isProperty))).strong(strong));
} else if (doc instanceof MemberDoc) {
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(doc.name()).strong(strong));
+ .label(label).where(getName(doc.name())).strong(strong));
} else {
return label;
}
@@ -1319,10 +1340,10 @@
} else if (doc instanceof ExecutableMemberDoc) {
ExecutableMemberDoc emd = (ExecutableMemberDoc) doc;
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(getAnchor(emd)));
+ .label(label).where(getName(getAnchor(emd))));
} else if (doc instanceof MemberDoc) {
return getLink(new LinkInfoImpl(configuration, context, classDoc)
- .label(label).where(doc.name()));
+ .label(label).where(getName(doc.name())));
} else {
return label;
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -49,8 +49,6 @@
implements SerializedFormWriter.SerialFieldWriter {
ProgramElementDoc[] members = null;
- private boolean printedOverallAnchor = false;
-
public HtmlSerialFieldWriter(SubWriterHolderWriter writer,
ClassDoc classdoc) {
super(writer, classdoc);
@@ -98,10 +96,6 @@
HtmlTree li = new HtmlTree(HtmlTag.LI);
li.addStyle(HtmlStyle.blockList);
if (serializableFieldsTree.isValid()) {
- if (!printedOverallAnchor) {
- li.addContent(writer.getMarkerAnchor("serializedForm"));
- printedOverallAnchor = true;
- }
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -85,12 +85,10 @@
* @return a content tree for the serializable methods content
*/
public Content getSerializableMethods(String heading, Content serializableMethodContent) {
- Content li = HtmlTree.LI(HtmlStyle.blockList, writer.getMarkerAnchor(
- "serialized_methods"));
Content headingContent = new StringContent(heading);
Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING,
headingContent);
- li.addContent(serialHeading);
+ Content li = HtmlTree.LI(HtmlStyle.blockList, serialHeading);
li.addContent(serializableMethodContent);
return li;
}
@@ -113,8 +111,6 @@
* @param methodsContentTree the content tree to which the member header will be added
*/
public void addMemberHeader(MethodDoc member, Content methodsContentTree) {
- methodsContentTree.addContent(writer.getMarkerAnchor(
- writer.getAnchor(member)));
methodsContentTree.addContent(getHead(member));
methodsContentTree.addContent(getSignature(member));
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -85,7 +85,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_METHOD_DETAILS);
Content methodDetailsTree = writer.getMemberTreeHeader();
- methodDetailsTree.addContent(writer.getMarkerAnchor("method_detail"));
+ methodDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.METHOD_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.methodDetailsLabel);
methodDetailsTree.addContent(heading);
@@ -244,7 +245,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("method_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.METHOD_SUMMARY));
}
/**
@@ -252,8 +254,7 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "methods_inherited_from_class_" +
- configuration.getClassName(cd)));
+ SectionName.METHODS_INHERITANCE, configuration.getClassName(cd)));
}
/**
@@ -318,7 +319,7 @@
Content methlink = writer.getLink(
new LinkInfoImpl(writer.configuration, LinkInfoImpl.Kind.MEMBER,
overriddenType.asClassDoc())
- .where(writer.getAnchor(method)).label(name));
+ .where(writer.getName(writer.getAnchor(method))).label(name));
Content codeMethLink = HtmlTree.CODE(methlink);
Content dd = HtmlTree.DD(codeMethLink);
dd.addContent(writer.getSpace());
@@ -400,11 +401,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "method_summary":
- "methods_inherited_from_class_" +
- configuration.getClassName(cd),
- writer.getResource("doclet.navMethod"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.METHOD_SUMMARY,
+ writer.getResource("doclet.navMethod"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.METHODS_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navMethod"));
+ }
} else {
return writer.getResource("doclet.navMethod");
}
@@ -415,8 +420,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("method_detail",
- writer.getResource("doclet.navMethod")));
+ liNav.addContent(writer.getHyperLink(
+ SectionName.METHOD_DETAIL, writer.getResource("doclet.navMethod")));
} else {
liNav.addContent(writer.getResource("doclet.navMethod"));
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/NestedClassWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -132,7 +132,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("nested_class_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.NESTED_CLASS_SUMMARY));
}
/**
@@ -140,7 +141,8 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "nested_classes_inherited_from_class_" + cd.qualifiedName()));
+ SectionName.NESTED_CLASSES_INHERITANCE,
+ cd.qualifiedName()));
}
/**
@@ -202,9 +204,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null) ? "nested_class_summary":
- "nested_classes_inherited_from_class_" + cd.qualifiedName(),
- writer.getResource("doclet.navNested"));
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.NESTED_CLASS_SUMMARY,
+ writer.getResource("doclet.navNested"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.NESTED_CLASSES_INHERITANCE,
+ cd.qualifiedName(), writer.getResource("doclet.navNested"));
+ }
} else {
return writer.getResource("doclet.navNested");
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -203,8 +203,9 @@
Content see = seeLabel;
see.addContent(" ");
Content descPara = HtmlTree.P(see);
- Content descLink = getHyperLink(DocLink.fragment("overview_description"),
- descriptionLabel, "", "");
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.OVERVIEW_DESCRIPTION),
+ descriptionLabel, "", "");
descPara.addContent(descLink);
div.addContent(descPara);
body.addContent(div);
@@ -220,7 +221,8 @@
*/
protected void addOverviewComment(Content htmltree) {
if (root.inlineTags().length > 0) {
- htmltree.addContent(getMarkerAnchor("overview_description"));
+ htmltree.addContent(
+ getMarkerAnchor(SectionName.OVERVIEW_DESCRIPTION));
addInlineComment(root, htmltree);
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -112,7 +112,8 @@
addSummaryComment(packageDoc, docSummaryDiv);
div.addContent(docSummaryDiv);
Content space = getSpace();
- Content descLink = getHyperLink(DocLink.fragment("package_description"),
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
@@ -211,7 +212,8 @@
*/
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
- packageContentTree.addContent(getMarkerAnchor("package_description"));
+ packageContentTree.addContent(
+ getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -129,7 +129,8 @@
addSummaryComment(packageDoc, docSummaryDiv);
div.addContent(docSummaryDiv);
Content space = getSpace();
- Content descLink = getHyperLink(DocLink.fragment("package_description"),
+ Content descLink = getHyperLink(getDocLink(
+ SectionName.PACKAGE_DESCRIPTION),
descriptionLabel, "", "");
Content descPara = new HtmlTree(HtmlTag.P, seeLabel, space, descLink);
div.addContent(descPara);
@@ -192,7 +193,8 @@
*/
public void addPackageDescription(Content packageContentTree) {
if (packageDoc.inlineTags().length > 0) {
- packageContentTree.addContent(getMarkerAnchor("package_description"));
+ packageContentTree.addContent(
+ getMarkerAnchor(SectionName.PACKAGE_DESCRIPTION));
Content h2Content = new StringContent(
configuration.getText("doclet.Package_Description",
packageDoc.name()));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PropertyWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -70,7 +70,8 @@
Content memberDetailsTree) {
memberDetailsTree.addContent(HtmlConstants.START_OF_PROPERTY_DETAILS);
Content propertyDetailsTree = writer.getMemberTreeHeader();
- propertyDetailsTree.addContent(writer.getMarkerAnchor("property_detail"));
+ propertyDetailsTree.addContent(writer.getMarkerAnchor(
+ SectionName.PROPERTY_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.propertyDetailsLabel);
propertyDetailsTree.addContent(heading);
@@ -220,7 +221,8 @@
* {@inheritDoc}
*/
public void addSummaryAnchor(ClassDoc cd, Content memberTree) {
- memberTree.addContent(writer.getMarkerAnchor("property_summary"));
+ memberTree.addContent(writer.getMarkerAnchor(
+ SectionName.PROPERTY_SUMMARY));
}
/**
@@ -228,7 +230,8 @@
*/
public void addInheritedSummaryAnchor(ClassDoc cd, Content inheritedTree) {
inheritedTree.addContent(writer.getMarkerAnchor(
- "properties_inherited_from_class_" + configuration.getClassName(cd)));
+ SectionName.PROPERTIES_INHERITANCE,
+ configuration.getClassName(cd)));
}
/**
@@ -297,11 +300,15 @@
*/
protected Content getNavSummaryLink(ClassDoc cd, boolean link) {
if (link) {
- return writer.getHyperLink((cd == null)?
- "property_summary":
- "properties_inherited_from_class_" +
- configuration.getClassName(cd),
+ if (cd == null) {
+ return writer.getHyperLink(
+ SectionName.PROPERTY_SUMMARY,
writer.getResource("doclet.navProperty"));
+ } else {
+ return writer.getHyperLink(
+ SectionName.PROPERTIES_INHERITANCE,
+ configuration.getClassName(cd), writer.getResource("doclet.navProperty"));
+ }
} else {
return writer.getResource("doclet.navProperty");
}
@@ -312,7 +319,8 @@
*/
protected void addNavDetailLink(boolean link, Content liNav) {
if (link) {
- liNav.addContent(writer.getHyperLink("property_detail",
+ liNav.addContent(writer.getHyperLink(
+ SectionName.PROPERTY_DETAIL,
writer.getResource("doclet.navProperty")));
} else {
liNav.addContent(writer.getResource("doclet.navProperty"));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SectionName.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.doclets.formats.html;
+
+/**
+ * Enum representing various section names of generated API documentation.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own risk.
+ * This code and its internal interfaces are subject to change or
+ * deletion without notice.</b>
+ *
+ * @author Bhavesh Patel
+ */
+public enum SectionName {
+
+ ANNOTATION_TYPE_ELEMENT_DETAIL("annotation.type.element.detail"),
+ ANNOTATION_TYPE_FIELD_DETAIL("annotation.type.field.detail"),
+ ANNOTATION_TYPE_FIELD_SUMMARY("annotation.type.field.summary"),
+ ANNOTATION_TYPE_OPTIONAL_ELEMENT_SUMMARY("annotation.type.optional.element.summary"),
+ ANNOTATION_TYPE_REQUIRED_ELEMENT_SUMMARY("annotation.type.required.element.summary"),
+ CONSTRUCTOR_DETAIL("constructor.detail"),
+ CONSTRUCTOR_SUMMARY("constructor.summary"),
+ ENUM_CONSTANT_DETAIL("enum.constant.detail"),
+ ENUM_CONSTANTS_INHERITANCE("enum.constants.inherited.from.class."),
+ ENUM_CONSTANT_SUMMARY("enum.constant.summary"),
+ FIELD_DETAIL("field.detail"),
+ FIELDS_INHERITANCE("fields.inherited.from.class."),
+ FIELD_SUMMARY("field.summary"),
+ METHOD_DETAIL("method.detail"),
+ METHODS_INHERITANCE("methods.inherited.from.class."),
+ METHOD_SUMMARY("method.summary"),
+ NAVBAR_BOTTOM("navbar.bottom"),
+ NAVBAR_BOTTOM_FIRSTROW("navbar.bottom.firstrow"),
+ NAVBAR_TOP("navbar.top"),
+ NAVBAR_TOP_FIRSTROW("navbar.top.firstrow"),
+ NESTED_CLASSES_INHERITANCE("nested.classes.inherited.from.class."),
+ NESTED_CLASS_SUMMARY("nested.class.summary"),
+ OVERVIEW_DESCRIPTION("overview.description"),
+ PACKAGE_DESCRIPTION("package.description"),
+ PROPERTY_DETAIL("property.detail"),
+ PROPERTIES_INHERITANCE("properties.inherited.from.class."),
+ PROPERTY_SUMMARY("property.summary"),
+ SKIP_NAVBAR_BOTTOM("skip.navbar.bottom"),
+ SKIP_NAVBAR_TOP("skip.navbar.top"),
+ UNNAMED_PACKAGE_ANCHOR("unnamed.package");
+
+ private final String value;
+
+ SectionName(String sName) {
+ this.value = sName;
+ }
+
+ public String getName() {
+ return this.value;
+ }
+}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SingleIndexWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -115,7 +115,8 @@
for (int i = 0; i < indexbuilder.elements().length; i++) {
String unicode = (indexbuilder.elements())[i].toString();
contentTree.addContent(
- getHyperLink("_" + unicode + "_", new StringContent(unicode)));
+ getHyperLink(getNameForIndex(unicode),
+ new StringContent(unicode)));
contentTree.addContent(getSpace());
}
}
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -118,7 +118,8 @@
if (deprs.length > 0) {
Content body = commentTagsToOutput(null, doc,
deprs[0].inlineTags(), false);
- result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body));
+ if (!body.isEmpty())
+ result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body));
}
} else {
if (Util.isDeprecated(member.containingClass())) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Mon Oct 28 12:28:57 2013 -0700
@@ -41,8 +41,6 @@
@Override
public void addContent(Content content) {
nullCheck(content);
- if ((content instanceof ContentBuilder) && content.isEmpty())
- return;
ensureMutableContents();
if (content instanceof ContentBuilder) {
contents.addAll(((ContentBuilder) content).contents);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlDocWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -30,6 +30,7 @@
import com.sun.javadoc.*;
import com.sun.tools.doclets.formats.html.ConfigurationImpl;
+import com.sun.tools.doclets.formats.html.SectionName;
import com.sun.tools.doclets.internal.toolkit.*;
import com.sun.tools.doclets.internal.toolkit.util.DocFile;
import com.sun.tools.doclets.internal.toolkit.util.DocLink;
@@ -78,7 +79,7 @@
}
/**
- * Get Html Hyper Link string.
+ * Get Html Hyper Link Content.
*
* @param where Position of the link in the file. Character '#' is not
* needed.
@@ -87,7 +88,125 @@
*/
public Content getHyperLink(String where,
Content label) {
- return getHyperLink(DocLink.fragment(where), label, "", "");
+ return getHyperLink(getDocLink(where), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName), label, "", "");
+ }
+
+ /**
+ * Get Html Hyper Link Content.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @param label Tag for the link.
+ * @return a content tree for the hyper link
+ */
+ public Content getHyperLink(SectionName sectionName, String where,
+ Content label) {
+ return getHyperLink(getDocLink(sectionName, where), label, "", "");
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param where Position of the link in the file.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(String where) {
+ return DocLink.fragment(getName(where));
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name to which the link will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName) {
+ return DocLink.fragment(sectionName.getName());
+ }
+
+ /**
+ * Get the link.
+ *
+ * @param sectionName The section name combined with where to which the link
+ * will be created.
+ * @param where The fragment combined with sectionName to which the link
+ * will be created.
+ * @return a DocLink object for the hyper link
+ */
+ public DocLink getDocLink(SectionName sectionName, String where) {
+ return DocLink.fragment(sectionName.getName() + getName(where));
+ }
+
+ /**
+ * Convert the name to a valid HTML name.
+ *
+ * @param name the name that needs to be converted to valid HTML name.
+ * @return a valid HTML name string.
+ */
+ public String getName(String name) {
+ StringBuilder sb = new StringBuilder();
+ char ch;
+ /* The HTML 4 spec at http://www.w3.org/TR/html4/types.html#h-6.2 mentions
+ * that the name/id should begin with a letter followed by other valid characters.
+ * The HTML 5 spec (draft) is more permissive on names/ids where the only restriction
+ * is that it should be at least one character long and should not contain spaces.
+ * The spec draft is @ http://www.w3.org/html/wg/drafts/html/master/dom.html#the-id-attribute.
+ *
+ * For HTML 4, we need to check for non-characters at the beginning of the name and
+ * substitute it accordingly, "_" and "$" can appear at the beginning of a member name.
+ * The method substitutes "$" with "Z:Z:D" and will prefix "_" with "Z:Z".
+ */
+ for (int i = 0; i < name.length(); i++) {
+ ch = name.charAt(i);
+ switch (ch) {
+ case '(':
+ case ')':
+ case '<':
+ case '>':
+ case ',':
+ sb.append('-');
+ break;
+ case ' ':
+ case '[':
+ break;
+ case ']':
+ sb.append(":A");
+ break;
+ // Any appearance of $ needs to be substituted with ":D" and not with hyphen
+ // since a field name "P$$ and a method P(), both valid member names, can end
+ // up as "P--". A member name beginning with $ needs to be substituted with
+ // "Z:Z:D".
+ case '$':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(":D");
+ break;
+ // A member name beginning with _ needs to be prefixed with "Z:Z" since valid anchor
+ // names can only begin with a letter.
+ case '_':
+ if (i == 0)
+ sb.append("Z:Z");
+ sb.append(ch);
+ break;
+ default:
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
}
/**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Mon Oct 28 12:28:57 2013 -0700
@@ -102,7 +102,12 @@
* @param tagContent tag content to be added
*/
public void addContent(Content tagContent) {
- if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
+ if (tagContent instanceof ContentBuilder) {
+ for (Content content: ((ContentBuilder)tagContent).contents) {
+ addContent(content);
+ }
+ }
+ else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) {
if (content.isEmpty())
content = new ArrayList<Content>();
content.add(tagContent);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java Mon Oct 28 12:28:57 2013 -0700
@@ -312,7 +312,7 @@
String scriptCode = "<!--" + DocletConstants.NL +
" try {" + DocletConstants.NL +
" if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
- " parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
+ " parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
" }" + DocletConstants.NL +
" }" + DocletConstants.NL +
" catch(err) {" + DocletConstants.NL +
@@ -325,6 +325,53 @@
}
/**
+ * Returns a String with escaped special JavaScript characters.
+ *
+ * @param s String that needs to be escaped
+ * @return a valid escaped JavaScript string
+ */
+ private static String escapeJavaScriptChars(String s) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < s.length(); i++) {
+ char ch = s.charAt(i);
+ switch (ch) {
+ case '\b':
+ sb.append("\\b");
+ break;
+ case '\t':
+ sb.append("\\t");
+ break;
+ case '\n':
+ sb.append("\\n");
+ break;
+ case '\f':
+ sb.append("\\f");
+ break;
+ case '\r':
+ sb.append("\\r");
+ break;
+ case '"':
+ sb.append("\\\"");
+ break;
+ case '\'':
+ sb.append("\\\'");
+ break;
+ case '\\':
+ sb.append("\\\\");
+ break;
+ default:
+ if (ch < 32 || ch >= 127) {
+ sb.append(String.format("\\u%04X", (int)ch));
+ } else {
+ sb.append(ch);
+ }
+ break;
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
* Returns a content tree for the SCRIPT tag for the main page(index.html).
*
* @return a content for the SCRIPT tag
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ This package contains classes that write HTML markup tags.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+ */
+@jdk.Exported(false)
+package com.sun.tools.doclets.formats.html.markup;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.formats.html.markup package</title>
-<body bgcolor="white">
- This package contains classes that write HTML markup tags.
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ This is the default doclet provided with JDK that produces Javadoc's
+ default HTML-formatted API output. For more documentation
+ on this doclet, please refer to the link below.
+
+ @see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
+ http://www.java.sun.com/javadoc/standard-doclet.html </a>
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.formats.html;
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.formats.html package</title>
-</head>
-<body bgcolor="white">
- This is the default doclet provided with JDK that produces Javadoc's
- default HTML-formatted API output. For more documentation
- on this doclet, please refer to the link below.
-
- @see <a href="http://www.java.sun.com/javadoc/standard-doclet.html">
- http://www.java.sun.com/javadoc/standard-doclet.html </a>
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ This doclet-independent package has a set of classes and
+ interfaces that are the building blocks for doclets. They
+ define the basic structure of doclets and make doclet
+ writing much easier because they provide the content generation
+ code to be shared among different doclets. Builders only provide
+ the structure and content of API documentation.
+ They will not provide any style markup.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.builders;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.builders package</title>
-</head>
-<body bgcolor="white">
- This doclet-independent package has a set of classes and
- interfaces that are the building blocks for doclets. They
- define the basic structure of doclets and make doclet
- writing much easier because they provide the content generation
- code to be shared among different doclets. Builders only provide
- the structure and content of API documentation.
- They will not provide any style markup.
- <p>
- This code is not part of an API.
- It is implementation that is subject to change.
- Do not use it as an API.
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ Contains the base classes that make up a doclet. Doclets that reuse
+ the functionality provided by the toolkit should have the following
+ characteristics:
+ <ul>
+ <li>
+ The main driver class should extend
+ {@link com.sun.tools.doclets.internal.toolkit.AbstractDoclet}.
+ </li>
+ <li>
+ The doclet configuration class should extend
+ {@link com.sun.tools.doclets.internal.toolkit.Configuration}.
+ </li>
+ <li>
+ The doclet should have a writer factory that implements
+ {@link com.sun.tools.doclets.internal.toolkit.WriterFactory}.
+ This class constructs writers that write doclet specific output.
+ </li>
+ <li>
+ The doclet should have a taglet writer that extends
+ {@link com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter}.
+ This writer determines how to output each given tag.
+ </li>
+ </ul>
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit package</title>
-</head>
-<body bgcolor="white">
-
- Contains the base classes that make up a doclet. Doclets that reuse
- the functionality provided by the toolkit should have the following
- characteristics:
- <ul>
- <li>
- The main driver class should extend
- {@link com.sun.tools.doclets.internal.toolkit.AbstractDoclet}.
- </li>
- <li>
- The doclet configuration class should extend
- {@link com.sun.tools.doclets.internal.toolkit.Configuration}.
- </li>
- <li>
- The doclet should have a writer factory that implements
- {@link com.sun.tools.doclets.internal.toolkit.WriterFactory}.
- This class constructs writers that write doclet specific output.
- </li>
- <li>
- The doclet should have a taglet writer that extends
- {@link com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter}.
- This writer determines how to output each given tag.
- </li>
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ This package has classes used to generate Javadoc tag documentation.
+ Doclets no longer have to implement its own version of standard tags
+ such as @param and @throws. This is the single, doclet
+ implementation of each standard tag that is shared by all
+ doclets. Each doclet must have a taglet writer that takes a taglet
+ as input and writes doclet-dependent output. The taglet itself will
+ do the tag processing. For example, suppose we are outputing
+ @throws tags. The taglet would:
+ <ul>
+ <li> Retrieve the list of throws tags to be documented.
+ <li> Replace {@inheritDoc} with the appropriate documentation.
+ <li> Add throws documentation for exceptions that are declared in
+ the signature of the method but
+ not documented with the throws tags.
+ </ul>
+ After doing the steps above, the taglet would pass the information to
+ the taglet writer for writing. The taglets are essentially builders for
+ tags.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.taglets;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.taglets package</title>
-</head>
-<body bgcolor="white">
- This package has classes used to generate Javadoc tag documentation.
- Doclets no longer have to implement its own version of standard tags
- such as @param and @throws. This is the single, doclet
- implementation of each standard tag that is shared by all
- doclets. Each doclet must have a taglet writer that takes a taglet
- as input and writes doclet-dependent output. The taglet itself will
- do the tag processing. For example, suppose we are outputing
- @throws tags. The taglet would:
- <ul>
- <li> Retrieve the list of throws tags to be documented.
- <li> Replace {@inheritDoc} with the appropriate documentation.
- <li> Add throws documentation for exceptions that are declared in
- the signature of the method but
- not documented with the throws tags.
- </ul>
- After doing the steps above, the taglet would pass the information to
- the taglet writer for writing. The taglets are essentially builders for
- tags.
- <p>
- This code is not part of an API.
- It is implementation that is subject to change.
- Do not use it as an API.
- </body>
-</html>
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocletConstants.java Mon Oct 28 12:28:57 2013 -0700
@@ -58,9 +58,4 @@
* The default package file name.
*/
public static final String DEFAULT_PACKAGE_FILE_NAME = "default";
-
- /**
- * The anchor for the default package.
- */
- public static final String UNNAMED_PACKAGE_ANCHOR = "unnamed_package";
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ Provides a factory for constructing links.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.util.links;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.interal.toolkit.util.links package</title>
-</head>
-<body bgcolor="white">
- Provides a factory for constructing links.
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ This package has utility classes that perform common services required
+ for API documentation generation.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets.internal.toolkit.util;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute 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.
--->
-
-<html>
-<head>
-<title>com.sun.tools.doclets.internal.toolkit.util package</title>
-</head>
-<body bgcolor="white">
- This package has utility classes that perform common services required
- for API documentation generation.
- <p>
- This code is not part of an API.
- It is implementation that is subject to change.
- Do not use it as an API.
- </body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/doclets/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ As of JDK version 1.5, replaced by
+ {@code com.sun.tools.doclets.internal.toolkit.util}.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.doclets;
--- a/langtools/src/share/classes/com/sun/tools/doclets/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-<!--
- Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation. Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<html>
-<head>
-<title>com.sun.tools/doclets package</title>
-</head>
-<body bgcolor="white">
- As of JDK version 1.5, replaced by
- {@code com.sun.tools.doclets.internal.toolkit.util}.
- </body>
-</html>
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java Mon Oct 28 12:28:57 2013 -0700
@@ -213,6 +213,7 @@
public Void visitDocComment(DocCommentTree tree, Void ignore) {
super.visitDocComment(tree, ignore);
for (TagStackItem tsi: tagStack) {
+ warnIfEmpty(tsi, null);
if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT
&& tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) {
StartElementTree t = (StartElementTree) tsi.tree;
@@ -270,7 +271,6 @@
@Override
public Void visitStartElement(StartElementTree tree, Void ignore) {
- markEnclosingTag(Flag.HAS_ELEMENT);
final Name treeName = tree.getName();
final HtmlTag t = HtmlTag.get(treeName);
if (t == null) {
@@ -279,7 +279,10 @@
boolean done = false;
for (TagStackItem tsi: tagStack) {
if (tsi.tag.accepts(t)) {
- while (tagStack.peek() != tsi) tagStack.pop();
+ while (tagStack.peek() != tsi) {
+ warnIfEmpty(tagStack.peek(), null);
+ tagStack.pop();
+ }
done = true;
break;
} else if (tsi.tag.endKind != HtmlTag.EndKind.OPTIONAL) {
@@ -288,9 +291,13 @@
}
}
if (!done && HtmlTag.BODY.accepts(t)) {
- tagStack.clear();
+ while (!tagStack.isEmpty()) {
+ warnIfEmpty(tagStack.peek(), null);
+ tagStack.pop();
+ }
}
+ markEnclosingTag(Flag.HAS_ELEMENT);
checkStructure(tree, t);
// tag specific checks
@@ -447,12 +454,7 @@
"dc.no.summary.or.caption.for.table");
}
}
- if (t.flags.contains(HtmlTag.Flag.EXPECT_CONTENT)
- && !top.flags.contains(Flag.HAS_TEXT)
- && !top.flags.contains(Flag.HAS_ELEMENT)
- && !top.flags.contains(Flag.HAS_INLINE_TAG)) {
- env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
- }
+ warnIfEmpty(top, tree);
tagStack.pop();
done = true;
break;
@@ -485,6 +487,20 @@
return super.visitEndElement(tree, ignore);
}
+
+ void warnIfEmpty(TagStackItem tsi, DocTree endTree) {
+ if (tsi.tag != null && tsi.tree instanceof StartElementTree) {
+ if (tsi.tag.flags.contains(HtmlTag.Flag.EXPECT_CONTENT)
+ && !tsi.flags.contains(Flag.HAS_TEXT)
+ && !tsi.flags.contains(Flag.HAS_ELEMENT)
+ && !tsi.flags.contains(Flag.HAS_INLINE_TAG)) {
+ DocTree tree = (endTree != null) ? endTree : tsi.tree;
+ Name treeName = ((StartElementTree) tsi.tree).getName();
+ env.messages.warning(HTML, tree, "dc.tag.empty", treeName);
+ }
+ }
+ }
+
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="HTML attributes">
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/AnnoConstruct.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.code;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.lang.model.AnnotatedConstruct;
+
+import com.sun.tools.javac.model.AnnotationProxyMaker;
+import com.sun.tools.javac.util.List;
+import com.sun.tools.javac.util.ListBuffer;
+
+/**
+ * Common super type for annotated constructs such as Types and Symbols.
+ *
+ * This class should *not* contain any fields since it would have a significant
+ * impact on the javac memory footprint.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk. This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public abstract class AnnoConstruct implements AnnotatedConstruct {
+
+
+ // Override to enforce a narrower return type.
+ @Override
+ public abstract List<? extends Attribute.Compound> getAnnotationMirrors();
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ protected <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+ String name = annoType.getName();
+
+ for (Attribute.Compound anno : getAnnotationMirrors()) {
+ if (name.equals(anno.type.tsym.flatName().toString()))
+ return anno;
+ }
+
+ return null;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+ return (A[]) java.lang.reflect.Array.newInstance(annoType, 0); // annoType is the Class for A
+ }
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ public <A extends Annotation> A[] getAnnotationsByType(Class<A> annoType) {
+
+ if (!annoType.isAnnotation())
+ throw new IllegalArgumentException("Not an annotation type: "
+ + annoType);
+ // If annoType does not declare a container this is equivalent to wrapping
+ // getAnnotation(...) in an array.
+ Class <? extends Annotation> containerType = getContainer(annoType);
+ if (containerType == null) {
+ A res = getAnnotation(annoType);
+ int size = res == null ? 0 : 1;
+
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+ if (res != null)
+ arr[0] = res;
+ return arr;
+ }
+
+ // So we have a containing type
+ String annoTypeName = annoType.getName();
+ String containerTypeName = containerType.getName();
+ int directIndex = -1, containerIndex = -1;
+ Attribute.Compound direct = null, container = null;
+ // Find directly (explicit or implicit) present annotations
+ int index = -1;
+ for (Attribute.Compound attribute : getAnnotationMirrors()) {
+ index++;
+ if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
+ directIndex = index;
+ direct = attribute;
+ } else if(containerTypeName != null &&
+ attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
+ containerIndex = index;
+ container = attribute;
+ }
+ }
+
+ // Deal with inherited annotations
+ if (direct == null && container == null)
+ return getInheritedAnnotations(annoType);
+
+ // Pack them in an array
+ Attribute[] contained0 = null;
+ if (container != null)
+ contained0 = unpackAttributes(container);
+ ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
+ if (contained0 != null) {
+ for (Attribute a : contained0)
+ if (a instanceof Attribute.Compound)
+ compounds = compounds.append((Attribute.Compound)a);
+ }
+ Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
+
+ int size = (direct == null ? 0 : 1) + contained.length;
+ @SuppressWarnings("unchecked") // annoType is the Class for A
+ A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
+
+ // if direct && container, which is first?
+ int insert = -1;
+ int length = arr.length;
+ if (directIndex >= 0 && containerIndex >= 0) {
+ if (directIndex < containerIndex) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 1;
+ } else {
+ arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ insert = 0;
+ length--;
+ }
+ } else if (directIndex >= 0) {
+ arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
+ return arr;
+ } else {
+ // Only container
+ insert = 0;
+ }
+
+ for (int i = 0; i + insert < length; i++)
+ arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
+
+ return arr;
+ }
+
+
+ // This method is part of the javax.lang.model API, do not use this in javac code.
+ public <A extends Annotation> A getAnnotation(Class<A> annoType) {
+
+ if (!annoType.isAnnotation())
+ throw new IllegalArgumentException("Not an annotation type: " + annoType);
+
+ Attribute.Compound c = getAttribute(annoType);
+ return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
+ }
+
+ // Needed to unpack the runtime view of containing annotations
+ private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
+ private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
+
+ private static Class<? extends Annotation> initRepeatable() {
+ try {
+ // Repeatable will not be available when bootstrapping on
+ // JDK 7 so use a reflective lookup instead of a class
+ // literal for Repeatable.class.
+ return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
+ } catch (ClassNotFoundException | SecurityException e) {
+ return null;
+ }
+ }
+
+ private static Method initValueElementMethod() {
+ if (REPEATABLE_CLASS == null)
+ return null;
+
+ Method m = null;
+ try {
+ m = REPEATABLE_CLASS.getMethod("value");
+ if (m != null)
+ m.setAccessible(true);
+ return m;
+ } catch (NoSuchMethodException e) {
+ return null;
+ }
+ }
+
+
+ // Helper to getAnnotationsByType
+ private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
+ // Since we can not refer to java.lang.annotation.Repeatable until we are
+ // bootstrapping with java 8 we need to get the Repeatable annotation using
+ // reflective invocations instead of just using its type and element method.
+ if (REPEATABLE_CLASS != null &&
+ VALUE_ELEMENT_METHOD != null) {
+ // Get the Repeatable instance on the annotations declaration
+ Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
+ if (repeatable != null) {
+ try {
+ // Get the value element, it should be a class
+ // indicating the containing annotation type
+ @SuppressWarnings("unchecked")
+ Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
+ if (containerType == null)
+ return null;
+
+ return containerType;
+ } catch (ClassCastException | IllegalAccessException | InvocationTargetException e) {
+ return null;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ // Helper to getAnnotationsByType
+ private static Attribute[] unpackAttributes(Attribute.Compound container) {
+ // We now have an instance of the container,
+ // unpack it returning an instance of the
+ // contained type or null
+ return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
+ }
+
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java Mon Oct 28 12:28:57 2013 -0700
@@ -64,6 +64,8 @@
return false;
}
+ public TypeAnnotationPosition getPosition() { return null; };
+
/** The value for an annotation element of primitive type or String. */
public static class Constant extends Attribute {
public final Object value;
@@ -191,8 +193,13 @@
}
public Attribute member(Name member) {
+ Pair<MethodSymbol,Attribute> res = getElemPair(member);
+ return res == null ? null : res.snd;
+ }
+
+ private Pair<MethodSymbol, Attribute> getElemPair(Name member) {
for (Pair<MethodSymbol,Attribute> pair : values)
- if (pair.fst.name == member) return pair.snd;
+ if (pair.fst.name == member) return pair;
return null;
}
@@ -208,6 +215,16 @@
return (DeclaredType) type;
}
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (values.size() != 0) {
+ Name valueName = values.head.fst.name.table.names.value;
+ Pair<MethodSymbol, Attribute> res = getElemPair(valueName);
+ return res == null ? null : res.snd.getPosition();
+ }
+ return null;
+ }
+
public Map<MethodSymbol, Attribute> getElementValues() {
Map<MethodSymbol, Attribute> valmap =
new LinkedHashMap<MethodSymbol, Attribute>();
@@ -219,6 +236,7 @@
public static class TypeCompound extends Compound {
public TypeAnnotationPosition position;
+
public TypeCompound(Compound compound,
TypeAnnotationPosition position) {
this(compound.type, compound.values, position);
@@ -230,8 +248,16 @@
this.position = position;
}
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (hasUnknownPosition()) {
+ position = super.getPosition();
+ }
+ return position;
+ }
+
public boolean hasUnknownPosition() {
- return position == null || position.type == TargetType.UNKNOWN;
+ return position.type == TargetType.UNKNOWN;
}
public boolean isContainerTypeCompound() {
@@ -302,6 +328,14 @@
public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
return v.visitArray(getValue(), p);
}
+
+ @Override
+ public TypeAnnotationPosition getPosition() {
+ if (values.length != 0)
+ return values[0].getPosition();
+ else
+ return null;
+ }
}
/** The value for an annotation element of an enum type.
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Printer.java Mon Oct 28 12:28:57 2013 -0700
@@ -260,24 +260,23 @@
@Override
public String visitAnnotatedType(AnnotatedType t, Locale locale) {
- if (t.typeAnnotations != null &&
- t.typeAnnotations.nonEmpty()) {
- if (t.underlyingType.hasTag(TypeTag.ARRAY)) {
+ if (t.getAnnotationMirrors().nonEmpty()) {
+ if (t.unannotatedType().hasTag(TypeTag.ARRAY)) {
StringBuilder res = new StringBuilder();
printBaseElementType(t, res, locale);
printBrackets(t, res, locale);
return res.toString();
- } else if (t.underlyingType.hasTag(TypeTag.CLASS) &&
- t.underlyingType.getEnclosingType() != Type.noType) {
- return visit(t.underlyingType.getEnclosingType(), locale) +
+ } else if (t.unannotatedType().hasTag(TypeTag.CLASS) &&
+ t.unannotatedType().getEnclosingType() != Type.noType) {
+ return visit(t.unannotatedType().getEnclosingType(), locale) +
". " +
- t.typeAnnotations +
- " " + className((ClassType)t.underlyingType, false, locale);
+ t.getAnnotationMirrors() +
+ " " + className((ClassType)t.unannotatedType(), false, locale);
} else {
- return t.typeAnnotations + " " + visit(t.underlyingType, locale);
+ return t.getAnnotationMirrors() + " " + visit(t.unannotatedType(), locale);
}
} else {
- return visit(t.underlyingType, locale);
+ return visit(t.unannotatedType(), locale);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,8 @@
package com.sun.tools.javac.code;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
import java.util.Set;
import java.util.concurrent.Callable;
@@ -37,8 +39,6 @@
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.model.*;
-import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.Name;
import static com.sun.tools.javac.code.Flags.*;
@@ -58,8 +58,7 @@
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
-public abstract class Symbol implements Element {
- // public Throwable debug = new Throwable();
+public abstract class Symbol extends AnnoConstruct implements Element {
/** The kind of this symbol.
* @see Kinds
@@ -103,6 +102,7 @@
*/
protected SymbolMetadata annotations;
+
/** An accessor method for the attributes of this symbol.
* Attributes of class symbols should be accessed through the accessor
* method to make sure that the class symbol is loaded.
@@ -596,18 +596,6 @@
return getRawAttributes();
}
- /**
- * @deprecated this method should never be used by javac internally.
- */
- @Deprecated
- public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotation(this, annoType);
- }
-
- // This method is part of the javax.lang.model API, do not use this in javac code.
- public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotationsByType(this, annoType);
- }
// TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
public java.util.List<Symbol> getEnclosedElements() {
@@ -793,6 +781,28 @@
return res = res.reverse();
}
+
+
+ // Helper to getAnnotation[s]
+ @Override
+ public <A extends Annotation> Attribute.Compound getAttribute(Class<A> annoType) {
+
+ String name = annoType.getName();
+
+ // Declaration annotations on type variables are stored in type attributes
+ // on the owner of the TypeVariableSymbol
+ List<Attribute.TypeCompound> candidates = owner.getRawTypeAttributes();
+ for (Attribute.TypeCompound anno : candidates)
+ if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
+ anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
+ if (name.contentEquals(anno.type.tsym.flatName()))
+ return anno;
+
+ return null;
+ }
+
+
+
@Override
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
return v.visitTypeParameter(this, p);
@@ -1049,6 +1059,31 @@
}
}
+ /**
+ * Returns the next class to search for inherited annotations or {@code null}
+ * if the next class can't be found.
+ */
+ private ClassSymbol getSuperClassToSearchForAnnotations() {
+
+ Type sup = getSuperclass();
+
+ if (!sup.hasTag(CLASS) || sup.isErroneous())
+ return null;
+
+ return (ClassSymbol) sup.tsym;
+ }
+
+
+ @Override
+ protected <A extends Annotation> A[] getInheritedAnnotations(Class<A> annoType) {
+
+ ClassSymbol sup = getSuperClassToSearchForAnnotations();
+
+ return sup == null ? super.getInheritedAnnotations(annoType)
+ : sup.getAnnotationsByType(annoType);
+ }
+
+
public ElementKind getKind() {
long flags = flags();
if ((flags & ANNOTATION) != 0)
@@ -1079,15 +1114,25 @@
return NestingKind.MEMBER;
}
- /**
- * Since this method works in terms of the runtime representation
- * of annotations, it should never be used by javac internally.
- */
+
@Override
- public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) {
- return JavacAnnoConstructs.getAnnotation(this, annoType);
+ protected <A extends Annotation> Attribute.Compound getAttribute(final Class<A> annoType) {
+
+ Attribute.Compound attrib = super.getAttribute(annoType);
+
+ boolean inherited = annoType.isAnnotationPresent(Inherited.class);
+ if (attrib != null || !inherited)
+ return attrib;
+
+ // Search supertypes
+ ClassSymbol superType = getSuperClassToSearchForAnnotations();
+ return superType == null ? null
+ : superType.getAttribute(annoType);
}
+
+
+
public <R, P> R accept(ElementVisitor<R, P> v, P p) {
return v.visitType(this, p);
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/SymbolMetadata.java Mon Oct 28 12:28:57 2013 -0700
@@ -205,14 +205,14 @@
// Queue a pass that will replace Attribute.Placeholders
// with Attribute.Compound (made from synthesized containers).
- ctx.annotateRepeated(new Annotate.Annotator() {
+ ctx.annotateRepeated(new Annotate.Worker() {
@Override
public String toString() {
return "repeated annotation pass of: " + sym + " in: " + sym.owner;
}
@Override
- public void enterAnnotation() {
+ public void run() {
complete(ctx);
}
});
@@ -429,7 +429,7 @@
super(on.type, List.<Pair<Symbol.MethodSymbol, Attribute>>nil(),
ctx.isTypeCompound ?
((Attribute.TypeCompound)placeholderFor.head).position :
- null);
+ new TypeAnnotationPosition());
this.ctx = ctx;
this.placeholderFor = placeholderFor;
this.on = on;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Type.java Mon Oct 28 12:28:57 2013 -0700
@@ -35,7 +35,6 @@
import javax.lang.model.type.*;
import com.sun.tools.javac.code.Symbol.*;
-import com.sun.tools.javac.model.JavacAnnoConstructs;
import com.sun.tools.javac.util.*;
import static com.sun.tools.javac.code.BoundKind.*;
import static com.sun.tools.javac.code.Flags.*;
@@ -70,7 +69,7 @@
*
* @see TypeTag
*/
-public abstract class Type implements TypeMirror {
+public abstract class Type extends AnnoConstruct implements TypeMirror {
/** Constant type: no type at all. */
public static final JCNoType noType = new JCNoType();
@@ -166,6 +165,12 @@
return lb.toList();
}
+ /**For ErrorType, returns the original type, otherwise returns the type itself.
+ */
+ public Type getOriginalType() {
+ return this;
+ }
+
public <R,S> R accept(Type.Visitor<R,S> v, S s) { return v.visitType(this, s); }
/** Define a type given its tag and type symbol
@@ -220,6 +225,10 @@
return this;
}
+ public Type annotatedType(List<Attribute.TypeCompound> annos) {
+ return new AnnotatedType(annos, this);
+ }
+
public boolean isAnnotated() {
return false;
}
@@ -233,15 +242,17 @@
}
@Override
- public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+ public List<Attribute.TypeCompound> getAnnotationMirrors() {
return List.nil();
}
+
@Override
public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
return null;
}
+
@Override
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
@SuppressWarnings("unchecked")
@@ -1811,25 +1822,19 @@
javax.lang.model.type.WildcardType {
/** The type annotations on this type.
*/
- public List<Attribute.TypeCompound> typeAnnotations;
+ private List<Attribute.TypeCompound> typeAnnotations;
/** The underlying type that is annotated.
*/
- public Type underlyingType;
+ private Type underlyingType;
- public AnnotatedType(Type underlyingType) {
- super(underlyingType.tsym);
- this.typeAnnotations = List.nil();
- this.underlyingType = underlyingType;
- Assert.check(!underlyingType.isAnnotated(),
- "Can't annotate already annotated type: " + underlyingType);
- }
-
- public AnnotatedType(List<Attribute.TypeCompound> typeAnnotations,
+ protected AnnotatedType(List<Attribute.TypeCompound> typeAnnotations,
Type underlyingType) {
super(underlyingType.tsym);
this.typeAnnotations = typeAnnotations;
this.underlyingType = underlyingType;
+ Assert.check(typeAnnotations != null && typeAnnotations.nonEmpty(),
+ "Can't create AnnotatedType without annotations: " + underlyingType);
Assert.check(!underlyingType.isAnnotated(),
"Can't annotate already annotated type: " + underlyingType +
"; adding: " + typeAnnotations);
@@ -1846,19 +1851,10 @@
}
@Override
- public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
+ public List<Attribute.TypeCompound> getAnnotationMirrors() {
return typeAnnotations;
}
- @Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
- return JavacAnnoConstructs.getAnnotation(this, annotationType);
- }
-
- @Override
- public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
- return JavacAnnoConstructs.getAnnotationsByType(this, annotationType);
- }
@Override
public TypeKind getKind() {
@@ -1979,10 +1975,8 @@
public TypeMirror getComponentType() { return ((ArrayType)underlyingType).getComponentType(); }
// The result is an ArrayType, but only in the model sense, not the Type sense.
- public AnnotatedType makeVarargs() {
- AnnotatedType atype = new AnnotatedType(((ArrayType)underlyingType).makeVarargs());
- atype.typeAnnotations = this.typeAnnotations;
- return atype;
+ public Type makeVarargs() {
+ return ((ArrayType) underlyingType).makeVarargs().annotatedType(typeAnnotations);
}
@Override
--- a/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/TypeAnnotations.java Mon Oct 28 12:28:57 2013 -0700
@@ -49,7 +49,8 @@
import com.sun.tools.javac.code.Symbol.VarSymbol;
import com.sun.tools.javac.code.Symbol.MethodSymbol;
import com.sun.tools.javac.comp.Annotate;
-import com.sun.tools.javac.comp.Annotate.Annotator;
+import com.sun.tools.javac.comp.Annotate.Worker;
+import com.sun.tools.javac.comp.Attr;
import com.sun.tools.javac.comp.AttrContext;
import com.sun.tools.javac.comp.Env;
import com.sun.tools.javac.tree.JCTree;
@@ -71,6 +72,7 @@
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
/**
* Contains operations specific to processing type annotations.
@@ -94,6 +96,7 @@
final Names names;
final Symtab syms;
final Annotate annotate;
+ final Attr attr;
protected TypeAnnotations(Context context) {
context.put(typeAnnosKey, this);
@@ -101,6 +104,8 @@
log = Log.instance(context);
syms = Symtab.instance(context);
annotate = Annotate.instance(context);
+ attr = Attr.instance(context);
+ Options options = Options.instance(context);
}
/**
@@ -109,13 +114,13 @@
* This version only visits types in signatures and should be
* called from MemberEnter.
* The method takes the Annotate object as parameter and
- * adds an Annotator to the correct Annotate queue for
+ * adds an Annotate.Worker to the correct Annotate queue for
* later processing.
*/
public void organizeTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
- annotate.afterRepeated( new Annotator() {
+ annotate.afterRepeated( new Worker() {
@Override
- public void enterAnnotation() {
+ public void run() {
JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
try {
@@ -127,6 +132,21 @@
} );
}
+ public void validateTypeAnnotationsSignatures(final Env<AttrContext> env, final JCClassDecl tree) {
+ annotate.validate(new Worker() { //validate annotations
+ @Override
+ public void run() {
+ JavaFileObject oldSource = log.useSource(env.toplevel.sourcefile);
+
+ try {
+ attr.validateTypeAnnotations(tree, true);
+ } finally {
+ log.useSource(oldSource);
+ }
+ }
+ } );
+ }
+
/**
* This version only visits types in bodies, that is, field initializers,
* top-level blocks, and method bodies, and should be called from Attr.
@@ -265,13 +285,10 @@
*/
private void separateAnnotationsKinds(JCTree typetree, Type type, Symbol sym,
TypeAnnotationPosition pos) {
- /*
- System.out.printf("separateAnnotationsKinds(typetree: %s, type: %s, symbol: %s, pos: %s%n",
- typetree, type, sym, pos);
- */
List<Attribute.Compound> annotations = sym.getRawAttributes();
ListBuffer<Attribute.Compound> declAnnos = new ListBuffer<Attribute.Compound>();
ListBuffer<Attribute.TypeCompound> typeAnnos = new ListBuffer<Attribute.TypeCompound>();
+ ListBuffer<Attribute.TypeCompound> onlyTypeAnnos = new ListBuffer<Attribute.TypeCompound>();
for (Attribute.Compound a : annotations) {
switch (annotationType(a, sym)) {
@@ -287,6 +304,8 @@
case TYPE: {
Attribute.TypeCompound ta = toTypeCompound(a, pos);
typeAnnos.append(ta);
+ // Also keep track which annotations are only type annotations
+ onlyTypeAnnos.append(ta);
break;
}
}
@@ -310,7 +329,7 @@
}
// type is non-null and annotations are added to that type
- type = typeWithAnnotations(typetree, type, typeAnnotations);
+ type = typeWithAnnotations(typetree, type, typeAnnotations, onlyTypeAnnos.toList());
if (sym.getKind() == ElementKind.METHOD) {
sym.type.asMethodType().restype = type;
@@ -362,32 +381,23 @@
// As a side effect the method sets the type annotation position of "annotations".
// Note that it is assumed that all annotations share the same position.
private Type typeWithAnnotations(final JCTree typetree, final Type type,
- final List<Attribute.TypeCompound> annotations) {
- // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s)%n",
- // typetree, type, annotations);
+ final List<Attribute.TypeCompound> annotations,
+ final List<Attribute.TypeCompound> onlyTypeAnnotations) {
+ // System.out.printf("typeWithAnnotations(typetree: %s, type: %s, annotations: %s, onlyTypeAnnotations: %s)%n",
+ // typetree, type, annotations, onlyTypeAnnotations);
if (annotations.isEmpty()) {
return type;
}
if (type.hasTag(TypeTag.ARRAY)) {
+ Type.ArrayType arType = (Type.ArrayType) type.unannotatedType();
+ Type.ArrayType tomodify = new Type.ArrayType(null, arType.tsym);
Type toreturn;
- Type.ArrayType tomodify;
- Type.ArrayType arType;
- {
- Type touse = type;
- if (type.isAnnotated()) {
- Type.AnnotatedType atype = (Type.AnnotatedType)type;
- toreturn = new Type.AnnotatedType(atype.underlyingType);
- ((Type.AnnotatedType)toreturn).typeAnnotations = atype.typeAnnotations;
- touse = atype.underlyingType;
- arType = (Type.ArrayType) touse;
- tomodify = new Type.ArrayType(null, arType.tsym);
- ((Type.AnnotatedType)toreturn).underlyingType = tomodify;
- } else {
- arType = (Type.ArrayType) touse;
- tomodify = new Type.ArrayType(null, arType.tsym);
- toreturn = tomodify;
- }
+ if (type.isAnnotated()) {
+ toreturn = tomodify.annotatedType(type.getAnnotationMirrors());
+ } else {
+ toreturn = tomodify;
}
+
JCArrayTypeTree arTree = arrayTypeTree(typetree);
ListBuffer<TypePathEntry> depth = new ListBuffer<>();
@@ -395,12 +405,10 @@
while (arType.elemtype.hasTag(TypeTag.ARRAY)) {
if (arType.elemtype.isAnnotated()) {
Type.AnnotatedType aelemtype = (Type.AnnotatedType) arType.elemtype;
- Type.AnnotatedType newAT = new Type.AnnotatedType(aelemtype.underlyingType);
- tomodify.elemtype = newAT;
- newAT.typeAnnotations = aelemtype.typeAnnotations;
- arType = (Type.ArrayType) aelemtype.underlyingType;
+ arType = (Type.ArrayType) aelemtype.unannotatedType();
+ ArrayType prevToMod = tomodify;
tomodify = new Type.ArrayType(null, arType.tsym);
- newAT.underlyingType = tomodify;
+ prevToMod.elemtype = (Type.AnnotatedType) tomodify.annotatedType(arType.elemtype.getAnnotationMirrors());
} else {
arType = (Type.ArrayType) arType.elemtype;
tomodify.elemtype = new Type.ArrayType(null, arType.tsym);
@@ -409,7 +417,7 @@
arTree = arrayTypeTree(arTree.elemtype);
depth = depth.append(TypePathEntry.ARRAY);
}
- Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations);
+ Type arelemType = typeWithAnnotations(arTree.elemtype, arType.elemtype, annotations, onlyTypeAnnotations);
tomodify.elemtype = arelemType;
{
// All annotations share the same position; modify the first one.
@@ -426,7 +434,7 @@
// There is a TypeKind, but no TypeTag.
JCTypeUnion tutree = (JCTypeUnion) typetree;
JCExpression fst = tutree.alternatives.get(0);
- Type res = typeWithAnnotations(fst, fst.type, annotations);
+ Type res = typeWithAnnotations(fst, fst.type, annotations, onlyTypeAnnotations);
fst.type = res;
// TODO: do we want to set res as first element in uct.alternatives?
// UnionClassType uct = (com.sun.tools.javac.code.Type.UnionClassType)type;
@@ -465,14 +473,23 @@
* but nothing more exists.
*/
if (enclTy != null &&
- enclTy.getKind() == TypeKind.NONE &&
- (enclTr.getKind() == JCTree.Kind.IDENTIFIER ||
- enclTr.getKind() == JCTree.Kind.MEMBER_SELECT ||
- enclTr.getKind() == JCTree.Kind.PARAMETERIZED_TYPE ||
- enclTr.getKind() == JCTree.Kind.ANNOTATED_TYPE)) {
- // TODO: also if it's "java. @A lang.Object", that is,
- // if it's on a package?
- log.error(enclTr.pos(), "cant.annotate.nested.type", enclTr.toString());
+ enclTy.hasTag(TypeTag.NONE)) {
+ switch (onlyTypeAnnotations.size()) {
+ case 0:
+ // Don't issue an error if all type annotations are
+ // also declaration annotations.
+ // If the annotations are also declaration annotations, they are
+ // illegal as type annotations but might be legal as declaration annotations.
+ // The normal declaration annotation checks make sure that the use is valid.
+ break;
+ case 1:
+ log.error(typetree.pos(), "cant.type.annotate.scoping.1",
+ onlyTypeAnnotations);
+ break;
+ default:
+ log.error(typetree.pos(), "cant.type.annotate.scoping",
+ onlyTypeAnnotations);
+ }
return type;
}
@@ -551,7 +568,7 @@
// assert that t.constValue() == null?
if (t == stopAt ||
t.getEnclosingType() == Type.noType) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
} else {
ClassType ret = new ClassType(t.getEnclosingType().accept(this, s),
t.typarams_field, t.tsym);
@@ -566,12 +583,12 @@
@Override
public Type visitAnnotatedType(AnnotatedType t, List<TypeCompound> s) {
- return new AnnotatedType(t.typeAnnotations, t.underlyingType.accept(this, s));
+ return t.unannotatedType().accept(this, s).annotatedType(t.getAnnotationMirrors());
}
@Override
public Type visitWildcardType(WildcardType t, List<TypeCompound> s) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
}
@Override
@@ -594,12 +611,12 @@
@Override
public Type visitTypeVar(TypeVar t, List<TypeCompound> s) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
}
@Override
public Type visitCapturedType(CapturedType t, List<TypeCompound> s) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
}
@Override
@@ -616,12 +633,12 @@
@Override
public Type visitErrorType(ErrorType t, List<TypeCompound> s) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
}
@Override
public Type visitType(Type t, List<TypeCompound> s) {
- return new AnnotatedType(s, t);
+ return t.annotatedType(s);
}
};
@@ -1023,9 +1040,7 @@
@Override
public void visitMethodDef(final JCMethodDecl tree) {
if (tree.sym == null) {
- // Something most be wrong, e.g. a class not found.
- // Quietly ignore. (See test FailOver15.java)
- return;
+ Assert.error("Visiting tree node before memberEnter");
}
if (sigOnly) {
if (!tree.mods.annotations.isEmpty()) {
@@ -1129,7 +1144,7 @@
// Nothing to do for separateAnnotationsKinds if
// there are no annotations of either kind.
} else if (tree.sym == null) {
- // Something is wrong already. Quietly ignore.
+ Assert.error("Visiting tree node before memberEnter");
} else if (tree.sym.getKind() == ElementKind.PARAMETER) {
// Parameters are handled in visitMethodDef or visitLambda.
} else if (tree.sym.getKind() == ElementKind.FIELD) {
@@ -1282,9 +1297,9 @@
private void findPosition(JCTree tree, JCTree frame, List<JCAnnotation> annotations) {
if (!annotations.isEmpty()) {
/*
- System.out.println("Finding pos for: " + annotations);
- System.out.println(" tree: " + tree + " kind: " + tree.getKind());
- System.out.println(" frame: " + frame + " kind: " + frame.getKind());
+ System.err.println("Finding pos for: " + annotations);
+ System.err.println(" tree: " + tree + " kind: " + tree.getKind());
+ System.err.println(" frame: " + frame + " kind: " + frame.getKind());
*/
TypeAnnotationPosition p = new TypeAnnotationPosition();
p.onLambda = currentLambda;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java Mon Oct 28 12:28:57 2013 -0700
@@ -1273,7 +1273,7 @@
return false;
if (!s.getAnnotationMirrors().containsAll(t.getAnnotationMirrors()))
return false;
- return visit(t.underlyingType, s);
+ return visit(t.unannotatedType(), s);
}
};
// </editor-fold>
@@ -2217,15 +2217,15 @@
@Override
public Type visitAnnotatedType(AnnotatedType t, Boolean recurse) {
- Type erased = erasure(t.underlyingType, recurse);
+ Type erased = erasure(t.unannotatedType(), recurse);
if (erased.isAnnotated()) {
// This can only happen when the underlying type is a
// type variable and the upper bound of it is annotated.
// The annotation on the type variable overrides the one
// on the bound.
- erased = ((AnnotatedType)erased).underlyingType;
+ erased = ((AnnotatedType)erased).unannotatedType();
}
- return new AnnotatedType(t.typeAnnotations, erased);
+ return erased.annotatedType(t.getAnnotationMirrors());
}
};
@@ -4419,7 +4419,7 @@
public R visitUndetVar(UndetVar t, S s) { return visitType(t, s); }
public R visitErrorType(ErrorType t, S s) { return visitType(t, s); }
// Pretend annotations don't exist
- public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.underlyingType, s); }
+ public R visitAnnotatedType(AnnotatedType t, S s) { return visit(t.unannotatedType(), s); }
}
/**
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java Mon Oct 28 12:28:57 2013 -0700
@@ -37,6 +37,7 @@
import static com.sun.tools.javac.code.TypeTag.ARRAY;
import static com.sun.tools.javac.code.TypeTag.CLASS;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import javax.lang.model.type.ErrorType;
/** Enter annotations on symbols. Annotations accumulate in a queue,
* which is processed at the top level of any set of recursive calls
@@ -87,31 +88,36 @@
private int enterCount = 0;
- ListBuffer<Annotator> q = new ListBuffer<Annotator>();
- ListBuffer<Annotator> typesQ = new ListBuffer<Annotator>();
- ListBuffer<Annotator> repeatedQ = new ListBuffer<Annotator>();
- ListBuffer<Annotator> afterRepeatedQ = new ListBuffer<Annotator>();
+ ListBuffer<Worker> q = new ListBuffer<Worker>();
+ ListBuffer<Worker> typesQ = new ListBuffer<Worker>();
+ ListBuffer<Worker> repeatedQ = new ListBuffer<Worker>();
+ ListBuffer<Worker> afterRepeatedQ = new ListBuffer<Worker>();
+ ListBuffer<Worker> validateQ = new ListBuffer<Worker>();
- public void earlier(Annotator a) {
+ public void earlier(Worker a) {
q.prepend(a);
}
- public void normal(Annotator a) {
+ public void normal(Worker a) {
q.append(a);
}
- public void typeAnnotation(Annotator a) {
+ public void typeAnnotation(Worker a) {
typesQ.append(a);
}
- public void repeated(Annotator a) {
+ public void repeated(Worker a) {
repeatedQ.append(a);
}
- public void afterRepeated(Annotator a) {
+ public void afterRepeated(Worker a) {
afterRepeatedQ.append(a);
}
+ public void validate(Worker a) {
+ validateQ.append(a);
+ }
+
/** Called when the Enter phase starts. */
public void enterStart() {
enterCount++;
@@ -123,34 +129,45 @@
flush();
}
+ /** Variant which allows for a delayed flush of annotations.
+ * Needed by ClassReader */
+ public void enterDoneWithoutFlush() {
+ enterCount--;
+ }
+
public void flush() {
if (enterCount != 0) return;
enterCount++;
try {
while (q.nonEmpty()) {
- q.next().enterAnnotation();
+ q.next().run();
}
while (typesQ.nonEmpty()) {
- typesQ.next().enterAnnotation();
+ typesQ.next().run();
}
while (repeatedQ.nonEmpty()) {
- repeatedQ.next().enterAnnotation();
+ repeatedQ.next().run();
}
while (afterRepeatedQ.nonEmpty()) {
- afterRepeatedQ.next().enterAnnotation();
+ afterRepeatedQ.next().run();
+ }
+ while (validateQ.nonEmpty()) {
+ validateQ.next().run();
}
} finally {
enterCount--;
}
}
- /** A client that has annotations to add registers an annotator,
- * the method it will use to add the annotation. There are no
- * parameters; any needed data should be captured by the
- * Annotator.
+ /** A client that needs to run during {@link #flush()} registers an worker
+ * into one of the queues defined in this class. The queues are: {@link #earlier(Worker)},
+ * {@link #normal(Worker)}, {@link #typeAnnotation(Worker)}, {@link #repeated(Worker)},
+ * {@link #afterRepeated(Worker)}, {@link #validate(Worker)}.
+ * The {@link Worker#run()} method will called inside the {@link #flush()}
+ * call. Queues are empties in the abovementioned order.
*/
- public interface Annotator {
- void enterAnnotation();
+ public interface Worker {
+ void run();
String toString();
}
@@ -195,12 +212,12 @@
}
/**
- * Queue the Annotator a on the repeating annotations queue of the
+ * Queue the Worker a on the repeating annotations queue of the
* Annotate instance this context belongs to.
*
- * @param a the Annotator to enqueue for repeating annotation annotating
+ * @param a the Worker to enqueue for repeating annotation annotating
*/
- public void annotateRepeated(Annotator a) {
+ public void annotateRepeated(Worker a) {
Annotate.this.repeated(a);
}
}
@@ -239,7 +256,8 @@
a.type = chk.checkType(a.annotationType.pos(), at, expected);
if (a.type.isErroneous()) {
if (typeAnnotation) {
- return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(), null);
+ return new Attribute.TypeCompound(a.type, List.<Pair<MethodSymbol,Attribute>>nil(),
+ new TypeAnnotationPosition());
} else {
return new Attribute.Compound(a.type, List.<Pair<MethodSymbol,Attribute>>nil());
}
@@ -310,7 +328,6 @@
Attribute enterAttributeValue(Type expected,
JCExpression tree,
Env<AttrContext> env) {
- Type original = expected;
//first, try completing the attribution value sym - if a completion
//error is thrown, we should recover gracefully, and display an
//ordinary resolution diagnostic.
@@ -351,7 +368,7 @@
l.head,
env);
}
- return new Attribute.Error(original);
+ return new Attribute.Error(syms.errType);
}
if ((expected.tsym.flags() & Flags.ANNOTATION) != 0) {
if (tree.hasTag(ANNOTATION)) {
@@ -365,12 +382,12 @@
if (!expected.isErroneous())
log.error(tree.pos(), "annotation.not.valid.for.type", expected);
enterAnnotation((JCAnnotation)tree, syms.errType, env);
- return new Attribute.Error(original);
+ return new Attribute.Error(((JCAnnotation)tree).annotationType.type);
}
if (expected.isPrimitive() || types.isSameType(expected, syms.stringType)) {
Type result = attr.attribExpr(tree, env, expected);
if (result.isErroneous())
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
if (result.constValue() == null) {
log.error(tree.pos(), "attribute.value.must.be.constant");
return new Attribute.Error(expected);
@@ -381,14 +398,15 @@
if (expected.tsym == syms.classType.tsym) {
Type result = attr.attribExpr(tree, env, expected);
if (result.isErroneous()) {
- // Does it look like a class literal?
- if (TreeInfo.name(tree) == names._class) {
+ // Does it look like an unresolved class literal?
+ if (TreeInfo.name(tree) == names._class &&
+ ((JCFieldAccess) tree).selected.type.isErroneous()) {
Name n = (((JCFieldAccess) tree).selected).type.tsym.flatName();
return new Attribute.UnresolvedClass(expected,
types.createErrorType(n,
syms.unknownSymbol, syms.classType));
} else {
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
}
}
@@ -396,21 +414,21 @@
// at the tree level
if (TreeInfo.name(tree) != names._class) {
log.error(tree.pos(), "annotation.value.must.be.class.literal");
- return new Attribute.Error(expected);
+ return new Attribute.Error(syms.errType);
}
return new Attribute.Class(types,
(((JCFieldAccess) tree).selected).type);
}
if (expected.hasTag(CLASS) &&
(expected.tsym.flags() & Flags.ENUM) != 0) {
- attr.attribExpr(tree, env, expected);
+ Type result = attr.attribExpr(tree, env, expected);
Symbol sym = TreeInfo.symbol(tree);
if (sym == null ||
TreeInfo.nonstaticSelect(tree) ||
sym.kind != Kinds.VAR ||
(sym.flags() & Flags.ENUM) == 0) {
log.error(tree.pos(), "enum.annotation.must.be.enum.constant");
- return new Attribute.Error(expected);
+ return new Attribute.Error(result.getOriginalType());
}
VarSymbol enumerator = (VarSymbol) sym;
return new Attribute.Enum(expected, enumerator);
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Oct 28 12:28:57 2013 -0700
@@ -792,17 +792,19 @@
Type t = tree.type != null ?
tree.type :
attribType(tree, env);
- return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible);
+ return checkBase(t, tree, env, classExpected, interfaceExpected, false, checkExtensible);
}
Type checkBase(Type t,
JCTree tree,
Env<AttrContext> env,
boolean classExpected,
- boolean interfaceOrArrayExpected,
+ boolean interfacesOnlyExpected,
+ boolean interfacesOrArraysExpected,
boolean checkExtensible) {
if (t.isErroneous())
return t;
- if (t.hasTag(TYPEVAR) && !classExpected && !interfaceOrArrayExpected) {
+ if (t.hasTag(TYPEVAR) && !classExpected &&
+ !interfacesOrArraysExpected && !interfacesOnlyExpected) {
// check that type variable is already visible
if (t.getUpperBound() == null) {
log.error(tree.pos(), "illegal.forward.ref");
@@ -814,9 +816,14 @@
t = chk.checkClassOrArrayType(tree.pos(), t,
checkExtensible|!allowGenerics);
}
- if (interfaceOrArrayExpected &&
+ if (interfacesOnlyExpected && !t.tsym.isInterface()) {
+ log.error(tree.pos(), "intf.expected.here");
+ // return errType is necessary since otherwise there might
+ // be undetected cycles which cause attribution to loop
+ return types.createErrorType(t);
+ } else if (interfacesOrArraysExpected &&
!(t.tsym.isInterface() || t.getTag() == ARRAY)) {
- log.error(tree.pos(), "intf.expected.here");
+ log.error(tree.pos(), "intf.or.array.expected.here");
// return errType is necessary since otherwise there might
// be undetected cycles which cause attribution to loop
return types.createErrorType(t);
@@ -958,12 +965,6 @@
chk.validateAnnotationType(tree.restype);
// ensure that annotation method does not clash with members of Object/Annotation
chk.validateAnnotationMethod(tree.pos(), m);
-
- if (tree.defaultValue != null) {
- // if default value is an annotation, check it is a well-formed
- // annotation value (e.g. no duplicate values, no missing values, etc.)
- chk.validateAnnotationTree(tree.defaultValue);
- }
}
for (List<JCExpression> l = tree.thrown; l.nonEmpty(); l = l.tail)
@@ -1025,7 +1026,6 @@
localEnv.info.scope.leave();
result = tree.type = m.type;
- chk.validateAnnotations(tree.mods.annotations, m);
}
finally {
chk.setLint(prevLint);
@@ -1083,7 +1083,6 @@
}
}
result = tree.type = v.type;
- chk.validateAnnotations(tree.mods.annotations, v);
}
finally {
chk.setLint(prevLint);
@@ -3535,15 +3534,6 @@
Type normOuter = site;
if (normOuter.hasTag(CLASS)) {
normOuter = types.asEnclosingSuper(site, ownOuter.tsym);
- if (site.isAnnotated()) {
- // Propagate any type annotations.
- // TODO: should asEnclosingSuper do this?
- // Note that the type annotations in site will be updated
- // by annotateType. Therefore, modify site instead
- // of creating a new AnnotatedType.
- ((AnnotatedType)site).underlyingType = normOuter;
- normOuter = site;
- }
}
if (normOuter == null) // perhaps from an import
normOuter = types.erasure(ownOuter);
@@ -3902,12 +3892,6 @@
}
}
owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
- if (clazztype.isAnnotated()) {
- // Use the same AnnotatedType, because it will have
- // its annotations set later.
- ((AnnotatedType)clazztype).underlyingType = owntype;
- owntype = clazztype;
- }
} else {
if (formals.length() != 0) {
log.error(tree.pos(), "wrong.number.type.args",
@@ -3973,9 +3957,7 @@
TypeVar typeVar = (TypeVar) tree.type;
if (tree.annotations != null && tree.annotations.nonEmpty()) {
- AnnotatedType antype = new AnnotatedType(typeVar);
- annotateType(antype, tree.annotations);
- tree.type = antype;
+ annotateType(tree, tree.annotations);
}
if (!typeVar.bound.isErroneous()) {
@@ -3988,7 +3970,7 @@
Set<Type> boundSet = new HashSet<Type>();
if (bounds.nonEmpty()) {
// accept class or interface or typevar as first bound.
- bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false);
+ bounds.head.type = checkBase(bounds.head.type, bounds.head, env, false, false, false, false);
boundSet.add(types.erasure(bounds.head.type));
if (bounds.head.type.isErroneous()) {
return bounds.head.type;
@@ -4004,7 +3986,7 @@
// if first bound was a class or interface, accept only interfaces
// as further bounds.
for (JCExpression bound : bounds.tail) {
- bound.type = checkBase(bound.type, bound, env, false, true, false);
+ bound.type = checkBase(bound.type, bound, env, false, false, true, false);
if (bound.type.isErroneous()) {
bounds = List.of(bound);
}
@@ -4075,26 +4057,28 @@
public void visitAnnotatedType(JCAnnotatedType tree) {
Type underlyingType = attribType(tree.getUnderlyingType(), env);
this.attribAnnotationTypes(tree.annotations, env);
- AnnotatedType antype = new AnnotatedType(underlyingType);
- annotateType(antype, tree.annotations);
- result = tree.type = antype;
+ annotateType(tree, tree.annotations);
+ result = tree.type = underlyingType;
}
/**
* Apply the annotations to the particular type.
*/
- public void annotateType(final AnnotatedType type, final List<JCAnnotation> annotations) {
- if (annotations.isEmpty())
- return;
- annotate.typeAnnotation(new Annotate.Annotator() {
+ public void annotateType(final JCTree tree, final List<JCAnnotation> annotations) {
+ // Callers ensure this.
+ // Assert.check(annotations != null && annotations.nonEmpty());
+ annotate.typeAnnotation(new Annotate.Worker() {
@Override
public String toString() {
- return "annotate " + annotations + " onto " + type;
+ return "annotate " + annotations + " onto " + tree;
}
@Override
- public void enterAnnotation() {
+ public void run() {
List<Attribute.TypeCompound> compounds = fromAnnotations(annotations);
- type.typeAnnotations = compounds;
+ if (annotations.size() == compounds.size()) {
+ // All annotations were successfully converted into compounds
+ tree.type = tree.type.unannotatedType().annotatedType(compounds);
+ }
}
});
}
@@ -4148,7 +4132,6 @@
JCCompilationUnit toplevel = env.toplevel;
try {
annotate.flush();
- chk.validateAnnotations(toplevel.packageAnnotations, toplevel.packge);
} catch (CompletionFailure ex) {
chk.completionError(toplevel.pos(), ex);
}
@@ -4233,6 +4216,7 @@
chk.checkDeprecatedAnnotation(env.tree.pos(), c);
chk.checkClassOverrideEqualsAndHashIfNeeded(env.tree.pos(), c);
+ chk.checkFunctionalInterface((JCClassDecl) env.tree, c);
} finally {
env.info.returnResult = prevReturnRes;
log.useSource(prev);
@@ -4251,9 +4235,6 @@
JCClassDecl tree = (JCClassDecl)env.tree;
Assert.check(c == tree.sym);
- // Validate annotations
- chk.validateAnnotations(tree.mods.annotations, c);
-
// Validate type parameters, supertype and interfaces.
attribStats(tree.typarams, env);
if (!c.isAnonymous()) {
@@ -4354,7 +4335,7 @@
typeAnnotations.organizeTypeAnnotationsBodies(tree);
// Check type annotations applicability rules
- validateTypeAnnotations(tree);
+ validateTypeAnnotations(tree, false);
}
}
// where
@@ -4429,19 +4410,25 @@
return types.capture(type);
}
- private void validateTypeAnnotations(JCTree tree) {
- tree.accept(typeAnnotationsValidator);
+ public void validateTypeAnnotations(JCTree tree, boolean sigOnly) {
+ tree.accept(new TypeAnnotationsValidator(sigOnly));
}
//where
- private final JCTree.Visitor typeAnnotationsValidator = new TreeScanner() {
-
- private boolean checkAllAnnotations = false;
+ private final class TypeAnnotationsValidator extends TreeScanner {
+
+ private final boolean sigOnly;
+ public TypeAnnotationsValidator(boolean sigOnly) {
+ this.sigOnly = sigOnly;
+ }
public void visitAnnotation(JCAnnotation tree) {
- if (tree.hasTag(TYPE_ANNOTATION) || checkAllAnnotations) {
- chk.validateTypeAnnotation(tree, false);
+ chk.validateTypeAnnotation(tree, false);
+ super.visitAnnotation(tree);
+ }
+ public void visitAnnotatedType(JCAnnotatedType tree) {
+ if (!tree.underlyingType.type.isErroneous()) {
+ super.visitAnnotatedType(tree);
}
- super.visitAnnotation(tree);
}
public void visitTypeParameter(JCTypeParameter tree) {
chk.validateTypeAnnotations(tree.annotations, true);
@@ -4460,12 +4447,26 @@
if (tree.restype != null && tree.restype.type != null) {
validateAnnotatedType(tree.restype, tree.restype.type);
}
- super.visitMethodDef(tree);
+ if (sigOnly) {
+ scan(tree.mods);
+ scan(tree.restype);
+ scan(tree.typarams);
+ scan(tree.recvparam);
+ scan(tree.params);
+ scan(tree.thrown);
+ } else {
+ scan(tree.defaultValue);
+ scan(tree.body);
+ }
}
public void visitVarDef(final JCVariableDecl tree) {
if (tree.sym != null && tree.sym.type != null)
- validateAnnotatedType(tree, tree.sym.type);
- super.visitVarDef(tree);
+ validateAnnotatedType(tree.vartype, tree.sym.type);
+ scan(tree.mods);
+ scan(tree.vartype);
+ if (!sigOnly) {
+ scan(tree.init);
+ }
}
public void visitTypeCast(JCTypeCast tree) {
if (tree.clazz != null && tree.clazz.type != null)
@@ -4478,28 +4479,37 @@
super.visitTypeTest(tree);
}
public void visitNewClass(JCNewClass tree) {
- if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
- boolean prevCheck = this.checkAllAnnotations;
- try {
- this.checkAllAnnotations = true;
- scan(((JCAnnotatedType)tree.clazz).annotations);
- } finally {
- this.checkAllAnnotations = prevCheck;
- }
- }
+ if (tree.clazz.type != null)
+ validateAnnotatedType(tree.clazz, tree.clazz.type);
super.visitNewClass(tree);
}
public void visitNewArray(JCNewArray tree) {
- if (tree.elemtype != null && tree.elemtype.hasTag(ANNOTATED_TYPE)) {
- boolean prevCheck = this.checkAllAnnotations;
- try {
- this.checkAllAnnotations = true;
- scan(((JCAnnotatedType)tree.elemtype).annotations);
- } finally {
- this.checkAllAnnotations = prevCheck;
+ if (tree.elemtype != null && tree.elemtype.type != null)
+ validateAnnotatedType(tree.elemtype, tree.elemtype.type);
+ super.visitNewArray(tree);
+ }
+
+ @Override
+ public void visitClassDef(JCClassDecl tree) {
+ if (sigOnly) {
+ scan(tree.mods);
+ scan(tree.typarams);
+ scan(tree.extending);
+ scan(tree.implementing);
+ }
+ for (JCTree member : tree.defs) {
+ if (member.hasTag(Tag.CLASSDEF)) {
+ continue;
}
+ scan(member);
}
- super.visitNewArray(tree);
+ }
+
+ @Override
+ public void visitBlock(JCBlock tree) {
+ if (!sigOnly) {
+ scan(tree.stats);
+ }
}
/* I would want to model this after
@@ -4511,21 +4521,95 @@
* can occur.
*/
private void validateAnnotatedType(final JCTree errtree, final Type type) {
- if (type.getEnclosingType() != null &&
- type != type.getEnclosingType()) {
- validateEnclosingAnnotatedType(errtree, type.getEnclosingType());
- }
- for (Type targ : type.getTypeArguments()) {
- validateAnnotatedType(errtree, targ);
+ // System.out.println("Attr.validateAnnotatedType: " + errtree + " type: " + type);
+
+ if (type.isPrimitiveOrVoid()) {
+ return;
}
- }
- private void validateEnclosingAnnotatedType(final JCTree errtree, final Type type) {
- validateAnnotatedType(errtree, type);
- if (type.tsym != null &&
- type.tsym.isStatic() &&
- type.getAnnotationMirrors().nonEmpty()) {
- // Enclosing static classes cannot have type annotations.
- log.error(errtree.pos(), "cant.annotate.static.class");
+
+ JCTree enclTr = errtree;
+ Type enclTy = type;
+
+ boolean repeat = true;
+ while (repeat) {
+ if (enclTr.hasTag(TYPEAPPLY)) {
+ List<Type> tyargs = enclTy.getTypeArguments();
+ List<JCExpression> trargs = ((JCTypeApply)enclTr).getTypeArguments();
+ if (trargs.length() > 0) {
+ // Nothing to do for diamonds
+ if (tyargs.length() == trargs.length()) {
+ for (int i = 0; i < tyargs.length(); ++i) {
+ validateAnnotatedType(trargs.get(i), tyargs.get(i));
+ }
+ }
+ // If the lengths don't match, it's either a diamond
+ // or some nested type that redundantly provides
+ // type arguments in the tree.
+ }
+
+ // Look at the clazz part of a generic type
+ enclTr = ((JCTree.JCTypeApply)enclTr).clazz;
+ }
+
+ if (enclTr.hasTag(SELECT)) {
+ enclTr = ((JCTree.JCFieldAccess)enclTr).getExpression();
+ if (enclTy != null &&
+ !enclTy.hasTag(NONE)) {
+ enclTy = enclTy.getEnclosingType();
+ }
+ } else if (enclTr.hasTag(ANNOTATED_TYPE)) {
+ JCAnnotatedType at = (JCTree.JCAnnotatedType) enclTr;
+ if (enclTy == null ||
+ enclTy.hasTag(NONE)) {
+ if (at.getAnnotations().size() == 1) {
+ log.error(at.underlyingType.pos(), "cant.type.annotate.scoping.1", at.getAnnotations().head.attribute);
+ } else {
+ ListBuffer<Attribute.Compound> comps = new ListBuffer<Attribute.Compound>();
+ for (JCAnnotation an : at.getAnnotations()) {
+ comps.add(an.attribute);
+ }
+ log.error(at.underlyingType.pos(), "cant.type.annotate.scoping", comps.toList());
+ }
+ repeat = false;
+ }
+ enclTr = at.underlyingType;
+ // enclTy doesn't need to be changed
+ } else if (enclTr.hasTag(IDENT)) {
+ repeat = false;
+ } else if (enclTr.hasTag(JCTree.Tag.WILDCARD)) {
+ JCWildcard wc = (JCWildcard) enclTr;
+ if (wc.getKind() == JCTree.Kind.EXTENDS_WILDCARD) {
+ validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getExtendsBound());
+ } else if (wc.getKind() == JCTree.Kind.SUPER_WILDCARD) {
+ validateAnnotatedType(wc.getBound(), ((WildcardType)enclTy.unannotatedType()).getSuperBound());
+ } else {
+ // Nothing to do for UNBOUND
+ }
+ repeat = false;
+ } else if (enclTr.hasTag(TYPEARRAY)) {
+ JCArrayTypeTree art = (JCArrayTypeTree) enclTr;
+ validateAnnotatedType(art.getType(), ((ArrayType)enclTy.unannotatedType()).getComponentType());
+ repeat = false;
+ } else if (enclTr.hasTag(TYPEUNION)) {
+ JCTypeUnion ut = (JCTypeUnion) enclTr;
+ for (JCTree t : ut.getTypeAlternatives()) {
+ validateAnnotatedType(t, t.type);
+ }
+ repeat = false;
+ } else if (enclTr.hasTag(TYPEINTERSECTION)) {
+ JCTypeIntersection it = (JCTypeIntersection) enclTr;
+ for (JCTree t : it.getBounds()) {
+ validateAnnotatedType(t, t.type);
+ }
+ repeat = false;
+ } else if (enclTr.getKind() == JCTree.Kind.PRIMITIVE_TYPE) {
+ // This happens in test TargetTypeTest52.java
+ // Is there anything to do?
+ repeat = false;
+ } else {
+ Assert.error("Unexpected tree: " + enclTr + " with kind: " + enclTr.getKind() +
+ " within: "+ errtree + " with kind: " + errtree.getKind());
+ }
}
}
};
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Mon Oct 28 12:28:57 2013 -0700
@@ -30,6 +30,7 @@
import javax.tools.JavaFileManager;
import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Attribute.Compound;
import com.sun.tools.javac.jvm.*;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.util.*;
@@ -1951,7 +1952,7 @@
* for errors.
* @param m The overriding method.
*/
- void checkOverride(JCTree tree, MethodSymbol m) {
+ void checkOverride(JCMethodDecl tree, MethodSymbol m) {
ClassSymbol origin = (ClassSymbol)m.owner;
if ((origin.flags() & ENUM) != 0 && names.finalize.equals(m.name))
if (m.overrides(syms.enumFinalFinalize, origin, types, false)) {
@@ -1967,6 +1968,17 @@
checkOverride(tree, t2, origin, m);
}
}
+
+ if (m.attribute(syms.overrideType.tsym) != null && !isOverrider(m)) {
+ DiagnosticPosition pos = tree.pos();
+ for (JCAnnotation a : tree.getModifiers().annotations) {
+ if (a.annotationType.type.tsym == syms.overrideType.tsym) {
+ pos = a.pos();
+ break;
+ }
+ }
+ log.error(pos, "method.does.not.override.superclass");
+ }
}
void checkOverride(JCTree tree, Type site, ClassSymbol origin, MethodSymbol m) {
@@ -2387,13 +2399,28 @@
ClashFilter cf = new ClashFilter(site);
//for each method m1 that is overridden (directly or indirectly)
//by method 'sym' in 'site'...
+
+ List<MethodSymbol> potentiallyAmbiguousList = List.nil();
+ boolean overridesAny = false;
for (Symbol m1 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
- if (!sym.overrides(m1, site.tsym, types, false)) {
- checkPotentiallyAmbiguousOverloads(pos, site, sym, (MethodSymbol)m1);
- continue;
- }
- //...check each method m2 that is a member of 'site'
- for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
+ if (!sym.overrides(m1, site.tsym, types, false)) {
+ if (m1 == sym) {
+ continue;
+ }
+
+ if (!overridesAny) {
+ potentiallyAmbiguousList = potentiallyAmbiguousList.prepend((MethodSymbol)m1);
+ }
+ continue;
+ }
+
+ if (m1 != sym) {
+ overridesAny = true;
+ potentiallyAmbiguousList = List.nil();
+ }
+
+ //...check each method m2 that is a member of 'site'
+ for (Symbol m2 : types.membersClosure(site, false).getElementsByName(sym.name, cf)) {
if (m2 == m1) continue;
//if (i) the signature of 'sym' is not a subsignature of m1 (seen as
//a member of 'site') and (ii) m1 has the same erasure as m2, issue an error
@@ -2412,10 +2439,14 @@
}
}
}
+
+ if (!overridesAny) {
+ for (MethodSymbol m: potentiallyAmbiguousList) {
+ checkPotentiallyAmbiguousOverloads(pos, site, sym, m);
+ }
+ }
}
-
-
/** Check that all static methods accessible from 'site' are
* mutually compatible (JLS 8.4.8).
*
@@ -2725,20 +2756,11 @@
if (!annotationApplicable(a, s))
log.error(a.pos(), "annotation.type.not.applicable");
- if (a.annotationType.type.tsym == syms.overrideType.tsym) {
- if (!isOverrider(s))
- log.error(a.pos(), "method.does.not.override.superclass");
- }
-
if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
if (s.kind != TYP) {
log.error(a.pos(), "bad.functional.intf.anno");
- } else {
- try {
- types.findDescriptorSymbol((TypeSymbol)s);
- } catch (Types.FunctionDescriptorLookupError ex) {
- log.error(a.pos(), "bad.functional.intf.anno.1", ex.getDiagnostic());
- }
+ } else if (!s.isInterface() || (s.flags() & ANNOTATION) != 0) {
+ log.error(a.pos(), "bad.functional.intf.anno.1", diags.fragment("not.a.functional.intf", s));
}
}
}
@@ -2747,8 +2769,11 @@
Assert.checkNonNull(a.type, "annotation tree hasn't been attributed yet: " + a);
validateAnnotationTree(a);
- if (!isTypeAnnotation(a, isTypeParameter))
+ if (a.hasTag(TYPE_ANNOTATION) &&
+ !a.annotationType.type.isErroneous() &&
+ !isTypeAnnotation(a, isTypeParameter)) {
log.error(a.pos(), "annotation.type.not.applicable");
+ }
}
/**
@@ -2953,7 +2978,7 @@
return false;
}
- /** Is the annotation applicable to type annotations? */
+ /** Is the annotation applicable to types? */
protected boolean isTypeAnnotation(JCAnnotation a, boolean isTypeParameter) {
Attribute.Compound atTarget =
a.annotationType.type.tsym.attribute(syms.annotationTargetType.tsym);
@@ -3420,15 +3445,14 @@
sym.name != names.error &&
(!staticImport || !e.isStaticallyImported())) {
if (!e.sym.type.isErroneous()) {
- String what = e.sym.toString();
if (!isClassDecl) {
if (staticImport)
- log.error(pos, "already.defined.static.single.import", what);
+ log.error(pos, "already.defined.static.single.import", e.sym);
else
- log.error(pos, "already.defined.single.import", what);
+ log.error(pos, "already.defined.single.import", e.sym);
}
else if (sym != e.sym)
- log.error(pos, "already.defined.this.unit", what);
+ log.error(pos, "already.defined.this.unit", e.sym);
}
return false;
}
@@ -3508,4 +3532,23 @@
public Warner convertWarner(DiagnosticPosition pos, Type found, Type expected) {
return new ConversionWarner(pos, "unchecked.assign", found, expected);
}
+
+ public void checkFunctionalInterface(JCClassDecl tree, ClassSymbol cs) {
+ Compound functionalType = cs.attribute(syms.functionalInterfaceType.tsym);
+
+ if (functionalType != null) {
+ try {
+ types.findDescriptorSymbol((TypeSymbol)cs);
+ } catch (Types.FunctionDescriptorLookupError ex) {
+ DiagnosticPosition pos = tree.pos();
+ for (JCAnnotation a : tree.getModifiers().annotations) {
+ if (a.annotationType.type.tsym == syms.functionalInterfaceType.tsym) {
+ pos = a.pos();
+ break;
+ }
+ }
+ log.error(pos, "bad.functional.intf.anno.1", ex.getDiagnostic());
+ }
+ }
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Oct 28 12:28:57 2013 -0700
@@ -128,10 +128,9 @@
private KlassInfo(Symbol kSym) {
appendedMethodList = new ListBuffer<>();
deserializeCases = new HashMap<String, ListBuffer<JCStatement>>();
- long flags = PRIVATE | STATIC | SYNTHETIC;
MethodType type = new MethodType(List.of(syms.serializedLambdaType), syms.objectType,
List.<Type>nil(), syms.methodClass);
- deserMethodSym = makeSyntheticMethod(flags, names.deserializeLambda, type, kSym);
+ deserMethodSym = makePrivateSyntheticMethod(STATIC, names.deserializeLambda, type, kSym);
deserParamSym = new VarSymbol(FINAL, names.fromString("lambda"),
syms.serializedLambdaType, deserMethodSym);
}
@@ -671,8 +670,8 @@
/**
* Create new synthetic method with given flags, name, type, owner
*/
- private MethodSymbol makeSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
- return new MethodSymbol(flags | SYNTHETIC, name, type, owner);
+ private MethodSymbol makePrivateSyntheticMethod(long flags, Name name, Type type, Symbol owner) {
+ return new MethodSymbol(flags | SYNTHETIC | PRIVATE, name, type, owner);
}
/**
@@ -1067,12 +1066,12 @@
} else {
if (refSym.isStatic()) {
return ClassFile.REF_invokeStatic;
+ } else if ((refSym.flags() & PRIVATE) != 0) {
+ return ClassFile.REF_invokeSpecial;
} else if (refSym.enclClass().isInterface()) {
return ClassFile.REF_invokeInterface;
} else {
- return (refSym.flags() & PRIVATE) != 0 ?
- ClassFile.REF_invokeSpecial :
- ClassFile.REF_invokeVirtual;
+ return ClassFile.REF_invokeVirtual;
}
}
}
@@ -1480,7 +1479,7 @@
//static clinits are generated in Gen - so we need to fake them
Symbol clinit = clinits.get(csym);
if (clinit == null) {
- clinit = makeSyntheticMethod(STATIC,
+ clinit = makePrivateSyntheticMethod(STATIC,
names.clinit,
new MethodType(List.<Type>nil(), syms.voidType, List.<Type>nil(), syms.methodClass),
csym);
@@ -1729,7 +1728,7 @@
self = ((JCVariableDecl)frame.tree).sym;
}
Name name = isSerializable() ? serializedLambdaName(owner) : lambdaName();
- this.translatedSym = makeSyntheticMethod(0, name, null, owner.enclClass());
+ this.translatedSym = makePrivateSyntheticMethod(0, name, null, owner.enclClass());
if (dumpLambdaToMethodStats) {
log.note(tree, "lambda.stat", needsAltMetafactory(), translatedSym);
}
@@ -1845,9 +1844,9 @@
// If instance access isn't needed, make it static.
// Interface instance methods must be default methods.
- // Awaiting VM channges, default methods are public
+ // Lambda methods are private synthetic.
translatedSym.flags_field = SYNTHETIC |
- ((inInterface && thisReferenced)? PUBLIC : PRIVATE) |
+ PRIVATE |
(thisReferenced? (inInterface? DEFAULT : 0) : STATIC);
//compute synthetic params
@@ -1890,7 +1889,7 @@
super(tree);
this.isSuper = tree.hasKind(ReferenceKind.SUPER);
this.bridgeSym = needsBridge()
- ? makeSyntheticMethod(isSuper ? 0 : STATIC,
+ ? makePrivateSyntheticMethod(isSuper ? 0 : STATIC,
lambdaName().append(names.fromString("$bridge")), null,
owner.enclClass())
: null;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Oct 28 12:28:57 2013 -0700
@@ -2172,6 +2172,18 @@
* Code for enabling/disabling assertions.
*************************************************************************/
+ private ClassSymbol assertionsDisabledClassCache;
+
+ /**Used to create an auxiliary class to hold $assertionsDisabled for interfaces.
+ */
+ private ClassSymbol assertionsDisabledClass() {
+ if (assertionsDisabledClassCache != null) return assertionsDisabledClassCache;
+
+ assertionsDisabledClassCache = makeEmptyClass(STATIC | SYNTHETIC, outermostClassDef.sym).sym;
+
+ return assertionsDisabledClassCache;
+ }
+
// This code is not particularly robust if the user has
// previously declared a member named '$assertionsDisabled'.
// The same faulty idiom also appears in the translation of
@@ -2182,8 +2194,9 @@
// Outermost class may be either true class or an interface.
ClassSymbol outermostClass = outermostClassDef.sym;
- // note that this is a class, as an interface can't contain a statement.
- ClassSymbol container = currentClass;
+ //only classes can hold a non-public field, look for a usable one:
+ ClassSymbol container = !currentClass.isInterface() ? currentClass :
+ assertionsDisabledClass();
VarSymbol assertDisabledSym =
(VarSymbol)lookupSynthetic(dollarAssertionsDisabled,
@@ -2208,6 +2221,16 @@
JCVariableDecl assertDisabledDef = make.VarDef(assertDisabledSym,
notStatus);
containerDef.defs = containerDef.defs.prepend(assertDisabledDef);
+
+ if (currentClass.isInterface()) {
+ //need to load the assertions enabled/disabled state while
+ //initializing the interface:
+ JCClassDecl currentClassDef = classDef(currentClass);
+ make_at(currentClassDef.pos());
+ JCStatement dummy = make.If(make.QualIdent(assertDisabledSym), make.Skip(), null);
+ JCBlock clinit = make.Block(STATIC, List.<JCStatement>of(dummy));
+ currentClassDef.defs = currentClassDef.defs.prepend(clinit);
+ }
}
make_at(pos);
return makeUnary(NOT, make.Ident(assertDisabledSym));
@@ -2811,20 +2834,9 @@
tree.underlyingType = translate(tree.underlyingType);
// but maintain type annotations in the type.
if (tree.type.isAnnotated()) {
- if (tree.underlyingType.type.isAnnotated()) {
- // The erasure of a type variable might be annotated.
- // Merge all annotations.
- AnnotatedType newat = (AnnotatedType) tree.underlyingType.type;
- AnnotatedType at = (AnnotatedType) tree.type;
- at.underlyingType = newat.underlyingType;
- newat.typeAnnotations = at.typeAnnotations.appendList(newat.typeAnnotations);
- tree.type = newat;
- } else {
- // Create a new AnnotatedType to have the correct tag.
- AnnotatedType oldat = (AnnotatedType) tree.type;
- tree.type = new AnnotatedType(tree.underlyingType.type);
- ((AnnotatedType) tree.type).typeAnnotations = oldat.typeAnnotations;
- }
+ tree.type = tree.underlyingType.type.unannotatedType().annotatedType(tree.type.getAnnotationMirrors());
+ } else if (tree.underlyingType.type.isAnnotated()) {
+ tree.type = tree.underlyingType.type;
}
result = tree;
}
@@ -3929,6 +3941,7 @@
accessConstrTags = null;
accessed = null;
enumSwitchMap.clear();
+ assertionsDisabledClassCache = null;
}
return translated.toList();
}
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java Mon Oct 28 12:28:57 2013 -0700
@@ -114,12 +114,15 @@
deferredLintHandler = DeferredLintHandler.instance(context);
lint = Lint.instance(context);
allowTypeAnnos = source.allowTypeAnnotations();
+ allowRepeatedAnnos = source.allowRepeatedAnnotations();
}
/** Switch: support type annotations.
*/
boolean allowTypeAnnos;
+ boolean allowRepeatedAnnos;
+
/** A queue for classes whose members still need to be entered into the
* symbol table.
*/
@@ -199,7 +202,7 @@
}.importFrom(tsym);
// enter non-types before annotations that might use them
- annotate.earlier(new Annotate.Annotator() {
+ annotate.earlier(new Annotate.Worker() {
Set<Symbol> processed = new HashSet<Symbol>();
public String toString() {
@@ -225,7 +228,7 @@
}
}
}
- public void enterAnnotation() {
+ public void run() {
importFrom(tsym);
}
});
@@ -293,7 +296,7 @@
}.importFrom(tsym);
// enter non-types before annotations that might use them
- annotate.earlier(new Annotate.Annotator() {
+ annotate.earlier(new Annotate.Worker() {
Set<Symbol> processed = new HashSet<Symbol>();
boolean found = false;
@@ -323,7 +326,7 @@
}
}
}
- public void enterAnnotation() {
+ public void run() {
JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
try {
importFrom(tsym);
@@ -640,9 +643,6 @@
if (TreeInfo.isEnumInit(tree)) {
attr.attribIdentAsEnumType(localEnv, (JCIdent)tree.vartype);
} else {
- // Make sure type annotations are processed.
- // But we don't have a symbol to attach them to yet - use null.
- typeAnnotate(tree.vartype, env, null, tree.pos());
attr.attribType(tree.vartype, localEnv);
if (tree.nameexpr != null) {
attr.attribExpr(tree.nameexpr, localEnv);
@@ -693,7 +693,6 @@
}
annotateLater(tree.mods.annotations, localEnv, v, tree.pos());
typeAnnotate(tree.vartype, env, v, tree.pos());
- annotate.flush();
v.pos = tree.pos;
}
// where
@@ -842,14 +841,14 @@
if (s.kind != PCK) {
s.resetAnnotations(); // mark Annotations as incomplete for now
}
- annotate.normal(new Annotate.Annotator() {
+ annotate.normal(new Annotate.Worker() {
@Override
public String toString() {
return "annotate " + annotations + " onto " + s + " in " + s.owner;
}
@Override
- public void enterAnnotation() {
+ public void run() {
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
@@ -872,6 +871,18 @@
}
}
});
+
+ annotate.validate(new Annotate.Worker() { //validate annotations
+ @Override
+ public void run() {
+ JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+ try {
+ chk.validateAnnotations(annotations, s);
+ } finally {
+ log.useSource(prev);
+ }
+ }
+ });
}
/**
@@ -906,14 +917,14 @@
}
if (annotated.containsKey(a.type.tsym)) {
- if (source.allowRepeatedAnnotations()) {
- ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
- l = l.append(c);
- annotated.put(a.type.tsym, l);
- pos.put(c, a.pos());
- } else {
- log.error(a.pos(), "duplicate.annotation");
+ if (!allowRepeatedAnnos) {
+ log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
+ allowRepeatedAnnos = true;
}
+ ListBuffer<Attribute.Compound> l = annotated.get(a.type.tsym);
+ l = l.append(c);
+ annotated.put(a.type.tsym, l);
+ pos.put(c, a.pos());
} else {
annotated.put(a.type.tsym, ListBuffer.of(c));
pos.put(c, a.pos());
@@ -935,7 +946,7 @@
void annotateDefaultValueLater(final JCExpression defaultValue,
final Env<AttrContext> localEnv,
final MethodSymbol m) {
- annotate.normal(new Annotate.Annotator() {
+ annotate.normal(new Annotate.Worker() {
@Override
public String toString() {
return "annotate " + m.owner + "." +
@@ -943,7 +954,7 @@
}
@Override
- public void enterAnnotation() {
+ public void run() {
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
enterDefaultValue(defaultValue, localEnv, m);
@@ -952,6 +963,19 @@
}
}
});
+ annotate.validate(new Annotate.Worker() { //validate annotations
+ @Override
+ public void run() {
+ JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
+ try {
+ // if default value is an annotation, check it is a well-formed
+ // annotation value (e.g. no duplicate values, no missing values, etc.)
+ chk.validateAnnotationTree(defaultValue);
+ } finally {
+ log.useSource(prev);
+ }
+ }
+ });
}
/** Enter a default value for an attribute method. */
@@ -1081,7 +1105,6 @@
// Do this here, where we have the symbol.
for (JCTypeParameter tp : tree.typarams)
typeAnnotate(tp, baseEnv, sym, tree.pos());
- annotate.flush();
// Add default constructor if needed.
if ((c.flags() & INTERFACE) == 0 &&
@@ -1159,15 +1182,17 @@
if (wasFirst) {
try {
while (halfcompleted.nonEmpty()) {
- finish(halfcompleted.next());
+ Env<AttrContext> toFinish = halfcompleted.next();
+ finish(toFinish);
+ if (allowTypeAnnos) {
+ typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
+ typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
+ }
}
} finally {
isFirst = true;
}
}
- if (allowTypeAnnos) {
- typeAnnotations.organizeTypeAnnotationsSignatures(env, tree);
- }
}
/*
@@ -1197,7 +1222,7 @@
annotated.put(a.type.tsym, l);
pos.put(tc, a.pos());
} else {
- log.error(a.pos(), "duplicate.annotation");
+ log.error(a.pos(), "repeatable.annotations.not.supported.in.source");
}
} else {
annotated.put(a.type.tsym, ListBuffer.of(tc));
@@ -1239,13 +1264,13 @@
final DiagnosticPosition deferPos = this.deferPos;
- annotate.normal(new Annotate.Annotator() {
+ annotate.normal(new Annotate.Worker() {
@Override
public String toString() {
return "type annotate " + annotations + " onto " + sym + " in " + sym.owner;
}
@Override
- public void enterAnnotation() {
+ public void run() {
JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
DiagnosticPosition prevLintPos = null;
@@ -1381,7 +1406,7 @@
if (!t.hasTag(ERROR))
return t;
- return new ErrorType(((ErrorType) t).getOriginalType(), t.tsym) {
+ return new ErrorType(t.getOriginalType(), t.tsym) {
private Type modelType;
@Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Oct 28 12:28:57 2013 -0700
@@ -424,13 +424,14 @@
*/
private
boolean isProtectedAccessible(Symbol sym, ClassSymbol c, Type site) {
+ Type newSite = site.hasTag(TYPEVAR) ? site.getUpperBound() : site;
while (c != null &&
!(c.isSubClass(sym.owner, types) &&
(c.flags() & INTERFACE) == 0 &&
// In JLS 2e 6.6.2.1, the subclass restriction applies
// only to instance fields and methods -- types are excluded
// regardless of whether they are declared 'static' or not.
- ((sym.flags() & STATIC) != 0 || sym.kind == TYP || site.tsym.isSubClass(c, types))))
+ ((sym.flags() & STATIC) != 0 || sym.kind == TYP || newSite.tsym.isSubClass(c, types))))
c = c.owner.enclClass();
return c != null;
}
@@ -2710,11 +2711,6 @@
InferenceContext inferenceContext) {
MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
- if (site.hasTag(TYPEVAR)) {
- return resolveMemberReference(pos, env, referenceTree, site.getUpperBound(),
- name, argtypes, typeargtypes, boxingAllowed, methodCheck, inferenceContext);
- }
-
site = types.capture(site);
ReferenceLookupHelper boundLookupHelper;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Oct 28 12:28:57 2013 -0700
@@ -1877,7 +1877,7 @@
}
}
- class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Annotator {
+ class AnnotationDefaultCompleter extends AnnotationDeproxy implements Annotate.Worker {
final MethodSymbol sym;
final Attribute value;
final JavaFileObject classFile = currentClassFile;
@@ -1889,8 +1889,8 @@
this.sym = sym;
this.value = value;
}
- // implement Annotate.Annotator.enterAnnotation()
- public void enterAnnotation() {
+ // implement Annotate.Worker.run()
+ public void run() {
JavaFileObject previousClassFile = currentClassFile;
try {
// Reset the interim value set earlier in
@@ -1904,7 +1904,7 @@
}
}
- class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Annotator {
+ class AnnotationCompleter extends AnnotationDeproxy implements Annotate.Worker {
final Symbol sym;
final List<CompoundAnnotationProxy> l;
final JavaFileObject classFile;
@@ -1917,8 +1917,8 @@
this.l = l;
this.classFile = currentClassFile;
}
- // implement Annotate.Annotator.enterAnnotation()
- public void enterAnnotation() {
+ // implement Annotate.Worker.run()
+ public void run() {
JavaFileObject previousClassFile = currentClassFile;
try {
currentClassFile = classFile;
@@ -1955,7 +1955,7 @@
}
@Override
- public void enterAnnotation() {
+ public void run() {
JavaFileObject previousClassFile = currentClassFile;
try {
currentClassFile = classFile;
@@ -1993,11 +1993,15 @@
(flags & ABSTRACT) == 0 && !name.equals(names.clinit)) {
if (majorVersion > Target.JDK1_8.majorVersion ||
(majorVersion == Target.JDK1_8.majorVersion && minorVersion >= Target.JDK1_8.minorVersion)) {
- currentOwner.flags_field |= DEFAULT;
- flags |= DEFAULT | ABSTRACT;
+ if ((flags & STATIC) == 0) {
+ currentOwner.flags_field |= DEFAULT;
+ flags |= DEFAULT | ABSTRACT;
+ }
} else {
//protect against ill-formed classfiles
- throw new CompletionFailure(currentOwner, "default method found in pre JDK 8 classfile");
+ throw badClassFile((flags & STATIC) == 0 ? "invalid.default.interface" : "invalid.static.interface",
+ Integer.toString(majorVersion),
+ Integer.toString(minorVersion));
}
}
if (name == names.init && currentOwner.hasOuterInstance()) {
@@ -2401,8 +2405,6 @@
return c;
}
- private boolean suppressFlush = false;
-
/** Completion for classes to be loaded. Before a class is loaded
* we make sure its enclosing class (if any) is loaded.
*/
@@ -2410,13 +2412,14 @@
if (sym.kind == TYP) {
ClassSymbol c = (ClassSymbol)sym;
c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
- boolean saveSuppressFlush = suppressFlush;
- suppressFlush = true;
+ annotate.enterStart();
try {
completeOwners(c.owner);
completeEnclosing(c);
} finally {
- suppressFlush = saveSuppressFlush;
+ // The flush needs to happen only after annotations
+ // are filled in.
+ annotate.enterDoneWithoutFlush();
}
fillIn(c);
} else if (sym.kind == PCK) {
@@ -2427,7 +2430,7 @@
throw new CompletionFailure(sym, ex.getLocalizedMessage()).initCause(ex);
}
}
- if (!filling && !suppressFlush)
+ if (!filling)
annotate.flush(); // finish attaching annotations
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Mon Oct 28 12:28:57 2013 -0700
@@ -104,6 +104,8 @@
*/
private LVTRanges lvtRanges;
+ private final boolean typeAnnoAsserts;
+
protected Gen(Context context) {
context.put(genKey, this);
@@ -140,6 +142,7 @@
debugCode = options.isSet("debugcode");
allowInvokedynamic = target.hasInvokedynamic() || options.isSet("invokedynamic");
pool = new Pool(types);
+ typeAnnoAsserts = options.isSet("TypeAnnotationAsserts");
generateIproxies =
target.requiresIproxy() ||
@@ -562,9 +565,13 @@
ListBuffer<Attribute.TypeCompound> fieldTAs = new ListBuffer<Attribute.TypeCompound>();
ListBuffer<Attribute.TypeCompound> nonfieldTAs = new ListBuffer<Attribute.TypeCompound>();
for (TypeCompound ta : tas) {
- if (ta.position.type == TargetType.FIELD) {
+ if (ta.getPosition().type == TargetType.FIELD) {
fieldTAs.add(ta);
} else {
+ if (typeAnnoAsserts) {
+ Assert.error("Type annotation does not have a valid positior");
+ }
+
nonfieldTAs.add(ta);
}
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Pool.java Mon Oct 28 12:28:57 2013 -0700
@@ -296,7 +296,10 @@
interfaceOwner = true;
staticOk = true;
case ClassFile.REF_invokeVirtual:
+ expectedKind = Kinds.MTH;
+ break;
case ClassFile.REF_invokeSpecial:
+ interfaceOwner = true;
expectedKind = Kinds.MTH;
break;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,445 +0,0 @@
-/*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.javac.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.Inherited;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import com.sun.tools.javac.code.Attribute;
-import com.sun.tools.javac.code.Kinds;
-import com.sun.tools.javac.code.Symbol;
-import com.sun.tools.javac.code.Symbol.ClassSymbol;
-import com.sun.tools.javac.code.Symbol.TypeVariableSymbol;
-import com.sun.tools.javac.code.TargetType;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.code.Type.AnnotatedType;
-import com.sun.tools.javac.util.ListBuffer;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import com.sun.tools.javac.util.List;
-
-/**
- * Utility methods for operating on annotated constructs.
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class JavacAnnoConstructs {
-
- // <editor-fold defaultstate="collapsed" desc="Symbols">
-
- /**
- * An internal-use utility that creates a runtime view of an
- * annotation. This is the implementation of
- * Element.getAnnotation(Class).
- */
- public static <A extends Annotation> A getAnnotation(Symbol annotated,
- Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- Attribute.Compound c;
- if (annotated.kind == Kinds.TYP &&
- annotated instanceof ClassSymbol) {
- c = getAttributeOnClass((ClassSymbol)annotated, annoType);
- } else if (annotated.kind == Kinds.TYP &&
- annotated instanceof TypeVariableSymbol) {
- c = getAttributeOnTypeVariable((TypeVariableSymbol)annotated, annoType);
- } else {
- c = getAttribute(annotated, annoType);
- }
- return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttribute(Symbol annotated,
- Class<A> annoType) {
- String name = annoType.getName();
-
- for (Attribute.Compound anno : annotated.getRawAttributes()) {
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
- }
-
- return null;
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound
- getAttributeOnTypeVariable(TypeVariableSymbol annotated, Class<A> annoType) {
- String name = annoType.getName();
-
- // Declaration annotations on type variables are stored in type attributes
- // on the owner of the TypeVariableSymbol
- List<Attribute.Compound> res = List.nil();
- List<Attribute.TypeCompound> candidates = annotated.owner.getRawTypeAttributes();
- for (Attribute.TypeCompound anno : candidates)
- if (anno.position.type == TargetType.CLASS_TYPE_PARAMETER ||
- anno.position.type == TargetType.METHOD_TYPE_PARAMETER)
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
-
- return null;
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttributeOnClass(
- ClassSymbol annotated,
- final Class<A> annoType)
- {
- boolean inherited = annoType.isAnnotationPresent(Inherited.class);
- Attribute.Compound result = null;
-
- result = getAttribute(annotated, annoType);
- if (result != null || !inherited)
- return result;
-
- while ((annotated = nextSupertypeToSearch(annotated)) != null) {
- result = getAttribute(annotated, annoType);
- if (result != null)
- return result;
- }
- return null; // no more supertypes to search
- }
-
- /**
- * Returns the next type to search for inherited annotations or {@code null}
- * if the next type can't be found.
- */
- private static ClassSymbol nextSupertypeToSearch(ClassSymbol annotated) {
- if (annotated.name == annotated.name.table.names.java_lang_Object)
- return null;
-
- Type sup = annotated.getSuperclass();
- if (!sup.hasTag(CLASS) || sup.isErroneous())
- return null;
-
- return (ClassSymbol) sup.tsym;
- }
-
- /**
- * An internal-use utility that creates a runtime view of
- * annotations. This is the implementation of
- * Element.getAnnotations(Class).
- */
- public static <A extends Annotation> A[] getAnnotationsByType(Symbol annotated,
- Class<A> annoType)
- {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- // If annoType does not declare a container this is equivalent to wrapping
- // getAnnotation(...) in an array.
- Class <? extends Annotation> containerType = getContainer(annoType);
- if (containerType == null) {
- A res = getAnnotation(annotated, annoType);
- int size;
- if (res == null) {
- size = 0;
- } else {
- size = 1;
- }
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
- if (res != null)
- arr[0] = res;
- return arr;
- }
-
- // So we have a containing type
- String annoTypeName = annoType.getName();
- String containerTypeName = containerType.getName();
- int directIndex = -1, containerIndex = -1;
- Attribute.Compound direct = null, container = null;
- // Find directly (explicit or implicit) present annotations
- int index = -1;
- for (List<Attribute.Compound> list = annotated.getAnnotationMirrors();
- !list.isEmpty();
- list = list.tail) {
- Attribute.Compound attribute = list.head;
- index++;
- if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
- directIndex = index;
- direct = attribute;
- } else if(containerTypeName != null &&
- attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
- containerIndex = index;
- container = attribute;
- }
- }
-
- // Deal with inherited annotations
- if (direct == null && container == null) {
- if (annotated.kind == Kinds.TYP &&
- (annotated instanceof ClassSymbol)) {
- ClassSymbol s = nextSupertypeToSearch((ClassSymbol)annotated);
- if (s != null)
- return getAnnotationsByType(s, annoType);
- }
- }
-
- // Pack them in an array
- Attribute[] contained0 = null;
- if (container != null)
- contained0 = unpackAttributes(container);
- ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
- if (contained0 != null) {
- for (Attribute a : contained0)
- if (a instanceof Attribute.Compound)
- compounds = compounds.append((Attribute.Compound)a);
- }
- Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
- int size = (direct == null ? 0 : 1) + contained.length;
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
- // if direct && container, which is first?
- int insert = -1;
- int length = arr.length;
- if (directIndex >= 0 && containerIndex >= 0) {
- if (directIndex < containerIndex) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 1;
- } else {
- arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 0;
- length--;
- }
- } else if (directIndex >= 0) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- return arr;
- } else {
- // Only container
- insert = 0;
- }
-
- for (int i = 0; i + insert < length; i++)
- arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
- return arr;
- }
-
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="Types">
-
- /**
- * An internal-use utility that creates a runtime view of an
- * annotation. This is the implementation of
- * TypeMirror.getAnnotation(Class).
- */
- public static <A extends Annotation> A getAnnotation(AnnotatedType annotated, Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- Attribute.Compound c = getAttribute(annotated, annoType);
- return c == null ? null : AnnotationProxyMaker.generateAnnotation(c, annoType);
- }
-
- // Helper to getAnnotation[s]
- private static <A extends Annotation> Attribute.Compound getAttribute(Type annotated,
- Class<A> annoType) {
- String name = annoType.getName();
-
- for (Attribute.Compound anno : annotated.getAnnotationMirrors()) {
- if (name.equals(anno.type.tsym.flatName().toString()))
- return anno;
- }
-
- return null;
- }
-
- /**
- * An internal-use utility that creates a runtime view of
- * annotations. This is the implementation of
- * TypeMirror.getAnnotationsByType(Class).
- */
- public static <A extends Annotation> A[] getAnnotationsByType(AnnotatedType annotated, Class<A> annoType) {
- if (!annoType.isAnnotation())
- throw new IllegalArgumentException("Not an annotation type: "
- + annoType);
- // If annoType does not declare a container this is equivalent to wrapping
- // getAnnotation(...) in an array.
- Class <? extends Annotation> containerType = getContainer(annoType);
- if (containerType == null) {
- A res = getAnnotation(annotated, annoType);
- int size;
- if (res == null) {
- size = 0;
- } else {
- size = 1;
- }
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
- if (res != null)
- arr[0] = res;
- return arr;
- }
-
- // So we have a containing type
- String annoTypeName = annoType.getName();
- String containerTypeName = containerType.getName();
- int directIndex = -1, containerIndex = -1;
- Attribute.Compound direct = null, container = null;
- // Find directly (explicit or implicit) present annotations
- int index = -1;
- for (List<? extends Attribute.Compound> list = annotated.getAnnotationMirrors();
- !list.isEmpty();
- list = list.tail) {
- Attribute.Compound attribute = list.head;
- index++;
- if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
- directIndex = index;
- direct = attribute;
- } else if(containerTypeName != null &&
- attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
- containerIndex = index;
- container = attribute;
- }
- }
-
- // Pack them in an array
- Attribute[] contained0 = null;
- if (container != null)
- contained0 = unpackAttributes(container);
- ListBuffer<Attribute.Compound> compounds = new ListBuffer<>();
- if (contained0 != null) {
- for (Attribute a : contained0)
- if (a instanceof Attribute.Compound)
- compounds = compounds.append((Attribute.Compound)a);
- }
- Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
-
- int size = (direct == null ? 0 : 1) + contained.length;
- @SuppressWarnings("unchecked") // annoType is the Class for A
- A[] arr = (A[])java.lang.reflect.Array.newInstance(annoType, size);
-
- // if direct && container, which is first?
- int insert = -1;
- int length = arr.length;
- if (directIndex >= 0 && containerIndex >= 0) {
- if (directIndex < containerIndex) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 1;
- } else {
- arr[arr.length - 1] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- insert = 0;
- length--;
- }
- } else if (directIndex >= 0) {
- arr[0] = AnnotationProxyMaker.generateAnnotation(direct, annoType);
- return arr;
- } else {
- // Only container
- insert = 0;
- }
-
- for (int i = 0; i + insert < length; i++)
- arr[insert + i] = AnnotationProxyMaker.generateAnnotation(contained[i], annoType);
-
- return arr;
- }
-
- // </editor-fold>
-
- // <editor-fold defaultstate="collapsed" desc="Container support">
-
- // Needed to unpack the runtime view of containing annotations
- private static final Class<? extends Annotation> REPEATABLE_CLASS = initRepeatable();
- private static final Method VALUE_ELEMENT_METHOD = initValueElementMethod();
-
- private static Class<? extends Annotation> initRepeatable() {
- try {
- // Repeatable will not be available when bootstrapping on
- // JDK 7 so use a reflective lookup instead of a class
- // literal for Repeatable.class.
- return Class.forName("java.lang.annotation.Repeatable").asSubclass(Annotation.class);
- } catch (ClassNotFoundException e) {
- return null;
- } catch (SecurityException e) {
- return null;
- }
- }
-
- private static Method initValueElementMethod() {
- if (REPEATABLE_CLASS == null)
- return null;
-
- Method m = null;
- try {
- m = REPEATABLE_CLASS.getMethod("value");
- if (m != null)
- m.setAccessible(true);
- return m;
- } catch (NoSuchMethodException e) {
- return null;
- }
- }
-
- // Helper to getAnnotations
- private static Class<? extends Annotation> getContainer(Class<? extends Annotation> annoType) {
- // Since we can not refer to java.lang.annotation.Repeatable until we are
- // bootstrapping with java 8 we need to get the Repeatable annotation using
- // reflective invocations instead of just using its type and element method.
- if (REPEATABLE_CLASS != null &&
- VALUE_ELEMENT_METHOD != null) {
- // Get the Repeatable instance on the annotations declaration
- Annotation repeatable = (Annotation)annoType.getAnnotation(REPEATABLE_CLASS);
- if (repeatable != null) {
- try {
- // Get the value element, it should be a class
- // indicating the containing annotation type
- @SuppressWarnings("unchecked")
- Class<? extends Annotation> containerType = (Class)VALUE_ELEMENT_METHOD.invoke(repeatable);
- if (containerType == null)
- return null;
-
- return containerType;
- } catch (ClassCastException e) {
- return null;
- } catch (IllegalAccessException e) {
- return null;
- } catch (InvocationTargetException e ) {
- return null;
- }
- }
- }
- return null;
- }
-
- // Helper to getAnnotations
- private static Attribute[] unpackAttributes(Attribute.Compound container) {
- // We now have an instance of the container,
- // unpack it returning an instance of the
- // contained type or null
- return ((Attribute.Array)container.member(container.type.tsym.name.table.names.value)).values;
- }
-
- // </editor-fold>
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Mon Oct 28 12:28:57 2013 -0700
@@ -78,26 +78,26 @@
# 0: string
compiler.err.already.defined.single.import=\
- {0} is already defined in a single-type import
+ a type with the same simple name is already defined by the single-type-import of {0}
# 0: string
compiler.err.already.defined.static.single.import=\
- {0} is already defined in a static single-type import
+ a type with the same simple name is already defined by the static single-type-import of {0}
compiler.err.already.defined.this.unit=\
{0} is already defined in this compilation unit
# 0: type, 1: list of name
compiler.err.annotation.missing.default.value=\
- annotation {0} is missing value for the attribute {1}
+ annotation @{0} is missing a default value for the element ''{1}''
# 0: type, 1: list of name
compiler.err.annotation.missing.default.value.1=\
- annotation {0} is missing values for attributes {1}
+ annotation @{0} is missing default values for elements {1}
# 0: type
compiler.err.annotation.not.valid.for.type=\
- annotation not valid for a value of type {0}
+ annotation not valid for an element of type {0}
compiler.err.annotation.type.not.applicable=\
annotation type not applicable to this kind of declaration
@@ -135,7 +135,7 @@
array required, but {0} found
compiler.err.attribute.value.must.be.constant=\
- attribute value must be constant
+ element value must be a constant expression
# 0: statement type
compiler.err.bad.initializer=\
@@ -298,8 +298,9 @@
compiler.err.cyclic.inheritance=\
cyclic inheritance involving {0}
+# 0: symbol
compiler.err.cyclic.annotation.element=\
- cyclic annotation element type
+ type of element {0} is cyclic
# 0: unused
compiler.err.call.to.super.not.allowed.in.enum.ctor=\
@@ -307,73 +308,70 @@
# 0: type
compiler.err.no.superclass=\
- {0} has no superclass
+ {0} has no superclass.
# 0: symbol, 1: type, 2: symbol, 3: type, 4: unused
compiler.err.concrete.inheritance.conflict=\
methods {0} from {1} and {2} from {3} are inherited with the same signature
compiler.err.default.allowed.in.intf.annotation.member=\
- default value only allowed in an @interface member
+ default value only allowed in an annotation type declaration
# 0: symbol
compiler.err.doesnt.exist=\
package {0} does not exist
-compiler.err.duplicate.annotation=\
- duplicate annotation
-
# 0: type
compiler.err.duplicate.annotation.invalid.repeated=\
- annotation {0} cannot be repeated\nIt does not define a valid containing annotation.
+ annotation {0} is not a valid repeatable annotation
# 0: name, 1: type
compiler.err.duplicate.annotation.member.value=\
- duplicate annotation member value {0} in {1}
-
-# 0: type, 1: type
+ duplicate element ''{0}'' in annotation @{1}.
+
+# 0: name, 1: unused
compiler.err.duplicate.annotation.missing.container=\
- duplicate annotation: the declaration of {0} does not have a valid {1} annotation
-
-# 0: type
+ {0} is not a repeatable annotation type
+
+# 0: type, 1: unused
compiler.err.invalid.repeatable.annotation=\
- duplicate annotation: {0} is annotated with an invalid Repeatable annotation
+ duplicate annotation: {0} is annotated with an invalid @Repeatable annotation
# 0: symbol or type
compiler.err.invalid.repeatable.annotation.no.value=\
- duplicate annotation: {0} is not a valid Repeatable, no value element method declared
+ {0} is not a valid @Repeatable, no value element method declared
# 0: type, 1: number
compiler.err.invalid.repeatable.annotation.multiple.values=\
- duplicate annotation: {0} is not a valid Repeatable, {1} value element methods declared
+ {0} is not a valid @Repeatable, {1} element methods named ''value'' declared
# 0: type
compiler.err.invalid.repeatable.annotation.invalid.value=\
- duplicate annotation: {0} is not a valid Repeatable: invalid value element
-
-# 0: symbol type, 1: type, 2: type
+ {0} is not a valid @Repeatable: invalid value element
+
+# 0: symbol type, 1: unused, 2: type
compiler.err.invalid.repeatable.annotation.value.return=\
- duplicate annotation: value element of containing annotation {0} should have type {2}, found {1}
+ containing annotation type ({0}) must declare an element named ''value'' of type {2}
# 0: symbol or type, 1: symbol
compiler.err.invalid.repeatable.annotation.elem.nondefault=\
- containing annotation {0} does not have a default value for element {1}
-
-# 0: symbol, 1: type, 2: symbol, 3: type
+ containing annotation type ({0}) does not have a default value for element {1}
+
+# 0: symbol, 1: unused, 2: symbol, 3: unused
compiler.err.invalid.repeatable.annotation.retention=\
- containing annotation {0} has shorter retention ({1}) than the contained annotation {2} with retention {3}
+ retention of containing annotation type ({0}) is shorter than the retention of repeatable annotation type ({2})
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.not.documented=\
- containing annotation type, {0}, is not @Documented while repeated annotation type, {1}, is
+ repeatable annotation type ({1}) is @Documented while containing annotation type ({0}) is not
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.not.inherited=\
- containing annotation type, {0}, is not @Inherited while repeated annotation type, {1}, is
+ repeatable annotation type ({1}) is @Inherited while containing annotation type ({0}) is not
# 0: symbol, 1: symbol
compiler.err.invalid.repeatable.annotation.incompatible.target=\
- target of container annotation {0} is not a subset of target of repeated annotation {1}
+ containing annotation type ({0}) is applicable to more targets than repeatable annotation type ({1})
# 0: symbol
compiler.err.invalid.repeatable.annotation.repeated.and.container.present=\
@@ -561,26 +559,31 @@
integer number too large: {0}
compiler.err.intf.annotation.members.cant.have.params=\
- @interface members may not have parameters
-
+ elements in annotation type declarations cannot declare formal parameters
+
+# 0: symbol
compiler.err.intf.annotation.cant.have.type.params=\
- @interface may not have type parameters
+ annotation type {0} cannot be generic
compiler.err.intf.annotation.members.cant.have.type.params=\
- @interface members may not have type parameters
+ elements in annotation type declarations cannot be generic methods
# 0: symbol, 1: type
compiler.err.intf.annotation.member.clash=\
- @interface member clashes with method ''{0}'' in {1}
+ annotation type {1} declares an element with the same name as method {0}
compiler.err.intf.expected.here=\
interface expected here
+compiler.err.intf.or.array.expected.here=\
+ interface or array type expected here
+
compiler.err.intf.meth.cant.have.body=\
interface abstract methods cannot have body
+# 0: symbol
compiler.err.invalid.annotation.member.type=\
- invalid type for annotation member
+ invalid type for element {0} of annotation type
compiler.err.invalid.binary.number=\
binary numbers must contain at least one binary digit
@@ -1699,6 +1702,7 @@
cannot access {0}\n\
{1}
+# 0: file name, 1: message segment
compiler.misc.bad.class.file.header=\
bad class file: {0}\n\
{1}\n\
@@ -1744,6 +1748,14 @@
compiler.misc.class.file.not.found=\
class file for {0} not found
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.default.interface=\
+ default method found in version {0}.{1} classfile
+
+# 0: classfile major version, 1: classfile minor version
+compiler.misc.invalid.static.interface=\
+ static method found in version {0}.{1} classfile
+
# 0: name
compiler.misc.file.doesnt.contain.class=\
file does not contain class {0}
@@ -2245,13 +2257,14 @@
receiver parameter not applicable for constructor of top-level class
# TODO 308: make a better error message
-compiler.err.cant.annotate.static.class=\
- enclosing static nested class cannot be annotated
+# 0: symbol
+compiler.err.cant.type.annotate.scoping.1=\
+ scoping construct cannot be annotated with type-use annotation: {0}
# TODO 308: make a better error message
-# 0: unused
-compiler.err.cant.annotate.nested.type=\
- scoping construct for static nested type cannot be annotated
+# 0: list of symbol
+compiler.err.cant.type.annotate.scoping=\
+ scoping construct cannot be annotated with type-use annotations: {0}
# 0: type, 1: type
compiler.err.incorrect.receiver.name=\
@@ -2301,8 +2314,13 @@
(use -source 8 or higher to enable type annotations)
# 0: string
+compiler.err.repeatable.annotations.not.supported.in.source=\
+ repeated annotations are not supported in -source {0}\n\
+(use -source 8 or higher to enable repeated annotations)
+
+# 0: string
compiler.err.foreach.not.supported.in.source=\
- for-each loops are not supported in -source {0}\n\
+ enhanced for loops are not supported in -source {0}\n\
(use -source 5 or higher to enable for-each loops)
# 0: string
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java Mon Oct 28 12:28:57 2013 -0700
@@ -2359,6 +2359,7 @@
public JCExpression underlyingType;
protected JCAnnotatedType(List<JCAnnotation> annotations, JCExpression underlyingType) {
+ Assert.check(annotations != null && annotations.nonEmpty());
this.annotations = annotations;
this.underlyingType = underlyingType;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/Pretty.java Mon Oct 28 12:28:57 2013 -0700
@@ -782,9 +782,9 @@
public void visitConditional(JCConditional tree) {
try {
open(prec, TreeInfo.condPrec);
- printExpr(tree.cond, TreeInfo.condPrec);
+ printExpr(tree.cond, TreeInfo.condPrec + 1);
print(" ? ");
- printExpr(tree.truepart, TreeInfo.condPrec);
+ printExpr(tree.truepart);
print(" : ");
printExpr(tree.falsepart, TreeInfo.condPrec);
close(prec, TreeInfo.condPrec);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -619,8 +619,10 @@
Names names = tsym.name.table.names;
List<MethodDocImpl> methods = List.nil();
for (Scope.Entry e = tsym.members().elems; e != null; e = e.sibling) {
- if (e.sym != null &&
- e.sym.kind == Kinds.MTH && e.sym.name != names.init) {
+ if (e.sym != null
+ && e.sym.kind == Kinds.MTH
+ && e.sym.name != names.init
+ && e.sym.name != names.clinit) {
MethodSymbol s = (MethodSymbol)e.sym;
if (!filter || env.shouldDocument(s)) {
methods = methods.prepend(env.getMethodDoc(s));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javap/package-info.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ Classes to dump class files in text format.
+
+ <p><b>This is NOT part of any supported API.
+ If you write code that depends on this, you do so at your own risk.
+ This code and its internal interfaces are subject to change or
+ deletion without notice.</b>
+*/
+@jdk.Exported(false)
+package com.sun.tools.javap;
--- a/langtools/src/share/classes/com/sun/tools/javap/package.html Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
- <head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- </head>
- <body>
- Classes to dump class files in text format.
- </body>
-</html>
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Analyzer.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,9 +25,8 @@
package com.sun.tools.jdeps;
import com.sun.tools.classfile.Dependency.Location;
-import java.util.ArrayList;
+import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -52,8 +51,8 @@
};
private final Type type;
- private final List<ArchiveDeps> results = new ArrayList<ArchiveDeps>();
- private final Map<String, Archive> map = new HashMap<String, Archive>();
+ private final Map<Archive, ArchiveDeps> results = new HashMap<>();
+ private final Map<String, Archive> map = new HashMap<>();
private final Archive NOT_FOUND
= new Archive(JdepsTask.getMessage("artifact.not.found"));
@@ -78,27 +77,27 @@
deps = new PackageVisitor(archive);
}
archive.visit(deps);
- results.add(deps);
+ results.put(archive, deps);
}
// set the required dependencies
- for (ArchiveDeps result: results) {
+ for (ArchiveDeps result: results.values()) {
for (Set<String> set : result.deps.values()) {
for (String target : set) {
Archive source = getArchive(target);
if (result.archive != source) {
- if (!result.requiredArchives.contains(source)) {
- result.requiredArchives.add(source);
+ String profile = "";
+ if (source instanceof JDKArchive) {
+ profile = result.profile != null ? result.profile.toString() : "";
+ if (result.getTargetProfile(target) == null) {
+ profile += ", JDK internal API";
+ // override the value if it accesses any JDK internal
+ result.requireArchives.put(source, profile);
+ continue;
+ }
}
- // either a profile name or the archive name
- String tname = result.getTargetProfile(target);
- if (tname.isEmpty()) {
- tname = PlatformClassPath.contains(source)
- ? "JDK internal API (" + source.getFileName() + ")"
- : source.toString();
- }
- if (!result.targetNames.contains(tname)) {
- result.targetNames.add(tname);
+ if (!result.requireArchives.containsKey(source)) {
+ result.requireArchives.put(source, profile);
}
}
}
@@ -106,42 +105,46 @@
}
}
+ public boolean hasDependences(Archive archive) {
+ if (results.containsKey(archive)) {
+ return results.get(archive).deps.size() > 0;
+ }
+ return false;
+ }
+
public interface Visitor {
/**
+ * Visits the source archive to its destination archive of
+ * a recorded dependency.
+ */
+ void visitArchiveDependence(Archive origin, Archive target, String profile);
+ /**
* Visits a recorded dependency from origin to target which can be
* a fully-qualified classname, a package name, a profile or
* archive name depending on the Analyzer's type.
*/
- void visit(String origin, String target, String profile);
- /**
- * Visits the source archive to its destination archive of
- * a recorded dependency.
- */
- void visit(Archive source, Archive dest);
+ void visitDependence(String origin, Archive source, String target, Archive archive, String profile);
}
- public void visitSummary(Visitor v) {
- for (ArchiveDeps r : results) {
- for (Archive a : r.requiredArchives) {
- v.visit(r.archive, a);
- }
- for (String name : r.targetNames) {
- v.visit(r.archive.getFileName(), name, name);
- }
+ public void visitArchiveDependences(Archive source, Visitor v) {
+ ArchiveDeps r = results.get(source);
+ for (Map.Entry<Archive,String> e : r.requireArchives.entrySet()) {
+ v.visitArchiveDependence(r.archive, e.getKey(), e.getValue());
}
}
- public void visit(Visitor v) {
- for (ArchiveDeps r: results) {
- for (Archive a : r.requiredArchives) {
- v.visit(r.archive, a);
- }
- for (String origin : r.deps.keySet()) {
- for (String target : r.deps.get(origin)) {
- // filter intra-dependency unless in verbose mode
- if (type == Type.VERBOSE || getArchive(origin) != getArchive(target)) {
- v.visit(origin, target, r.getTargetProfile(target));
- }
+ public void visitDependences(Archive source, Visitor v) {
+ ArchiveDeps r = results.get(source);
+ for (String origin : r.deps.keySet()) {
+ for (String target : r.deps.get(origin)) {
+ Archive archive = getArchive(target);
+ assert source == getArchive(origin);
+ Profile profile = r.getTargetProfile(target);
+
+ // filter intra-dependency unless in verbose mode
+ if (type == Type.VERBOSE || archive != source) {
+ v.visitDependence(origin, source, target, archive,
+ profile != null ? profile.toString() : "");
}
}
}
@@ -151,29 +154,15 @@
return map.containsKey(name) ? map.get(name) : NOT_FOUND;
}
- /**
- * Returns the file name of the archive for non-JRE class or
- * internal JRE classes. It returns empty string for SE API.
- */
- public String getArchiveName(String target, String profile) {
- Archive source = getArchive(target);
- String name = source.getFileName();
- if (PlatformClassPath.contains(source))
- return profile.isEmpty() ? "JDK internal API (" + name + ")" : "";
- return name;
- }
-
private abstract class ArchiveDeps implements Archive.Visitor {
final Archive archive;
- final Set<Archive> requiredArchives;
- final SortedSet<String> targetNames;
+ final Map<Archive,String> requireArchives;
final SortedMap<String, SortedSet<String>> deps;
-
+ Profile profile = null;
ArchiveDeps(Archive archive) {
this.archive = archive;
- this.requiredArchives = new HashSet<Archive>();
- this.targetNames = new TreeSet<String>();
- this.deps = new TreeMap<String, SortedSet<String>>();
+ this.requireArchives = new HashMap<>();
+ this.deps = new TreeMap<>();
}
void add(String loc) {
@@ -188,17 +177,19 @@
void add(String origin, String target) {
SortedSet<String> set = deps.get(origin);
if (set == null) {
- set = new TreeSet<String>();
- deps.put(origin, set);
+ deps.put(origin, set = new TreeSet<>());
}
if (!set.contains(target)) {
set.add(target);
+ // find the corresponding profile
+ Profile p = getTargetProfile(target);
+ if (profile == null || (p != null && profile.profile < p.profile)) {
+ profile = p;
+ }
}
}
-
public abstract void visit(Location o, Location t);
- public abstract String getTargetProfile(String target);
-
+ public abstract Profile getTargetProfile(String target);
}
private class ClassVisitor extends ArchiveDeps {
@@ -211,9 +202,9 @@
public void visit(Location o, Location t) {
add(o.getClassName(), t.getClassName());
}
- public String getTargetProfile(String target) {
+ public Profile getTargetProfile(String target) {
int i = target.lastIndexOf('.');
- return (i > 0) ? Profiles.getProfileName(target.substring(0, i)) : "";
+ return (i > 0) ? Profile.getProfile(target.substring(0, i)) : null;
}
}
@@ -231,8 +222,8 @@
String pkg = loc.getPackageName();
return pkg.isEmpty() ? "<unnamed>" : pkg;
}
- public String getTargetProfile(String target) {
- return Profiles.getProfileName(target);
+ public Profile getTargetProfile(String target) {
+ return Profile.getProfile(target);
}
}
}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Archive.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,7 @@
package com.sun.tools.jdeps;
import com.sun.tools.classfile.Dependency.Location;
-import java.io.File;
+import java.nio.file.Path;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -35,21 +35,20 @@
* Represents the source of the class files.
*/
public class Archive {
- private final File file;
+ private final Path path;
private final String filename;
private final ClassFileReader reader;
- private final Map<Location, Set<Location>> deps
- = new HashMap<Location, Set<Location>>();
+ private final Map<Location, Set<Location>> deps = new HashMap<>();
public Archive(String name) {
- this.file = null;
+ this.path = null;
this.filename = name;
this.reader = null;
}
- public Archive(File f, ClassFileReader reader) {
- this.file = f;
- this.filename = f.getName();
+ public Archive(Path p, ClassFileReader reader) {
+ this.path = p;
+ this.filename = path.getFileName().toString();
this.reader = reader;
}
@@ -64,14 +63,14 @@
public void addClass(Location origin) {
Set<Location> set = deps.get(origin);
if (set == null) {
- set = new HashSet<Location>();
+ set = new HashSet<>();
deps.put(origin, set);
}
}
public void addClass(Location origin, Location target) {
Set<Location> set = deps.get(origin);
if (set == null) {
- set = new HashSet<Location>();
+ set = new HashSet<>();
deps.put(origin, set);
}
set.add(target);
@@ -87,7 +86,7 @@
}
public String toString() {
- return file != null ? file.getPath() : filename;
+ return path != null ? path.toString() : filename;
}
interface Visitor {
--- a/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java Mon Oct 28 12:28:57 2013 -0700
@@ -45,17 +45,17 @@
/**
* Returns a ClassFileReader instance of a given path.
*/
- public static ClassFileReader newInstance(File path) throws IOException {
- if (!path.exists()) {
- throw new FileNotFoundException(path.getAbsolutePath());
+ public static ClassFileReader newInstance(Path path) throws IOException {
+ if (!Files.exists(path)) {
+ throw new FileNotFoundException(path.toString());
}
- if (path.isDirectory()) {
- return new DirectoryReader(path.toPath());
- } else if (path.getName().endsWith(".jar")) {
- return new JarFileReader(path.toPath());
+ if (Files.isDirectory(path)) {
+ return new DirectoryReader(path);
+ } else if (path.getFileName().toString().endsWith(".jar")) {
+ return new JarFileReader(path);
} else {
- return new ClassFileReader(path.toPath());
+ return new ClassFileReader(path);
}
}
@@ -163,16 +163,16 @@
int i = name.lastIndexOf('.');
String pathname = name.replace('.', File.separatorChar) + ".class";
Path p = path.resolve(pathname);
- if (!p.toFile().exists()) {
+ if (!Files.exists(p)) {
p = path.resolve(pathname.substring(0, i) + "$" +
pathname.substring(i+1, pathname.length()));
}
- if (p.toFile().exists()) {
+ if (Files.exists(p)) {
return readClassFile(p);
}
} else {
Path p = path.resolve(name + ".class");
- if (p.toFile().exists()) {
+ if (Files.exists(p)) {
return readClassFile(p);
}
}
@@ -193,7 +193,7 @@
Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
- if (file.toFile().getName().endsWith(".class")) {
+ if (file.getFileName().toString().endsWith(".class")) {
files.add(file);
}
return FileVisitResult.CONTINUE;
--- a/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/JdepsTask.java Mon Oct 28 12:28:57 2013 -0700
@@ -24,12 +24,18 @@
*/
package com.sun.tools.jdeps;
+import com.sun.tools.classfile.AccessFlags;
import com.sun.tools.classfile.ClassFile;
import com.sun.tools.classfile.ConstantPoolException;
import com.sun.tools.classfile.Dependencies;
import com.sun.tools.classfile.Dependencies.ClassFileError;
import com.sun.tools.classfile.Dependency;
+import com.sun.tools.jdeps.PlatformClassPath.JDKArchive;
import java.io.*;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.text.MessageFormat;
import java.util.*;
import java.util.regex.Pattern;
@@ -67,11 +73,10 @@
boolean matches(String opt) {
for (String a : aliases) {
- if (a.equals(opt)) {
+ if (a.equals(opt))
return true;
- } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+ if (hasArg && opt.startsWith(a + "="))
return true;
- }
}
return false;
}
@@ -96,62 +101,96 @@
}
static Option[] recognizedOptions = {
- new Option(false, "-h", "-?", "--help") {
+ new Option(false, "-h", "-?", "-help") {
void process(JdepsTask task, String opt, String arg) {
task.options.help = true;
}
},
- new Option(false, "-s", "--summary") {
+ new Option(true, "-dotoutput") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ Path p = Paths.get(arg);
+ if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) {
+ throw new BadArgs("err.dot.output.path", arg);
+ }
+ task.options.dotOutputDir = arg;
+ }
+ },
+ new Option(false, "-s", "-summary") {
void process(JdepsTask task, String opt, String arg) {
task.options.showSummary = true;
task.options.verbose = Analyzer.Type.SUMMARY;
}
},
- new Option(false, "-v", "--verbose") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.verbose = Analyzer.Type.VERBOSE;
- }
- },
- new Option(true, "-V", "--verbose-level") {
+ new Option(false, "-v", "-verbose",
+ "-verbose:package",
+ "-verbose:class")
+ {
void process(JdepsTask task, String opt, String arg) throws BadArgs {
- if ("package".equals(arg)) {
- task.options.verbose = Analyzer.Type.PACKAGE;
- } else if ("class".equals(arg)) {
- task.options.verbose = Analyzer.Type.CLASS;
- } else {
- throw new BadArgs("err.invalid.arg.for.option", opt);
+ switch (opt) {
+ case "-v":
+ case "-verbose":
+ task.options.verbose = Analyzer.Type.VERBOSE;
+ break;
+ case "-verbose:package":
+ task.options.verbose = Analyzer.Type.PACKAGE;
+ break;
+ case "-verbose:class":
+ task.options.verbose = Analyzer.Type.CLASS;
+ break;
+ default:
+ throw new BadArgs("err.invalid.arg.for.option", opt);
}
}
},
- new Option(true, "-c", "--classpath") {
+ new Option(true, "-cp", "-classpath") {
void process(JdepsTask task, String opt, String arg) {
task.options.classpath = arg;
}
},
- new Option(true, "-p", "--package") {
+ new Option(true, "-p", "-package") {
void process(JdepsTask task, String opt, String arg) {
task.options.packageNames.add(arg);
}
},
- new Option(true, "-e", "--regex") {
+ new Option(true, "-e", "-regex") {
void process(JdepsTask task, String opt, String arg) {
task.options.regex = arg;
}
},
- new Option(false, "-P", "--profile") {
+ new Option(true, "-include") {
+ void process(JdepsTask task, String opt, String arg) throws BadArgs {
+ task.options.includePattern = Pattern.compile(arg);
+ }
+ },
+ new Option(false, "-P", "-profile") {
void process(JdepsTask task, String opt, String arg) throws BadArgs {
task.options.showProfile = true;
- if (Profiles.getProfileCount() == 0) {
+ if (Profile.getProfileCount() == 0) {
throw new BadArgs("err.option.unsupported", opt, getMessage("err.profiles.msg"));
}
}
},
- new Option(false, "-R", "--recursive") {
+ new Option(false, "-apionly") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.apiOnly = true;
+ }
+ },
+ new Option(false, "-R", "-recursive") {
void process(JdepsTask task, String opt, String arg) {
task.options.depth = 0;
}
},
- new HiddenOption(true, "-d", "--depth") {
+ new Option(false, "-version") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.version = true;
+ }
+ },
+ new HiddenOption(false, "-fullversion") {
+ void process(JdepsTask task, String opt, String arg) {
+ task.options.fullVersion = true;
+ }
+ },
+ new HiddenOption(true, "-depth") {
void process(JdepsTask task, String opt, String arg) throws BadArgs {
try {
task.options.depth = Integer.parseInt(arg);
@@ -160,16 +199,6 @@
}
}
},
- new Option(false, "--version") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.version = true;
- }
- },
- new HiddenOption(false, "--fullversion") {
- void process(JdepsTask task, String opt, String arg) {
- task.options.fullVersion = true;
- }
- },
};
private static final String PROGNAME = "jdeps";
@@ -202,7 +231,7 @@
if (options.version || options.fullVersion) {
showVersion(options.fullVersion);
}
- if (classes.isEmpty() && !options.wildcard) {
+ if (classes.isEmpty() && options.includePattern == null) {
if (options.help || options.version || options.fullVersion) {
return EXIT_OK;
} else {
@@ -233,19 +262,51 @@
}
}
- private final List<Archive> sourceLocations = new ArrayList<Archive>();
+ private final List<Archive> sourceLocations = new ArrayList<>();
private boolean run() throws IOException {
findDependencies();
Analyzer analyzer = new Analyzer(options.verbose);
analyzer.run(sourceLocations);
- if (options.verbose == Analyzer.Type.SUMMARY) {
- printSummary(log, analyzer);
+ if (options.dotOutputDir != null) {
+ Path dir = Paths.get(options.dotOutputDir);
+ Files.createDirectories(dir);
+ generateDotFiles(dir, analyzer);
} else {
- printDependencies(log, analyzer);
+ printRawOutput(log, analyzer);
}
return true;
}
+ private void generateDotFiles(Path dir, Analyzer analyzer) throws IOException {
+ Path summary = dir.resolve("summary.dot");
+ try (PrintWriter sw = new PrintWriter(Files.newOutputStream(summary));
+ DotFileFormatter formatter = new DotFileFormatter(sw, "summary")) {
+ for (Archive archive : sourceLocations) {
+ analyzer.visitArchiveDependences(archive, formatter);
+ }
+ }
+ if (options.verbose != Analyzer.Type.SUMMARY) {
+ for (Archive archive : sourceLocations) {
+ if (analyzer.hasDependences(archive)) {
+ Path dotfile = dir.resolve(archive.getFileName() + ".dot");
+ try (PrintWriter pw = new PrintWriter(Files.newOutputStream(dotfile));
+ DotFileFormatter formatter = new DotFileFormatter(pw, archive)) {
+ analyzer.visitDependences(archive, formatter);
+ }
+ }
+ }
+ }
+ }
+
+ private void printRawOutput(PrintWriter writer, Analyzer analyzer) {
+ for (Archive archive : sourceLocations) {
+ RawOutputFormatter formatter = new RawOutputFormatter(writer);
+ analyzer.visitArchiveDependences(archive, formatter);
+ if (options.verbose != Analyzer.Type.SUMMARY) {
+ analyzer.visitDependences(archive, formatter);
+ }
+ }
+ }
private boolean isValidClassName(String name) {
if (!Character.isJavaIdentifierStart(name.charAt(0))) {
return false;
@@ -259,27 +320,43 @@
return true;
}
- private void findDependencies() throws IOException {
- Dependency.Finder finder = Dependencies.getClassDependencyFinder();
- Dependency.Filter filter;
- if (options.regex != null) {
- filter = Dependencies.getRegexFilter(Pattern.compile(options.regex));
+ private Dependency.Filter getDependencyFilter() {
+ if (options.regex != null) {
+ return Dependencies.getRegexFilter(Pattern.compile(options.regex));
} else if (options.packageNames.size() > 0) {
- filter = Dependencies.getPackageFilter(options.packageNames, false);
+ return Dependencies.getPackageFilter(options.packageNames, false);
} else {
- filter = new Dependency.Filter() {
+ return new Dependency.Filter() {
+ @Override
public boolean accepts(Dependency dependency) {
return !dependency.getOrigin().equals(dependency.getTarget());
}
};
}
+ }
- List<Archive> archives = new ArrayList<Archive>();
- Deque<String> roots = new LinkedList<String>();
+ private boolean matches(String classname, AccessFlags flags) {
+ if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) {
+ return false;
+ } else if (options.includePattern != null) {
+ return options.includePattern.matcher(classname.replace('/', '.')).matches();
+ } else {
+ return true;
+ }
+ }
+
+ private void findDependencies() throws IOException {
+ Dependency.Finder finder =
+ options.apiOnly ? Dependencies.getAPIFinder(AccessFlags.ACC_PROTECTED)
+ : Dependencies.getClassDependencyFinder();
+ Dependency.Filter filter = getDependencyFilter();
+
+ List<Archive> archives = new ArrayList<>();
+ Deque<String> roots = new LinkedList<>();
for (String s : classes) {
- File f = new File(s);
- if (f.exists()) {
- archives.add(new Archive(f, ClassFileReader.newInstance(f)));
+ Path p = Paths.get(s);
+ if (Files.exists(p)) {
+ archives.add(new Archive(p, ClassFileReader.newInstance(p)));
} else {
if (isValidClassName(s)) {
roots.add(s);
@@ -289,9 +366,8 @@
}
}
- List<Archive> classpaths = new ArrayList<Archive>(); // for class file lookup
- if (options.wildcard) {
- // include all archives from classpath to the initial list
+ List<Archive> classpaths = new ArrayList<>(); // for class file lookup
+ if (options.includePattern != null) {
archives.addAll(getClassPathArchives(options.classpath));
} else {
classpaths.addAll(getClassPathArchives(options.classpath));
@@ -305,8 +381,8 @@
// Work queue of names of classfiles to be searched.
// Entries will be unique, and for classes that do not yet have
// dependencies in the results map.
- Deque<String> deque = new LinkedList<String>();
- Set<String> doneClasses = new HashSet<String>();
+ Deque<String> deque = new LinkedList<>();
+ Set<String> doneClasses = new HashSet<>();
// get the immediate dependencies of the input files
for (Archive a : archives) {
@@ -318,16 +394,18 @@
throw new ClassFileError(e);
}
- if (!doneClasses.contains(classFileName)) {
- doneClasses.add(classFileName);
- }
- for (Dependency d : finder.findDependencies(cf)) {
- if (filter.accepts(d)) {
- String cn = d.getTarget().getName();
- if (!doneClasses.contains(cn) && !deque.contains(cn)) {
- deque.add(cn);
+ if (matches(classFileName, cf.access_flags)) {
+ if (!doneClasses.contains(classFileName)) {
+ doneClasses.add(classFileName);
+ }
+ for (Dependency d : finder.findDependencies(cf)) {
+ if (filter.accepts(d)) {
+ String cn = d.getTarget().getName();
+ if (!doneClasses.contains(cn) && !deque.contains(cn)) {
+ deque.add(cn);
+ }
+ a.addClass(d.getOrigin(), d.getTarget());
}
- a.addClass(d.getOrigin(), d.getTarget());
}
}
}
@@ -379,46 +457,10 @@
}
}
unresolved = deque;
- deque = new LinkedList<String>();
+ deque = new LinkedList<>();
} while (!unresolved.isEmpty() && depth-- > 0);
}
- private void printSummary(final PrintWriter out, final Analyzer analyzer) {
- Analyzer.Visitor visitor = new Analyzer.Visitor() {
- public void visit(String origin, String target, String profile) {
- if (options.showProfile) {
- out.format("%-30s -> %s%n", origin, target);
- }
- }
- public void visit(Archive origin, Archive target) {
- if (!options.showProfile) {
- out.format("%-30s -> %s%n", origin, target);
- }
- }
- };
- analyzer.visitSummary(visitor);
- }
-
- private void printDependencies(final PrintWriter out, final Analyzer analyzer) {
- Analyzer.Visitor visitor = new Analyzer.Visitor() {
- private String pkg = "";
- public void visit(String origin, String target, String profile) {
- if (!origin.equals(pkg)) {
- pkg = origin;
- out.format(" %s (%s)%n", origin, analyzer.getArchive(origin).getFileName());
- }
- out.format(" -> %-50s %s%n", target,
- (options.showProfile && !profile.isEmpty())
- ? profile
- : analyzer.getArchiveName(target, profile));
- }
- public void visit(Archive origin, Archive target) {
- out.format("%s -> %s%n", origin, target);
- }
- };
- analyzer.visit(visitor);
- }
-
public void handleOptions(String[] args) throws BadArgs {
// process options
for (int i=0; i < args.length; i++) {
@@ -427,7 +469,7 @@
Option option = getOption(name);
String param = null;
if (option.hasArg) {
- if (name.startsWith("--") && name.indexOf('=') > 0) {
+ if (name.startsWith("-") && name.indexOf('=') > 0) {
param = name.substring(name.indexOf('=') + 1, name.length());
} else if (i + 1 < args.length) {
param = args[++i];
@@ -447,11 +489,7 @@
if (name.charAt(0) == '-') {
throw new BadArgs("err.option.after.class", name).showUsage(true);
}
- if (name.equals("*") || name.equals("\"*\"")) {
- options.wildcard = true;
- } else {
- classes.add(name);
- }
+ classes.add(name);
}
}
}
@@ -518,13 +556,15 @@
boolean showProfile;
boolean showSummary;
boolean wildcard;
- String regex;
+ boolean apiOnly;
+ String dotOutputDir;
String classpath = "";
int depth = 1;
Analyzer.Type verbose = Analyzer.Type.PACKAGE;
- Set<String> packageNames = new HashSet<String>();
+ Set<String> packageNames = new HashSet<>();
+ String regex; // apply to the dependences
+ Pattern includePattern; // apply to classes
}
-
private static class ResourceBundleHelper {
static final ResourceBundle versionRB;
static final ResourceBundle bundle;
@@ -547,9 +587,9 @@
private List<Archive> getArchives(List<String> filenames) throws IOException {
List<Archive> result = new ArrayList<Archive>();
for (String s : filenames) {
- File f = new File(s);
- if (f.exists()) {
- result.add(new Archive(f, ClassFileReader.newInstance(f)));
+ Path p = Paths.get(s);
+ if (Files.exists(p)) {
+ result.add(new Archive(p, ClassFileReader.newInstance(p)));
} else {
warning("warn.file.not.exist", s);
}
@@ -558,18 +598,131 @@
}
private List<Archive> getClassPathArchives(String paths) throws IOException {
- List<Archive> result = new ArrayList<Archive>();
+ List<Archive> result = new ArrayList<>();
if (paths.isEmpty()) {
return result;
}
for (String p : paths.split(File.pathSeparator)) {
if (p.length() > 0) {
- File f = new File(p);
- if (f.exists()) {
- result.add(new Archive(f, ClassFileReader.newInstance(f)));
+ List<Path> files = new ArrayList<>();
+ // wildcard to parse all JAR files e.g. -classpath dir/*
+ int i = p.lastIndexOf(".*");
+ if (i > 0) {
+ Path dir = Paths.get(p.substring(0, i));
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, "*.jar")) {
+ for (Path entry : stream) {
+ files.add(entry);
+ }
+ }
+ } else {
+ files.add(Paths.get(p));
+ }
+ for (Path f : files) {
+ if (Files.exists(f)) {
+ result.add(new Archive(f, ClassFileReader.newInstance(f)));
+ }
}
}
}
return result;
}
+
+
+ /**
+ * Returns the file name of the archive for non-JRE class or
+ * internal JRE classes. It returns empty string for SE API.
+ */
+ private static String getArchiveName(Archive source, String profile) {
+ String name = source.getFileName();
+ if (source instanceof JDKArchive)
+ return profile.isEmpty() ? "JDK internal API (" + name + ")" : "";
+ return name;
+ }
+
+ class RawOutputFormatter implements Analyzer.Visitor {
+ private final PrintWriter writer;
+ RawOutputFormatter(PrintWriter writer) {
+ this.writer = writer;
+ }
+
+ private String pkg = "";
+ @Override
+ public void visitDependence(String origin, Archive source,
+ String target, Archive archive, String profile) {
+ if (!origin.equals(pkg)) {
+ pkg = origin;
+ writer.format(" %s (%s)%n", origin, source.getFileName());
+ }
+ String name = (options.showProfile && !profile.isEmpty())
+ ? profile
+ : getArchiveName(archive, profile);
+ writer.format(" -> %-50s %s%n", target, name);
+ }
+
+ @Override
+ public void visitArchiveDependence(Archive origin, Archive target, String profile) {
+ writer.format("%s -> %s", origin, target);
+ if (options.showProfile && !profile.isEmpty()) {
+ writer.format(" (%s)%n", profile);
+ } else {
+ writer.format("%n");
+ }
+ }
+ }
+
+ class DotFileFormatter implements Analyzer.Visitor, AutoCloseable {
+ private final PrintWriter writer;
+ private final String name;
+ DotFileFormatter(PrintWriter writer, String name) {
+ this.writer = writer;
+ this.name = name;
+ writer.format("digraph \"%s\" {%n", name);
+ }
+ DotFileFormatter(PrintWriter writer, Archive archive) {
+ this.writer = writer;
+ this.name = archive.getFileName();
+ writer.format("digraph \"%s\" {%n", name);
+ writer.format(" // Path: %s%n", archive.toString());
+ }
+
+ @Override
+ public void close() {
+ writer.println("}");
+ }
+
+ private final Set<String> edges = new HashSet<>();
+ private String node = "";
+ @Override
+ public void visitDependence(String origin, Archive source,
+ String target, Archive archive, String profile) {
+ if (!node.equals(origin)) {
+ edges.clear();
+ node = origin;
+ }
+ // if -P option is specified, package name -> profile will
+ // be shown and filter out multiple same edges.
+ if (!edges.contains(target)) {
+ StringBuilder sb = new StringBuilder();
+ String name = options.showProfile && !profile.isEmpty()
+ ? profile
+ : getArchiveName(archive, profile);
+ writer.format(" %-50s -> %s;%n",
+ String.format("\"%s\"", origin),
+ name.isEmpty() ? String.format("\"%s\"", target)
+ : String.format("\"%s (%s)\"", target, name));
+ edges.add(target);
+ }
+ }
+
+ @Override
+ public void visitArchiveDependence(Archive origin, Archive target, String profile) {
+ String name = options.showProfile && !profile.isEmpty()
+ ? profile : "";
+ writer.format(" %-30s -> \"%s\";%n",
+ String.format("\"%s\"", origin.getFileName()),
+ name.isEmpty()
+ ? target.getFileName()
+ : String.format("%s (%s)", target.getFileName(), name));
+ }
+ }
}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/PlatformClassPath.java Mon Oct 28 12:28:57 2013 -0700
@@ -24,11 +24,11 @@
*/
package com.sun.tools.jdeps;
-import java.io.File;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.*;
@@ -38,45 +38,38 @@
*/
class PlatformClassPath {
private final static List<Archive> javaHomeArchives = init();
+
static List<Archive> getArchives() {
return javaHomeArchives;
}
- static boolean contains(Archive archive) {
- return javaHomeArchives.contains(archive);
+ private static List<Archive> init() {
+ List<Archive> result = new ArrayList<>();
+ Path home = Paths.get(System.getProperty("java.home"));
+ try {
+ if (home.endsWith("jre")) {
+ // jar files in <javahome>/jre/lib
+ result.addAll(addJarFiles(home.resolve("lib")));
+ } else if (Files.exists(home.resolve("lib"))) {
+ // either a JRE or a jdk build image
+ Path classes = home.resolve("classes");
+ if (Files.isDirectory(classes)) {
+ // jdk build outputdir
+ result.add(new JDKArchive(classes, ClassFileReader.newInstance(classes)));
+ }
+ // add other JAR files
+ result.addAll(addJarFiles(home.resolve("lib")));
+ } else {
+ throw new RuntimeException("\"" + home + "\" not a JDK home");
+ }
+ return result;
+ } catch (IOException e) {
+ throw new Error(e);
+ }
}
- private static List<Archive> init() {
- List<Archive> result = new ArrayList<Archive>();
- String javaHome = System.getProperty("java.home");
- File jre = new File(javaHome, "jre");
- File lib = new File(javaHome, "lib");
-
- try {
- if (jre.exists() && jre.isDirectory()) {
- result.addAll(addJarFiles(new File(jre, "lib")));
- result.addAll(addJarFiles(lib));
- } else if (lib.exists() && lib.isDirectory()) {
- // either a JRE or a jdk build image
- File classes = new File(javaHome, "classes");
- if (classes.exists() && classes.isDirectory()) {
- // jdk build outputdir
- result.add(new Archive(classes, ClassFileReader.newInstance(classes)));
- }
- // add other JAR files
- result.addAll(addJarFiles(lib));
- } else {
- throw new RuntimeException("\"" + javaHome + "\" not a JDK home");
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return result;
- }
-
- private static List<Archive> addJarFiles(File f) throws IOException {
- final List<Archive> result = new ArrayList<Archive>();
- final Path root = f.toPath();
+ private static List<Archive> addJarFiles(final Path root) throws IOException {
+ final List<Archive> result = new ArrayList<>();
final Path ext = root.resolve("ext");
Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
@Override
@@ -91,17 +84,30 @@
}
}
@Override
- public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+ public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
throws IOException
{
- File f = file.toFile();
- String fn = f.getName();
- if (fn.endsWith(".jar") && !fn.equals("alt-rt.jar")) {
- result.add(new Archive(f, ClassFileReader.newInstance(f)));
+ String fn = p.getFileName().toString();
+ if (fn.endsWith(".jar")) {
+ // JDK may cobundle with JavaFX that doesn't belong to any profile
+ // Treat jfxrt.jar as regular Archive
+ result.add(fn.equals("jfxrt.jar")
+ ? new Archive(p, ClassFileReader.newInstance(p))
+ : new JDKArchive(p, ClassFileReader.newInstance(p)));
}
return FileVisitResult.CONTINUE;
}
});
return result;
}
+
+ /**
+ * A JDK archive is part of the JDK containing the Java SE API
+ * or implementation classes (i.e. JDK internal API)
+ */
+ static class JDKArchive extends Archive {
+ JDKArchive(Path p, ClassFileReader reader) {
+ super(p, reader);
+ }
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/Profile.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.jdeps;
+
+import com.sun.tools.classfile.Annotation;
+import com.sun.tools.classfile.Annotation.*;
+import com.sun.tools.classfile.Attribute;
+import com.sun.tools.classfile.ClassFile;
+import com.sun.tools.classfile.ConstantPool.*;
+import com.sun.tools.classfile.ConstantPoolException;
+import com.sun.tools.classfile.RuntimeAnnotations_attribute;
+import java.io.FileReader;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.jar.JarFile;
+
+/**
+ * Build the profile information from ct.sym if exists.
+ */
+enum Profile {
+
+ COMPACT1("compact1", 1),
+ COMPACT2("compact2", 2),
+ COMPACT3("compact3", 3),
+ FULL_JRE("Full JRE", 4);
+
+ final String name;
+ final int profile;
+ final Set<String> packages;
+ final Set<String> proprietaryPkgs;
+
+ Profile(String name, int profile) {
+ this.name = name;
+ this.profile = profile;
+ this.packages = new HashSet<>();
+ this.proprietaryPkgs = new HashSet<>();
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public static int getProfileCount() {
+ return PackageToProfile.map.values().size();
+ }
+
+ /**
+ * Returns the Profile for the given package name. It returns an empty
+ * string if the given package is not in any profile.
+ */
+ public static Profile getProfile(String pn) {
+ Profile profile = PackageToProfile.map.get(pn);
+ return (profile != null && profile.packages.contains(pn))
+ ? profile : null;
+ }
+
+ static class PackageToProfile {
+ static Map<String, Profile> map = initProfiles();
+
+ private static Map<String, Profile> initProfiles() {
+ try {
+ String profilesProps = System.getProperty("jdeps.profiles");
+ if (profilesProps != null) {
+ // for testing for JDK development build where ct.sym doesn't exist
+ initProfilesFromProperties(profilesProps);
+ } else {
+ Path home = Paths.get(System.getProperty("java.home"));
+ if (home.endsWith("jre")) {
+ home = home.getParent();
+ }
+ Path ctsym = home.resolve("lib").resolve("ct.sym");
+ if (Files.exists(ctsym)) {
+ // parse ct.sym and load information about profiles
+ try (JarFile jf = new JarFile(ctsym.toFile())) {
+ ClassFileReader reader = ClassFileReader.newInstance(ctsym, jf);
+ for (ClassFile cf : reader.getClassFiles()) {
+ findProfile(cf);
+ }
+ }
+ }
+ }
+ } catch (IOException | ConstantPoolException e) {
+ throw new Error(e);
+ }
+ HashMap<String,Profile> map = new HashMap<>();
+ for (Profile profile : Profile.values()) {
+ for (String pn : profile.packages) {
+ if (!map.containsKey(pn)) {
+ // split packages in the JRE: use the smaller compact
+ map.put(pn, profile);
+ }
+ }
+ for (String pn : profile.proprietaryPkgs) {
+ if (!map.containsKey(pn)) {
+ map.put(pn, profile);
+ }
+ }
+ }
+ return map;
+ }
+ private static final String PROFILE_ANNOTATION = "Ljdk/Profile+Annotation;";
+ private static final String PROPRIETARY_ANNOTATION = "Lsun/Proprietary+Annotation;";
+ private static Profile findProfile(ClassFile cf) throws ConstantPoolException {
+ RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
+ cf.attributes.get(Attribute.RuntimeInvisibleAnnotations);
+ int index = 0;
+ boolean proprietary = false;
+ if (attr != null) {
+ for (int i = 0; i < attr.annotations.length; i++) {
+ Annotation ann = attr.annotations[i];
+ String annType = cf.constant_pool.getUTF8Value(ann.type_index);
+ if (PROFILE_ANNOTATION.equals(annType)) {
+ for (int j = 0; j < ann.num_element_value_pairs; j++) {
+ Annotation.element_value_pair pair = ann.element_value_pairs[j];
+ Primitive_element_value ev = (Primitive_element_value) pair.value;
+ CONSTANT_Integer_info info = (CONSTANT_Integer_info)
+ cf.constant_pool.get(ev.const_value_index);
+ index = info.value;
+ break;
+ }
+ } else if (PROPRIETARY_ANNOTATION.equals(annType)) {
+ proprietary = true;
+ }
+ }
+ }
+
+ Profile p = null; // default
+ switch (index) {
+ case 1:
+ p = Profile.COMPACT1; break;
+ case 2:
+ p = Profile.COMPACT2; break;
+ case 3:
+ p = Profile.COMPACT3; break;
+ case 4:
+ p = Profile.FULL_JRE; break;
+ default:
+ // skip classes with profile=0
+ // Inner classes are not annotated with the profile annotation
+ return null;
+ }
+
+ String name = cf.getName();
+ int i = name.lastIndexOf('/');
+ name = (i > 0) ? name.substring(0, i).replace('/', '.') : "";
+ if (proprietary) {
+ p.proprietaryPkgs.add(name);
+ } else {
+ p.packages.add(name);
+ }
+ return p;
+ }
+
+ private static void initProfilesFromProperties(String path) throws IOException {
+ Properties props = new Properties();
+ try (FileReader reader = new FileReader(path)) {
+ props.load(reader);
+ }
+ for (Profile prof : Profile.values()) {
+ int i = prof.profile;
+ String key = props.getProperty("profile." + i + ".name");
+ if (key == null) {
+ throw new RuntimeException(key + " missing in " + path);
+ }
+ String n = props.getProperty("profile." + i + ".packages");
+ String[] pkgs = n.split("\\s+");
+ for (String p : pkgs) {
+ if (p.isEmpty()) continue;
+ prof.packages.add(p);
+ }
+ }
+ }
+ }
+
+ // for debugging
+ public static void main(String[] args) {
+ if (args.length == 0) {
+ if (Profile.getProfileCount() == 0) {
+ System.err.println("No profile is present in this JDK");
+ }
+ for (Profile p : Profile.values()) {
+ String profileName = p.name;
+ SortedSet<String> set = new TreeSet<>(p.packages);
+ for (String s : set) {
+ // filter out the inner classes that are not annotated with
+ // the profile annotation
+ if (PackageToProfile.map.get(s) == p) {
+ System.out.format("%2d: %-10s %s%n", p.profile, profileName, s);
+ profileName = "";
+ } else {
+ System.err.format("Split package: %s in %s and %s %n",
+ s, PackageToProfile.map.get(s).name, p.name);
+ }
+ }
+ }
+ }
+ for (String pn : args) {
+ System.out.format("%s in %s%n", pn, getProfile(pn));
+ }
+ }
+}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/Profiles.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.jdeps;
-
-import com.sun.tools.classfile.Annotation;
-import com.sun.tools.classfile.Annotation.*;
-import com.sun.tools.classfile.Attribute;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPool.*;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.RuntimeAnnotations_attribute;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.*;
-import java.util.jar.JarFile;
-
-/**
- * Build the profile information from ct.sym if exists.
- */
-class Profiles {
- private static final Map<String,Profile> map = initProfiles();
- /**
- * Returns the name of the profile for the given package name.
- * It returns an empty string if the given package is not in any profile.
- */
- public static String getProfileName(String pn) {
- Profile profile = map.get(pn);
- return (profile != null && profile.packages.contains(pn))
- ? profile.name : "";
- }
-
- public static int getProfileCount() {
- return new HashSet<Profile>(map.values()).size();
- }
-
- private static Map<String,Profile> initProfiles() {
- List<Profile> profiles = new ArrayList<Profile>();
- try {
- String profilesProps = System.getProperty("jdeps.profiles");
- if (profilesProps != null) {
- // for testing for JDK development build where ct.sym doesn't exist
- initProfilesFromProperties(profiles, profilesProps);
- } else {
- Path home = Paths.get(System.getProperty("java.home"));
- if (home.endsWith("jre")) {
- home = home.getParent();
- }
- Path ctsym = home.resolve("lib").resolve("ct.sym");
- if (ctsym.toFile().exists()) {
- // add a default Full JRE
- profiles.add(0, new Profile("Full JRE", 0));
- // parse ct.sym and load information about profiles
- try (JarFile jf = new JarFile(ctsym.toFile())) {
- ClassFileReader reader = ClassFileReader.newInstance(ctsym, jf);
- for (ClassFile cf : reader.getClassFiles()) {
- findProfile(profiles, cf);
- }
- }
-
- // merge the last Profile with the "Full JRE"
- if (profiles.size() > 1) {
- Profile fullJRE = profiles.get(0);
- Profile p = profiles.remove(profiles.size() - 1);
- for (String pn : fullJRE.packages) {
- // The last profile contains the packages determined from ct.sym.
- // Move classes annotated profile==0 or no attribute that are
- // added in the fullJRE profile to either supported or proprietary
- // packages appropriately
- if (p.proprietaryPkgs.contains(pn)) {
- p.proprietaryPkgs.add(pn);
- } else {
- p.packages.add(pn);
- }
- }
- fullJRE.packages.clear();
- fullJRE.proprietaryPkgs.clear();
- fullJRE.packages.addAll(p.packages);
- fullJRE.proprietaryPkgs.addAll(p.proprietaryPkgs);
- }
- }
- }
- } catch (IOException | ConstantPoolException e) {
- throw new Error(e);
- }
- HashMap<String,Profile> map = new HashMap<String,Profile>();
- for (Profile profile : profiles) {
- // Inner classes are not annotated with the profile annotation
- // packages may be in one profile but also appear in the Full JRE
- // Full JRE is always the first element in profiles list and
- // so the map will contain the appropriate Profile
- for (String pn : profile.packages) {
- map.put(pn, profile);
- }
- for (String pn : profile.proprietaryPkgs) {
- map.put(pn, profile);
- }
- }
- return map;
- }
-
- private static final String PROFILE_ANNOTATION = "Ljdk/Profile+Annotation;";
- private static final String PROPRIETARY_ANNOTATION = "Lsun/Proprietary+Annotation;";
- private static Profile findProfile(List<Profile> profiles, ClassFile cf)
- throws ConstantPoolException
- {
- RuntimeAnnotations_attribute attr = (RuntimeAnnotations_attribute)
- cf.attributes.get(Attribute.RuntimeInvisibleAnnotations);
- int index = 0;
- boolean proprietary = false;
- if (attr != null) {
- for (int i = 0; i < attr.annotations.length; i++) {
- Annotation ann = attr.annotations[i];
- String annType = cf.constant_pool.getUTF8Value(ann.type_index);
- if (PROFILE_ANNOTATION.equals(annType)) {
- for (int j = 0; j < ann.num_element_value_pairs; j++) {
- Annotation.element_value_pair pair = ann.element_value_pairs[j];
- Primitive_element_value ev = (Primitive_element_value)pair.value;
- CONSTANT_Integer_info info = (CONSTANT_Integer_info)
- cf.constant_pool.get(ev.const_value_index);
- index = info.value;
- break;
- }
- } else if (PROPRIETARY_ANNOTATION.equals(annType)) {
- proprietary = true;
- }
- }
- if (index >= profiles.size()) {
- Profile p = null;
- for (int i = profiles.size(); i <= index; i++) {
- p = new Profile(i);
- profiles.add(p);
- }
- }
- }
-
- Profile p = profiles.get(index);
- String name = cf.getName();
- int i = name.lastIndexOf('/');
- name = (i > 0) ? name.substring(0, i).replace('/','.') : "";
- if (proprietary) {
- p.proprietaryPkgs.add(name);
- } else {
- p.packages.add(name);
- }
- return p;
- }
-
- private static void initProfilesFromProperties(List<Profile> profiles, String path)
- throws IOException
- {
- Properties props = new Properties();
- try (FileReader reader = new FileReader(path)) {
- props.load(reader);
- }
- int i=1;
- String key;
- while (props.containsKey((key = "profile." + i + ".name"))) {
- Profile profile = new Profile(props.getProperty(key), i);
- profiles.add(profile);
- String n = props.getProperty("profile." + i + ".packages");
- String[] pkgs = n.split("\\s+");
- for (String p : pkgs) {
- if (p.isEmpty()) continue;
- profile.packages.add(p);
- }
- i++;
- }
- }
-
- private static class Profile {
- final String name;
- final int profile;
- final Set<String> packages;
- final Set<String> proprietaryPkgs;
- Profile(int profile) {
- this("compact" + profile, profile);
- }
- Profile(String name, int profile) {
- this.name = name;
- this.profile = profile;
- this.packages = new HashSet<String>();
- this.proprietaryPkgs = new HashSet<String>();
- }
- public String toString() {
- return name;
- }
- }
-
- // for debugging
- public static void main(String[] args) {
- if (args.length == 0) {
- Profile[] profiles = new Profile[getProfileCount()];
- for (Profile p : map.values()) {
- // move the zeroth profile to the last
- int index = p.profile == 0 ? profiles.length-1 : p.profile-1;
- profiles[index] = p;
- }
- for (Profile p : profiles) {
- String profileName = p.name;
- SortedSet<String> set = new TreeSet<String>(p.packages);
- for (String s : set) {
- // filter out the inner classes that are not annotated with
- // the profile annotation
- if (map.get(s) == p) {
- System.out.format("%-10s %s%n", profileName, s);
- profileName = "";
- }
- }
- }
- }
- for (String pn : args) {
- System.out.format("%s in %s%n", pn, getProfileName(pn));
- }
- }
-}
--- a/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/com/sun/tools/jdeps/resources/jdeps.properties Mon Oct 28 12:28:57 2013 -0700
@@ -5,46 +5,63 @@
main.usage=\
Usage: {0} <options> <classes...>\n\
where <classes> can be a pathname to a .class file, a directory, a JAR file,\n\
-or a fully-qualified classname or wildcard "*". Possible options include:
+or a fully-qualified class name. Possible options include:
error.prefix=Error:
warn.prefix=Warning:
main.opt.h=\
-\ -h -? --help Print this usage message
+\ -h -? -help Print this usage message
main.opt.version=\
-\ --version Version information
-
-main.opt.V=\
-\ -V <level> --verbose-level=<level> Print package-level or class-level dependencies\n\
-\ Valid levels are: "package" and "class"
+\ -version Version information
main.opt.v=\
-\ -v --verbose Print additional information
+\ -v -verbose Print all class level dependencies\n\
+\ -verbose:package Print package-level dependencies excluding\n\
+\ dependencies within the same archive\n\
+\ -verbose:class Print class-level dependencies excluding\n\
+\ dependencies within the same archive
main.opt.s=\
-\ -s --summary Print dependency summary only
+\ -s -summary Print dependency summary only
main.opt.p=\
-\ -p <pkg name> --package=<pkg name> Restrict analysis to classes in this package\n\
-\ (may be given multiple times)
+\ -p <pkgname> -package <pkgname> Finds dependences in the given package\n\
+\ (may be given multiple times)
main.opt.e=\
-\ -e <regex> --regex=<regex> Restrict analysis to packages matching pattern\n\
-\ (-p and -e are exclusive)
+\ -e <regex> -regex <regex> Finds dependences in packages matching pattern\n\
+\ (-p and -e are exclusive)
+
+main.opt.include=\
+\ -include <regex> Restrict analysis to classes matching pattern\n\
+\ This option filters the list of classes to\n\
+\ be analyzed. It can be used together with\n\
+\ -p and -e which apply pattern to the dependences
main.opt.P=\
-\ -P --profile Show profile or the file containing a package
+\ -P -profile Show profile or the file containing a package
-main.opt.c=\
-\ -c <path> --classpath=<path> Specify where to find class files
+main.opt.cp=\
+\ -cp <path> -classpath <path> Specify where to find class files
main.opt.R=\
-\ -R --recursive Recursively traverse all dependencies
+\ -R -recursive Recursively traverse all dependencies
-main.opt.d=\
-\ -d <depth> --depth=<depth> Specify the depth of the transitive dependency analysis
+main.opt.apionly=\
+\ -apionly Restrict analysis to APIs i.e. dependences\n\
+\ from the signature of public and protected\n\
+\ members of public classes including field\n\
+\ type, method parameter types, returned type,\n\
+\ checked exception types etc
+
+main.opt.dotoutput=\
+\ -dotoutput <dir> Destination directory for DOT file output
+
+main.opt.depth=\
+\ -depth=<depth> Specify the depth of the transitive\n\
+\ dependency analysis
err.unknown.option=unknown option: {0}
err.missing.arg=no value given for {0}
@@ -53,6 +70,7 @@
err.option.after.class=option must be specified before classes: {0}
err.option.unsupported={0} not supported: {1}
err.profiles.msg=No profile information
+err.dot.output.path=invalid path: {0}
warn.invalid.arg=Invalid classname or pathname not exist: {0}
warn.split.package=package {0} defined in {1} {2}
--- a/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/javax/lang/model/AnnotatedConstruct.java Mon Oct 28 12:28:57 2013 -0700
@@ -221,8 +221,8 @@
* type if present on this construct, else an empty array
*
* @see #getAnnotationMirrors()
- * @see #getAnnotation(java.lang.Class)
- * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType
+ * @see #getAnnotation(Class)
+ * @see java.lang.reflect.AnnotatedElement#getAnnotationsByType(Class)
* @see EnumConstantNotPresentException
* @see AnnotationTypeMismatchException
* @see IncompleteAnnotationException
--- a/langtools/src/share/classes/javax/lang/model/overview.html Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/javax/lang/model/overview.html Mon Oct 28 12:28:57 2013 -0700
@@ -1,8 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
<!--
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
@@ -25,7 +23,9 @@
or visit www.oracle.com if you need additional information or have any
questions.
-->
-
+<html>
+<head>
+<title>javax.lang.model</title>
</head>
<body bgcolor="white">
--- a/langtools/src/share/classes/javax/tools/overview.html Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/src/share/classes/javax/tools/overview.html Mon Oct 28 12:28:57 2013 -0700
@@ -1,3 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!--
+Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+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.
+-->
+
+<html>
+<head>
+<title>javax.tools</title>
+</head>
<body>
<p>
@@ -21,3 +51,4 @@
</ul>
</body>
+</html>
--- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638136 7198273
+ * @bug 4638136 7198273 8025633
* @summary Add ability to skip over nav bar for accessibility
* @author dkramer
* @run main AccessSkipNav
@@ -86,20 +86,20 @@
// Testing only for the presence of the <a href> and <a name>
// Top navbar <a href>
- { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a>",
+ { "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Top navbar <a name>
- { "<a name=\"skip-navbar_top\">" + LS +
+ { "<a name=\"skip.navbar.top\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a href>
- { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
+ { "<a href=\"#skip.navbar.bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a name>
- { "<a name=\"skip-navbar_bottom\">" + LS +
+ { "<a name=\"skip.navbar.bottom\">" + LS +
"<!-- -->" + LS + "</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" }
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025633
+ * @summary Test for valid name attribute in HTML anchors.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestAnchorNames
+ * @run main TestAnchorNames
+ */
+
+public class TestAnchorNames extends JavadocTester {
+
+ private static final String BUG_ID = "8025633";
+
+ //Input for string search tests.
+ private static final String[][] TEST = {
+
+ //Test some section markers and links to these markers
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"skip.navbar.top\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#skip.navbar.top\" title=\"Skip navigation links\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"nested.class.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#nested.class.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#method.summary\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"field.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#field.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"constructor.detail\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"#constructor.detail\">"
+ },
+
+ //Test some members and link to these members
+
+ //The marker for this appears in the serialized-form.html which we will
+ //test below
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../serialized-form.html#pkg1.RegClass\">"
+ },
+ //Test some fields
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z:D_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:D_\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z:Dfield\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z:Dfield\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"fieldInCla:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#fieldInCla:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"S_:D:D:D:D:DINT\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#method:D:D\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a name=\"Z:Z_field_In_Class\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+ },
+ //Test constructor
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"RegClass-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#RegClass-java.lang.String-int-\">"
+ },
+ //Test some methods
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_methodInClass-java.lang.String-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClass-java.lang.String-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"method--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#method--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"foo-java.util.Map-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#foo-java.util.Map-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodInCla:Ds-java.lang.String:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodInCla:Ds-java.lang.String:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"Z:Z_methodInClas:D-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#Z:Z_methodInClas:D-java.lang.String-int-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodD-pkg1.RegClass.:DA-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.:DA-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a name=\"methodD-pkg1.RegClass.D:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ "<a href=\"../pkg1/RegClass.html#methodD-pkg1.RegClass.D:A-\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a name=\"Z:Z:Dmethod_In_Class--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "DeprMemClass.html",
+ "<a href=\"../pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+ },
+
+ //Test enum
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+ "<a name=\"Z:Z:DFLD2\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.Te$t_Enum.html",
+ "<a href=\"../pkg1/RegClass.Te$t_Enum.html#Z:Z:DFLD2\">"
+ },
+
+ //Test nested class
+
+ {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+ "<a name=\"RegClass._NestedClas:D--\">"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html",
+ "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">"
+ },
+
+ //Test class use page
+
+ {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "DeprMemClass.html",
+ "<a href=\"../../pkg1/RegClass.html#d____mc\">"
+ },
+
+ //Test deprecated list page
+
+ {BUG_ID + FS + "deprecated-list.html",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z_field_In_Class\">"
+ },
+ {BUG_ID + FS + "deprecated-list.html",
+ "<a href=\"pkg1/DeprMemClass.html#Z:Z:Dmethod_In_Class--\">"
+ },
+
+ //Test constant values page
+
+ {BUG_ID + FS + "constant-values.html",
+ "<a href=\"pkg1/RegClass.html#S_:D:D:D:D:DINT\">"
+ },
+
+ //Test serialized form page
+
+ //This is the marker for the link that appears in the pkg1.RegClass.html page
+ {BUG_ID + FS + "serialized-form.html",
+ "<a name=\"pkg1.RegClass\">"
+ },
+
+ //Test member name index page
+
+ {BUG_ID + FS + "index-all.html",
+ "<a name=\"I:Z:Z:D\">"
+ },
+ {BUG_ID + FS + "index-all.html",
+ "<a href=\"#I:Z:Z:D\">$"
+ },
+ {BUG_ID + FS + "index-all.html",
+ "<a href=\"#I:Z:Z_\">_"
+ }
+ };
+
+ private static final String[][] NEGATED_TEST = {
+ //The marker name conversion should only affect HTML anchors. It should not
+ //affect the lables.
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z_"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z:Dfield"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " Z:Z_field_In_Class"
+ },
+ {BUG_ID + FS + "pkg1" + FS + "RegClass.html",
+ " S_:D:D:D:D:DINT"
+ },
+ };
+
+ private static final String[] ARGS = new String[] {
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1"
+ };
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) throws Exception {
+ TestAnchorNames tester = new TestAnchorNames();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/DeprMemClass.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class DeprMemClass
+{
+ /**
+ * Field in the class.
+ * @deprecated Do not use this field.
+ */
+ public int _field_In_Class;
+
+ public int _fld;
+
+ /**
+ * Method in the class.
+ * @deprecated Do not use this method.
+ */
+ public void $method_In_Class() {
+ }
+
+ public void regularMethod() {
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/pkg1/RegClass.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,186 @@
+/*
+ * 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 pkg1;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * @serial This is the serial tag's comment.
+ */
+public class RegClass implements Serializable {
+
+ /**
+ * Normal field in class.
+ */
+ public String field;
+
+ /**
+ * Normal field in class.
+ */
+ public String method$$;
+
+ /**
+ * Filed staring with $.
+ */
+ public String $field;
+
+ /**
+ * Filed staring with underscore.
+ */
+ public String _field;
+
+ /**
+ * Serial field
+ * @serial
+ */
+ public boolean t_e$t;
+
+ /**
+ * Field in class with a $ in the name.
+ */
+ public String fieldInCla$$;
+
+ /**
+ * Field name as just an underscore.
+ */
+ public int _;
+
+ /**
+ * Field name as just a $.
+ */
+ public int $;
+
+ /**
+ * Field name with underscore and $.
+ */
+ public int _$;
+
+ /**
+ * Field name with $ and underscore.
+ */
+ public int $_;
+
+ /**
+ * An array.
+ */
+ public int arr[];
+
+ /**
+ * Another array.
+ */
+ public int[] arr1;
+
+ /**
+ * A constant field.
+ */
+ public static final int S_$$$$$INT = 0;
+
+ /**
+ * Another field.
+ */
+ public DeprMemClass d____mc;
+
+ /**
+ * An enum.
+ */
+ public static enum Te$t_Enum {
+ FLD_1,
+ $FLD2
+ };
+
+ /**
+ * A constructor.
+ */
+ public RegClass(String p, int i) {
+ }
+
+ /**
+ * Method in Class.
+ * @param p a string
+ */
+ public void _methodInClass(String p) {
+ }
+
+ /**
+ * Method in Class.
+ * @param p a string
+ * @param i an int
+ */
+ public void _methodInClas$(String p, int i) {
+ }
+
+ /**
+ * Method with $ in the name.
+ * @param p a string array
+ */
+ public void methodInCla$s(String[] p) {
+ }
+
+ /**
+ * Method with D[] as a parameter.
+ * @param p an array of D
+ */
+ public void methodD(D[] p) {
+ }
+
+ /**
+ * Method with $A as a parameter.
+ * @param p an object of $A
+ */
+ public void methodD($A p) {
+ }
+
+ /**
+ * Serial test.
+ * @serialData This is a serial data comment.
+ * @return null
+ */
+ protected Object $readResolve(){return null;}
+
+ /**
+ * Simple method.
+ */
+ public void method() {}
+
+ /**
+ * Generics.
+ */
+ public static <A> void foo(Map<A, Map<A, A>> map) {}
+
+ /**
+ * A nested class.
+ */
+ public class _NestedClas$ {}
+
+ /**
+ * Nested class D.
+ */
+ class D {}
+
+ /**
+ * Nested class $A.
+ */
+ class $A {}
+}
--- a/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testAnnotationOptional/TestAnnotationOptional.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,8 @@
/*
* @test
- * @summary Make sure that annotations types with optional elements has
+ * @bug 8025633
+ * @summary Make sure that annotations types with optional elements have
* element headers
* @author Mahmood Ali
* @library ../lib/
@@ -45,7 +46,7 @@
//Input for string search tests.
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "AnnotationOptional.html",
- "<a name=\"annotation_type_element_detail\">"
+ "<a name=\"annotation.type.element.detail\">"
}
};
--- a/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testAnnotationTypes/TestAnnotationTypes.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4973609 8015249
+ * @bug 4973609 8015249 8025633
* @summary Make sure that annotation types with 0 members does not have
* extra HR tags.
* @author jamieh
@@ -45,11 +45,11 @@
//Input for string search tests.
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
- "<li>Summary: </li>" + NL + "<li><a href=\"#annotation_type_" +
- "field_summary\">Field</a> | </li>"},
+ "<li>Summary: </li>" + NL + "<li><a href=\"#annotation.type." +
+ "field.summary\">Field</a> | </li>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
- "<li>Detail: </li>" + NL + "<li><a href=\"#annotation_type_" +
- "field_detail\">Field</a> | </li>"},
+ "<li>Detail: </li>" + NL + "<li><a href=\"#annotation.type." +
+ "field.detail\">Field</a> | </li>"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
"<!-- =========== ANNOTATION TYPE FIELD SUMMARY =========== -->"},
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeField.html",
--- a/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testClassCrossReferences/TestClassCrossReferences.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4652655 4857717
+ * @bug 4652655 4857717 8025633
* @summary This test verifies that class cross references work properly.
* @author jamieh
* @library ../lib/
@@ -45,7 +45,7 @@
"<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigDecimal.html?is-external=true\" " +
"title=\"class or interface in java.math\"><code>Link to external class BigDecimal</code></a>"},
{BUG_ID + FS + "C.html",
- "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd(java.math.BigInteger)\" " +
+ "<a href=\"http://java.sun.com/j2se/1.4/docs/api/java/math/BigInteger.html?is-external=true#gcd-java.math.BigInteger-\" " +
"title=\"class or interface in java.math\"><code>Link to external member gcd</code></a>"},
{BUG_ID + FS + "C.html",
"<dl>" + NL + "<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
--- a/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testExternalOverridenMethod/TestExternalOverridenMethod.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,14 +23,13 @@
/*
* @test
- * @bug 4857717
+ * @bug 4857717 8025633
* @summary Test to make sure that externally overriden and implemented methods
* are documented properly. The method should still include "implements" or
* "overrides" documentation even though the method is external.
* @author jamieh
* @library ../lib/
- * @build JavadocTester
- * @build TestExternalOverridenMethod
+ * @build JavadocTester TestExternalOverridenMethod
* @run main TestExternalOverridenMethod
*/
@@ -40,13 +39,13 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "XReader.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read()\" " +
+ "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true#read--\" " +
"title=\"class or interface in java.io\">read</a></code> in class <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/FilterReader.html?is-external=true\" " +
"title=\"class or interface in java.io\">FilterReader</a></code></dd>"},
{BUG_ID + FS + "pkg" + FS + "XReader.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt()\" " +
+ "<dd><code><a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true#readInt--\" " +
"title=\"class or interface in java.io\">readInt</a></code> in interface <code>" +
"<a href=\"http://java.sun.com/j2se/1.4.1/docs/api/java/io/DataInput.html?is-external=true\" " +
"title=\"class or interface in java.io\">DataInput</a></code></dd>"}};
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4663254 8016328
+ * @bug 4663254 8016328 8025633
* @summary Verify that spaces do not appear in hrefs and anchors.
* @author jamieh
* @library ../lib/
@@ -46,31 +46,31 @@
private static final String[][] TEST = {
//External link.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait(long,%20int)\""
+ "href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true#wait-long-int-\""
},
//Member summary table link.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\""
+ "href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\""
},
//Anchor test.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+ "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
//Backward compatibility anchor test.
{BUG_ID + FS + "pkg" + FS + "C1.html",
- "<a name=\"method(int, int, java.util.ArrayList)\">" + NL +
+ "<a name=\"method-int-int-java.util.ArrayList-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
//{@link} test.
{BUG_ID + FS + "pkg" + FS + "C2.html",
- "Link: <a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+ "Link: <a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//@see test.
{BUG_ID + FS + "pkg" + FS + "C2.html",
- "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method(int,%20int,%20java.util.ArrayList)\">"
+ "See Also:</span></dt>" + NL + "<dd><a href=\"../pkg/C1.html#method-int-int-java.util.ArrayList-\">"
},
//Header does not link to the page itself.
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 6786690 6820360
+ * @bug 6786690 6820360 8025633
* @summary This test verifies the nesting of definition list tags.
* @author Bhavesh Patel
* @library ../lib/
@@ -64,7 +64,7 @@
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL +
"<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
- "<a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>"+ NL + "<dt><span class=\"strong\">Parameters:</span></dt>" + NL + "<dd><code>title" +
"</code> - the title</dd>" + NL + "<dd><code>test</code> - boolean value" +
@@ -79,11 +79,11 @@
"if decorations are to be enabled.</dd>" + NL + "<dt><span class=\"strong\">Since:" +
"</span></dt>" + NL + "<dd>1.4</dd>" + NL +
"<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd>" +
- "<a href=\"../pkg1/C1.html#readObject()\"><code>readObject()" +
+ "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
"</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL +
"<dd><code>java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:" +
- "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C2.html", "<dl>" + NL + "<dt><span class=\"strong\">Parameters:" +
"</span></dt>" + NL + "<dd><code>set</code> - boolean</dd>" + NL + "<dt><span class=\"strong\">" +
@@ -91,20 +91,20 @@
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -141,29 +141,29 @@
" if no decorations are" + NL + " to be enabled;" + NL +
" <code>false</code> if decorations are to be enabled." +
"</dd>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL + "<dd>1.4</dd>" + NL +
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject()\">" +
+ "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
"<code>readObject()</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "pkg1" + FS + "C1.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>java.io.IOException</code></dd>" + NL + "<dt>" +
- "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated(boolean)\">" +
+ "<span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL + "<dt><span class=\"strong\">Throws:</span>" +
"</dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 is " +
"undecorated.</div>" + NL + " " + NL + "<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:" +
@@ -188,12 +188,12 @@
{BUG_ID + FS + "serialized-form.html", "<pre>boolean " +
"undecorated</pre>" + NL + "<div class=\"block\"><span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version" +
" 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
// Test for valid HTML generation which should not comprise of empty
--- a/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testInterface/TestInterface.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4682448 4947464 5029946
+ * @bug 4682448 4947464 5029946 8025633
* @summary Verify that the public modifier does not show up in the
* documentation for public methods, as recommended by the JLS.
* If A implements I and B extends A, B should be in the list of
@@ -84,7 +84,7 @@
//Make sure "Specified By" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/Interface.html#method()\">method</a>" +
+ "<dd><code><a href=\"../pkg/Interface.html#method--\">method</a>" +
"</code> in interface <code>" +
"<a href=\"../pkg/Interface.html\" title=\"interface in pkg\">" +
"Interface</a><<a href=\"../pkg/Child.html\" title=\"type parameter in Child\">" +
@@ -93,7 +93,7 @@
//Make sure "Overrides" has substituted type parameters.
{BUG_ID + FS + "pkg" + FS + "Child.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/Parent.html#method()\">method</a>" +
+ "<dd><code><a href=\"../pkg/Parent.html#method--\">method</a>" +
"</code> in class <code><a href=\"../pkg/Parent.html\" " +
"title=\"class in pkg\">Parent</a><<a href=\"../pkg/Child.html\" " +
"title=\"type parameter in Child\">T</a>></code></dd>"
--- a/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testJavaFX/TestJavaFX.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 7112427 8012295
+ * @bug 7112427 8012295 8025633
* @summary Test of the JavaFX doclet features.
* @author jvalenta
* @library ../lib/
@@ -38,8 +38,8 @@
private static final String[][] TEST =
new String[][] {
{"./" + BUG_ID + "/C.html",
- "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate()\"><code>getRate()</code></a>, " + NL +
- "<a href=\"C.html#setRate(double)\"><code>setRate(double)</code></a></dd>"},
+ "<dt><span class=\"strong\">See Also:</span></dt>" + NL + "<dd><a href=\"C.html#getRate--\"><code>getRate()</code></a>, " + NL +
+ "<a href=\"C.html#setRate-double-\"><code>setRate(double)</code></a></dd>"},
{"./" + BUG_ID + "/C.html",
"<pre>public final void setRate(double value)</pre>" + NL +
"<div class=\"block\">Sets the value of the property rate.</div>" + NL +
@@ -63,7 +63,7 @@
{"./" + BUG_ID + "/C.html",
"<span class=\"strong\">Property description:</span>"},
{"./" + BUG_ID + "/C.html",
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty()\">setTestMethodProperty</a></span>()</code> </td>" },
+ "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"C.html#setTestMethodProperty--\">setTestMethodProperty</a></span>()</code> </td>" },
{"./" + BUG_ID + "/C.html",
"<h4>isPaused</h4>" + NL +
"<pre>public final double isPaused()</pre>" + NL +
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4732864 6280605 7064544 8014636 8016328
+ * @bug 4732864 6280605 7064544 8014636 8016328 8025633
* @summary Make sure that you can link from one member to another using
* non-qualified name, furthermore, ensure the right one is linked.
* @author jamieh
@@ -49,9 +49,9 @@
"Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
- " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
- " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
- " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC,%20pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
+ " Qualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
+ " Unqualified Link: <a href=\"../pkg/C.html#method-pkg.C.InnerC-pkg.C.InnerC2-\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
},
{BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
--- a/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testMemberInheritence/TestMemberInheritence.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638588 4635809 6256068 6270645
+ * @bug 4638588 4635809 6256068 6270645 8025633
* @summary Test to make sure that members are inherited properly in the Javadoc.
* Verify that inheritence labels are correct.
* @author jamieh
@@ -44,7 +44,7 @@
//Public method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#pubMethod()\">"},
+ "<a href=\"../pkg/BaseClass.html#pubMethod--\">"},
//Public inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -56,7 +56,7 @@
//Protected method should be inherited
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#proMethod()\">"},
+ "<a href=\"../pkg/BaseClass.html#proMethod--\">"},
//Protected inner class should be inherited.
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
@@ -73,14 +73,14 @@
// Test overriding/implementing methods with generic parameters.
{BUG_ID + FS + "pkg" + FS + "BaseClass.html",
"<dl>" + NL + "<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation(java.lang.Class)\">" +
+ "<dd><code><a href=\"../pkg/BaseInterface.html#getAnnotation-java.lang.Class-\">" +
"getAnnotation</a></code> in interface <code>" +
"<a href=\"../pkg/BaseInterface.html\" title=\"interface in pkg\">" +
"BaseInterface</a></code></dd>" + NL + "</dl>"},
// Test diamond inheritence member summary (6256068)
{BUG_ID + FS + "diamond" + FS + "Z.html",
- "<code><a href=\"../diamond/A.html#aMethod()\">aMethod</a></code>"},
+ "<code><a href=\"../diamond/A.html#aMethod--\">aMethod</a></code>"},
// Test that doc is inherited from closed parent (6270645)
{BUG_ID + FS + "inheritDist" + FS + "C.html",
@@ -90,7 +90,7 @@
private static final String[][] NEGATED_TEST = {
{BUG_ID + FS + "pkg" + FS + "SubClass.html",
- "<a href=\"../pkg/BaseClass.html#staticMethod()\">staticMethod</a></code>"},
+ "<a href=\"../pkg/BaseClass.html#staticMethod--\">staticMethod</a></code>"},
};
private static final String[] ARGS =
new String[] {
--- a/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testMemberSummary/TestMemberSummary.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4951228 6290760
+ * @bug 4951228 6290760 8025633
* @summary Test the case where the overriden method returns a different
* type than the method in the child class. Make sure the
* documentation is inherited but the return type isn't.
@@ -49,7 +49,7 @@
// Check return type in member summary.
{BUG_ID + FS + "pkg" + FS + "PublicChild.html",
"<code><a href=\"../pkg/PublicChild.html\" title=\"class in pkg\">PublicChild</a></code></td>" + NL +
- "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest()\">" +
+ "<td class=\"colLast\"><code><span class=\"strong\"><a href=\"../pkg/PublicChild.html#returnTypeTest--\">" +
"returnTypeTest</a></span>()</code>"
},
// Check return type in member detail.
@@ -60,9 +60,9 @@
// Legacy anchor dimensions (6290760)
{BUG_ID + FS + "pkg2" + FS + "A.html",
- "<a name=\"f(java.lang.Object[])\">" + NL +
+ "<a name=\"f-java.lang.Object:A-\">" + NL +
"<!-- -->" + NL +
- "</a><a name=\"f(T[])\">" + NL +
+ "</a><a name=\"f-T:A-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4131628 4664607 7025314 8023700 7198273
+ * @bug 4131628 4664607 7025314 8023700 7198273 8025633
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
@@ -60,7 +60,7 @@
{BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
// Test for 4664607
{BUG_ID + FS + "pkg" + FS + "I.html",
- "<div class=\"skipNav\"><a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar_top_firstrow\">" + NL +
+ "<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar.top.firstrow\">" + NL +
"<!-- -->" + NL + "</a>"}
};
private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testNestedGenerics/TestNestedGenerics.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6758050
+ * @bug 6758050 8025633
* @summary Test HTML output for nested generic types.
* @author bpatel
* @library ../lib/
@@ -46,7 +46,7 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg" + FS + "NestedGenerics.html",
"<div class=\"block\">Contains <a " +
- "href=\"../pkg/NestedGenerics.html#foo(java.util.Map)\"><code>foo" +
+ "href=\"../pkg/NestedGenerics.html#foo-java.util.Map-\"><code>foo" +
"(java.util.Map<A, java.util.Map<A, A>>)</code></a></div>"
}
};
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344
+ * @bug 4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344 8025633
* @summary Run Javadoc on a set of source files that demonstrate new
* language features. Check the output to ensure that the new
* language features are properly documented.
@@ -145,7 +145,7 @@
//=================================
{BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int... i)"},
{BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[][]... i)"},
- {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "(int[]...)"},
+ {BUG_ID + FS + "pkg" + FS + "VarArgs.html", "-int:A...-"},
{BUG_ID + FS + "pkg" + FS + "VarArgs.html",
"<a href=\"../pkg/TypeParameters.html\" title=\"class in pkg\">" +
"TypeParameters</a>... t"},
@@ -156,13 +156,13 @@
//Make sure the summary links are correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"<li>Summary: </li>" + NL + "<li>Field | </li>" + NL +
- "<li><a href=\"#annotation_type_required_element_summary\">" +
+ "<li><a href=\"#annotation.type.required.element.summary\">" +
"Required</a> | </li>" + NL + "<li>" +
- "<a href=\"#annotation_type_optional_element_summary\">Optional</a></li>"},
+ "<a href=\"#annotation.type.optional.element.summary\">Optional</a></li>"},
//Make sure the detail links are correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"<li>Detail: </li>" + NL + "<li>Field | </li>" + NL +
- "<li><a href=\"#annotation_type_element_detail\">Element</a></li>"},
+ "<li><a href=\"#annotation.type.element.detail\">Element</a></li>"},
//Make sure the heading is correct.
{BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
"Annotation Type AnnotationType</h2>"},
@@ -188,16 +188,16 @@
//PACKAGE
{BUG_ID + FS + "pkg" + FS + "package-summary.html",
- "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"Package Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)"},
+ "<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"Package Annotation\"," + NL +
+ " <a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)"},
//CLASS
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Class Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public class <span class=\"strong\">" +
"AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
@@ -205,36 +205,36 @@
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Field Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public int field</pre>"},
//CONSTRUCTOR
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Constructor Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public AnnotationTypeUsage()</pre>"},
//METHOD
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre><a href=\"../pkg/AnnotationType.html\" " +
"title=\"annotation in pkg\">@AnnotationType</a>(" +
- "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
+ "<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>" +
"=\"Method Annotation\"," + NL +
- " <a href=\"../pkg/AnnotationType.html#required()\">" +
+ " <a href=\"../pkg/AnnotationType.html#required--\">" +
"required</a>=1994)" + NL + "public void method()</pre>"},
//METHOD PARAMS
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre>public void methodWithParams(" +
"<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+ "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
"optional</a>=\"Parameter Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
" int documented," + NL +
" int undocmented)</pre>"},
@@ -242,9 +242,9 @@
{BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
"<pre>public AnnotationTypeUsage(<a " +
"href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">" +
- "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
+ "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">" +
"optional</a>=\"Constructor Param Annotation\",<a " +
- "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
+ "href=\"../pkg/AnnotationType.html#required--\">required</a>=1994)" + NL +
" int documented," + NL +
" int undocmented)</pre>"},
@@ -254,43 +254,43 @@
//Integer
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
//Double
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#d()\">d</a>=3.14,"},
+ "<a href=\"../pkg1/A.html#d--\">d</a>=3.14,"},
//Boolean
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#b()\">b</a>=true,"},
+ "<a href=\"../pkg1/A.html#b--\">b</a>=true,"},
//String
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#s()\">s</a>=\"sigh\","},
+ "<a href=\"../pkg1/A.html#s--\">s</a>=\"sigh\","},
//Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#c()\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
+ "<a href=\"../pkg1/A.html#c--\">c</a>=<a href=\"../pkg2/Foo.html\" title=\"class in pkg2\">Foo.class</a>,"},
//Bounded Class
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#w()\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
+ "<a href=\"../pkg1/A.html#w--\">w</a>=<a href=\"../pkg/TypeParameterSubClass.html\" title=\"class in pkg\">TypeParameterSubClass.class</a>,"},
//Enum
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#e()\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
+ "<a href=\"../pkg1/A.html#e--\">e</a>=<a href=\"../pkg/Coin.html#Penny\">Penny</a>,"},
//Annotation Type
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#a()\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required()\">required</a>=1994),"},
+ "<a href=\"../pkg1/A.html#a--\">a</a>=<a href=\"../pkg/AnnotationType.html\" title=\"annotation in pkg\">@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional--\">optional</a>=\"foo\",<a href=\"../pkg/AnnotationType.html#required--\">required</a>=1994),"},
//String Array
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#sa()\">sa</a>={\"up\",\"down\"},"},
+ "<a href=\"../pkg1/A.html#sa--\">sa</a>={\"up\",\"down\"},"},
//Primitive
{BUG_ID + FS + "pkg1" + FS + "B.html",
- "<a href=\"../pkg1/A.html#primitiveClassTest()\">primitiveClassTest</a>=boolean.class,"},
+ "<a href=\"../pkg1/A.html#primitiveClassTest--\">primitiveClassTest</a>=boolean.class,"},
//XXX: Add array test case after this if fixed:
//5020899: Incorrect internal representation of class-valued annotation elements
@@ -335,7 +335,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest1." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest1.html#method(T)\">method</a></span>" +
+ "ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
@@ -388,7 +388,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
"<td class=\"colLast\"><span class=\"strong\">" +
"ClassUseTest1.</span><code><span class=\"strong\"><a href=\"../../" +
- "pkg2/ClassUseTest1.html#method(T)\">method</a></span>" +
+ "pkg2/ClassUseTest1.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
@@ -417,7 +417,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method(T)\">method</a></span>" +
+ "ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
@@ -472,7 +472,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest2." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/" +
- "ClassUseTest2.html#method(T)\">method</a></span>" +
+ "ClassUseTest2.html#method-T-\">method</a></span>" +
"(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
@@ -517,7 +517,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3" +
".</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(T)\">method</a></span>(T t)</code> </td>"
+ "html#method-T-\">method</a></span>(T t)</code> </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
"<td class=\"colFirst\"><code><T extends <a href=\"../" +
@@ -554,7 +554,7 @@
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(T)\">method</a></span>(T t)</code>" +
+ "html#method-T-\">method</a></span>(T t)</code>" +
" </td>"
},
{BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
@@ -588,7 +588,7 @@
"<td class=\"colFirst\"><code>void</code></td>" + NL +
"<td class=\"colLast\"><span class=\"strong\">ClassUseTest3." +
"</span><code><span class=\"strong\"><a href=\"../../pkg2/ClassUseTest3." +
- "html#method(java.util.Set)\">method</a></span>(java." +
+ "html#method-java.util.Set-\">method</a></span>(java." +
"util.Set<<a href=\"../../pkg2/Foo4.html\" title=\"" +
"class in pkg2\">Foo4</a>> p)</code> </td>" + NL +
"</tr>" + NL + "</tbody>"
@@ -663,14 +663,14 @@
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+ "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
//=================================
// TYPE PARAMETER IN INDEX
//=================================
{BUG_ID + FS + "index-all.html",
- "<span class=\"strong\"><a href=\"pkg2/Foo.html#method(java.util.Vector)\">" +
+ "<span class=\"strong\"><a href=\"pkg2/Foo.html#method-java.util.Vector-\">" +
"method(Vector<Object>)</a></span>"
},
};
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenMethodDocCopy.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4368820
+ * @bug 4368820 8025633
* @summary Inherited comment should link directly to member, not just
* class
* @author jamieh
@@ -47,7 +47,7 @@
private static final String[][] TEST = {
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<span class=\"strong\">Description copied from class: <code>" +
- "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy()\">" +
+ "<a href=\"../pkg1/BaseClass.html#overridenMethodWithDocsToCopy--\">" +
"BaseClass</a></code></span>"
}
};
--- a/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testOverridenMethods/TestOverridenPrivateMethodsWithPackageFlag.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4634891
+ * @bug 4634891 8025633
* @summary Determine if overriden methods are properly documented when
* -protected (default) visibility flag is used.
* @author jamieh
@@ -41,14 +41,14 @@
//The public method should be overriden
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
//The public method in different package should be overriden
{BUG_ID + FS + "pkg2" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#publicMethod--\">" +
"publicMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"},
@@ -56,7 +56,7 @@
//package.
{BUG_ID + FS + "pkg1" + FS + "SubClass.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod()\">" +
+ "<dd><code><a href=\"../pkg1/BaseClass.html#packagePrivateMethod--\">" +
"packagePrivateMethod</a></code> in class <code>" +
"<a href=\"../pkg1/BaseClass.html\" title=\"class in pkg1\">BaseClass</a></code></dd>"}
};
--- a/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4780441 4874845 4978816 8014017 8016328
+ * @bug 4780441 4874845 4978816 8014017 8016328 8025633
* @summary Make sure that when the -private flag is not used, members
* inherited from package private class are documented in the child.
*
@@ -66,7 +66,7 @@
// Method inheritence from non-public superclass.
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicChild.html",
- "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent(int)\">" +
+ "<a href=\"../pkg/PublicChild.html#methodInheritedFromParent-int-\">" +
"methodInheritedFromParent</a>"
},
@@ -78,7 +78,7 @@
// Method inheritence from non-public superinterface.
{BUG_ID + "-1" + FS + "pkg" + FS + "PublicInterface.html",
- "<a href=\"../pkg/PublicInterface.html#methodInterface(int)\">" +
+ "<a href=\"../pkg/PublicInterface.html#methodInterface-int-\">" +
"methodInterface</a>"
},
@@ -139,7 +139,7 @@
//Do not inherit private interface method with generic parameters.
//This method has been implemented.
{BUG_ID + "-1" + FS + "pkg2" + FS + "C.html",
- "<span class=\"strong\"><a href=\"../pkg2/I.html#hello(T)\">hello</a></span>"},
+ "<span class=\"strong\"><a href=\"../pkg2/I.html#hello-T-\">hello</a></span>"},
};
// Test output when -private flag is used.
@@ -171,20 +171,20 @@
"PrivateParent</a>"
},
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
- "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent(int)\">" +
+ "<a href=\"../pkg/PrivateParent.html#methodInheritedFromParent-int-\">" +
"methodInheritedFromParent</a>"
},
// Should document that a method overrides method from private class.
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
"<dt><span class=\"strong\">Overrides:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent(char[],%20int,%20T,%20V,%20java.util.List)\">" +
+ "<dd><code><a href=\"../pkg/PrivateParent.html#methodOverridenFromParent-char:A-int-T-V-java.util.List-\">" +
"methodOverridenFromParent</a></code> in class <code>" +
"<a href=\"../pkg/PrivateParent.html\" title=\"class in pkg\">" +
"PrivateParent</a></code></dd>"},
// Should document that a method is specified by private interface.
{BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+ "<dd><code><a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
"methodInterface</a></code> in interface <code>" +
"<a href=\"../pkg/PrivateInterface.html\" title=\"interface in pkg\">" +
"PrivateInterface</a></code></dd>"},
@@ -195,7 +195,7 @@
"PrivateInterface</a>"
},
{BUG_ID + "-2" + FS + "pkg" + FS + "PrivateInterface.html",
- "<a href=\"../pkg/PrivateInterface.html#methodInterface(int)\">" +
+ "<a href=\"../pkg/PrivateInterface.html#methodInterface-int-\">" +
"methodInterface</a>"
},
// Should mention that any documentation was copied.
@@ -228,11 +228,11 @@
//with generic parameters has been implemented.
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
"<span class=\"strong\">Description copied from interface: <code>" +
- "<a href=\"../pkg2/I.html#hello(T)\">I</a></code></span>"},
+ "<a href=\"../pkg2/I.html#hello-T-\">I</a></code></span>"},
{BUG_ID + "-2" + FS + "pkg2" + FS + "C.html",
"<dt><span class=\"strong\">Specified by:</span></dt>" + NL +
- "<dd><code><a href=\"../pkg2/I.html#hello(T)\">hello</a></code>" +
+ "<dd><code><a href=\"../pkg2/I.html#hello-T-\">hello</a></code>" +
" in interface <code>" +
"<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
"<java.lang.String></code></dd>"},
--- a/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testRepeatedAnnotations/TestRepeatedAnnotations.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/RegContainerDoc.html\" " +
"title=\"annotation in pkg\">@RegContainerDoc</a>" +
- "(<a href=\"../pkg/RegContainerDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg/RegContainerDoc.html#value--\">value</a>={" +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -71,7 +71,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/ContainerSynthDoc.html\" " +
"title=\"annotation in pkg\">@ContainerSynthDoc</a>(" +
- "<a href=\"../pkg/ContainerSynthDoc.html#value()\">value</a>=" +
+ "<a href=\"../pkg/ContainerSynthDoc.html#value--\">value</a>=" +
"<a href=\"../pkg/ContaineeSynthDoc.html\" " +
"title=\"annotation in pkg\">@ContaineeSynthDoc</a>)"},
{BUG_ID + FS + "pkg" + FS + "C.html",
@@ -82,37 +82,37 @@
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegDoc.html\" title=\"annotation in pkg\">@RegDoc</a>" +
- "(<a href=\"../pkg/RegDoc.html#x()\">x</a>=1)"},
+ "(<a href=\"../pkg/RegDoc.html#x--\">x</a>=1)"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>=1)"},
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>=1)"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>" +
- "(<a href=\"../pkg/RegArryDoc.html#y()\">y</a>={1,2})"},
+ "(<a href=\"../pkg/RegArryDoc.html#y--\">y</a>={1,2})"},
{BUG_ID + FS + "pkg" + FS + "D.html",
"<a href=\"../pkg/NonSynthDocContainer.html\" " +
"title=\"annotation in pkg\">@NonSynthDocContainer</a>" +
- "(<a href=\"../pkg/NonSynthDocContainer.html#value()\">value</a>=" +
+ "(<a href=\"../pkg/NonSynthDocContainer.html#value--\">value</a>=" +
"<a href=\"../pkg/RegArryDoc.html\" title=\"annotation in pkg\">@RegArryDoc</a>)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/RegContainerValDoc.html\" " +
"title=\"annotation in pkg1\">@RegContainerValDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/RegContainerValDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg1/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValDoc.html#y()\">y</a>=3)"},
+ "<a href=\"../pkg1/RegContainerValDoc.html#y--\">y</a>=3)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerValDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerValDoc</a>" +
- "(<a href=\"../pkg1/ContainerValDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/ContainerValDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValDoc.html#x()\">x</a>=1)"}
+ "<a href=\"../pkg1/ContainerValDoc.html#x--\">x</a>=1)"}
};
private static final String[][] NEGATED_TEST = {
@@ -124,7 +124,7 @@
{BUG_ID + FS + "pkg" + FS + "C.html",
"<a href=\"../pkg/RegContainerNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContainerNotDoc</a>" +
- "(<a href=\"../pkg/RegContainerNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg/RegContainerNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
"title=\"annotation in pkg\">@RegContaineeNotDoc</a>," +
"<a href=\"../pkg/RegContaineeNotDoc.html\" " +
@@ -138,25 +138,25 @@
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/RegContainerValNotDoc.html\" " +
"title=\"annotation in pkg1\">@RegContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/RegContainerValNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/RegContainerValNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/RegContaineeDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeDoc</a>," +
"<a href=\"../pkg1/RegContaineeDoc.html\" " +
"title=\"annotation in pkg1\">@RegContaineeDoc</a>}," +
- "<a href=\"../pkg1/RegContainerValNotDoc.html#y()\">y</a>=4)"},
+ "<a href=\"../pkg1/RegContainerValNotDoc.html#y--\">y</a>=4)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerValNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerValNotDoc</a>" +
- "(<a href=\"../pkg1/ContainerValNotDoc.html#value()\">value</a>={" +
+ "(<a href=\"../pkg1/ContainerValNotDoc.html#value--\">value</a>={" +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>," +
"<a href=\"../pkg1/ContaineeNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeNotDoc</a>}," +
- "<a href=\"../pkg1/ContainerValNotDoc.html#x()\">x</a>=2)"},
+ "<a href=\"../pkg1/ContainerValNotDoc.html#x--\">x</a>=2)"},
{BUG_ID + FS + "pkg1" + FS + "C.html",
"<a href=\"../pkg1/ContainerSynthNotDoc.html\" " +
"title=\"annotation in pkg1\">@ContainerSynthNotDoc</a>(" +
- "<a href=\"../pkg1/ContainerSynthNotDoc.html#value()\">value</a>=" +
+ "<a href=\"../pkg1/ContainerSynthNotDoc.html#value--\">value</a>=" +
"<a href=\"../pkg1/ContaineeSynthDoc.html\" " +
"title=\"annotation in pkg1\">@ContaineeSynthDoc</a>)"}
};
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 6802694
+ * @bug 6802694 8025633
* @summary This test verifies deprecation info in serialized-form.html.
* @author Bhavesh Patel
* @library ../lib/
@@ -44,21 +44,21 @@
{BUG_ID + FS + "serialized-form.html", "<dl>" + NL +
"<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code>" +
"java.io.IOException</code></dd>"+ NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">This field indicates whether the C1 " +
"is undecorated.</div>" + NL + " " + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Since:</span></dt>" + NL +
"<dd>1.4</dd>" + NL + "<dt><span class=\"strong\">See Also:</span>" +
- "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ "</dt>" + NL + "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>C1.setUndecorated(boolean)</code></a></dd>" + NL + "</dl>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">Deprecated.</span>" +
" <span class=\"italic\">As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL +
"<div class=\"block\">Reads the object stream.</div>" + NL +
"<dl>" + NL + "<dt><span class=\"strong\">Throws:</span></dt>" + NL + "<dd><code><code>" +
@@ -75,12 +75,12 @@
{BUG_ID + FS + "serialized-form.html", "<pre>boolean undecorated</pre>" + NL +
"<div class=\"block\"><span class=\"strong\">Deprecated.</span> <span class=\"italic\">" +
"As of JDK version 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\"><code>" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
"setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"},
{BUG_ID + FS + "serialized-form.html", "<span class=\"strong\">" +
"Deprecated.</span> <span class=\"italic\">As of JDK version" +
" 1.5, replaced by" + NL +
- " <a href=\"pkg1/C1.html#setUndecorated(boolean)\">" +
+ " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
"<code>setUndecorated(boolean)</code></a>.</span></div>" + NL + "</li>"}};
// Test with -nodeprecated option. The serialized-form.html should
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026370
+ * @summary This test checks the generated tag output.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestTagOutput
+ * @run main TestTagOutput
+ */
+
+public class TestTagOutput extends JavadocTester {
+
+ private static final String BUG_ID = "8026370";
+ private static final String[][] TEST = {
+ {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+ "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"},
+ {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+ "<div class=\"block\"><span class=\"strong\">Deprecated.</span> " +
+ "<span class=\"italic\">Do not use this.</span></div>"}};
+
+ private static final String[][] NEGATED_TEST = {
+ {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html",
+ "<div class=\"block\"><span class=\"strong\">Deprecated." +
+ "</span> <span class=\"italic\"></span></div>"}};
+
+ private static final String[] ARGS =
+ new String[] {
+ "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"};
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestTagOutput tester = new TestTagOutput();
+ run(tester, ARGS, TEST, NEGATED_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testTagOutput/pkg1/DeprecatedTag.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class DeprecatedTag {
+
+ /**
+ * This method is deprecated.
+ *
+ * @deprecated
+ */
+ public void deprecatedMethod() {
+ }
+
+ /**
+ * This method is also deprecated.
+ *
+ * @deprecated Do not use this.
+ */
+ public void deprecatedMethodWithDesc() {
+ }
+}
+
--- a/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testTaglets/TestTaglets.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4654308 4767038
+ * @bug 4654308 4767038 8025633
* @summary Use a Taglet and include some inline tags such as {@link}. The
* inline tags should be interpreted properly.
* Run Javadoc on some sample source that uses {@inheritDoc}. Make
@@ -56,7 +56,7 @@
//Input for string search tests.
private static final String[][] TEST_4654308 = new String[][] {
{"4654308" + FS + "C.html", "<span class=\"strong\">Foo:</span></dt>" +
- "<dd>my only method is <a href=\"C.html#method()\"><code>here" +
+ "<dd>my only method is <a href=\"C.html#method--\"><code>here" +
"</code></a></dd></dl>"}
};
private static final String[][] NEGATED_TEST_4654308 = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,10 +23,11 @@
/*
* @test
- * @bug 8005091 8009686
+ * @bug 8005091 8009686 8025633
* @summary Make sure that type annotations are displayed correctly
* @author Bhavesh Patel
* @library ../lib/
+ * @ignore
* @build JavadocTester TestTypeAnnotations
* @run main TestTypeAnnotations
*/
@@ -272,13 +273,13 @@
"<pre>void oneException()" + NL +
" throws <a href=\"../typeannos/ThrB.html\" title=\"" +
"annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>"
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.Exception</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
"<pre>void twoExceptions()" + NL +
" throws <a href=\"../typeannos/ThrB.html\" title=\"" +
"annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
- "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL +
+ "ThrB.html#value--\">value</a>=\"m\") java.lang.RuntimeException," + NL +
" <a href=\"../typeannos/ThrA.html\" title=\"" +
"annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
},
@@ -307,14 +308,14 @@
"<pre>void wcSuper(<a href=\"../typeannos/MyList.html\" title=\"" +
"class in typeannos\">MyList</a><? super <a href=\"../typeannos/" +
"WldB.html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"" +
- "../typeannos/WldB.html#value()\">value</a>=\"m\") java.lang." +
+ "../typeannos/WldB.html#value--\">value</a>=\"m\") java.lang." +
"String> l)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "BoundWithValue.html",
"<pre><a href=\"../typeannos/MyList.html\" title=\"class in " +
"typeannos\">MyList</a><? extends <a href=\"../typeannos/WldB." +
"html\" title=\"annotation in typeannos\">@WldB</a>(<a href=\"../" +
- "typeannos/WldB.html#value()\">value</a>=\"m\") java.lang.String" +
+ "typeannos/WldB.html#value--\">value</a>=\"m\") java.lang.String" +
"> returnWcExtends()</pre>"
},
@@ -329,7 +330,7 @@
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrA." +
"html\" title=\"annotation in typeannos\">@RcvrA</a> <a href=\"../" +
"typeannos/RcvrB.html\" title=\"annotation in typeannos\">@RcvrB" +
- "</a>(<a href=\"../typeannos/RcvrB.html#value()\">value</a>=\"m\")" +
+ "</a>(<a href=\"../typeannos/RcvrB.html#value--\">value</a>=\"m\")" +
" DefaultUnmodified this)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
@@ -354,7 +355,7 @@
{BUG_ID + FS + "typeannos" + FS + "WithValue.html",
"<pre><T extends java.lang.Runnable> void accept(" +
"<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
- "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" +
+ "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value--\">" +
"value</a>=\"m\") WithValue this," + NL +
" T r)" + NL +
" throws java.lang.Exception</pre>"
@@ -362,7 +363,7 @@
{BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
"<pre>java.lang.String nonVoid(<a href=\"../typeannos/RcvrB." +
"html\" title=\"annotation in typeannos\">@RcvrB</a>(<a href=\"../" +
- "typeannos/RcvrB.html#value()\">value</a>=\"m\") WithFinal" +
+ "typeannos/RcvrB.html#value--\">value</a>=\"m\") WithFinal" +
" this)</pre>"
},
{BUG_ID + FS + "typeannos" + FS + "WithBody.html",
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4927167 4974929 7010344
+ * @bug 4927167 4974929 7010344 8025633
* @summary When the type parameters are more than 10 characters in length,
* make sure there is a line break between type params and return type
* in member summary. Also, test for type parameter links in package-summary and
@@ -71,7 +71,7 @@
},
//Nested type parameters
{BUG_ID + FS + "pkg" + FS + "C.html",
- "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
+ "<a name=\"formatDetails-java.util.Collection-java.util.Collection-\">" + NL +
"<!-- -->" + NL +
"</a>"
},
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4515705 4804296 4702454 4697036
+ * @bug 4515705 4804296 4702454 4697036 8025633
* @summary Make sure that first sentence warning only appears once.
* Make sure that only warnings/errors are printed when quiet is used.
* Make sure that links to private/unincluded methods do not cause
@@ -65,8 +65,8 @@
};
private static final String[][] TEST2 = {
- {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m()\"><code>m()</code></a><br/>"},
- {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X()\"><code>X()</code></a><br/>"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#m--\"><code>m()</code></a><br/>"},
+ {BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#X--\"><code>X()</code></a><br/>"},
{BUG_ID + FS + "pkg" + FS + "X.html", "<a href=\"../pkg/X.html#f\"><code>f</code></a><br/>"},
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016675
+ * @summary Test for window title.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestWindowTitle
+ * @run main TestWindowTitle
+ */
+
+public class TestWindowTitle extends JavadocTester {
+
+ private static final String BUG_ID = "8016675";
+ private static final String WIN_TITLE =
+ "Testing \"Window 'Title'\" with a \\ backslash and a / " +
+ "forward slash and a \u00e8 unicode char also a tab and also a " +
+ "\t special character another \u0002 unicode)";
+ private static final String[][] TEST = {
+ {BUG_ID + FS + "overview-summary.html",
+ "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
+ "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
+ "also a tab and also a \\t special character another \\u0002 unicode))\";"
+ },
+ };
+ private static final String[][] NEG_TEST = {
+ {BUG_ID + FS + "overview-summary.html",
+ "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
+ "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
+ "also a tab and also a \t special character another \u0002 unicode))\";"
+ },
+ };
+ private static final String[] ARGS = new String[]{
+ "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2"
+ };
+
+ /**
+ * The entry point of the test.
+ * @param args the array of command line arguments.
+ */
+ public static void main(String[] args) {
+ TestWindowTitle tester = new TestWindowTitle();
+ run(tester, ARGS, TEST, NEG_TEST);
+ tester.printSummary();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugId() {
+ return BUG_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getBugName() {
+ return getClass().getName();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/p1/C1.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * 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 p1;
+
+public class C1 {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testWindowTitle/p2/C2.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * 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 p2;
+
+public class C2 {
+}
--- a/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/com/sun/javadoc/typeAnnotations/smoke/TestSmoke.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,6 +28,7 @@
*
* @author Mahmood Ali <mali>
* @library ../../lib/
+ * @ignore
* @build JavadocTester
* @build TestSmoke
* @run main TestSmoke
--- a/langtools/test/tools/doclint/HtmlAttrsTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/doclint/HtmlAttrsTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -10,7 +10,7 @@
/** */
public class HtmlAttrsTest {
/**
- * <p xyz>
+ * <p xyz> text </p>
*/
public void unknown() { }
--- a/langtools/test/tools/doclint/HtmlAttrsTest.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/doclint/HtmlAttrsTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,5 +1,5 @@
HtmlAttrsTest.java:13: error: unknown attribute: xyz
- * <p xyz>
+ * <p xyz> text </p>
^
HtmlAttrsTest.java:18: warning: attribute obsolete: name
* <img name="x" alt="alt">
--- a/langtools/test/tools/doclint/tidy/BadEnd.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/doclint/tidy/BadEnd.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,6 +1,9 @@
BadEnd.java:14: warning: nested tag not allowed: <code>
* <code> text <code>
^
+BadEnd.java:14: warning: empty <code> tag
+ * <code> text <code>
+ ^
BadEnd.java:14: error: element not closed: code
* <code> text <code>
^
@@ -14,4 +17,4 @@
* <a name="here"> text <a>
^
4 errors
-1 warning
+2 warnings
--- a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,6 +1,6 @@
/*
* @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8026368
* @summary Add new doclint package
* @library ..
* @build DocLintTester
@@ -26,4 +26,9 @@
* <ul></ul>
* <ul><li></li></ul>
*/
-public class TrimmingEmptyTag { }
+public class TrimmingEmptyTag {
+ /** <p> */
+ public void implicitParaEnd_endOfComment() { }
+ /** <p> <ul><li>text</ul> */
+ public void implicitParaEnd_nextBlockTag() { }
+}
--- a/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/doclint/tidy/TrimmingEmptyTag.out Mon Oct 28 12:28:57 2013 -0700
@@ -43,4 +43,10 @@
TrimmingEmptyTag.java:26: warning: empty <ul> tag
* <ul></ul>
^
-15 warnings
+TrimmingEmptyTag.java:30: warning: empty <p> tag
+ /** <p> */
+ ^
+TrimmingEmptyTag.java:32: warning: empty <p> tag
+ /** <p> <ul><li>text</ul> */
+ ^
+17 warnings
--- a/langtools/test/tools/javac/MethodParameters/AnnotationTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters AnnotationTest.java
- * @run main Tester AnnotationTest
+ * @run main Tester AnnotationTest AnnotationTest.out
*/
import java.lang.annotation.*;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/AnnotationTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,10 @@
+static interface AnnotationTest$Annos -- inner
+AnnotationTest$Annos.foo()
+AnnotationTest$Annos.value()
+class AnnotationTest --
+AnnotationTest.<init>(i, ji)
+AnnotationTest.foo(i, ji)
+static interface AnnotationTest$I -- inner
+AnnotationTest$I.m(i, ji)
+static interface AnnotationTest$Anno -- inner
+AnnotationTest$Anno.f()
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/AnonymousClass.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters AnonymousClass.java
- * @run main Tester AnonymousClass
+ * @run main Tester AnonymousClass AnonymousClass.out
*/
class AnonymousClass {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/AnonymousClass.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,80 @@
+static public class AnonymousClass$Sinner -- inner
+AnonymousClass$Sinner.<init>()
+AnonymousClass$Sinner.<init>(arg, barg)
+AnonymousClass$Sinner.m(s/*synthetic*/, ts/*synthetic*/)/*synthetic*/
+AnonymousClass$Sinner.m()/*synthetic*/
+AnonymousClass$Sinner.m(s, ts)
+AnonymousClass$Sinner.m()
+class AnonymousClass$9 -- anon
+AnonymousClass$9.<init>(final this$0/*implicit*/)
+AnonymousClass$9.m()/*synthetic*/
+AnonymousClass$9.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$9.m(i, ji)
+AnonymousClass$9.m()
+class AnonymousClass$Inner -- inner
+AnonymousClass$Inner.<init>(final this$0/*synthetic*/)
+AnonymousClass$Inner.<init>(final this$0/*synthetic*/, arg, barg)
+AnonymousClass$Inner.m(s/*synthetic*/, ts/*synthetic*/)/*synthetic*/
+AnonymousClass$Inner.m()/*synthetic*/
+AnonymousClass$Inner.m(s, ts)
+AnonymousClass$Inner.m()
+class AnonymousClass$3 -- anon
+AnonymousClass$3.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$3.m()/*synthetic*/
+AnonymousClass$3.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$3.m(i, ji)
+AnonymousClass$3.m()
+class AnonymousClass$2 -- anon
+AnonymousClass$2.<init>(final this$0/*implicit*/)
+AnonymousClass$2.m()/*synthetic*/
+AnonymousClass$2.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$2.m(i, ji)
+AnonymousClass$2.m()
+class AnonymousClass --
+AnonymousClass.<init>(final a, ba)
+AnonymousClass.foo(final a, ba)
+class AnonymousClass$5 -- anon
+AnonymousClass$5.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$5.m()/*synthetic*/
+AnonymousClass$5.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$5.m(i, ji)
+AnonymousClass$5.m()
+static interface AnonymousClass$I -- inner
+AnonymousClass$I.m()
+AnonymousClass$I.m(x, yx)
+class AnonymousClass$10 -- anon
+AnonymousClass$10.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$10.m()/*synthetic*/
+AnonymousClass$10.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$10.m(i, ji)
+AnonymousClass$10.m()
+class AnonymousClass$8 -- anon
+AnonymousClass$8.<init>(final this$0/*implicit*/, arg, barg)
+AnonymousClass$8.m()/*synthetic*/
+AnonymousClass$8.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$8.m(i, ji)
+AnonymousClass$8.m()
+class AnonymousClass$6 -- anon
+AnonymousClass$6.<init>(final this$0/*implicit*/)
+AnonymousClass$6.m()/*synthetic*/
+AnonymousClass$6.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$6.m(i, ji)
+AnonymousClass$6.m()
+class AnonymousClass$7 -- anon
+AnonymousClass$7.<init>(final this$0/*implicit*/)
+AnonymousClass$7.m()/*synthetic*/
+AnonymousClass$7.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$7.m(i, ji)
+AnonymousClass$7.m()
+class AnonymousClass$4 -- anon
+AnonymousClass$4.<init>(final this$0/*implicit*/)
+AnonymousClass$4.m()/*synthetic*/
+AnonymousClass$4.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$4.m(i, ji)
+AnonymousClass$4.m()
+class AnonymousClass$1 -- anon
+AnonymousClass$1.<init>(final this$0/*implicit*/)
+AnonymousClass$1.m()/*synthetic*/
+AnonymousClass$1.m(i/*synthetic*/, ji/*synthetic*/)/*synthetic*/
+AnonymousClass$1.m(i, ji)
+AnonymousClass$1.m()
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/ClassFileVisitor.java Mon Oct 28 12:28:57 2013 -0700
@@ -82,15 +82,14 @@
* Read the class and determine some key characteristics, like if it's
* an enum, or inner class, etc.
*/
- void visitClass(final String cname, final File cfile, final StringBuilder sb)
- throws Exception {
+ void visitClass(final String cname, final File cfile, final StringBuilder sb) throws Exception {
this.cname = cname;
classFile = ClassFile.read(cfile);
isEnum = classFile.access_flags.is(AccessFlags.ACC_ENUM);
isInterface = classFile.access_flags.is(AccessFlags.ACC_INTERFACE);
isPublic = classFile.access_flags.is(AccessFlags.ACC_PUBLIC);
isInner = false;
- isStatic = true;
+ isStatic = false;
isAnon = false;
Attribute attr = classFile.getAttribute("InnerClasses");
@@ -100,10 +99,11 @@
sb.append(isStatic ? "static " : "")
.append(isPublic ? "public " : "")
.append(isEnum ? "enum " : isInterface ? "interface " : "class ")
- .append(cname).append(" -- ")
- .append(isInner? "inner " : "" )
- .append(isAnon ? "anon" : "")
- .append("\n");;
+ .append(cname).append(" -- ");
+ if (isInner) {
+ sb.append(isAnon ? "anon" : "inner");
+ }
+ sb.append("\n");
for (Method method : classFile.methods) {
new MethodVisitor().visitMethod(method, sb);
@@ -148,7 +148,9 @@
public int mNumParams;
public boolean mSynthetic;
public boolean mIsConstructor;
+ public boolean mIsClinit;
public boolean mIsBridge;
+ public boolean isFinal;
public String prefix;
void visitMethod(Method method, StringBuilder sb) throws Exception {
@@ -160,9 +162,13 @@
mNumParams = -1; // no MethodParameters attribute found
mSynthetic = method.access_flags.is(AccessFlags.ACC_SYNTHETIC);
mIsConstructor = mName.equals("<init>");
+ mIsClinit = mName.equals("<clinit>");
prefix = cname + "." + mName + "() - ";
mIsBridge = method.access_flags.is(AccessFlags.ACC_BRIDGE);
+ if (mIsClinit) {
+ sb = new StringBuilder(); // Discard output
+ }
sb.append(cname).append(".").append(mName).append("(");
for (Attribute a : method.attributes) {
@@ -170,9 +176,18 @@
}
if (mNumParams == -1) {
if (mSynthetic) {
- sb.append("<none>)!!");
+ // We don't generate MethodParameters attribute for synthetic
+ // methods, so we are creating a parameter pattern to match
+ // ReflectionVisitor API output.
+ for (int i = 0; i < mParams; i++) {
+ if (i == 0)
+ sb.append("arg").append(i);
+ else
+ sb.append(", arg").append(i);
+ }
+ sb.append(")/*synthetic*/");
} else {
- sb.append("<none>)");
+ sb.append(")");
}
}
sb.append("\n");
@@ -217,7 +232,7 @@
String sep = "";
String userParam = null;
for (int x = 0; x < mNumParams; x++) {
-
+ isFinal = (mp.method_parameter_table[x].flags & AccessFlags.ACC_FINAL) != 0;
// IMPL: Assume all parameters are named, something.
int cpi = mp.method_parameter_table[x].name_index;
if (cpi == 0) {
@@ -229,6 +244,8 @@
String param = null;
try {
param = classFile.constant_pool.getUTF8Value(cpi);
+ if (isFinal)
+ param = "final " + param;
sb.append(sep).append(param);
sep = ", ";
} catch(ConstantPoolException e) {
@@ -239,7 +256,7 @@
// Check availability, flags and special names
- int check = checkParam(mp, param, x, sb);
+ int check = checkParam(mp, param, x, sb, isFinal);
if (check < 0) {
return null;
}
@@ -253,9 +270,15 @@
char c = userParam.charAt(0);
expect = (++c) + userParam;
}
+ if(isFinal && expect != null)
+ expect = "final " + expect;
if (check > 0) {
+ if(isFinal) {
+ userParam = param.substring(6);
+ } else {
userParam = param;
}
+ }
if (expect != null && !param.equals(expect)) {
error(prefix + "param[" + x + "]='"
+ param + "' expected '" + expect + "'");
@@ -263,7 +286,7 @@
}
}
if (mSynthetic) {
- sb.append(")!!");
+ sb.append(")/*synthetic*/");
} else {
sb.append(")");
}
@@ -278,7 +301,7 @@
* explicitly declared parameter.
*/
int checkParam(MethodParameters_attribute mp, String param, int index,
- StringBuilder sb) {
+ StringBuilder sb, boolean isFinal) {
boolean synthetic = (mp.method_parameter_table[index].flags
& AccessFlags.ACC_SYNTHETIC) != 0;
@@ -304,9 +327,13 @@
}
} else if (index == 0) {
if (isAnon) {
+ expect = "this\\$[0-9]+";
allowMandated = true;
- expect = "this\\$[0-n]*";
+ if (isFinal) {
+ expect = "final this\\$[0-9]+";
+ }
} else if (isInner && !isStatic) {
+ expect = "this\\$[0-9]+";
allowMandated = true;
if (!isPublic) {
// some but not all non-public inner classes
@@ -314,7 +341,9 @@
// the test a bit of slack and allow either.
allowSynthetic = true;
}
- expect = "this\\$[0-n]*";
+ if (isFinal) {
+ expect = "final this\\$[0-9]+";
+ }
}
}
} else if (isEnum && mNumParams == 1 && index == 0 && mName.equals("valueOf")) {
@@ -327,8 +356,8 @@
*/
expect = null;
}
- if (mandated) sb.append("!");
- if (synthetic) sb.append("!!");
+ if (mandated) sb.append("/*implicit*/");
+ if (synthetic) sb.append("/*synthetic*/");
// IMPL: our rules a somewhat fuzzy, sometimes allowing both mandated
// and synthetic. However, a parameters cannot be both.
--- a/langtools/test/tools/javac/MethodParameters/Constructors.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters Constructors.java
- * @run main Tester Constructors
+ * @run main Tester Constructors Constructors.out
*/
public class Constructors {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/Constructors.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,5 @@
+public class Constructors --
+Constructors.<init>()
+Constructors.<init>(final a, final ba)
+Constructors.<init>(a, final ba, final cba)
+Constructors.<init>(a, ba, final cba, final dcba)
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/EnumTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters EnumTest.java
- * @run main Tester EnumTest
+ * @run main Tester EnumTest EnumTest.out
*/
/** Test that parameter names are recorded for enum methods */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/EnumTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,7 @@
+enum EnumTest --
+EnumTest.<init>($enum$name/*synthetic*/, $enum$ordinal/*synthetic*/)
+EnumTest.<init>($enum$name/*synthetic*/, $enum$ordinal/*synthetic*/, a, ba)
+EnumTest.ok(c, dc)
+EnumTest.values()
+EnumTest.valueOf(A, BA)
+EnumTest.valueOf(name/*implicit*/)
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/InstanceMethods.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters InstanceMethods.java
- * @run main Tester InstanceMethods
+ * @run main Tester InstanceMethods InstanceMethods.out
*/
public class InstanceMethods {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/InstanceMethods.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,11 @@
+public class InstanceMethods --
+InstanceMethods.<init>()
+InstanceMethods.empty()
+InstanceMethods.def(a, final ba, final cba)
+InstanceMethods.pub(d, final ed, final fed)
+InstanceMethods.prot(g, final hg, final ihg)
+InstanceMethods.priv(j, final kj, final lkj)
+InstanceMethods.def(A, BA, final CBA, final DCBA)
+InstanceMethods.pub(B, CB, final DCB, final EDCB)
+InstanceMethods.prot(C, DC, final EDC, final FEDC)
+InstanceMethods.priv(D, ED, final FED, final GFED)
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/LambdaTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters LambdaTest.java
- * @run main Tester LambdaTest
+ * @run main Tester LambdaTest LambdaTest.out
*/
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/LambdaTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,7 @@
+class LambdaTest --
+LambdaTest.<init>()
+LambdaTest.foo(i)
+LambdaTest.lambda$1(arg0, arg1)/*synthetic*/
+LambdaTest.lambda$0(arg0)/*synthetic*/
+static interface LambdaTest$I -- inner
+LambdaTest$I.m(x)
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/LocalClassTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters LocalClassTest.java
- * @run main Tester LocalClassTest
+ * @run main Tester LocalClassTest LocalClassTest.out
*/
class LocalClassTest {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/LocalClassTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,12 @@
+class LocalClassTest$1Local_has_constructor -- inner
+LocalClassTest$1Local_has_constructor.<init>(final this$0/*implicit*/, a, ba)
+LocalClassTest$1Local_has_constructor.<init>(final this$0/*implicit*/)
+LocalClassTest$1Local_has_constructor.foo(m, nm)
+LocalClassTest$1Local_has_constructor.foo()
+class LocalClassTest$1Local_default_constructor -- inner
+LocalClassTest$1Local_default_constructor.<init>(final this$0/*implicit*/)
+LocalClassTest$1Local_default_constructor.foo()
+LocalClassTest$1Local_default_constructor.foo(m, nm)
+class LocalClassTest --
+LocalClassTest.<init>()
+LocalClassTest.foo()
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/MemberClassTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters MemberClassTest.java
- * @run main Tester MemberClassTest
+ * @run main Tester MemberClassTest MemberClassTest.out
*/
class MemberClassTest {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/MemberClassTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,33 @@
+static class MemberClassTest$Static_Member -- inner
+MemberClassTest$Static_Member.<init>()
+MemberClassTest$Static_Member.<init>(arg, barg)
+MemberClassTest$Static_Member.m(s, ts)
+MemberClassTest$Static_Member.m()
+public class MemberClassTest$Member -- inner
+MemberClassTest$Member.<init>(final this$0/*implicit*/)
+MemberClassTest$Member.<init>(final this$0/*implicit*/, a, ba)
+MemberClassTest$Member.m(s, ts)
+MemberClassTest$Member.m()
+public class MemberClassTest$Member$Member_Member -- inner
+MemberClassTest$Member$Member_Member.<init>(final this$1/*implicit*/)
+MemberClassTest$Member$Member_Member.<init>(final this$1/*implicit*/, x, yx)
+class MemberClassTest$1 -- anon
+MemberClassTest$1.<init>(final this$0/*implicit*/)
+MemberClassTest$1.m()
+MemberClassTest$1.m(s, ts)
+static public class MemberClassTest$Static_Member$Static_Member_Static_Member -- inner
+MemberClassTest$Static_Member$Static_Member_Static_Member.<init>()
+MemberClassTest$Static_Member$Static_Member_Static_Member.<init>(x, yx)
+public class MemberClassTest$Static_Member$Static_Member_Member -- inner
+MemberClassTest$Static_Member$Static_Member_Member.<init>(final this$0/*implicit*/)
+MemberClassTest$Static_Member$Static_Member_Member.<init>(final this$0/*implicit*/, x, yx)
+class MemberClassTest --
+MemberClassTest.<init>(final a, ba)
+MemberClassTest.<init>()
+MemberClassTest.foo()
+static interface MemberClassTest$I -- inner
+MemberClassTest$I.m()
+MemberClassTest$I.m(x, yx)
+class MemberClassTest$1$Anonymous_Member -- inner
+MemberClassTest$1$Anonymous_Member.<init>(final this$1/*implicit*/)
+MemberClassTest$1$Anonymous_Member.<init>(final this$1/*implicit*/, x, yx)
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/ReflectionVisitor.java Mon Oct 28 12:28:57 2013 -0700
@@ -48,6 +48,7 @@
boolean isMember;
boolean isStatic;
boolean isPublic;
+ boolean isFinal;
Class clazz;
StringBuilder sb;
@@ -72,8 +73,8 @@
.append(isPublic ? "public " : "")
.append(isEnum ? "enum " : isInterface ? "interface " : "class ")
.append(cl).append(" -- ")
- .append(isMember? "member " : "" )
- .append(isLocal? "local " : "" )
+ .append(isMember? "inner" : "" )
+ .append(isLocal? "inner" : "" )
.append(isAnon ? "anon" : "")
.append("\n");
@@ -82,7 +83,6 @@
}
for (Method m :clazz.getDeclaredMethods()) {
-
testMethod(m);
}
}
@@ -116,9 +116,15 @@
for (Parameter p : c.getParameters()) {
i++;
String pname = p.getName();
+ int pmodifier = p.getModifiers();
+ isFinal = false;
+ if (Modifier.isFinal(pmodifier)) {
+ isFinal = true;
+ pname = "final " + pname;
+ }
sb.append(sep).append(pname);
- if (p.isImplicit()) sb.append("!");
- if (p.isSynthetic()) sb.append("!!");
+ if (p.isImplicit()) sb.append("/*implicit*/");
+ if (p.isSynthetic()) sb.append("/*synthetic*/");
sep = ", ";
// Set expectations
@@ -135,11 +141,17 @@
}
} else if (i == 0) {
if (isAnon) {
- allowImplicit = true;
- } else if (isLocal) {
+ expect = "this\\$[0-9]+";
allowImplicit = true;
- expect = "this\\$[0-n]*";
+ if (isFinal)
+ expect = "final this\\$[0-9]+";
+ } else if (isLocal) {
+ expect = "this\\$[0-9]+";
+ allowImplicit = true;
+ if (isFinal)
+ expect = "final this\\$[0-9]+";
} else if ((isMember && !isStatic)) {
+ expect = "this\\$[0-9]+";
allowImplicit = true;
if (!isPublic) {
// some but not all non-public inner classes
@@ -147,7 +159,8 @@
// the test a bit of slack and allow either.
allowSynthetic = true;
}
- expect = "this\\$[0-n]*";
+ if (isFinal)
+ expect = "final this\\$[0-9]+";
}
}
@@ -201,11 +214,16 @@
char ch = param.charAt(0);
expect = (++ch) + param;
}
-
+ if (isFinal && expect != null) {
+ expect = "final " + expect;
+ }
if (pname != null && fidelity) {
+ if (isFinal) {
+ param = pname.substring(6);
+ } else {
param = pname;
}
-
+ }
if (expect != null && !expect.equals(pname)) {
error(prefix + "param[" + i + "]='" + pname +
"' expected '" + expect + "'");
@@ -213,7 +231,7 @@
}
}
if (c.isSynthetic()) {
- sb.append(")!!\n");
+ sb.append(")/*synthetic*/\n");
} else {
sb.append(")\n");
}
@@ -240,13 +258,24 @@
// the test-case design pattern, except synthetic methods.
for (Parameter p : m.getParameters()) {
i++;
+ isFinal = false;
+ int pmodifier = p.getModifiers();
if (param == null) {
param = p.getName();
+ if (Modifier.isFinal(pmodifier)) {
+ isFinal = true;
+ param = "final " + param;
+ }
sb.append(sep).append(param);
} else {
char c = param.charAt(0);
String expect = m.isSynthetic() ? ("arg" + i) : ((++c) + param);
param = p.getName();
+ if (Modifier.isFinal(pmodifier)) {
+ isFinal = true;
+ expect = "final " + expect;
+ param = "final " + param;
+ }
sb.append(sep).append(param);
if (!m.isBridge() && !expect.equals(param)) {
error(prefix + "param[" + i + "]='"
@@ -254,10 +283,18 @@
break;
}
}
+ if(isFinal)
+ param = param.substring(6);
+ if (p.isImplicit()) {
+ sb.append("/*implicit*/");
+ }
+ if (p.isSynthetic()) {
+ sb.append("/*synthetic*/");
+ }
sep = ", ";
}
if (m.isSynthetic()) {
- sb.append(")!!\n");
+ sb.append(")/*synthetic*/\n");
} else {
sb.append(")\n");
}
--- a/langtools/test/tools/javac/MethodParameters/StaticMethods.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters StaticMethods.java
- * @run main Tester StaticMethods
+ * @run main Tester StaticMethods StaticMethods.out
*/
public class StaticMethods {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/StaticMethods.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,11 @@
+public class StaticMethods --
+StaticMethods.<init>()
+StaticMethods.def(a, ba, final cba, final dcba)
+StaticMethods.def(a, final ba, final cba)
+StaticMethods.pub(d, final ed, final fed)
+StaticMethods.pub(a, ba, final cba, final dcba)
+StaticMethods.prot(g, final hg, final ihg)
+StaticMethods.prot(aa, baa, final cbaa, final dcbaa)
+StaticMethods.priv(j, final kj, final lkj)
+StaticMethods.priv(abc, babc, final cbabc, final dcbabc)
+StaticMethods.empty()
\ No newline at end of file
--- a/langtools/test/tools/javac/MethodParameters/Tester.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/Tester.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,6 +23,12 @@
import java.io.*;
import java.lang.reflect.Constructor;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
/**
* Test driver for MethodParameters testing.
@@ -44,6 +50,13 @@
final static File classesdir = new File(System.getProperty("test.classes", "."));
+ private String classname;
+ private File[] files;
+ private File refFile;
+ private int errors;
+ private int warnings;
+ private int diffGolden;
+
/**
* The visitor classes that does the actual checking are referenced
* statically, to force compilations, without having to reference
@@ -62,32 +75,38 @@
* Test-driver expect a single classname as argument.
*/
public static void main(String... args) throws Exception {
- if (args.length != 1) {
- throw new Error("A single class name is expected as argument");
+ if (args.length != 2) {
+ throw new Error("A single class name and a golden file are expected as argument");
}
- final String pattern = args[0] + ".*\\.class";
- File files[] = classesdir.listFiles(new FileFilter() {
+ String testSrc = System.getProperty("test.src");
+ String testName = args[0];
+ String testGoldenFile = args[1];
+ final String pattern = testName + ".*\\.class";
+ File refFile = new File(testSrc, testGoldenFile);
+ File[] files = classesdir.listFiles(new FileFilter() {
public boolean accept(File f) {
return f.getName().matches(pattern);
}
});
if (files.length == 0) {
- File file = new File(classesdir, args[0] + ".class");
+ File file = new File(classesdir, testName + ".class");
throw new Error(file.getPath() + " not found");
}
- new Tester(args[0], files).run();
+ new Tester(testName, files, refFile).run();
}
- public Tester(String name, File files[]) {
+ public Tester(String name, File[] files, File refFile) {
this.classname = name;
this.files = files;
+ this.refFile = refFile;
}
void run() throws Exception {
// Test with each visitor
for (Class<Visitor> vclass : visitors) {
+ boolean compResult = false;
try {
String vname = vclass.getName();
Constructor c = vclass.getConstructor(Tester.class);
@@ -105,12 +124,21 @@
e.printStackTrace();
}
}
- info(sb.toString());
+ String output = sb.toString();
+ info(output);
+ compResult = compareOutput(refFile, output);
} catch(ReflectiveOperationException e) {
warn("Class " + vclass.getName() + " ignored, not a Visitor");
continue;
}
+ if (!compResult) {
+ diffGolden++;
+ error("The output from " + vclass.getName() + " did not match golden file.");
}
+ }
+
+ if (0 != diffGolden)
+ throw new Exception("Test output is not equal with golden file.");
if(0 != warnings)
System.err.println("Test generated " + warnings + " warnings");
@@ -119,6 +147,25 @@
throw new Exception("Tester test failed with " +
errors + " errors");
}
+ // Check if test output matches the golden file.
+ boolean compareOutput(File refFile, String sb)
+ throws FileNotFoundException, IOException {
+
+ List<String> refFileList = Files.readAllLines(refFile.toPath(), StandardCharsets.UTF_8);
+ List<String> sbList = Arrays.asList(sb.split(System.getProperty("line.separator")));
+ // Check if test output contains unexpected lines or is missing expected lines.
+ List<String> sbOnly = new ArrayList<String>(sbList);
+ sbOnly.removeAll(refFileList);
+ for (String line: sbOnly)
+ error("unexpected line found: " + line);
+
+ List<String> refOnly = new ArrayList<String>(refFileList);
+ refOnly.removeAll(sbList);
+ for (String line: refOnly)
+ error("expected line not found: " + line);
+
+ return sbOnly.isEmpty() && refOnly.isEmpty();
+ }
abstract static class Visitor {
Tester tester;
@@ -153,9 +200,4 @@
void info(String msg) {
System.out.println(msg);
}
-
- int errors;
- int warnings;
- String classname;
- File files[];
}
--- a/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.java Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
* @summary javac should generate method parameters correctly.
* @build Tester
* @compile -parameters UncommonParamNames.java
- * @run main Tester UncommonParamNames
+ * @run main Tester UncommonParamNames UncommonParamNames.out
*/
/** Test uncommon parameter names */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/MethodParameters/UncommonParamNames.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,17 @@
+class UncommonParamNames --
+UncommonParamNames.<init>(zerozero)
+UncommonParamNames.<init>(a)
+UncommonParamNames.<init>($1)
+UncommonParamNames.<init>(_x)
+UncommonParamNames.<init>(a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba, ihgfedcba, jihgfedcba, kjihgfedcba, lkjihgfedcba, mlkjihgfedcba, nmlkjihgfedcba, onmlkjihgfedcba, ponmlkjihgfedcba, qponmlkjihgfedcba, rqponmlkjihgfedcba, srqponmlkjihgfedcba, tsrqponmlkjihgfedcba, utsrqponmlkjihgfedcba, vutsrqponmlkjihgfedcba, wvutsrqponmlkjihgfedcba, xwvutsrqponmlkjihgfedcba, yxwvutsrqponmlkjihgfedcba, zyxwvutsrqponmlkjihgfedcba)
+UncommonParamNames.<init>(aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName)
+UncommonParamNames.<init>(zerozeroeight)
+UncommonParamNames.<init>(zerozeroseven)
+UncommonParamNames.foo(zerozero)
+UncommonParamNames.foo(a)
+UncommonParamNames.foo($1)
+UncommonParamNames.foo(a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba, ihgfedcba, jihgfedcba, kjihgfedcba, lkjihgfedcba, mlkjihgfedcba, nmlkjihgfedcba, onmlkjihgfedcba, ponmlkjihgfedcba, qponmlkjihgfedcba, rqponmlkjihgfedcba, srqponmlkjihgfedcba, tsrqponmlkjihgfedcba, utsrqponmlkjihgfedcba, vutsrqponmlkjihgfedcba, wvutsrqponmlkjihgfedcba, xwvutsrqponmlkjihgfedcba, yxwvutsrqponmlkjihgfedcba, zyxwvutsrqponmlkjihgfedcba)
+UncommonParamNames.foo(zerozeroseven)
+UncommonParamNames.foo(zerozeroeight)
+UncommonParamNames.foo(aLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, baLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName, cbaLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongName)
+UncommonParamNames.foo(_x)
\ No newline at end of file
--- a/langtools/test/tools/javac/T7042623.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/T7042623.java Mon Oct 28 12:28:57 2013 -0700
@@ -2,6 +2,7 @@
* @test /nodynamiccopyright/
* @bug 7042623
* @summary Regression: javac silently crash when attributing non-existent annotation
+ * @ignore
* @compile/fail/ref=T7042623.out -XDrawDiagnostics -XDdev T7042623.java
*/
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Mon Oct 28 12:28:57 2013 -0700
@@ -54,10 +54,10 @@
IMPORTEXPECTED("import expectedFiles.*;\n"),
REPEATABLE("\n@Repeatable(FooContainer.class)\n"),
CONTAINER("@interface FooContainer {\n" + " Foo[] value();\n}\n"),
- BASE("@interface Foo {}\n"),
- BASEANNO("@Foo"),
- LEGACYCONTAINER("@FooContainer(value = {@Foo, @Foo})\n"),
- REPEATABLEANNO("\n@Foo() @Foo()"),
+ BASE("@interface Foo {int value() default Integer.MAX_VALUE;}\n"),
+ BASEANNO("@Foo(0)"),
+ LEGACYCONTAINER("@FooContainer(value = {@Foo(1), @Foo(2)})\n"),
+ REPEATABLEANNO("\n@Foo(1) @Foo(2)"),
DEPRECATED("\n@Deprecated"),
DOCUMENTED("\n@Documented"),
INHERITED("\n@Inherited"),
--- a/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -45,6 +45,8 @@
import expectedFiles.ExpectedBase;
import expectedFiles.ExpectedContainer;
+import java.util.Iterator;
+import java.util.regex.Pattern;
/*
* Objective:
@@ -99,6 +101,7 @@
* Set it to true to get more debug information
*/
static final boolean DEBUG = false;
+ static boolean CHECKORDERING;
public static void main(String args[]) throws Exception {
ReflectionTest test = new ReflectionTest();
@@ -145,6 +148,23 @@
if (c != null) {
// For the loaded class object, compare expected and actual annotation values
// for each of the methods under test from java.lang.reflect.AnnotatedElement
+
+
+ // Ignoring following test cases since for now they are
+ // failing with ordering issues.
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
+ List<String> orderingTestFailures = Arrays.asList(
+ "SingleOnSuperContainerOnSub_Inherited_Legacy",
+ "SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy",
+ "ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy",
+ "SingleAnnoWithContainer",
+ "SingleOnSuperContainerAndSingleOnSub_Inherited");
+ if (orderingTestFailures.contains(testCase.toString())) {
+ CHECKORDERING = false;
+ } else
+ CHECKORDERING = true;
+
checkAnnoValues(srcType, c);
} else {
error("Could not load className = " + c);
@@ -167,12 +187,12 @@
enum TestCase {
BasicNonRepeatable_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
- + "getDeclAnnoVal = \"Foo\", "
- + "getAnnosArgs = {\"Foo\"}, "
- + "getDeclAnnosArgs = {\"Foo\"}) ",
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnoVal = \"@Foo(value=0)\", "
+ + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+ + "getDeclAnnosArgs = {\"@Foo(value=0)\"}) ",
"@ExpectedContainer") {
@Override
@@ -202,11 +222,11 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(0)
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
Sample testSrc:
package testpkg;
@@ -229,11 +249,11 @@
/*
Sample testSrc for class
@Retention(RetentionPolicy.RUNTIME)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(0)
class A {}
*/
replaceVal = expectedVals + anno;
@@ -248,11 +268,11 @@
},
SingleAnnoInherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
- + "getAnnotationsVals = {\"Foo\", \"ExpectedBase\", \"ExpectedContainer\"}, "
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ + "getAnnotationsVals = {\"@Foo(value=0)\", \"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", "
- + "getAnnosArgs = {\"Foo\"}, "
+ + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+ "getDeclAnnosArgs = {})",
"@ExpectedContainer") {
@@ -273,9 +293,9 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
- @Foo
+ @Foo(0)
class SuperClass { }
@ExpectedBase
@@ -337,9 +357,9 @@
Sample test src:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
- @Foo
+ @Foo(0)
interface TestInterface { }
@ExpectedBase
@@ -375,18 +395,18 @@
},
AnnoOnSuperAndSubClass_Inherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+ + "getAnnotationVal = \"@Foo(value=2)\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
+ // override every annotation on superClass
- "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
+ // ignores inherited annotations
- "getDeclAnnoVal = \"Foo\", " // ignores inherited
- + "getAnnosArgs = {\"Foo\"}, "
- + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+ "getDeclAnnoVal = \"@Foo(value=2)\", " // ignores inherited
+ + "getAnnosArgs = {\"@Foo(value=2)\"}, "
+ + "getDeclAnnosArgs = { \"@Foo(value=2)\" })", // ignores inherited
"@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"NULL\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, "
+ // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", " + // ignores inherited
"getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") { // ignores inherited
@@ -408,19 +428,19 @@
Sample test src
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Inherited
@interface FooContainer {
Foo[] value();
}
- @Foo
+ @Foo(1)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(2)
class SubClass extends SuperClass {}
*/
// @Inherited only works for classes, no switch cases for
@@ -435,12 +455,13 @@
if (srcType == SrcType.CLASS) {
// Contents for SuperClass
- anno = Helper.ContentVars.BASEANNO.getVal();
+ anno = "@Foo(1)";
replaceVal = commonStmts + "\n" + anno;
String superClassContents = srcType.getTemplate()
.replace("#CN", SUPERCLASS).replace("#REPLACE", replaceVal);
// Contents for SubClass that extends SuperClass
+ anno = "@Foo(2)";
replaceVal = expectedVals + "\n" + anno;
String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
.replace("#CN", className).replace("#SN", SUPERCLASS)
@@ -456,17 +477,17 @@
BasicContainer_Legacy(
"@ExpectedBase(value = Foo.class, "
+ "getAnnotationVal = \"NULL\","
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, "
+ "getDeclAnnosArgs = {} )",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"FooContainer\", "
- + "getAnnosArgs = {\"FooContainer\"}, "
- + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -498,11 +519,11 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -529,7 +550,7 @@
Sample testSrc for class:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -539,7 +560,7 @@
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class A {}
*/
replaceVal = expectedVals + anno;
@@ -554,23 +575,23 @@
},
SingleAndContainerOnSuper_Legacy(
"@ExpectedBase(value = Foo.class, "
- + "getAnnotationVal = \"Foo\","
+ + "getAnnotationVal = \"@Foo(value=0)\","
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"Foo\", "
- + "getAnnosArgs = {\"Foo\"}, "
- + "getDeclAnnosArgs = {\"Foo\"} )",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@Foo(value=0)\", "
+ + "getAnnosArgs = {\"@Foo(value=0)\"}, "
+ + "getDeclAnnosArgs = {\"@Foo(value=0)\"} )",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"FooContainer\", "
- + "getAnnosArgs = {\"FooContainer\"}, "
- + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -589,8 +610,8 @@
+ getExpectedContainer() + "\n";
StringBuilder commonStmts = new StringBuilder();
- anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
- + Helper.ContentVars.BASEANNO.getVal();
+ anno = Helper.ContentVars.BASEANNO.getVal() +
+ Helper.ContentVars.LEGACYCONTAINER.getVal();
commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal())
.append(Helper.ContentVars.IMPORTSTMTS.getVal())
.append(Helper.ContentVars.RETENTIONRUNTIME.getVal())
@@ -603,12 +624,12 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @Foo
- @FooContainer(value = {@Foo, @Foo})
+ @Foo(0)
+ @FooContainer(value = {@Foo(1), @Foo(2)})
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -636,7 +657,7 @@
Sample testSrc for class:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -646,8 +667,8 @@
@ExpectedBase
@ExpectedContainer
- @Foo
- @FooContainer(value = {@Foo, @Foo})
+ @Foo(0)
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class A {}
*/
replaceVal = expectedVals + anno;
@@ -664,17 +685,17 @@
BasicContainer_Inherited_Legacy(
"@ExpectedBase(value = Foo.class, "
+ "getAnnotationVal = \"NULL\","
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", "
+ "getAnnosArgs = {}, "
+ "getDeclAnnosArgs = {} )",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", "
- + "getAnnosArgs = {\"FooContainer\"}, "
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosArgs = {} )") {
@Override
@@ -694,7 +715,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -702,7 +723,7 @@
Foo[] value();
}
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class SuperClass { }
@ExpectedBase
@@ -736,20 +757,20 @@
},
ContainerOnSuperSingleOnSub_Inherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
- + "getDeclAnnoVal = \"Foo\","
- + "getAnnosArgs = {\"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\"})",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ + "getDeclAnnoVal = \"@Foo(value=0)\","
+ + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\","
- + "getAnnosArgs = {\"FooContainer\"},"
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnosArgs = {})") {
@Override
@@ -769,7 +790,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -777,12 +798,12 @@
Foo[] value();
}
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(0)
class SubClass extends SuperClass {}
*/
// @Inherited only works for classes, no switch cases for
@@ -811,22 +832,24 @@
return files;
}
},
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
- + "getDeclAnnoVal = \"Foo\","
- + "getAnnosArgs = {\"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\"})",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ + "getDeclAnnoVal = \"@Foo(value=0)\","
+ + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=0)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"},"
+ "getDeclAnnoVal = \"NULL\","
- + "getAnnosArgs = {\"FooContainer\"},"
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnosArgs = {})") {
@Override
@@ -846,7 +869,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -854,12 +877,12 @@
Foo[] value();
}
- @FooContainer(value = {@Foo, @Foo}) @Foo
+ @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(0)
class SubClass extends SuperClass {}
*/
// @Inherited only works for classes, no switch cases for
@@ -868,7 +891,7 @@
if (srcType == SrcType.CLASS) {
// Contents for SuperClass
anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
- + Helper.ContentVars.BASEANNO.getVal();
+ + "@Foo(3)";
replaceVal = commonStmts + "\n" + anno;
String superClassContents = srcType.getTemplate()
.replace("#CN", SUPERCLASS)
@@ -888,23 +911,25 @@
return files;
}
},
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
SingleOnSuperContainerOnSub_Inherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnoVal = \"NULL\","
- + "getAnnosArgs = {\"Foo\"},"
+ + "getAnnosArgs = {\"@Foo(value=0)\"},"
+ "getDeclAnnosArgs = {})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"FooContainer\","
- + "getAnnosArgs = {\"FooContainer\"},"
- + "getDeclAnnosArgs = {\"FooContainer\"})") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -924,7 +949,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -932,12 +957,12 @@
Foo[] value();
}
- @Foo
+ @Foo(0)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class SubClass extends SuperClass {}
*/
@@ -963,25 +988,27 @@
return files;
}
},
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=3)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"Foo\","
- + "getAnnosArgs = {\"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\"})",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+ + "getDeclAnnoVal = \"@Foo(value=3)\","
+ + "getAnnosArgs = {\"@Foo(value=3)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=3)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"FooContainer\","
- + "getAnnosArgs = {\"FooContainer\"},"
- + "getDeclAnnosArgs = {\"FooContainer\"})") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1001,7 +1028,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1009,12 +1036,12 @@
Foo[] value();
}
- @Foo
+ @Foo(0)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo}) @Foo
+ @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
class SubClass extends SuperClass {}
*/
@@ -1028,7 +1055,7 @@
//Contents for SubClass that extends SuperClass
anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
- + Helper.ContentVars.BASEANNO.getVal();
+ + "@Foo(3)";
replaceVal = expectedVals + "\n" + anno;
String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
.replace("#CN", className).replace("#SN", SUPERCLASS)
@@ -1044,18 +1071,18 @@
BasicRepeatable(
"@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\" }, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\" }, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnoVal = \"NULL\","
- + "getAnnosArgs = {\"Foo\", \"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+ + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\","
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"FooContainer\","
- + "getAnnosArgs = {\"FooContainer\"},"
- + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1088,12 +1115,12 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @Foo() @Foo()
+ @Foo(1) @Foo(2)
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -1120,7 +1147,7 @@
Sample testSrc for class:
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -1129,7 +1156,7 @@
@ExpectedBase
@ExpectedContainer
- @Foo @Foo
+ @Foo(1) @Foo(2)
class A { }
*/
replaceVal = expectedVals + anno;
@@ -1146,21 +1173,21 @@
"@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnoVal = \"NULL\","
- + "getAnnosArgs = {\"Foo\", \"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})",
+ + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\","
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"FooContainer\","
- + "getAnnosArgs = {\"FooContainer\"},"
- + "getDeclAnnosArgs = {\"FooContainer\"} )") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1193,12 +1220,12 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -1225,7 +1252,7 @@
Sample testSrc for class:
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -1234,7 +1261,7 @@
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class A { }
*/
replaceVal = expectedVals + anno;
@@ -1250,17 +1277,17 @@
BasicContainerRepeatable_Inherited(
"@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", "
- + "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+ + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
+ "getDeclAnnosArgs = {})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+ "getDeclAnnoVal = \"NULL\", "
- + "getAnnosArgs = {\"FooContainer\"}, "
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosArgs = {})") {
@Override
@@ -1280,7 +1307,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1288,7 +1315,7 @@
Foo[] value();
}
- @FooContainer(value = {@Foo, @Foo})
+ @FooContainer(value = {@Foo(1), @Foo(2)})
class SuperClass { }
@ExpectedBase
@@ -1323,21 +1350,21 @@
RepeatableAnnoInherited(
"@ExpectedBase(value=Foo.class, "
+ "getAnnotationVal = \"NULL\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, "
+ // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", "
+ // ignores inherited
- "getAnnosArgs = {\"Foo\", \"Foo\"}, "
+ "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, "
+ "getDeclAnnosArgs = {})", // ignores inherited
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, "
+ // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", "
+ // ignores inherited
- "getAnnosArgs = {\"FooContainer\"}, "
+ "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ "getDeclAnnosArgs = {})") { // ignores inherited
@Override
@@ -1357,7 +1384,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1365,7 +1392,7 @@
Foo[] value();
}
- @Foo() @Foo()
+ @Foo(1) @Foo(2)
class SuperClass { }
@ExpectedBase
@@ -1397,25 +1424,27 @@
return files;
}
},
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
SingleAnnoWithContainer(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=0)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"Foo\","
- + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\", \"Foo\",\"Foo\"})",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnoVal = \"@Foo(value=0)\","
+ + "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
- + "getDeclAnnoVal = \"FooContainer\","
- + "getDeclAnnosArgs = {\"FooContainer\"},"
- + "getAnnosArgs = {\"FooContainer\"})") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, "
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1449,12 +1478,12 @@
Sample package-info.java
@ExpectedBase
@ExpectedContainer
- @Foo @FooContainer(value = {@Foo, @Foo})
+ @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)})
package testpkg;
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@interface FooContainer {
@@ -1482,7 +1511,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1492,7 +1521,7 @@
@ExpectedBase
@ExpectedContainer
- @Foo @FooContainer(value = {@Foo, @Foo})
+ @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)})
class A { }
*/
replaceVal = expectedVals + anno;
@@ -1508,18 +1537,18 @@
},
AnnoOnSuperAndSubClass_Inherited(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
+ + "getAnnotationVal = \"@Foo(value=1)\", "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, "
+ // override every annotation on superClass
- "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+ "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, "
+ // ignores inherited annotations
- "getDeclAnnoVal = \"Foo\", " // ignores inherited
- + "getAnnosArgs = {\"Foo\"}, "
- + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited
+ "getDeclAnnoVal = \"@Foo(value=1)\", " // ignores inherited
+ + "getAnnosArgs = {\"@Foo(value=1)\"}, "
+ + "getDeclAnnosArgs = { \"@Foo(value=1)\" })", // ignores inherited
"@ExpectedContainer(value=FooContainer.class, "
+ "getAnnotationVal = \"NULL\", "
- + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, "
- + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, "
+ + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, "
+ + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, "
+ // ignores inherited annotations
"getDeclAnnoVal = \"NULL\", " + // ignores inherited
"getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") {
@@ -1542,7 +1571,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Repeatable(FooContainer.class)
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1550,12 +1579,12 @@
Foo[] value();
}
- @Foo()
+ @Foo(0)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @Foo
+ @Foo(1)
class SubClass extends SuperClass { }
*/
// @Inherited only works for classes, no switch cases for
@@ -1570,7 +1599,7 @@
.replace("#REPLACE", replaceVal);
// Contents for SubClass that extends SuperClass
- replaceVal = expectedVals + "\n" + anno;
+ replaceVal = expectedVals + "\n" + "@Foo(1)";
String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
.replace("#CN", className)
.replace("#SN", SUPERCLASS)
@@ -1623,7 +1652,7 @@
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
// @Repeatable(FooContainer.class)
-// @interface Foo {}
+// @interface Foo {int value() default Integer.MAX_VALUE;}
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
@@ -1650,7 +1679,7 @@
// .replace("#REPLACE", replaceVal);
// //Contents for SubClass that extends SuperClass
-// anno = Helper.ContentVars.BASEANNO.getVal();
+// anno = "@Foo(0)";
// replaceVal = expectedVals + "\n" + anno;
// String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
// .replace("#CN", className)
@@ -1703,7 +1732,7 @@
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
// @Repeatable(FooContainer.class)
-// @interface Foo {}
+// @interface Foo {int value() default Integer.MAX_VALUE;}
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
@@ -1723,7 +1752,7 @@
// //@Inherited only works for classes, no switch cases for method, field, package
// if (srcType == SrcType.CLASS) {
// //Contents for SuperClass
-// anno = Helper.ContentVars.BASEANNO.getVal();
+// anno = "@Foo(0)";
// replaceVal = commonStmts + "\n" + anno;
// String superClassContents = srcType.getTemplate()
// .replace("#CN", SUPERCLASS)
@@ -1781,7 +1810,7 @@
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
// @Repeatable(FooContainer.class)
-// @interface Foo {}
+// @interface Foo {int value() default Integer.MAX_VALUE;}
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
@@ -1808,7 +1837,7 @@
// .replace("#REPLACE", replaceVal);
// //Contents for SubClass that extends SuperClass
-// anno = Helper.ContentVars.BASEANNO.getVal();
+// anno = "@Foo(0)";
// replaceVal = expectedVals + "\n" + anno;
// String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
// .replace("#CN", className)
@@ -1859,7 +1888,7 @@
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
// @Repeatable(FooContainer.class)
-// @interface Foo {}
+// @interface Foo {int value() default Integer.MAX_VALUE;}
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
@@ -1879,7 +1908,7 @@
// //@Inherited only works for classes, no switch cases for method, field, package
// if (srcType == SrcType.CLASS) {
// //Contents for SuperClass
-// anno = Helper.ContentVars.BASEANNO.getVal();
+// anno = "@Foo(0)";
// replaceVal = commonStmts + "\n" + anno;
// String superClassContents = srcType.getTemplate()
// .replace("#CN", SUPERCLASS)
@@ -1900,25 +1929,27 @@
// return files;
// }
// },
+ // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest
+ // fail with ordering issues
SingleOnSuperContainerAndSingleOnSub_Inherited(
"@ExpectedBase(value=Foo.class, "
- + "getAnnotationVal = \"Foo\", "
+ + "getAnnotationVal = \"@Foo(value=3)\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"Foo\","
- + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"},"
- + "getDeclAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"})",
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+ + "getDeclAnnoVal = \"@Foo(value=3)\","
+ + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"},"
+ + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})",
"@ExpectedContainer(value=FooContainer.class, "
- + "getAnnotationVal = \"FooContainer\", "
+ + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", "
+ "getAnnotationsVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, "
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, "
+ "getDeclAnnosVals = {"
- + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"},"
- + "getDeclAnnoVal = \"FooContainer\","
- + "getAnnosArgs = {\"FooContainer\"},"
- + "getDeclAnnosArgs = {\"FooContainer\"})") {
+ + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"},"
+ + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\","
+ + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"},"
+ + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") {
@Override
public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType,
@@ -1936,7 +1967,7 @@
Sample testSrc:
@Retention(RetentionPolicy.RUNTIME)
@Inherited
- @interface Foo {}
+ @interface Foo {int value() default Integer.MAX_VALUE;}
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@@ -1945,12 +1976,12 @@
Foo[] value();
}
- @Foo
+ @Foo(0)
class SuperClass { }
@ExpectedBase
@ExpectedContainer
- @FooContainer(value = {@Foo, @Foo}) @Foo
+ @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3)
class SubClass extends SuperClass {}
*/
@@ -1964,7 +1995,7 @@
//Contents for SubClass that extends SuperClass
anno = Helper.ContentVars.LEGACYCONTAINER.getVal()
- + Helper.ContentVars.BASEANNO.getVal();
+ + "@Foo(3)";
replaceVal = expectedVals + "\n" + anno;
String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
.replace("#CN", className)
@@ -2015,7 +2046,7 @@
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
// @Repeatable(FooContainer.class)
-// @interface Foo {}
+// @interface Foo {int value() default Integer.MAX_VALUE;}
// @Retention(RetentionPolicy.RUNTIME)
// @Inherited
@@ -2044,7 +2075,7 @@
// .replace("#REPLACE", replaceVal);
// //Contents for SubClass that extends SuperClass
-// anno = Helper.ContentVars.BASEANNO.getVal();
+// anno = "@Foo(0)";
// replaceVal = expectedVals + "\n" + anno;
// String subClassContents = SrcType.CLASSEXTENDS.getTemplate()
// .replace("#CN", className)
@@ -2800,6 +2831,8 @@
// should be present in actualAnno[].
private static boolean compareAnnotations(Annotation[] actualAnnos,
String[] expectedAnnos) {
+ boolean compOrder = false;
+
// Length is different
if (actualAnnos.length != expectedAnnos.length) {
error("Length not same, Actual length = " + actualAnnos.length
@@ -2830,12 +2863,16 @@
// Lengths are same, compare array contents
String[] actualArr = new String[actualAnnos.length];
for (Annotation a : actualAnnos) {
+ if (a.annotationType().getSimpleName().contains("Expected"))
actualArr[i++] = a.annotationType().getSimpleName();
+ else if (a.annotationType().getName().contains(TESTPKG)) {
+ String replaced = a.toString().replaceAll(Pattern.quote("testpkg."),"");
+ actualArr[i++] = replaced;
+ } else
+ actualArr[i++] = a.toString();
}
-
- List<String> actualList = Arrays.asList(actualArr);
- List<String> expectedList = Arrays.asList(expectedAnnos);
-
+ List<String> actualList = new ArrayList<String>(Arrays.asList(actualArr));
+ List<String> expectedList = new ArrayList<String>(Arrays.asList(expectedAnnos));
if (!actualList.containsAll(expectedList)) {
error("Array values are not same");
printArrContents(actualAnnos);
@@ -2843,10 +2880,63 @@
return false;
} else {
debugPrint("Arr values are same as expected");
+ if (CHECKORDERING) {
+ debugPrint("Checking if annotation ordering is as expected..");
+ compOrder = compareOrdering(actualList, expectedList);
+ if (compOrder)
+ debugPrint("Arr values ordering is as expected");
+ else
+ error("Arr values ordering is not as expected! actual values: "
+ + actualList + " expected values: " + expectedList);
+ } else
+ compOrder = true;
}
}
+ return compOrder;
+ }
+
+ // Annotation ordering comparison
+ private static boolean compareOrdering(List<String> actualList, List<String> expectedList) {
+ boolean order = true;
+ // Discarding Expected* annotations before comparison of ordering
+ actualList = iterateList(actualList);
+ expectedList = iterateList(expectedList);
+ // Length is different
+ if (actualList.size() != expectedList.size()) {
+ error("Length not same, Actual list length = " + actualList.size()
+ + " Expected list length = " + expectedList.size());
+ return false;
+ } else {
+ if (actualList.isEmpty() && expectedList.isEmpty()) {
return true;
}
+ boolean tmp = true;
+ for (int i = 0; i < actualList.size(); i++) {
+ // Checking ordering
+ if (order) {
+ if (!actualList.get(i).equals(expectedList.get(i))) {
+ tmp = false;
+ debugPrint("Odering is false");
+ debugPrint("actualList values: " + actualList
+ + " expectedList values: " + expectedList);
+ }
+ }
+ }
+ order = tmp;
+ }
+ return order;
+ }
+
+ private static List<String> iterateList(List<String> list) {
+ Iterator<String> iter = list.iterator();
+ while (iter.hasNext()) {
+ String anno = iter.next();
+ if (anno.contains("Expected")) {
+ iter.remove();
+ }
+ }
+ return list;
+ }
private static void printArrContents(Annotation[] actualAnnos) {
System.out.print("Actual Arr Values: ");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/TestAnonInnerInstance1.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026286
+ * @summary This test previously forced an assertion to fail, due to
+ * TypeAnnotationPosition visiting a tree node prior to
+ * memberEnter.
+ * @compile TestAnonInnerInstance1.java
+ */
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class TestAnonInnerInstance1<T> {
+ Object mtest(TestAnonInnerInstance1<T> t){ return null; }
+ Object mmtest(TestAnonInnerInstance1<T> t){ return null; }
+
+ public void test() {
+
+ mtest(new TestAnonInnerInstance1<T>() {
+ class InnerAnon<U> { // Test1$1$InnerAnon.class
+ @A @B @C @D String ia_m1(){ return null; };
+ }
+ //If this is commented out, annotations are attributed correctly
+ InnerAnon<String> IA = new InnerAnon< String>();
+ });
+ }
+}
+
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface B { }
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface C { }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @interface D { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java Mon Oct 28 12:28:57 2013 -0700
@@ -36,7 +36,8 @@
//Makes debugging much easier. Set to 'false' for less output.
public Boolean verbose = true;
- void println(String msg) { if(verbose) System.out.println(msg); }
+ void println(String msg) { if (verbose) System.out.println(msg); }
+ void print(String msg) { if (verbose) System.out.print(msg); }
File writeTestFile(String fname, String source) throws IOException {
File f = new File(fname);
@@ -183,6 +184,13 @@
(RuntimeTypeAnnotations_attribute)attr;
println(testtype + ": " + name + ", " + annName + ": " +
tAttr.annotations.length );
+ if (tAttr.annotations.length > 0) {
+ for (int i = 0; i < tAttr.annotations.length; i++) {
+ println(" types:" + tAttr.annotations[i].position.type);
+ }
+ } else {
+ println("");
+ }
allt += tAttr.annotations.length;
if (visible)
tvisibles += tAttr.annotations.length;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/Scopes.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.annotation.*;
+import java.io.*;
+import java.net.URL;
+import java.util.List;
+
+import com.sun.tools.classfile.*;
+
+/*
+ * @test
+ * @bug 6843077 8006775
+ * @summary Qualified inner type annotation accessible to the class.
+ */
+
+@Scopes.UniqueInner
+public class Scopes<T extends @Scopes.UniqueInner Object> extends ClassfileTestHelper{
+ public static void main(String[] args) throws Exception {
+ new Scopes().run();
+ }
+
+ public void run() throws Exception {
+ expected_tinvisibles = 1;
+ expected_invisibles = 1;
+
+ ClassFile cf = getClassFile("Scopes.class");
+ test(cf);
+
+ countAnnotations();
+
+ if (errors > 0)
+ throw new Exception(errors + " errors found");
+ System.out.println("PASSED");
+ }
+
+ @Target({ElementType.TYPE_USE})
+ @interface UniqueInner { };
+}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/T8008762.java Mon Oct 28 12:28:57 2013 -0700
@@ -24,7 +24,6 @@
/*
* @test
* @bug 8008762
- * @ignore 8013409: test failures for type annotations
* @summary Type annotation on inner class in anonymous class
* shows up as regular annotation
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,439 @@
+/*
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8005085 8008762 8008751 8013065 8015323 8015257
+ * @summary Type annotations on anonymous and inner class.
+ * Six TYPE_USE annotations are repeated(or not); Four combinations create
+ * four test files, and each results in the test class and 2 anonymous classes.
+ * Each element of these three classes is checked for expected number of the
+ * four annotation Attributes. Expected annotation counts depend on type of
+ * annotation place on type of element (a FIELD&TYPE_USE element on a field
+ * results in 2). Elements with no annotations expect 0.
+ * Source template is read in from testanoninner.template
+ *
+ */
+import java.lang.annotation.*;
+import java.io.*;
+import java.util.List;
+import java.util.LinkedList;
+import com.sun.tools.classfile.*;
+import java.nio.file.Files;
+import java.nio.charset.*;
+import java.io.File;
+import java.io.IOException;
+
+
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+
+/*
+ * A source template is read in and testname and annotations are inserted
+ * via replace().
+ */
+public class TestAnonInnerClasses extends ClassfileTestHelper {
+ // tally errors and test cases
+ int errors = 0;
+ int checks = 0;
+ //Note expected test count in case of skips due to bugs.
+ int tc = 0, xtc = 180; // 45 x 4 variations of repeated annotations.
+ File testSrc = new File(System.getProperty("test.src"));
+
+ String[] AnnoAttributes = {
+ Attribute.RuntimeVisibleTypeAnnotations,
+ Attribute.RuntimeInvisibleTypeAnnotations,
+ Attribute.RuntimeVisibleAnnotations,
+ Attribute.RuntimeInvisibleAnnotations
+ };
+
+ // template for source files
+ String srcTemplate = "testanoninner.template";
+
+ // Four test files generated based on combinations of repeating annotations.
+ Boolean As= false, Bs=true, Cs=false, Ds=false, TAs=false,TBs=false;
+ Boolean[][] bRepeat = new Boolean[][]{
+ /* no repeats */ {false, false, false, false, false, false},
+ /* repeat A,C,TA */ {true, false, true, false, true, false},
+ /* repeat B,D,TB */ {false, true, false, true, false, true},
+ /* repeat all */ {true, true, true, true, true, true}
+ };
+ // Save descriptions of failed test case; does not terminate upon a failure.
+ List<String> failed = new LinkedList<>();
+
+ public static void main(String[] args) throws Exception {
+ new TestAnonInnerClasses().run();
+ }
+
+ // Check annotation counts and make reports sufficiently descriptive to
+ // easily diagnose.
+ void check(String testcase, int vtaX, int itaX, int vaX, int iaX,
+ int vtaA, int itaA, int vaA, int iaA) {
+
+ String descr = " checking " + testcase+" _TYPE_, expected: " +
+ vtaX + ", " + itaX + ", " + vaX + ", " + iaX + "; actual: " +
+ vtaA + ", " + itaA + ", " + vaA + ", " + iaA;
+ String description;
+ description=descr.replace("_TYPE_","RuntimeVisibleTypeAnnotations");
+ if (vtaX != vtaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (vtaX) " + vtaX +
+ " != " + vtaA + " (vtaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeInvisibleTypeAnnotations");
+ if (itaX != itaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (itaX) " + itaX + " != " +
+ itaA + " (itaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeVisibleAnnotations");
+ if (vaX != vaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (vaX) " + vaX + " != " +
+ vaA + " (vaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ description=descr.replace("_TYPE_","RuntimeInvisibleAnnotations");
+ if (iaX != iaA) {
+ errors++;
+ failed.add(++checks + " " + testcase + ": (iaX) " + iaX + " != " +
+ iaA + " (iaA)");
+ println(checks + " FAIL: " + description);
+ } else {
+ println(++checks + " PASS: " + description);
+ }
+ println("");
+ }
+
+ // Print failed cases (if any) and throw exception for fail.
+ void report() {
+ if (errors!=0) {
+ System.err.println("Failed tests: " + errors +
+ "\nfailed test cases:\n");
+ for (String t: failed) System.err.println(" " + t);
+ throw new RuntimeException("FAIL: There were test failures.");
+ } else
+ System.out.println("PASSED all tests.");
+ }
+
+ void test(String ttype, ClassFile cf, Method m, Field f, boolean visible) {
+ int vtaActual = 0,
+ itaActual = 0,
+ vaActual = 0,
+ iaActual = 0,
+ vtaExp = 0,
+ itaExp = 0,
+ vaExp = 0,
+ iaExp = 0,
+ index = 0,
+ index2 = 0;
+ String memberName = null,
+ testcase = "undefined",
+ testClassName = null;
+ Attribute attr = null,
+ cattr = null;
+ Code_attribute CAttr = null;
+ // Get counts of 4 annotation Attributes on element being checked.
+ for (String AnnoType : AnnoAttributes) {
+ try {
+ switch (ttype) {
+ case "METHOD":
+ index = m.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ memberName = m.getName(cf.constant_pool);
+ if (index != -1)
+ attr = m.attributes.get(index);
+ //fetch index annotations from code attribute.
+ index2 = m.attributes.getIndex(cf.constant_pool,
+ Attribute.Code);
+ if (index2 != -1) {
+ cattr = m.attributes.get(index2);
+ assert cattr instanceof Code_attribute;
+ CAttr = (Code_attribute)cattr;
+ index2 = CAttr.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index2 != -1)
+ cattr = CAttr.attributes.get(index2);
+ }
+ break;
+ case "FIELD":
+ index = f.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ memberName = f.getName(cf.constant_pool);
+ if (index != -1)
+ attr = f.attributes.get(index);
+ //fetch index annotations from code attribute.
+ index2 = cf.attributes.getIndex(cf.constant_pool,
+ Attribute.Code);
+ if (index2!= -1) {
+ cattr = cf.attributes.get(index2);
+ assert cattr instanceof Code_attribute;
+ CAttr = (Code_attribute)cattr;
+ index2 = CAttr.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index2!= -1)
+ cattr = CAttr.attributes.get(index2);
+ }
+ break;
+
+ default:
+ memberName = cf.getName();
+ index = cf.attributes.getIndex(cf.constant_pool,
+ AnnoType);
+ if (index!= -1) attr = cf.attributes.get(index);
+ break;
+ }
+ }
+ catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+ try {
+ testClassName=cf.getName();
+ testcase = ttype + ": " + testClassName + ": " +
+ memberName + ", ";
+ }
+ catch (ConstantPoolException cpe) { cpe.printStackTrace(); }
+ if (index != -1) {
+ switch (AnnoType) {
+ case Attribute.RuntimeVisibleTypeAnnotations:
+ //count RuntimeVisibleTypeAnnotations
+ RuntimeVisibleTypeAnnotations_attribute RVTAa =
+ (RuntimeVisibleTypeAnnotations_attribute)attr;
+ vtaActual += RVTAa.annotations.length;
+ break;
+ case Attribute.RuntimeVisibleAnnotations:
+ //count RuntimeVisibleAnnotations
+ RuntimeVisibleAnnotations_attribute RVAa =
+ (RuntimeVisibleAnnotations_attribute)attr;
+ vaActual += RVAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleTypeAnnotations:
+ //count RuntimeInvisibleTypeAnnotations
+ RuntimeInvisibleTypeAnnotations_attribute RITAa =
+ (RuntimeInvisibleTypeAnnotations_attribute)attr;
+ itaActual += RITAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleAnnotations:
+ //count RuntimeInvisibleAnnotations
+ RuntimeInvisibleAnnotations_attribute RIAa =
+ (RuntimeInvisibleAnnotations_attribute)attr;
+ iaActual += RIAa.annotations.length;
+ break;
+ }
+ }
+ // annotations from code attribute.
+ if (index2 != -1) {
+ switch (AnnoType) {
+ case Attribute.RuntimeVisibleTypeAnnotations:
+ //count RuntimeVisibleTypeAnnotations
+ RuntimeVisibleTypeAnnotations_attribute RVTAa =
+ (RuntimeVisibleTypeAnnotations_attribute)cattr;
+ vtaActual += RVTAa.annotations.length;
+ break;
+ case Attribute.RuntimeVisibleAnnotations:
+ //count RuntimeVisibleAnnotations
+ RuntimeVisibleAnnotations_attribute RVAa =
+ (RuntimeVisibleAnnotations_attribute)cattr;
+ vaActual += RVAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleTypeAnnotations:
+ //count RuntimeInvisibleTypeAnnotations
+ RuntimeInvisibleTypeAnnotations_attribute RITAa =
+ (RuntimeInvisibleTypeAnnotations_attribute)cattr;
+ itaActual += RITAa.annotations.length;
+ break;
+ case Attribute.RuntimeInvisibleAnnotations:
+ //count RuntimeInvisibleAnnotations
+ RuntimeInvisibleAnnotations_attribute RIAa =
+ (RuntimeInvisibleAnnotations_attribute)cattr;
+ iaActual += RIAa.annotations.length;
+ break;
+ }
+ }
+ }
+
+ switch (memberName) {
+ //METHODs
+ case "test" : vtaExp=4; itaExp=4; vaExp=0; iaExp=0; tc++; break;
+ case "mtest": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "m3": vtaExp=10; itaExp=10; vaExp=1; iaExp=1; tc++; break;
+ case "tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //inner class
+ case "i_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "i_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //local class
+ case "l_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "l_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //anon class
+ case "mm_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "mm_m3": vtaExp=10; itaExp=10;vaExp=1; iaExp=1; tc++; break;
+ case "mm_tm": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //InnerAnon class
+ case "ia_m1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_m2": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "ia_um": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //FIELDs
+ case "data": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ //inner class
+ case "i_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "i_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "i_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ //local class
+ case "l_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "l_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "l_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ //anon class
+ case "mm_odata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_pdata1": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "mm_sa1": vtaExp = 6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "mm_tdata": vtaExp = 2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ // InnerAnon class
+ case "ia_odata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_pdata1": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_udata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "ia_sa1": vtaExp=6; itaExp=6; vaExp=1; iaExp=1; tc++; break;
+ case "ia_tdata": vtaExp=2; itaExp=2; vaExp=1; iaExp=1; tc++; break;
+ case "IA": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ case "IN": vtaExp=4; itaExp=4; vaExp=1; iaExp=1; tc++; break;
+ // default cases are <init>, this$0, this$1, mmtest, atest
+ default: vtaExp = 0; itaExp=0; vaExp=0; iaExp=0; break;
+ }
+ check(testcase,vtaExp, itaExp, vaExp, iaExp,
+ vtaActual,itaActual,vaActual,iaActual);
+ }
+
+ public void run() {
+ ClassFile cf = null;
+ InputStream in = null;
+ int testcount = 1;
+ File testFile = null;
+ // Generate source, check methods and fields for each combination.
+ for (Boolean[] bCombo : bRepeat) {
+ As=bCombo[0]; Bs=bCombo[1]; Cs=bCombo[2];
+ Ds=bCombo[3]; TAs=bCombo[4]; TBs=bCombo[5];
+ String testname = "Test" + testcount++;
+ println("Combinations: " + As + ", " + Bs + ", " + Cs + ", " + Ds +
+ ", " + TAs + ", " + TBs +
+ "; see " + testname + ".java");
+ String[] classes = {testname + ".class",
+ testname + "$Inner.class",
+ testname + "$1Local1.class",
+ testname + "$1.class",
+ testname + "$1$1.class",
+ testname + "$1$InnerAnon.class"
+ };
+ // Create test source, create and compile File.
+ String sourceString = getSource(srcTemplate, testname,
+ As, Bs, Cs, Ds, TAs, TBs);
+ System.out.println(sourceString);
+ try {
+ testFile = writeTestFile(testname+".java", sourceString);
+ }
+ catch (IOException ioe) { ioe.printStackTrace(); }
+ // Compile test source and read classfile.
+ File classFile = null;
+ try {
+ classFile = compile(testFile);
+ }
+ catch (Error err) {
+ System.err.println("FAILED compile. Source:\n" + sourceString);
+ throw err;
+ }
+ String testloc = classFile.getAbsolutePath().substring(
+ 0,classFile.getAbsolutePath().indexOf(classFile.getPath()));
+ for (String clazz : classes) {
+ try {
+ cf = ClassFile.read(new File(testloc+clazz));
+ }
+ catch (Exception e) { e.printStackTrace(); }
+ // Test for all methods and fields
+ for (Method m: cf.methods) {
+ test("METHOD", cf, m, null, true);
+ }
+ for (Field f: cf.fields) {
+ test("FIELD", cf, null, f, true);
+ }
+ }
+ }
+ report();
+ if (tc!=xtc) System.out.println("Test Count: " + tc + " != " +
+ "expected: " + xtc);
+ }
+
+
+ String getSrcTemplate(String sTemplate) {
+ List<String> tmpl = null;
+ String sTmpl = "";
+ try {
+ tmpl = Files.readAllLines(new File(testSrc,sTemplate).toPath(),
+ Charset.defaultCharset());
+ }
+ catch (IOException ioe) {
+ String error = "FAILED: Test failed to read template" + sTemplate;
+ ioe.printStackTrace();
+ throw new RuntimeException(error);
+ }
+ for (String l : tmpl)
+ sTmpl=sTmpl.concat(l).concat("\n");
+ return sTmpl;
+ }
+
+ // test class template
+ String getSource(String templateName, String testname,
+ Boolean Arepeats, Boolean Brepeats,
+ Boolean Crepeats, Boolean Drepeats,
+ Boolean TArepeats, Boolean TBrepeats) {
+ String As = Arepeats ? "@A @A":"@A",
+ Bs = Brepeats ? "@B @B":"@B",
+ Cs = Crepeats ? "@C @C":"@C",
+ Ds = Drepeats ? "@D @D":"@D",
+ TAs = TArepeats ? "@TA @TA":"@TA",
+ TBs = TBrepeats ? "@TB @TB":"@TB";
+
+ // split up replace() lines for readability
+ String testsource = getSrcTemplate(templateName).replace("testname",testname);
+ testsource = testsource.replace("_As",As).replace("_Bs",Bs).replace("_Cs",Cs);
+ testsource = testsource.replace("_Ds",Ds).replace("_TAs",TAs).replace("_TBs",TBs);
+ return testsource;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/testanoninner.template Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,108 @@
+import java.lang.annotation.*;
+import static java.lang.annotation.RetentionPolicy.*;
+import static java.lang.annotation.ElementType.*;
+import java.util.List;
+
+class testname <T> { // TestN.class
+ _As _Bs _Cs _Ds String data = "test";
+ _As _Bs _Cs _Ds Object mtest( _As _Bs _Cs _Ds testname <T> t){ return null; }
+ Object mmtest( testname<T> t){ return null; }
+
+ class Inner<U> { // TestN$1$Inner.class
+ _As _Bs _Cs _Ds String i_odata1 = "test";
+ _As _Bs _Cs _Ds int i_pdata1 = 0;
+ _As _Bs _Cs _Ds U i_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds [] i_sa1 = null;
+ _As _Bs _Cs _Ds T i_tdata = null;
+ _As _Bs _Cs _Ds String i_m1(){ return null; };
+ _As _Bs _Cs _Ds int i_m2( _As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object i_um( _As _Bs _Cs _Ds U u) { return null; }
+ }
+//8015323
+ _As _Bs _Cs _Ds Inner< _As _Bs _Cs _Ds String> IN = new Inner< String>();
+
+ public void test() {
+
+ class Local1<U> { // TestN$Local1.class
+ _As _Bs _Cs _Ds String l_odata1 = "test";
+ _As _Bs _Cs _Ds int l_pdata1 = 0;
+ _As _Bs _Cs _Ds U l_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] l_sa1 = null;
+ _TAs _TBs _Cs _Ds T l_tdata = null;
+ _As _Bs _Cs _Ds String l_m1(){ return null; };
+ _As _Bs _Cs _Ds int l_m2(_As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object l_um(_As _Bs _Cs _Ds U u) { return null; }
+ }
+ // The below, as a local variable, will show up on test()
+ _As _Bs _Cs _Ds Local1<_As _Bs _Cs _Ds String> LC = new Local1<String>();
+
+ mtest( new testname<T>() { // TestN$1
+ class InnerAnon<U> { // TestN$1$InnerAnon.class
+ _As _Bs _Cs _Ds String ia_odata1 = "test";
+ _As _Bs _Cs _Ds int ia_pdata1 = 0;
+ _As _Bs _Cs _Ds U ia_udata = null;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] ia_sa1 = null;
+ _TAs _TBs _Cs _Ds T ia_tdata = null;
+ _As _Bs _Cs _Ds String ia_m1(){ return null; };
+ _As _Bs _Cs _Ds int ia_m2(_As _Bs _Cs _Ds Object o){return 0;}
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds U> Object ia_um(_As _Bs _Cs _Ds U u) { return null; }
+ }
+//8015257
+ _As _Bs _Cs _Ds InnerAnon<_As _Bs _Cs _Ds String> IA = new InnerAnon< String>();
+
+ _As _Bs _Cs _Ds String odata1 = "test";
+ _As _Bs _Cs _Ds int pdata1 = 0;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa1 = null;
+ _As _Bs _Cs _Ds T tdata = null;
+
+ _As _Bs _Cs _Ds String m1(){ return null; };
+ _As _Bs _Cs _Ds int m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+ m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds T> Object tm(_As _Bs _Cs _Ds T t) { return null; }
+
+ public void atest( testname<T> t){
+ t.mmtest( new testname<T>() { // TestN$1$1.class
+ _As _Bs _Cs _Ds String mm_odata1 = "test";
+ _As _Bs _Cs _Ds int mm_pdata1 = 0;
+//8015257
+ _As _Bs _Cs _Ds Object _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] mm_sa1 = null;
+ _TAs _TBs _Cs _Ds T mm_tdata = null;
+
+ _As _Bs _Cs _Ds String mm_m1(){ return null; };
+ _As _Bs _Cs _Ds int mm_m2(_As _Bs _Cs _Ds Object o){return 0;}
+
+ _As _Bs _Cs _Ds String _As _Bs _Cs _Ds [] _As _Bs _Cs _Ds []
+ mm_m3(String _As _Bs _Cs _Ds []_As _Bs _Cs _Ds [] sa){ return null; }
+
+ _As _Bs _Cs _Ds
+ <_TAs _TBs _Cs _Ds T> Object mm_tm(_As _Bs _Cs _Ds T t) { return null; }
+ });
+ }
+ });
+ }
+}
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @Repeatable( AC.class ) @interface A { }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @Repeatable( BC.class ) @interface B { }
+@Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface AC { A[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,METHOD}) @interface BC { B[] value(); }
+
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @Repeatable( CC.class ) @interface C { }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @Repeatable( DC.class ) @interface D { }
+@Retention(CLASS) @Target({TYPE_USE,FIELD}) @interface CC { C[] value(); }
+@Retention(CLASS) @Target({TYPE_USE,METHOD}) @interface DC { D[] value(); }
+
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @Repeatable( TAC.class ) @interface TA { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @Repeatable( TBC.class ) @interface TB { }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,FIELD}) @interface TAC { TA[] value(); }
+@Retention(RUNTIME) @Target({TYPE_USE,TYPE_PARAMETER,METHOD}) @interface TBC { TB[] value(); }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedImport.java Mon Oct 28 12:28:57 2013 -0700
@@ -3,13 +3,16 @@
* @bug 8006775
* @summary Import clauses cannot use annotations.
* @author Werner Dietl
+ * @ignore
* @compile/fail/ref=AnnotatedImport.out -XDrawDiagnostics AnnotatedImport.java
*/
+import java.lang.annotation.*;
import java.@A util.List;
import @A java.util.Map;
import java.util.@A HashMap;
class AnnotatedImport { }
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.java Mon Oct 28 12:28:57 2013 -0700
@@ -3,11 +3,15 @@
* @bug 8006775
* @summary Package declarations cannot use annotations.
* @author Werner Dietl
+ * @ignore
* @compile/fail/ref=AnnotatedPackage1.out -XDrawDiagnostics AnnotatedPackage1.java
*/
package name.@A p1.p2;
+import java.lang.annotation.*;
+
class AnnotatedPackage1 { }
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage1.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,3 +1,3 @@
AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
-AnnotatedPackage1.java:9:15: compiler.err.expected3: class, interface, enum
+AnnotatedPackage1.java:9:16: compiler.err.expected3: class, interface, enum
2 errors
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotatedPackage2.java Mon Oct 28 12:28:57 2013 -0700
@@ -8,6 +8,9 @@
package @A p1.p2;
+import java.lang.annotation.*;
+
class AnnotatedPackage2 { }
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.java Mon Oct 28 12:28:57 2013 -0700
@@ -3,11 +3,13 @@
* @bug 6843077 8006775
* @summary test that only Java 8 allows type annotations
* @author Mahmood Ali
+ * @compile AnnotationVersion.java
* @compile/fail/ref=AnnotationVersion.out -XDrawDiagnostics -Xlint:-options -source 1.6 AnnotationVersion.java
* @compile/fail/ref=AnnotationVersion7.out -XDrawDiagnostics -Xlint:-options -source 1.7 AnnotationVersion.java
*/
-class AnnotationVersion {
- public void method(@A AnnotationVersion this) { }
-}
+import java.lang.annotation.*;
+class myNumber<T extends @A Number> { }
+
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,2 @@
-AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.6
+AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.6
1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/AnnotationVersion7.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,2 @@
-AnnotationVersion.java:10:43: compiler.err.type.annotations.not.supported.in.source: 1.7
+AnnotationVersion.java:12:27: compiler.err.type.annotations.not.supported.in.source: 1.7
1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.java Mon Oct 28 12:28:57 2013 -0700
@@ -5,10 +5,13 @@
* @author Werner Dietl
* @compile/fail/ref=BadCast.out -XDrawDiagnostics BadCast.java
*/
+import java.lang.annotation.*;
+
class BadCast {
static void main() {
Object o = (@A) "";
}
}
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/BadCast.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,2 @@
-BadCast.java:10:19: compiler.err.illegal.start.of.type
-1 error
\ No newline at end of file
+BadCast.java:12:19: compiler.err.illegal.start.of.type
+1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 1234567
+ * @summary The parts of a fully-qualified type can't be annotated.
+ * @author Werner Dietl
+ * @compile/fail/ref=CantAnnotatePackages.out -XDrawDiagnostics CantAnnotatePackages.java
+ */
+
+import java.lang.annotation.*;
+import java.util.List;
+
+class CantAnnotatePackages {
+ // Before a package component:
+ @TA java.lang.Object of1;
+
+ // These result in a different error.
+ // TODO: should this be unified?
+
+ List<@TA java.lang.Object> of2;
+ java. @TA lang.Object of3;
+ List<java. @TA lang.Object> of4;
+
+ // TODO: also note the order of error messages.
+}
+
+@Target(ElementType.TYPE_USE)
+@interface TA { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotatePackages.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,5 @@
+CantAnnotatePackages.java:19:14: compiler.err.cant.resolve.location: kindname.class, java, , , (compiler.misc.location: kindname.class, CantAnnotatePackages, null)
+CantAnnotatePackages.java:20:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotatePackages.java:21:14: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotatePackages.java:14:18: compiler.err.cant.type.annotate.scoping.1: @TA
+4 errors
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,71 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @compile/fail/ref=CantAnnotateScoping.out -XDrawDiagnostics CantAnnotateScoping.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.lang.annotation.*;
+
+@Target({ElementType.TYPE_USE})
+@interface TA {}
+@Target({ElementType.TYPE_USE})
+@interface TA2 {}
+
+@Target({ElementType.FIELD})
+@interface DA {}
+@Target({ElementType.FIELD})
+@interface DA2 {}
+
+@Target({ElementType.TYPE_USE, ElementType.FIELD})
+@interface DTA {}
+@Target({ElementType.TYPE_USE, ElementType.FIELD})
+@interface DTA2 {}
+
+class Test {
+ static class Outer {
+ static class SInner {}
+ }
+
+ // Legal
+ List<Outer. @TA SInner> li;
+
+ // Illegal
+ @TA Outer.SInner osi;
+ // Illegal
+ List<@TA Outer.SInner> aloi;
+ // Illegal
+ Object o1 = new @TA @DA @TA2 Outer.SInner();
+ // Illegal
+ Object o = new ArrayList<@TA @DA Outer.SInner>();
+
+ // Illegal: @TA is only a type-use annotation
+ @TA java.lang.Object f1;
+
+ // Legal: @DA is only a declaration annotation
+ @DA java.lang.Object f2;
+
+ // Legal: @DTA is both a type-use and declaration annotation
+ @DTA java.lang.Object f3;
+
+ // Illegal: @TA and @TA2 are only type-use annotations
+ @DTA @DA @TA @DA2 @TA2 java.lang.Object f4;
+
+ // Illegal: Do we want one or two messages?
+ // 1: @DA in invalid location
+ // 2: Not finding class "lang"
+ java. @DA lang.Object f5;
+
+ // Illegal: Do we want one or two messages?
+ // 1: @DA in invalid location
+ // 2: Not finding class "XXX"
+ java. @DA XXX.Object f6;
+
+ // Illegal: Can't find class "lang".
+ // Would a different error message be desirable?
+ java. @TA lang.Object f7;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateScoping.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,11 @@
+CantAnnotateScoping.java:61:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:66:9: compiler.err.cant.resolve.location: kindname.class, XXX, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:70:9: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+CantAnnotateScoping.java:38:14: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:47:18: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:56:37: compiler.err.cant.type.annotate.scoping: @TA,@TA2
+CantAnnotateScoping.java:40:14: compiler.err.cant.type.annotate.scoping.1: @TA
+CantAnnotateScoping.java:42:34: compiler.err.cant.type.annotate.scoping: @TA,@DA,@TA2
+CantAnnotateScoping.java:44:38: compiler.err.cant.type.annotate.scoping: @TA,@DA
+CantAnnotateScoping.java:44:34: compiler.err.annotation.type.not.applicable
+10 errors
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,41 +1,96 @@
/*
* @test /nodynamiccopyright/
* @bug 8006733 8006775
- * @ignore 8013409: test failures for type annotations
- * @summary A static outer class cannot be annotated.
+ * @summary Ensure behavior for nested types is correct.
* @author Werner Dietl
- * @compile/fail/ref=CantAnnotateStaticClass.out -XDrawDiagnostics CantAnnotateStaticClass.java
+ * @compile CantAnnotateStaticClass.java
*/
import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.lang.annotation.*;
-class CantAnnotateStaticClass {
+class Top {
+ @Target(ElementType.TYPE_USE)
+ @interface TA {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface TB {}
+
@Target(ElementType.TYPE_USE)
- @interface A {}
+ @interface TC {}
- static class Outer {
- class Inner {}
+ class Outer {
+ class Inner {
+ Object o1 = Top.this;
+ Object o2 = Outer.this;
+ Object o3 = this;
+ }
+ // Illegal
+ // static class SInner {}
+ // interface IInner {}
}
- // 8 errors:
- @A Outer.Inner f1;
- @A Outer.Inner f1r() { return null; }
- void f1p(@A Outer.Inner p) { }
- void f1c(Object o) {
- Object l = (@A Outer.Inner) o;
+ // All combinations are OK
+
+ Top.@TB Outer f1;
+ @TB Outer.Inner f1a;
+ Outer. @TC Inner f1b;
+ @TB Outer. @TC Inner f1c;
+
+ @TA Top. @TB Outer f2;
+ @TA Top. @TB Outer.Inner f2a;
+ @TA Top. Outer. @TC Inner f2b;
+ @TA Top. @TB Outer. @TC Inner f2c;
+
+ @TB Outer f1r() { return null; }
+ @TB Outer.Inner f1ra() { return null; }
+ Outer. @TC Inner f1rb() { return null; }
+ @TB Outer. @TC Inner f1rc() { return null; }
+
+ void f1param(@TB Outer p,
+ @TB Outer.Inner p1,
+ Outer. @TC Inner p2,
+ @TB Outer. @TC Inner p3) { }
+
+ void f1cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.Inner) o;
+ l = (Outer. @TC Inner) o;
+ l = (@TB Outer. @TC Inner) o;
}
- List<@A Outer.Inner> f2;
- List<@A Outer.Inner> f2r() { return null; }
- void f2p(List<@A Outer.Inner> p) { }
- void f2c(Object o) {
- Object l = (List<@A Outer.Inner>) o;
- }
+ List<@TB Outer> g1;
+ List<@TB Outer.Inner> g1a;
+ List<Outer. @TC Inner> g1b;
+ List<@TB Outer. @TC Inner> g1c;
+
+ List<@TA Top. @TB Outer> g2;
+ List<@TA Top. @TB Outer.Inner> g2a;
+ List<@TA Top. Outer. @TC Inner> g2b;
+ List<@TA Top. @TB Outer. @TC Inner> g2c;
+
+ List<@TB Outer> g1r() { return null; }
+ List<@TB Outer.Inner> g1ra() { return null; }
+ List<Outer. @TC Inner> g1rb() { return null; }
+ List<@TB Outer. @TC Inner> g1rc() { return null; }
- // OK:
- @A Outer g1;
- List<@A Outer> g2;
- Outer. @A Inner g3;
- List<Outer. @A Inner> g4;
+ void g1param(List<@TB Outer> p,
+ List<@TB Outer.Inner> p1,
+ List<Outer. @TC Inner> p2,
+ List<@TB Outer. @TC Inner> p3) { }
+
+ void g1new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.Inner>();
+ l = new @TB HashMap<String, Outer. @TC Inner>();
+ l = new @TB HashMap<String, @TB Outer. Inner>();
+ l = new @TB HashMap<String, @TB Outer. @TC Inner>();
+ l = new @TB HashMap<String, @TA Top. Outer. @TC Inner>();
+ l = new @TB HashMap<String, @TA Top. @TB Outer. Inner>();
+ l = new @TB HashMap<String, @TA Top. @TB Outer. @TC Inner>();
+ }
}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass.out Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-dummy
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,207 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @ignore
+ * @compile/fail/ref=CantAnnotateStaticClass2.out -XDrawDiagnostics CantAnnotateStaticClass2.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.lang.annotation.*;
+
+class Top {
+ @Target(ElementType.TYPE_USE)
+ @interface TA {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface TB {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface TC {}
+
+ static class Outer {
+ class Inner {
+ // Object o1 = Top.this;
+ Object o2 = Outer.this;
+ Object o3 = this;
+ }
+ static class SInner {
+ // Object o1 = Top.this;
+ // Object o2 = Outer.this;
+ Object o3 = this;
+ }
+ interface IInner {
+ // Object o1 = Top.this;
+ // Object o2 = Outer.this;
+ // Object o3 = this;
+ }
+ }
+
+ @TB Outer f1;
+ @TB Outer.Inner f1a;
+ @TB Outer.SInner f2a; // err
+ @TB Outer.IInner f3a; // err
+
+ Outer. @TC Inner f1b;
+ Outer. @TC SInner f2b;
+ Outer. @TC IInner f3b;
+
+ @TB Outer. @TC Inner f1c;
+ @TB Outer. @TC SInner f2c; // err
+ @TB Outer. @TC IInner f3c; // err
+
+ @TA Top. @TB Outer g1; // err
+ @TA Top. @TB Outer.Inner g1a; // err
+ @TA Top. @TB Outer.SInner g2a; // err
+ @TA Top. @TB Outer.IInner g3a; // err
+
+ @TA Top. Outer. @TC Inner g1b; // err
+ @TA Top. Outer. @TC SInner g2b; // err
+ @TA Top. Outer. @TC IInner g3b; // err
+
+ @TA Top. @TB Outer. @TC Inner g1c; // err
+ @TA Top. @TB Outer. @TC SInner g2c; // err
+ @TA Top. @TB Outer. @TC IInner g3c; // err
+
+ @TB Outer f1r() { return null; }
+
+ @TB Outer.Inner f1ra() { return null; }
+ @TB Outer.SInner f2ra() { return null; } // err
+ @TB Outer.IInner f3ra() { return null; } // err
+
+ Outer. @TC Inner f1rb() { return null; }
+ Outer. @TC SInner f2rb() { return null; }
+ Outer. @TC IInner f3rb() { return null; }
+
+ @TB Outer. @TC Inner f1rc() { return null; }
+ @TB Outer. @TC SInner f2rc() { return null; } // err
+ @TB Outer. @TC IInner f3rc() { return null; } // err
+
+ void f1param(@TB Outer p,
+ @TB Outer.Inner p1,
+ Outer. @TC Inner p2,
+ @TB Outer. @TC Inner p3) { }
+ void f2param(@TB Outer p,
+ @TB Outer.SInner p1, // err
+ Outer. @TC SInner p2,
+ @TB Outer. @TC SInner p3) { } // err
+ void f3param(@TB Outer p,
+ @TB Outer.IInner p1, // err
+ Outer. @TC IInner p2,
+ @TB Outer. @TC IInner p3) { } // err
+
+ void f1cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.Inner) o;
+ l = (Outer. @TC Inner) o;
+ l = (@TB Outer. @TC Inner) o;
+ }
+ void f2cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.SInner) o; // err
+ l = (Outer. @TC SInner) o;
+ l = (@TB Outer. @TC SInner) o; // err
+ }
+ void f3cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.IInner) o; // err
+ l = (Outer. @TC IInner) o;
+ l = (@TB Outer. @TC IInner) o; // err
+ }
+
+ List<@TB Outer> h1;
+
+ List<@TB Outer.Inner> h1a;
+ List<@TB Outer.SInner> h2a; // err
+ List<@TB Outer.IInner> h3a; // err
+
+ List<Outer. @TC Inner> h1b;
+ List<Outer. @TC SInner> h2b;
+ List<Outer. @TC IInner> h3b;
+
+ List<@TB Outer. @TC Inner> h1c;
+ List<@TB Outer. @TC SInner> h2c; // err
+ List<@TB Outer. @TC IInner> h3c; // err
+
+ List<@TA Top. @TB Outer> k1; // err
+
+ List<@TA Top. @TB Outer.Inner> k1a; // err
+ List<@TA Top. @TB Outer.SInner> k2a; // err
+ List<@TA Top. @TB Outer.IInner> k3a; // err
+
+ List<@TA Top. Outer. @TC Inner> k1b; // err
+ List<@TA Top. Outer. @TC SInner> k2b; // err
+ List<@TA Top. Outer. @TC IInner> k3b; // err
+
+ List<@TA Top. @TB Outer. @TC Inner> k1c; // err
+ List<@TA Top. @TB Outer. @TC SInner> k2c; // err
+ List<@TA Top. @TB Outer. @TC IInner> k3c; // err
+
+
+ List<@TB Outer> g1r() { return null; }
+
+ List<@TB Outer.Inner> g1ra() { return null; }
+ List<@TB Outer.SInner> g2ra() { return null; } // err
+ List<@TB Outer.IInner> g3ra() { return null; } // err
+
+ List<Outer. @TC Inner> g1rb() { return null; }
+ List<Outer. @TC SInner> g2rb() { return null; }
+ List<Outer. @TC IInner> g3rb() { return null; }
+
+ List<@TB Outer. @TC Inner> g1rc() { return null; }
+ List<@TB Outer. @TC SInner> g2rc() { return null; } // err
+ List<@TB Outer. @TC IInner> g3rc() { return null; } // err
+
+ void g1param(List<@TB Outer> p,
+ List<@TB Outer.Inner> p1,
+ List<Outer. @TC Inner> p2,
+ List<@TB Outer. @TC Inner> p3) { }
+ void g2param(List<@TB Outer> p,
+ List<@TB Outer.SInner> p1, // err
+ List<Outer. @TC SInner> p2,
+ List<@TB Outer. @TC SInner> p3) { } // err
+ void g3param(List<@TB Outer> p,
+ List<@TB Outer.IInner> p1, // err
+ List<Outer. @TC IInner> p2,
+ List<@TB Outer. @TC IInner> p3) { } // err
+
+ void g1new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.Inner>();
+ l = new @TB HashMap<String, Outer. @TC Inner>();
+ l = new @TB HashMap<String, @TB Outer. Inner>();
+ l = new @TB HashMap<String, @TB Outer. @TC Inner>();
+ }
+ void g2new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.SInner>(); // err
+ l = new @TB HashMap<String, Outer. @TC SInner>();
+ l = new @TB HashMap<String, @TB Outer. SInner>(); // err
+ l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err
+ }
+ void g3new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.IInner>(); // err
+ l = new @TB HashMap<String, Outer. @TC IInner>();
+ l = new @TB HashMap<String, @TB Outer. IInner>(); // err
+ l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err
+ }
+ void g4new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TA Top. @TB Outer>(); // err
+ l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err
+ l = new @TB HashMap<String, @TA @TB @TC Top. Outer. IInner>(); // err
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass2.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,65 @@
+CantAnnotateStaticClass2.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:55:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:56:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:60:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:64:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:87:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:89:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:91:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:93:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:105:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:107:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:112:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:114:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:131:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:133:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:137:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:141:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:165:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:167:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:169:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:171:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:184:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:186:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:192:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:194:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:199:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:200:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:201:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass2.java:202:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass2.java:204:49: compiler.err.cant.type.annotate.scoping: @Top.TA,@Top.TB,@Top.TC
+64 errors
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,207 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8006733 8006775
+ * @summary Ensure behavior for nested types is correct.
+ * @author Werner Dietl
+ * @ignore
+ * @compile/fail/ref=CantAnnotateStaticClass3.out -XDrawDiagnostics CantAnnotateStaticClass3.java
+ */
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.lang.annotation.*;
+
+class Top {
+ @Target(ElementType.TYPE_USE)
+ @interface TA {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface TB {}
+
+ @Target(ElementType.TYPE_USE)
+ @interface TC {}
+
+ interface Outer {
+ class Inner {
+ // Object o1 = Top.this;
+ // Object o2 = Outer.this;
+ Object o3 = this;
+ }
+ static class SInner {
+ // Object o1 = Top.this;
+ // Object o2 = Outer.this;
+ Object o3 = this;
+ }
+ interface IInner {
+ // Object o1 = Top.this;
+ // Object o2 = Outer.this;
+ // Object o3 = this;
+ }
+ }
+
+
+ @TB Outer f1;
+ @TB Outer.Inner f1a; // err
+ @TB Outer.SInner f2a; // err
+ @TB Outer.IInner f3a; // err
+
+ Outer. @TC Inner f1b;
+ Outer. @TC SInner f2b;
+ Outer. @TC IInner f3b;
+
+ @TB Outer. @TC Inner f1c; // err
+ @TB Outer. @TC SInner f2c; // err
+ @TB Outer. @TC IInner f3c; // err
+
+ @TA Top. @TB Outer g1; // err
+ @TA Top. @TB Outer.Inner g1a; // err
+ @TA Top. @TB Outer.SInner g2a; // err
+ @TA Top. @TB Outer.IInner g3a; // err
+
+ @TA Top. Outer. @TC Inner g1b; // err
+ @TA Top. Outer. @TC SInner g2b; // err
+ @TA Top. Outer. @TC IInner g3b; // err
+
+ @TA Top. @TB Outer. @TC Inner g1c; // err
+ @TA Top. @TB Outer. @TC SInner g2c; // err
+ @TA Top. @TB Outer. @TC IInner g3c; // err
+
+ @TB Outer f1r() { return null; }
+
+ @TB Outer.Inner f1ra() { return null; } // err
+ @TB Outer.SInner f2ra() { return null; } // err
+ @TB Outer.IInner f3ra() { return null; } // err
+
+ Outer. @TC Inner f1rb() { return null; }
+ Outer. @TC SInner f2rb() { return null; }
+ Outer. @TC IInner f3rb() { return null; }
+
+ @TB Outer. @TC Inner f1rc() { return null; } // err
+ @TB Outer. @TC SInner f2rc() { return null; } // err
+ @TB Outer. @TC IInner f3rc() { return null; } // err
+
+ void f1param(@TB Outer p,
+ @TB Outer.Inner p1, // err
+ Outer. @TC Inner p2,
+ @TB Outer. @TC Inner p3) { } // err
+ void f2param(@TB Outer p,
+ @TB Outer.SInner p1, // err
+ Outer. @TC SInner p2,
+ @TB Outer. @TC SInner p3) { } // err
+ void f3param(@TB Outer p,
+ @TB Outer.IInner p1, // err
+ Outer. @TC IInner p2,
+ @TB Outer. @TC IInner p3) { } // err
+
+ void f1cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.Inner) o; // err
+ l = (Outer. @TC Inner) o;
+ l = (@TB Outer. @TC Inner) o; // err
+ }
+ void f2cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.SInner) o; // err
+ l = (Outer. @TC SInner) o;
+ l = (@TB Outer. @TC SInner) o; // err
+ }
+ void f3cast(Object o) {
+ Object l;
+ l = (@TB Outer) o;
+ l = (@TB Outer.IInner) o; // err
+ l = (Outer. @TC IInner) o;
+ l = (@TB Outer. @TC IInner) o; // err
+ }
+
+ List<@TB Outer> h1;
+
+ List<@TB Outer.Inner> h1a; // err
+ List<@TB Outer.SInner> h2a; // err
+ List<@TB Outer.IInner> h3a; // err
+
+ List<Outer. @TC Inner> h1b;
+ List<Outer. @TC SInner> h2b;
+ List<Outer. @TC IInner> h3b;
+
+ List<@TB Outer. @TC Inner> h1c; // err
+ List<@TB Outer. @TC SInner> h2c; // err
+ List<@TB Outer. @TC IInner> h3c; // err
+
+ List<@TA Top. @TB Outer> k1; // err
+
+ List<@TA Top. @TB Outer.Inner> k1a; // err
+ List<@TA Top. @TB Outer.SInner> k2a; // err
+ List<@TA Top. @TB Outer.IInner> k3a; // err
+
+ List<@TA Top. Outer. @TC Inner> k1b; // err
+ List<@TA Top. Outer. @TC SInner> k2b; // err
+ List<@TA Top. Outer. @TC IInner> k3b; // err
+
+ List<@TA Top. @TB Outer. @TC Inner> k1c; // err
+ List<@TA Top. @TB Outer. @TC SInner> k2c; // err
+ List<@TA Top. @TB Outer. @TC IInner> k3c; // err
+
+
+ List<@TB Outer> g1r() { return null; }
+
+ List<@TB Outer.Inner> g1ra() { return null; } // err
+ List<@TB Outer.SInner> g2ra() { return null; } // err
+ List<@TB Outer.IInner> g3ra() { return null; } // err
+
+ List<Outer. @TC Inner> g1rb() { return null; }
+ List<Outer. @TC SInner> g2rb() { return null; }
+ List<Outer. @TC IInner> g3rb() { return null; }
+
+ List<@TB Outer. @TC Inner> g1rc() { return null; } // err
+ List<@TB Outer. @TC SInner> g2rc() { return null; } // err
+ List<@TB Outer. @TC IInner> g3rc() { return null; } // err
+
+ void g1param(List<@TB Outer> p,
+ List<@TB Outer.Inner> p1, // err
+ List<Outer. @TC Inner> p2,
+ List<@TB Outer. @TC Inner> p3) { } // err
+ void g2param(List<@TB Outer> p,
+ List<@TB Outer.SInner> p1, // err
+ List<Outer. @TC SInner> p2,
+ List<@TB Outer. @TC SInner> p3) { } // err
+ void g3param(List<@TB Outer> p,
+ List<@TB Outer.IInner> p1, // err
+ List<Outer. @TC IInner> p2,
+ List<@TB Outer. @TC IInner> p3) { } // err
+
+ void g1new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.Inner>(); // err
+ l = new @TB HashMap<String, Outer. @TC Inner>();
+ l = new @TB HashMap<String, @TB Outer. Inner>(); // err
+ l = new @TB HashMap<String, @TB Outer. @TC Inner>(); // err
+ }
+ void g2new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.SInner>(); // err
+ l = new @TB HashMap<String, Outer. @TC SInner>();
+ l = new @TB HashMap<String, @TB Outer. SInner>(); // err
+ l = new @TB HashMap<String, @TB Outer. @TC SInner>(); // err
+ }
+ void g3new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TB Outer>();
+ l = new @TB ArrayList<@TB Outer.IInner>(); // err
+ l = new @TB HashMap<String, Outer. @TC IInner>();
+ l = new @TB HashMap<String, @TB Outer. IInner>(); // err
+ l = new @TB HashMap<String, @TB Outer. @TC IInner>(); // err
+ }
+ void g4new(Object o) {
+ Object l;
+ l = new @TB ArrayList<@TA Top. @TB Outer>(); // err
+ l = new @TB ArrayList<@TA Top. @TB Outer.IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. Outer. @TC IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. @TB Outer. IInner>(); // err
+ l = new @TB HashMap<String, @TA Top. @TB Outer. @TC IInner>(); // err
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/CantAnnotateStaticClass3.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,83 @@
+CantAnnotateStaticClass3.java:44:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:45:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:46:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:52:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:53:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:54:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:56:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:57:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:58:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:59:23: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:61:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:62:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:63:21: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:65:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:66:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:67:25: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:71:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:72:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:73:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:79:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:80:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:81:16: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:84:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:86:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:88:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:90:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:92:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:94:24: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:57:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:58:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:59:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:65:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:66:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:67:12: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:99:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:101:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:106:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:108:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:113:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:115:18: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:120:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:121:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:122:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:128:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:129:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:130:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:132:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:134:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:135:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:136:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:138:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:139:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:140:14: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:142:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:143:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:144:17: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:149:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:150:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:151:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:157:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:158:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:159:14: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:162:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:164:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:166:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:168:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:170:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:172:22: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:177:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:179:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:180:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:185:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:187:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:188:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:193:35: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:195:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:196:41: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:200:35: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:201:38: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:202:41: compiler.err.cant.type.annotate.scoping.1: @Top.TA
+CantAnnotateStaticClass3.java:203:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+CantAnnotateStaticClass3.java:204:44: compiler.err.cant.type.annotate.scoping.1: @Top.TB
+82 errors
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.java Mon Oct 28 12:28:57 2013 -0700
@@ -5,8 +5,11 @@
* @author Mahmood Ali
* @compile/fail/ref=IncompleteArray.out -XDrawDiagnostics IncompleteArray.java
*/
+import java.lang.annotation.*;
+
class IncompleteArray {
int @A [] @A var;
}
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteArray.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,2 @@
-IncompleteArray.java:9:13: compiler.err.illegal.start.of.type
+IncompleteArray.java:11:13: compiler.err.illegal.start.of.type
1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6843077 8006775
- * @summary test incomplete vararg declaration
- * @author Mahmood Ali
- * @compile/fail/ref=IncompleteVararg.out -XDrawDiagnostics IncompleteVararg.java
- */
-class IncompleteArray {
- // the last variable may be vararg
- void method(int @A test) { }
-}
-
-@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IncompleteVararg.out Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-IncompleteVararg.java:10:19: compiler.err.illegal.start.of.type
-1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.java Mon Oct 28 12:28:57 2013 -0700
@@ -5,9 +5,12 @@
* @author Mahmood Ali
* @compile/fail/ref=IndexArray.out -XDrawDiagnostics IndexArray.java
*/
+import java.lang.annotation.*;
+
class IndexArray {
int[] var;
int a = var @A [1];
}
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/IndexArray.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,2 @@
-IndexArray.java:10:15: compiler.err.illegal.start.of.expr
+IndexArray.java:12:15: compiler.err.illegal.start.of.expr
1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/LintCast.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,11 +1,11 @@
LintCast.java:15:21: compiler.warn.redundant.cast: java.lang.String
LintCast.java:21:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
-LintCast.java:27:20: compiler.warn.redundant.cast: int @A []
+LintCast.java:27:20: compiler.warn.redundant.cast: int[]
LintCast.java:39:24: compiler.warn.redundant.cast: java.lang.String
LintCast.java:40:26: compiler.warn.redundant.cast: java.lang.String
-LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object @A []
+LintCast.java:45:23: compiler.warn.redundant.cast: java.lang.Object[]
LintCast.java:49:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
-LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<@A java.lang.String>
+LintCast.java:53:27: compiler.warn.redundant.cast: java.util.List<java.lang.String>
LintCast.java:57:21: compiler.warn.redundant.cast: java.lang.Object
LintCast.java:61:27: compiler.warn.redundant.cast: LintCast.Outer.Inner
10 warnings
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,35 +1,16 @@
/*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
+ * @test /nodynamiccopyright/
* @test
* @bug 6843077 8006775
* @summary test old array syntax
* @author Mahmood Ali
- * @compile/fail -XDrawDiagnostics OldArray.java
+ * @compile/fail/ref=OldArray.out -XDrawDiagnostics OldArray.java
*/
+import java.lang.annotation.*;
+
class OldArray {
String [@A] s() { return null; }
}
+@Target(ElementType.TYPE_USE)
@interface A { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/OldArray.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,10 @@
+OldArray.java:12:11: compiler.err.expected: ']'
+OldArray.java:12:13: compiler.err.expected: token.identifier
+OldArray.java:12:14: compiler.err.expected: ';'
+OldArray.java:12:17: compiler.err.illegal.start.of.type
+OldArray.java:12:18: compiler.err.expected: token.identifier
+OldArray.java:12:19: compiler.err.expected: ';'
+OldArray.java:12:22: compiler.err.illegal.start.of.type
+OldArray.java:12:28: compiler.err.expected: token.identifier
+OldArray.java:13:1: compiler.err.expected3: class, interface, enum
+9 errors
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.java Mon Oct 28 12:28:57 2013 -0700
@@ -1,17 +1,16 @@
/*
* @test /nodynamiccopyright/
* @bug 6843077 8006775
- * @summary check that A is accessible in the class type parameters
+ * @summary Unqualified inner type annotation not in scope.
* @author Mahmood Ali
* @compile/fail/ref=Scopes.out -XDrawDiagnostics Scopes.java
*/
-class Scopes<T extends @UniqueInner Object> {
- // UniqueInner is not visible in the type parameters.
- // One has to use Scopes.UniqueInner.
- // Annotations with the default @Target are not allowed there,
- // so we also get the second error about the invalid location.
- // Adding the target here doesn't matter, as we don't resolve
- // the annotation type.
- // @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
- @interface UniqueInner { };
+import java.lang.annotation.*;
+
+@InnerTA
+class Scopes<@InnerTA T extends @InnerTA Object> {
+ // The simple name TA is not in scope on header of class.
+ // One has to use @Scopes.TA.
+ @Target(ElementType.TYPE_USE)
+ @interface InnerTA { };
}
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/Scopes.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,3 +1,4 @@
-Scopes.java:8:25: compiler.err.cant.resolve: kindname.class, UniqueInner, ,
-Scopes.java:8:24: compiler.err.annotation.type.not.applicable
-2 errors
+Scopes.java:10:2: compiler.err.cant.resolve: kindname.class, InnerTA, ,
+Scopes.java:11:34: compiler.err.cant.resolve: kindname.class, InnerTA, ,
+Scopes.java:11:15: compiler.err.cant.resolve: kindname.class, InnerTA, ,
+3 errors
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.java Mon Oct 28 12:28:57 2013 -0700
@@ -5,9 +5,23 @@
* @author Mahmood Ali
* @compile/fail/ref=StaticFields.out -XDrawDiagnostics StaticFields.java
*/
+import java.lang.annotation.*;
+
class C {
- int f;
+ static int f;
+ // static block
+ static {
+ @A C.f = 1;
+ }
+ // static ref
int a = @A C.f;
+ // static method
+ static int f() { return @A C.f; }
+ // main
+ public static void main(String... args) {
+ int a = @A C.f;
+ }
}
+@Target(ElementType.TYPE_USE)
@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticFields.out Mon Oct 28 12:28:57 2013 -0700
@@ -1,2 +1,5 @@
-StaticFields.java:10:17: compiler.err.illegal.start.of.expr
-1 error
+StaticFields.java:14:11: compiler.err.expected: token.identifier
+StaticFields.java:17:17: compiler.err.illegal.start.of.expr
+StaticFields.java:19:33: compiler.err.illegal.start.of.expr
+StaticFields.java:22:19: compiler.err.illegal.start.of.expr
+4 errors
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6843077 8006775
- * @summary static methods don't have receivers
- * @author Mahmood Ali
- * @compile/fail/ref=StaticMethods.out -XDrawDiagnostics StaticMethods.java
- */
-class StaticMethods {
- static void main(StaticMethods this) { }
-}
-
-@interface A { }
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/StaticMethods.out Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-StaticMethods.java:9:34: compiler.err.non-static.cant.be.ref: kindname.variable, this
-1 error
--- a/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableCycleTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -35,10 +35,12 @@
class TypeVariableCycleTest<CTV> {
<MTV extends @TA CTV> MTV cast(CTV p) {
- return (@TA MTV) p;
+ return (@TB MTV) p;
}
}
-@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
+@Target(ElementType.TYPE_USE)
@interface TA {}
+@Target(ElementType.TYPE_USE)
+@interface TB {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 1234567
+ * @summary A missing annotation type in a type variable bound
+ * should result in the same errors with and without an
+ * annotation processor.
+ * @author Werner Dietl
+ *
+ * @compile DummyProcessor.java
+ * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics TypeVariableMissingTA.java
+ * @compile/fail/ref=TypeVariableMissingTA.out -XDrawDiagnostics -cp . -processor DummyProcessor TypeVariableMissingTA.java
+ */
+
+import java.lang.annotation.*;
+
+class TypeVariableMissingTA<T extends @MISSING Object> {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/failures/TypeVariableMissingTA.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,2 @@
+TypeVariableMissingTA.java:39:40: compiler.err.cant.resolve: kindname.class, MISSING, ,
+1 error
\ No newline at end of file
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/MultiCatch.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
/*
* @test
+ * @ignore 8008762 Type annotations failures
* @bug 8006775
* @summary new type annotation location: multicatch
* @author Werner Dietl
--- a/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
/*
* @test
+ * @ignore 8008762 Type annotation failures
* @bug 8006732 8006775
* @summary Test population of reference info for multicatch exception parameters
* @author Werner Dietl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/Assertions.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,102 @@
+/*
+ * 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 test;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/*
+ * @test
+ * @bug 8025141
+ * @summary Interfaces must not contain non-public fields, ensure $assertionsDisabled
+ * is not generated into an interface
+ * @compile Assertions.java
+ * @run main/othervm -da test.Assertions
+ * @run main/othervm -ea:test.Assertions test.Assertions Inner
+ * @run main/othervm -ea:test.Outer test.Assertions Outer
+ * @run main/othervm -ea:test.Another test.Assertions Another.Inner
+ * @run main/othervm -ea:test... test.Assertions Inner Outer Another.Inner
+ */
+
+public class Assertions {
+ interface Inner {
+ default void testInner() {
+ assert false;
+ }
+ }
+
+ static class InnerImpl implements Inner {}
+
+ static class OuterImpl implements Outer {}
+
+ static class AnotherInnerImpl implements Another.Inner {}
+
+ public static void main(String... args) {
+ Set<String> shouldThrowAssert = new HashSet<String>(Arrays.asList(args));
+ try {
+ new InnerImpl().testInner();
+ if (shouldThrowAssert.contains("Inner")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Inner")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ try {
+ new OuterImpl().testOuter();
+ if (shouldThrowAssert.contains("Outer")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Outer")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ try {
+ new AnotherInnerImpl().testAnotherInner();
+ if (shouldThrowAssert.contains("Another.Inner")) {
+ throw new IllegalStateException("AssertionError expected, but not thrown.");
+ }
+ } catch (AssertionError e) {
+ if (!shouldThrowAssert.contains("Another.Inner")) {
+ throw new IllegalStateException("AssertionError not expected, but thrown.");
+ }
+ }
+ }
+}
+
+interface Outer {
+ default void testOuter() {
+ assert false;
+ }
+}
+
+@interface Another {
+ interface Inner {
+ default void testAnotherInner() {
+ assert false;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/BadClassfile.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025087
+ * @summary Verify that pre-JDK8 classfiles with default and/or static methods
+ * are refused correctly.
+ * @build BadClassfile
+ * @run main BadClassfile
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.code.Symbol;
+import com.sun.tools.javac.jvm.ClassReader.BadClassFile;
+import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.util.Assert;
+import com.sun.tools.javac.util.JCDiagnostic;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Objects;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class BadClassfile {
+ public static void main(String... args) throws Exception {
+ test("BadClassfile$DefaultMethodTest", "compiler.misc.invalid.default.interface");
+ test("BadClassfile$StaticMethodTest", "compiler.misc.invalid.static.interface");
+ }
+
+ private static void test(String classname, String expected) throws Exception {
+ File classfile = new File(System.getProperty("test.classes", "."), classname + ".class");
+ ClassFile cf = ClassFile.read(classfile);
+
+ cf = new ClassFile(cf.magic, Target.JDK1_7.minorVersion,
+ Target.JDK1_7.majorVersion, cf.constant_pool, cf.access_flags,
+ cf.this_class, cf.super_class, cf.interfaces, cf.fields,
+ cf.methods, cf.attributes);
+
+ new ClassWriter().write(cf, classfile);
+
+ JavaCompiler c = ToolProvider.getSystemJavaCompiler();
+ JavacTaskImpl task = (JavacTaskImpl) c.getTask(null, null, null, Arrays.asList("-classpath", System.getProperty("test.classes", ".")), null, null);
+
+ try {
+ Symbol clazz = com.sun.tools.javac.main.JavaCompiler.instance(task.getContext()).resolveIdent(classname);
+
+ clazz.complete();
+ } catch (BadClassFile f) {
+ JCDiagnostic embeddedDiag = (JCDiagnostic) f.diag.getArgs()[1];
+ assertEquals(expected, embeddedDiag.getCode());
+ assertEquals(Integer.toString(Target.JDK1_7.majorVersion), embeddedDiag.getArgs()[0]);
+ assertEquals(Integer.toString(Target.JDK1_7.minorVersion), embeddedDiag.getArgs()[1]);
+ }
+ }
+
+ private static void assertEquals(Object expected, Object actual) {
+ Assert.check(Objects.equals(expected, actual),
+ "expected: " + expected + ", but was: " + actual);
+ }
+
+ interface DefaultMethodTest {
+ default void test() { }
+ }
+ interface StaticMethodTest {
+ static void test() { }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/defaultMethods/CannotChangeAssertionsStateAfterInitialized.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025141
+ * @summary Ensure the assertion status cannot be changed once the class is initialized
+ * @compile CannotChangeAssertionsStateAfterInitialized.java
+ * @run main/othervm -da CannotChangeAssertionsStateAfterInitialized
+ */
+
+public interface CannotChangeAssertionsStateAfterInitialized {
+ default void m() {
+ assert false;
+ }
+
+ public static void main(String[] args) {
+ ClassLoader cl = CannotChangeAssertionsStateAfterInitialized.class.getClassLoader();
+ cl.setClassAssertionStatus(CannotChangeAssertionsStateAfterInitialized.class.getName(), true);
+ new CannotChangeAssertionsStateAfterInitialized() {}.m();
+ }
+
+}
--- a/langtools/test/tools/javac/diags/examples.not-yet.txt Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/diags/examples.not-yet.txt Mon Oct 28 12:28:57 2013 -0700
@@ -40,7 +40,6 @@
compiler.err.type.var.more.than.once.in.result # UNUSED
compiler.err.unexpected.type
compiler.err.unsupported.cross.fp.lit # Scanner: host system dependent
-compiler.misc.bad.class.file.header # bad class file
compiler.misc.bad.class.signature # bad class file
compiler.misc.bad.const.pool.tag # bad class file
compiler.misc.bad.const.pool.tag.at # bad class file
--- a/langtools/test/tools/javac/diags/examples/CantAnnotateNestedType.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.annotate.nested.type
-
-import java.lang.annotation.*;
-
-class CantAnnotateStaticClass {
- @Target(ElementType.TYPE_USE)
- @interface A {}
-
- interface Outer {
- interface Inner {}
- }
-
- // Error:
- @A Outer.Inner f;
-
- // OK:
- @A Outer g;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.type.annotate.scoping
+
+import java.lang.annotation.*;
+
+class CantAnnotateScoping {
+ @Target(ElementType.TYPE_USE)
+ @interface TA {}
+ @Target(ElementType.TYPE_USE)
+ @interface TB {}
+
+ interface Outer {
+ interface Inner {}
+ }
+
+ // Error:
+ @TA @TB Outer.Inner f;
+
+ // OK:
+ @TA @TB Outer g;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/CantAnnotateScoping1.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.cant.type.annotate.scoping.1
+
+import java.lang.annotation.*;
+
+class CantAnnotateNestedType {
+ @Target(ElementType.TYPE_USE)
+ @interface TA {}
+
+ interface Outer {
+ interface Inner {}
+ }
+
+ // Error:
+ @TA Outer.Inner f;
+
+ // OK:
+ @TA Outer g;
+}
--- a/langtools/test/tools/javac/diags/examples/CantAnnotateStaticClass.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.cant.annotate.static.class
-
-import java.lang.annotation.*;
-
-class CantAnnotateStaticClass {
- @Target(ElementType.TYPE_USE)
- @interface A {}
-
- static class Outer {
- class Inner {}
- }
-
- // Error:
- @A Outer.Inner f;
-
- // OK:
- @A Outer g;
-}
--- a/langtools/test/tools/javac/diags/examples/DuplicateAnnotation.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.err.duplicate.annotation
-// key: compiler.warn.source.no.bootclasspath
-// options: -source 7
-
-@interface Anno { }
-
-@Anno
-@Anno
-class DuplicateAnnotation { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InterfaceOrArrayExpected.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.intf.or.array.expected.here
+
+import java.util.List;
+
+class InterfaceExpected<T extends List & String> { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+// key: compiler.misc.invalid.default.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
+
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a non-abstract method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidDefaultInterface/processors/CreateBadClassFile.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a non-abstract method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+ public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+ if (++round == 1) {
+ ConstantPool cp = new ConstantPool(new CPInfo[] {
+ new CONSTANT_Utf8_info(""), //0
+ new CONSTANT_Utf8_info("Test"), //1
+ new CONSTANT_Class_info(null, 1), //2
+ new CONSTANT_Utf8_info("java/lang/Object"), //3
+ new CONSTANT_Class_info(null, 3), //4
+ new CONSTANT_Utf8_info("test"), //5
+ new CONSTANT_Utf8_info("()V"), //6
+ });
+ ClassFile cf = new ClassFile(0xCAFEBABE,
+ 0,
+ 51,
+ cp,
+ new AccessFlags(AccessFlags.ACC_ABSTRACT |
+ AccessFlags.ACC_INTERFACE |
+ AccessFlags.ACC_PUBLIC),
+ 2,
+ 4,
+ new int[0],
+ new Field[0],
+ new Method[] {
+ //creating non-abstract method in 51.0 classfile:
+ new Method(new AccessFlags(AccessFlags.ACC_PUBLIC),
+ 5,
+ new Descriptor(6),
+ new Attributes(cp, new Attribute[0]))
+ },
+ new Attributes(cp, new Attribute[0]));
+ try {
+ JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+ try (OutputStream out = clazz.openOutputStream()) {
+ new ClassWriter().write(cf, out);
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ int round = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+// key: compiler.misc.invalid.static.interface
+// key: compiler.misc.bad.class.file.header
+// key: compiler.err.cant.access
+// options: -processor CreateBadClassFile
+
+/* The annotation processor will create an invalid classfile with version 51.0
+ * and a static method in an interface. Loading the classfile will produce
+ * the diagnostic.
+ */
+class InvalidDefaultInterface { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/InvalidStaticInterface/processors/CreateBadClassFile.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.classfile.*;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Class_info;
+import com.sun.tools.classfile.ConstantPool.CONSTANT_Utf8_info;
+import com.sun.tools.classfile.ConstantPool.CPInfo;
+import java.io.*;
+import java.util.*;
+import javax.annotation.processing.*;
+import javax.lang.model.*;
+import javax.lang.model.element.*;
+import javax.tools.*;
+
+/* Create an invalid classfile with version 51.0 and a static method in an interface.*/
+@SupportedAnnotationTypes("*")
+public class CreateBadClassFile extends AbstractProcessor {
+ public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
+ if (++round == 1) {
+ ConstantPool cp = new ConstantPool(new CPInfo[] {
+ new CONSTANT_Utf8_info(""), //0
+ new CONSTANT_Utf8_info("Test"), //1
+ new CONSTANT_Class_info(null, 1), //2
+ new CONSTANT_Utf8_info("java/lang/Object"), //3
+ new CONSTANT_Class_info(null, 3), //4
+ new CONSTANT_Utf8_info("test"), //5
+ new CONSTANT_Utf8_info("()V"), //6
+ });
+ ClassFile cf = new ClassFile(0xCAFEBABE,
+ 0,
+ 51,
+ cp,
+ new AccessFlags(AccessFlags.ACC_ABSTRACT |
+ AccessFlags.ACC_INTERFACE |
+ AccessFlags.ACC_PUBLIC),
+ 2,
+ 4,
+ new int[0],
+ new Field[0],
+ new Method[] {
+ //creating static method in 51.0 classfile:
+ new Method(new AccessFlags(AccessFlags.ACC_PUBLIC |
+ AccessFlags.ACC_STATIC),
+ 5,
+ new Descriptor(6),
+ new Attributes(cp, new Attribute[0]))
+ },
+ new Attributes(cp, new Attribute[0]));
+ try {
+ JavaFileObject clazz = processingEnv.getFiler().createClassFile("Test");
+ try (OutputStream out = clazz.openOutputStream()) {
+ new ClassWriter().write(cf, out);
+ }
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.latest();
+ }
+
+ int round = 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/RepeatableAnnotationsNotSupported.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.repeatable.annotations.not.supported.in.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 7
+
+@interface Anno { }
+
+@Anno
+@Anno
+class RepeatableAnnotationsNotSupported { }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/A.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+interface A {
+ default String u() { return "A"; }
+ default String name() {
+ SAM s = ()->u()+"A";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/B.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+interface B {
+ default String u() { return "B"; }
+ default String name() {
+ SAM s = ()->u()+"B";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/C.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+interface C {
+ default String u() { return "C"; }
+ default String name() {
+ SAM s = ()->u()+"C";
+ return s.m();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/PrivateLambdas.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8012557
+ * @summary Check that 8012557 is fixed, that interface lambda
+ * methods are private
+ * @author Robert Field
+ * @compile SAM.java
+ * @compile A.java
+ * @compile B.java
+ * @compile C.java
+ * @run main PrivateLambdas
+ *
+ * Unless the lambda methods are private, this will fail with:
+ * AbstractMethodError:
+ * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+ */
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+interface X extends A, B, C {
+ default String u() { return " "; }
+ default String name() {
+ return A.super.name() + B.super.name() + C.super.name();
+ }
+}
+
+public class PrivateLambdas implements X {
+ public static void main(String[] args) throws Exception {
+
+ // Check that all the lambda methods are private instance synthetic
+ for (Class<?> k : new Class<?>[] { A.class, B.class, C.class }) {
+ Method[] methods = k.getDeclaredMethods();
+ int lambdaCount = 0;
+ for(Method m : methods) {
+ if (m.getName().startsWith("lambda$")) {
+ ++lambdaCount;
+ int mod = m.getModifiers();
+ if ((mod & Modifier.PRIVATE) == 0) {
+ throw new Exception("Expected " + m + " to be private");
+ }
+ if (!m.isSynthetic()) {
+ throw new Exception("Expected " + m + " to be synthetic");
+ }
+ if ((mod & Modifier.STATIC) != 0) {
+ throw new Exception("Expected " + m + " to be instance method");
+ }
+ }
+ }
+ if (lambdaCount == 0) {
+ throw new Exception("Expected at least one lambda method");
+ }
+ }
+
+ /*
+ * Unless the lambda methods are private, this will fail with:
+ * AbstractMethodError:
+ * Conflicting default methods: A.lambda$0 B.lambda$0 C.lambda$0
+ */
+ X x = new PrivateLambdas();
+ if (!x.name().equals(" A B C")) {
+ throw new Exception("Expected ' A B C' got: " + x.name());
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8012557/SAM.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+interface SAM {
+ String m();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8016320/IllegalBridgeModifier.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016320
+ * @summary Check that 8016320 is fixed,
+ * that bridges have valid modifier bits
+ * @author Robert Field
+ * @run main IllegalBridgeModifier
+ */
+
+interface SAM {
+ int m();
+}
+
+interface SuperI {
+ public default int foo() { return 1234; }
+}
+
+interface I extends SuperI {
+}
+
+interface T extends I {
+ public default SAM boo() { return I.super::foo; }
+}
+
+public class IllegalBridgeModifier {
+ public static void main(String argv[])throws Exception {
+ T t = new T(){};
+ if (t.boo().m() != 1234) {
+ throw new Exception("Failed test");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024947
+ * @summary javac should issue the potentially ambiguous overload warning only
+ * where the problem appears
+ * @compile/fail/ref=PotentiallyAmbiguousWarningTest.out -XDrawDiagnostics -Werror -Xlint:overloads PotentiallyAmbiguousWarningTest.java
+ * @compile PotentiallyAmbiguousWarningTest.java
+ */
+
+import java.util.function.*;
+
+public interface PotentiallyAmbiguousWarningTest {
+
+ //a warning should be fired
+ interface I1 {
+ void foo(Consumer<Integer> c);
+ void foo(IntConsumer c);
+ }
+
+ //a warning should be fired
+ class C1 {
+ void foo(Consumer<Integer> c) { }
+ void foo(IntConsumer c) { }
+ }
+
+ interface I2 {
+ void foo(Consumer<Integer> c);
+ }
+
+ //a warning should be fired, J1 is provoking the issue
+ interface J1 extends I2 {
+ void foo(IntConsumer c);
+ }
+
+ //no warning here, the issue is introduced in I1
+ interface I3 extends I1 {}
+
+ //no warning here, the issue is introduced in I1. I4 is just overriding an existing method
+ interface I4 extends I1 {
+ void foo(IntConsumer c);
+ }
+
+ class C2 {
+ void foo(Consumer<Integer> c) { }
+ }
+
+ //a warning should be fired, D1 is provoking the issue
+ class D1 extends C2 {
+ void foo(IntConsumer c) { }
+ }
+
+ //a warning should be fired, C3 is provoking the issue
+ class C3 implements I2 {
+ public void foo(Consumer<Integer> c) { }
+ public void foo(IntConsumer c) { }
+ }
+
+ //no warning here, the issue is introduced in C1
+ class C4 extends C1 {}
+
+ //no warning here, the issue is introduced in C1. C5 is just overriding an existing method
+ class C5 extends C1 {
+ void foo(IntConsumer c) {}
+ }
+
+ interface I5<T> {
+ void foo(T c);
+ }
+
+ //a warning should be fired, J2 is provoking the issue
+ interface J2 extends I5<IntConsumer> {
+ void foo(Consumer<Integer> c);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8024947/PotentiallyAmbiguousWarningTest.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,9 @@
+PotentiallyAmbiguousWarningTest.java:39:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.I1
+PotentiallyAmbiguousWarningTest.java:45:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C1, foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C1
+PotentiallyAmbiguousWarningTest.java:55:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.J1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.I2
+PotentiallyAmbiguousWarningTest.java:72:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.D1, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C2
+PotentiallyAmbiguousWarningTest.java:78:21: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.IntConsumer), PotentiallyAmbiguousWarningTest.C3, foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.C3
+PotentiallyAmbiguousWarningTest.java:95:14: compiler.warn.potentially.ambiguous.overload: foo(java.util.function.Consumer<java.lang.Integer>), PotentiallyAmbiguousWarningTest.J2, foo(T), PotentiallyAmbiguousWarningTest.I5
+- compiler.err.warnings.and.werror
+1 error
+6 warnings
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/T8025816/CrashMethodReferenceWithSiteTypeVarTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025816
+ * @summary Compiler crash when default method call with method reference
+ * @compile CrashMethodReferenceWithSiteTypeVarTest.java
+ */
+
+import java.util.Collection;
+import java.util.Comparator;
+
+public class CrashMethodReferenceWithSiteTypeVarTest {
+ public <T> void m1(Collection<T> c, Comparator<T> comp) {}
+
+ public <T extends Comparable> void m2(Collection<T> c) {
+ m1(c, T::compareTo);
+ }
+}
--- a/langtools/test/tools/javac/lib/DPrinter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/lib/DPrinter.java Mon Oct 28 12:28:57 2013 -0700
@@ -946,8 +946,8 @@
*/
public class TypeVisitor implements Type.Visitor<Void,Void> {
public Void visitAnnotatedType(AnnotatedType type, Void ignore) {
- printList("typeAnnotations", type.typeAnnotations);
- printType("underlyingType", type.underlyingType, Details.FULL);
+ printList("typeAnnotations", type.getAnnotationMirrors());
+ printType("underlyingType", type.unannotatedType(), Details.FULL);
return visitType(type, null);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Processor.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.annotation.*;
+import java.util.Set;
+import javax.annotation.processing.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.ElementFilter;
+import javax.tools.*;
+import com.sun.tools.javac.util.Assert;
+
+public class Processor extends JavacTestingAbstractProcessor {
+
+ private boolean seenGenerated;
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (Element e : roundEnv.getElementsAnnotatedWith(Gen.class)) {
+ Gen gen = e.getAnnotation(Gen.class);
+ try {
+ JavaFileObject source = processingEnv.getFiler().createSourceFile(gen.fileName());
+
+ try (Writer out = source.openWriter()) {
+ out.write(gen.content());
+ }
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ TypeElement generated = processingEnv.getElementUtils().getTypeElement("Generated");
+
+ if (generated != null) {
+ Check check = ElementFilter.methodsIn(generated.getEnclosedElements()).get(0).getAnnotation(Check.class);
+
+ checkCorrectException(check::classValue, "java.lang.Class<java.lang.String>");
+ checkCorrectException(check::intConstValue, "boolean");
+ checkCorrectException(check::enumValue, "java.lang.String");
+ checkCorrectException(check::incorrectAnnotationValue, "java.lang.Deprecated");
+ checkCorrectException(check::incorrectArrayValue, "<any>");
+ checkCorrectException(check::incorrectClassValue, "<any>");
+
+ seenGenerated = true;
+ }
+
+ if (roundEnv.processingOver() && !seenGenerated) {
+ Assert.error("Did not see the generated class!");
+ }
+
+ return true;
+ }
+
+ private static void checkCorrectException(Runnable runCheck, String expectedType) {
+ try {
+ runCheck.run();
+ Assert.check(false); //Should not reach here
+ } catch (AnnotationTypeMismatchException ex) {
+ Assert.check(expectedType.equals(ex.foundType()), ex.foundType());
+ }
+ }
+
+}
+
+@interface Gen {
+ String fileName();
+ String content();
+}
+
+@interface Check {
+ Class<? extends Number> classValue();
+ int intConstValue();
+ E enumValue();
+ int incorrectAnnotationValue();
+ int incorrectArrayValue();
+ Class<?> incorrectClassValue();
+}
+
+enum E {
+ A;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6278240
+ * @summary Ensure AnnotationTypeMismatchException is thrown when appropriate
+ * with reasonable foundType filled.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor Processor
+ * @compile/fail/ref=Source.out -XDrawDiagnostics -processor Processor Source.java
+ */
+
+@Gen(fileName="Generated",
+ content=
+"class Generated {\n" +
+" @Check(classValue=String.class,\n" +
+" intConstValue=false,\n" +
+" enumValue=\"a\",\n" +
+" incorrectAnnotationValue=@Deprecated,\n" +
+" incorrectArrayValue={1, \"a\"},\n" +
+" incorrectClassValue=get())\n" +
+" public static Class<?> get() {\n" +
+" return null;\n" +
+" }\n" +
+"}\n")
+class Source {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/EnsureAnnotationTypeMismatchException/Source.out Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,7 @@
+Generated.java:2:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Class<java.lang.String>, java.lang.Class<? extends java.lang.Number>)
+Generated.java:3:26: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: boolean, int)
+Generated.java:4:22: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.String, E)
+Generated.java:5:37: compiler.err.annotation.not.valid.for.type: int
+Generated.java:6:32: compiler.err.annotation.value.not.allowable.type
+Generated.java:7:35: compiler.err.annotation.value.must.be.class.literal
+6 errors
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateFunctionalInterface.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8014016
+ * @summary Ensure that an annotation processor can generate a super-interface
+ * which will make the current interface functional
+ * @build GenerateSuperInterfaceProcessor
+ * @compile -processor GenerateSuperInterfaceProcessor GenerateFunctionalInterface.java
+ */
+
+import java.lang.FunctionalInterface;
+
+@FunctionalInterface
+@Generate(fileName="SuperInterface.java", content="interface SuperInterface { public void run(); }")
+interface GenerateFunctionalInterface extends SuperInterface {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/GenerateSuperInterfaceProcessor.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.tools.javac.util.Assert;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class GenerateSuperInterfaceProcessor extends AbstractProcessor {
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ for (Element el : roundEnv.getElementsAnnotatedWith(Generate.class)) {
+ Generate g = el.getAnnotation(Generate.class);
+
+ Assert.checkNonNull(g);
+
+ try (OutputStream out =
+ processingEnv.getFiler().createSourceFile(g.fileName()).openOutputStream()) {
+ out.write(g.content().getBytes());
+ } catch (IOException ex) {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ return false;
+ }
+
+}
+
+@interface Generate {
+ String fileName();
+ String content();
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.source.tree.AnnotationTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TreeScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Assert;
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticListener;
+import javax.tools.FileObject;
+import javax.tools.ForwardingJavaFileManager;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends AbstractProcessor {
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ throw new IllegalStateException("Should not be invoked.");
+ }
+
+ public static void main(String... args) throws IOException, URISyntaxException {
+ if (args.length != 1) throw new IllegalStateException("Must provide class name!");
+ String testContent = null;
+ List<File> sourcePath = new ArrayList<>();
+ for (String sourcePaths : System.getProperty("test.src.path").split(":")) {
+ sourcePath.add(new File(sourcePaths));
+ }
+ JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
+ for (File sp : sourcePath) {
+ File inp = new File(sp, args[0]);
+
+ if (inp.canRead()) {
+ testContent = fm.getRegularFile(inp).getCharContent(true).toString();
+ }
+ }
+ if (testContent == null) throw new IllegalStateException();
+ DiagnosticListener<JavaFileObject> devNull = new DiagnosticListener<JavaFileObject>() {
+ @Override public void report(Diagnostic<? extends JavaFileObject> diagnostic) { }
+ };
+ JavaFileObject testFile = new TestFO(new URI("mem://" + args[0]), testContent);
+ JavacTask task = JavacTool.create().getTask(null,
+ new TestFM(fm),
+ devNull,
+ Arrays.asList("-Xjcov"),
+ null,
+ Arrays.asList(testFile));
+ final Trees trees = Trees.instance(task);
+ final CompilationUnitTree cut = task.parse().iterator().next();
+ task.analyze();
+
+ final List<int[]> annotations = new ArrayList<>();
+
+ new TreeScanner<Void, Void>() {
+ @Override
+ public Void visitAnnotation(AnnotationTree node, Void p) {
+ int endPos = (int) trees.getSourcePositions().getEndPosition(cut, node);
+
+ Assert.check(endPos >= 0);
+
+ annotations.add(new int[] {(int) trees.getSourcePositions().getStartPosition(cut, node), endPos});
+ return super.visitAnnotation(node, p);
+ }
+ }.scan(cut.getTypeDecls().get(0), null);
+
+ Collections.sort(annotations, new Comparator<int[]>() {
+ @Override public int compare(int[] o1, int[] o2) {
+ return o2[0] - o1[0];
+ }
+ });
+
+ for (final int[] annotation : annotations) {
+ StringBuilder updatedContent = new StringBuilder();
+ int last = testContent.length();
+
+ for (int[] toRemove : annotations) {
+ if (toRemove == annotation) continue;
+ updatedContent.insert(0, testContent.substring(toRemove[1], last));
+ last = toRemove[0];
+ }
+
+ updatedContent.insert(0, testContent.substring(0, last));
+
+ JavaFileObject updatedFile = new TestFO(new URI("mem://" + args[0]), updatedContent.toString());
+ JavacTask testTask = JavacTool.create().getTask(null,
+ new TestFM(fm),
+ devNull,
+ Arrays.asList("-processor", "Processor"),
+ null,
+ Arrays.asList(updatedFile));
+
+ try {
+ testTask.analyze();
+ } catch (Throwable e) {
+ System.out.println("error while processing:");
+ System.out.println(updatedContent);
+ throw e;
+ }
+ }
+ }
+
+ private static final class TestFO extends SimpleJavaFileObject {
+ private final String content;
+ public TestFO(URI uri, String content) {
+ super(uri, Kind.SOURCE);
+ this.content = content;
+ }
+
+ @Override public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+ return content;
+ }
+
+ @Override public boolean isNameCompatible(String simpleName, Kind kind) {
+ return true;
+ }
+ }
+
+ private static final class TestFM extends ForwardingJavaFileManager<JavaFileManager> {
+
+ public TestFM(JavaFileManager fileManager) {
+ super(fileManager);
+ }
+
+ @Override
+ public boolean isSameFile(FileObject a, FileObject b) {
+ return a.equals(b);
+ }
+
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Source.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8014016
+ * @summary Verify that annotation processors do not get invalid annotations
+ * @build Processor
+ * @run main Processor Source.java
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@OnMethod
+@OnField
+class Class<@OnType @OnMethod @OnField T extends @OnType @OnMethod @OnField CharSequence & @OnType @OnMethod @OnField Runnable> extends @OnType @OnMethod @OnField Object {
+
+ @OnType
+ @OnTypeUse
+ @OnField
+ private void testMethod(@OnType @OnField @OnMethod int i) { }
+
+ @OnType
+ @OnMethod
+ private java.lang.@OnType @OnMethod @OnField String testField;
+}
+
+@Target(ElementType.TYPE)
+@interface OnType {}
+
+@Target(ElementType.METHOD)
+@interface OnMethod {}
+
+@Target(ElementType.TYPE_USE)
+@interface OnTypeUse {}
+
+@Target(ElementType.FIELD)
+@interface OnField {}
--- a/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/processing/model/element/TestExecutableElement.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,54 +23,57 @@
/*
* @test
- * @bug 8005046 8011052
- * @summary Test basic properties of javax.lang.element.Element
+ * @bug 8005046 8011052 8025087
+ * @summary Test basic properties of javax.lang.element.ExecutableElement
* @author Joseph D. Darcy
* @library /tools/javac/lib
* @build JavacTestingAbstractProcessor TestExecutableElement
- * @compile -processor TestExecutableElement -proc:only TestExecutableElement.java
+ * @compile -processor TestExecutableElement -proc:only -AexpectedMethodCount=7 TestExecutableElement.java
+ * @compile/process -processor TestExecutableElement -proc:only -AexpectedMethodCount=3 ProviderOfDefault
*/
import java.lang.annotation.*;
import java.util.Formatter;
import java.util.Set;
-import java.util.Objects;
import java.util.regex.*;
import javax.annotation.processing.*;
-import javax.lang.model.SourceVersion;
-import static javax.lang.model.SourceVersion.*;
import javax.lang.model.element.*;
-import javax.lang.model.util.*;
import static javax.lang.model.util.ElementFilter.*;
import static javax.tools.Diagnostic.Kind.*;
-import static javax.tools.StandardLocation.*;
/**
* Test some basic workings of javax.lang.element.ExecutableElement
*/
+@SupportedOptions("expectedMethodCount")
public class TestExecutableElement extends JavacTestingAbstractProcessor implements ProviderOfDefault {
+ private int seenMethods = 0;
@IsDefault(false)
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
- int errors = 0;
if (!roundEnv.processingOver()) {
- boolean hasRun = false;
for (Element element : roundEnv.getRootElements()) {
for (ExecutableElement method : methodsIn(element.getEnclosedElements())) {
- hasRun = true;
- errors += checkIsDefault(method);
+ checkIsDefault(method);
+ seenMethods++;
}
}
+ } else {
+ String expectedMethodCountStr = processingEnv.getOptions().get("expectedMethodCount");
+ if (expectedMethodCountStr == null) {
+ messager.printMessage(ERROR, "No expected method count specified.");
+ } else {
+ int expectedMethodCount = Integer.parseInt(expectedMethodCountStr);
- if (!hasRun) {
- messager.printMessage(ERROR, "No test cases run; test fails.");
+ if (seenMethods != expectedMethodCount) {
+ messager.printMessage(ERROR, "Wrong number of seen methods: " + seenMethods);
+ }
}
}
return true;
}
@IsDefault(false)
- int checkIsDefault(ExecutableElement method) {
+ void checkIsDefault(ExecutableElement method) {
System.out.println("Testing " + method);
IsDefault expectedIsDefault = method.getAnnotation(IsDefault.class);
@@ -116,9 +119,7 @@
expectedDefault,
methodIsDefault).toString(),
method);
- return 1;
}
- return 0;
}
}
@@ -142,4 +143,6 @@
@IsDefault(value=true, expectedTextRegex="\\s*@IsDefault\\(.*\\)\\s*default strictfp void quux\\(\\);\\s*$")
default strictfp void quux() {};
+ @IsDefault(false)
+ static void statik() {}
}
--- a/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/javac/processing/model/type/BasicAnnoTests.java Mon Oct 28 12:28:57 2013 -0700
@@ -26,6 +26,7 @@
* @bug 1234567
* @summary Annotations on types
* @library /tools/javac/lib
+ * @ignore
* @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests
* @compile/process -processor BasicAnnoTests -proc:only BasicAnnoTests.java
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/NoPrivateTypesExported.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026180
+ * @summary Ensuring javax.lang.model.**, javax.tools.**, javax.annotation.processing.**
+ * and com.sun.source.** don't export inappropriate types.
+ * @library /tools/javac/lib
+ * @build JavacTestingAbstractProcessor NoPrivateTypesExported
+ * @compile -processor NoPrivateTypesExported NoPrivateTypesExported.java
+ */
+import java.lang.annotation.Documented;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.TypeParameterElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.ArrayType;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.IntersectionType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.type.TypeVariable;
+import javax.lang.model.type.WildcardType;
+import javax.lang.model.util.ElementScanner8;
+import javax.lang.model.util.SimpleAnnotationValueVisitor8;
+import javax.tools.Diagnostic.Kind;
+
+public class NoPrivateTypesExported extends JavacTestingAbstractProcessor {
+
+ private static final String[] javaxLangModelPackages = new String[] {
+ "javax.lang.model",
+ "javax.lang.model.element",
+ "javax.lang.model.type",
+ "javax.lang.model.util",
+ };
+
+ private static final Set<String> javaxLangModelAcceptable;
+
+ private static final String[] javaxToolsProcessingPackages = new String[] {
+ "javax.annotation.processing",
+ "javax.tools",
+ };
+
+ private static final Set<String> javaxToolsProcessingAcceptable;
+
+ private static final String[] comSunSourcePackages = new String[] {
+ "com.sun.source.doctree",
+ "com.sun.source.tree",
+ "com.sun.source.util"
+ };
+
+ private static final Set<String> comSunSourceAcceptable;
+
+ static {
+ javaxLangModelAcceptable = new HashSet<>(Arrays.asList(
+ "java.io.",
+ "java.lang.",
+ "java.net.",
+ "java.nio.",
+ "java.util.",
+ "javax.lang.model.",
+ "javax.annotation.processing.SupportedSourceVersion",
+ "jdk.Exported"
+ ));
+ Set<String> javaxToolsProcessingAcceptableTemp = new HashSet<>();
+ javaxToolsProcessingAcceptableTemp.addAll(javaxLangModelAcceptable);
+ javaxToolsProcessingAcceptableTemp.addAll(Arrays.asList(
+ "javax.annotation.processing.",
+ "javax.tools."
+ ));
+ javaxToolsProcessingAcceptable = javaxToolsProcessingAcceptableTemp;
+ Set<String> comSunSourceAcceptableTemp = new HashSet<>();
+ comSunSourceAcceptableTemp.addAll(javaxToolsProcessingAcceptable);
+ comSunSourceAcceptableTemp.addAll(Arrays.asList(
+ "com.sun.source.doctree.",
+ "com.sun.source.tree.",
+ "com.sun.source.util."
+ ));
+ comSunSourceAcceptable = comSunSourceAcceptableTemp;
+ }
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
+ RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
+ verifyPackage(javaxLangModelPackages, javaxLangModelAcceptable);
+ verifyPackage(javaxToolsProcessingPackages, javaxToolsProcessingAcceptable);
+ verifyPackage(comSunSourcePackages, comSunSourceAcceptable);
+ }
+ return true;
+ }
+
+ private void verifyPackage(String[] packagesToTest, Set<String> acceptable) {
+ for (String packageToTest : packagesToTest) {
+ PackageElement packageElement = processingEnv.getElementUtils()
+ .getPackageElement(packageToTest);
+
+ verifyReferredTypesAcceptable(packageElement, acceptable);
+ }
+ }
+
+ private void verifyReferredTypesAcceptable(Element rootElement,
+ final Set<String> acceptable) {
+ new ElementScanner8<Void, Void>() {
+ @Override public Void visitType(TypeElement e, Void p) {
+ verifyTypeAcceptable(e.getSuperclass(), acceptable);
+ verifyTypesAcceptable(e.getInterfaces(), acceptable);
+ scan(e.getTypeParameters(), p);
+ scan(e.getEnclosedElements(), p);
+ verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+ return null;
+ }
+ @Override public Void visitTypeParameter(TypeParameterElement e, Void p) {
+ verifyTypesAcceptable(e.getBounds(), acceptable);
+ scan(e.getEnclosedElements(), p);
+ verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+ return null;
+ }
+ @Override public Void visitPackage(PackageElement e, Void p) {
+ scan(e.getEnclosedElements(), p);
+ verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+ return null;
+ }
+ @Override public Void visitVariable(VariableElement e, Void p) {
+ verifyTypeAcceptable(e.asType(), acceptable);
+ scan(e.getEnclosedElements(), p);
+ verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+ return null;
+ }
+ @Override
+ public Void visitExecutable(ExecutableElement e, Void p) {
+ scan(e.getTypeParameters(), p);
+ verifyTypeAcceptable(e.getReturnType(), acceptable);
+ scan(e.getParameters(), p);
+ verifyTypesAcceptable(e.getThrownTypes(), acceptable);
+ scan(e.getEnclosedElements(), p);
+ verifyAnnotations(e.getAnnotationMirrors(), acceptable);
+ return null;
+ }
+ }.scan(rootElement, null);
+ }
+
+ private void verifyAnnotations(Iterable<? extends AnnotationMirror> annotations,
+ Set<String> acceptable) {
+ for (AnnotationMirror mirror : annotations) {
+ Element annotationElement = mirror.getAnnotationType().asElement();
+
+ if (annotationElement.getAnnotation(Documented.class) == null) {
+ note("Ignoring undocumented annotation: " + mirror.getAnnotationType());
+ }
+
+ verifyTypeAcceptable(mirror.getAnnotationType(), acceptable);
+
+ for (AnnotationValue value : mirror.getElementValues().values()) {
+ verifyAnnotationValue(value, acceptable);
+ }
+ }
+ }
+
+ private void verifyAnnotationValue(AnnotationValue value,
+ final Set<String> acceptable) {
+ value.accept(new SimpleAnnotationValueVisitor8<Void, Void>() {
+ @Override public Void visitType(TypeMirror t, Void p) {
+ verifyTypeAcceptable(t, acceptable);
+ return null;
+ }
+ @Override
+ public Void visitEnumConstant(VariableElement c, Void p) {
+ verifyReferredTypesAcceptable(c, acceptable);
+ return null;
+ }
+ @Override public Void visitArray(List<? extends AnnotationValue> vals,
+ Void p) {
+ for (AnnotationValue val : vals) {
+ val.accept(this, p);
+ }
+ return null;
+ }
+ @Override protected Void defaultAction(Object o, Void p) {
+ error("Unexpected AnnotationValue: " + o.toString());
+ return super.defaultAction(o, p);
+ }
+ }, null);
+ }
+
+ private void verifyTypesAcceptable(Iterable<? extends TypeMirror> types,
+ Set<String> acceptable) {
+ if (types == null) return ;
+
+ for (TypeMirror type : types) {
+ verifyTypeAcceptable(type, acceptable);
+ }
+ }
+
+ private void verifyTypeAcceptable(TypeMirror type, Set<String> acceptable) {
+ if (type == null) return ;
+
+ verifyAnnotations(type.getAnnotationMirrors(), acceptable);
+
+ switch (type.getKind()) {
+ case BOOLEAN: case BYTE: case CHAR: case DOUBLE: case FLOAT:
+ case INT: case LONG: case SHORT: case VOID: case NONE: case NULL:
+ return ;
+ case DECLARED:
+ DeclaredType dt = (DeclaredType) type;
+ TypeElement outermostTypeElement = outermostTypeElement(dt.asElement());
+ String outermostType = outermostTypeElement.getQualifiedName().toString();
+ boolean isAcceptable = false;
+ for (String acceptablePackage : acceptable) {
+ if (outermostType.startsWith(acceptablePackage)) {
+ isAcceptable = true;
+ break;
+ }
+ }
+ if (!isAcceptable) {
+ error("Type not acceptable for this API: " + dt.toString());
+ }
+
+ for (TypeMirror bound : dt.getTypeArguments()) {
+ verifyTypeAcceptable(bound, acceptable);
+ }
+ break;
+ case ARRAY:
+ verifyTypeAcceptable(((ArrayType) type).getComponentType(), acceptable);
+ break;
+ case INTERSECTION:
+ for (TypeMirror element : ((IntersectionType) type).getBounds()) {
+ verifyTypeAcceptable(element, acceptable);
+ }
+ break;
+ case TYPEVAR:
+ verifyTypeAcceptable(((TypeVariable) type).getLowerBound(), acceptable);
+ verifyTypeAcceptable(((TypeVariable) type).getUpperBound(), acceptable);
+ break;
+ case WILDCARD:
+ verifyTypeAcceptable(((WildcardType) type).getExtendsBound(), acceptable);
+ verifyTypeAcceptable(((WildcardType) type).getSuperBound(), acceptable);
+ break;
+ default:
+ error("Type not acceptable for this API: " + type.toString());
+ break;
+
+ }
+ }
+
+ private TypeElement outermostTypeElement(Element el) {
+ while (el.getEnclosingElement().getKind() != ElementKind.PACKAGE) {
+ el = el.getEnclosingElement();
+ }
+
+ return (TypeElement) el;
+ }
+
+ private void error(String text) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, text);
+ }
+
+ private void note(String text) {
+ processingEnv.getMessager().printMessage(Kind.NOTE, text);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/tree/T8024415.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024415
+ * @summary Pretty printing of JCConditional does not follow the precedence and
+ * associativity rules of JCConditional
+ * @run testng T8024415
+ */
+
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.IOException;
+import java.io.StringWriter;
+
+import org.testng.annotations.Test;
+
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.tree.JCTree.JCExpression;
+import com.sun.tools.javac.tree.Pretty;
+import com.sun.tools.javac.tree.TreeMaker;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Names;
+
+
+/*
+ * Test verifies that the precedence rules of conditional expressions
+ * (JCConditional) are correct.
+ */
+@Test
+public class T8024415 {
+
+ TreeMaker maker;
+ JCExpression x;
+
+
+ public T8024415() {
+ Context ctx = new Context();
+ JavacFileManager.preRegister(ctx);
+ maker = TreeMaker.instance(ctx);
+ Names names = Names.instance(ctx);
+ x = maker.Ident(names.fromString("x"));
+ }
+
+
+ // JLS 15.25: The conditional operator is syntactically right-associative
+ // (it groups right-to-left). Thus, a?b:c?d:e?f:g means the same as
+ // a?b:(c?d:(e?f:g)).
+ public void testAssociativity() throws IOException {
+
+ JCTree left = maker.Conditional(maker.Conditional(x, x, x), x, x);
+ JCTree right = maker.Conditional(x, x, maker.Conditional(x, x, x));
+
+ String prettyLeft = prettyPrint(left);
+ String prettyRight = prettyPrint(right);
+
+ assertEquals(prettyLeft.replaceAll("\\s", ""), "(x?x:x)?x:x");
+ assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:x?x:x");
+
+ }
+
+
+ // The true-part of of a conditional expression is surrounded by ? and :
+ // and can thus always be parsed unambiguously without surrounding
+ // parentheses.
+ public void testPrecedence() throws IOException {
+
+ JCTree left = maker.Conditional(maker.Assign(x, x), x, x);
+ JCTree middle = maker.Conditional(x, maker.Assign(x, x), x);
+ JCTree right = maker.Conditional(x, x, maker.Assign(x, x));
+
+ String prettyLeft = prettyPrint(left);
+ String prettyMiddle = prettyPrint(middle);
+ String prettyRight = prettyPrint(right);
+
+ assertEquals(prettyLeft.replaceAll("\\s", ""), "(x=x)?x:x");
+ assertEquals(prettyMiddle.replaceAll("\\s", ""), "x?x=x:x");
+ assertEquals(prettyRight.replaceAll("\\s", ""), "x?x:(x=x)");
+
+ }
+
+
+ // Helper method
+ private static String prettyPrint(JCTree tree) throws IOException {
+ StringWriter sw = new StringWriter();
+ new Pretty(sw, true).printExpr(tree);
+ return sw.toString();
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javadoc/8025693/Test.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8025693
+ * @summary javadoc should ignore <clinit> methods found in classes on classpath
+ */
+
+import java.io.*;
+
+public class Test {
+ public static void main(String[] args) throws Exception {
+ new Test().run();
+ }
+
+ final File baseFile = new File("src/Base.java");
+ final String baseText =
+ "package p;\n" +
+ "public class Base { static { } }\n";
+
+ final File srcFile = new File("src/C.java");
+ final String srcText =
+ "package p;\n" +
+ "/** comment */\n" +
+ "public abstract class C extends Base { }\n";
+
+ void run() throws Exception {
+ File classesDir = new File("classes");
+ classesDir.mkdirs();
+ writeFile(baseFile, baseText);
+ String[] javacArgs = {
+ "-d", classesDir.getPath(),
+ baseFile.getPath()
+ };
+ com.sun.tools.javac.Main.compile(javacArgs);
+
+ writeFile(srcFile, srcText);
+ String[] args = {
+ "-d", "api",
+ "-classpath", classesDir.getPath(),
+ "-package", "p",
+ srcFile.getPath()
+ };
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ PrintStream prev = System.err;
+ System.setErr(ps);
+ try {
+ int rc = com.sun.tools.javadoc.Main.execute(args);
+ } finally {
+ System.err.flush();
+ System.setErr(prev);
+ }
+ String out = baos.toString();
+ System.out.println(out);
+
+ String errorMessage = "java.lang.IllegalArgumentException: <clinit>";
+ if (out.contains(errorMessage))
+ throw new Exception("error message found: " + errorMessage);
+ }
+
+ void writeFile(File file, String body) throws IOException {
+ file.getParentFile().mkdirs();
+ try (FileWriter out = new FileWriter(file)) {
+ out.write(body);
+ }
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/APIDeps.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8015912
+ * @summary find API dependencies
+ * @build m.Bar m.Foo m.Gee b.B c.C c.I d.D e.E f.F g.G
+ * @run main APIDeps
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.regex.*;
+
+public class APIDeps {
+ private static boolean symbolFileExist = initProfiles();
+ private static boolean initProfiles() {
+ // check if ct.sym exists; if not use the profiles.properties file
+ Path home = Paths.get(System.getProperty("java.home"));
+ if (home.endsWith("jre")) {
+ home = home.getParent();
+ }
+ Path ctsym = home.resolve("lib").resolve("ct.sym");
+ boolean symbolExists = ctsym.toFile().exists();
+ if (!symbolExists) {
+ Path testSrcProfiles =
+ Paths.get(System.getProperty("test.src", "."), "profiles.properties");
+ if (!testSrcProfiles.toFile().exists())
+ throw new Error(testSrcProfiles + " does not exist");
+ System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
+ ctsym, testSrcProfiles);
+ System.setProperty("jdeps.profiles", testSrcProfiles.toString());
+ }
+ return symbolExists;
+ }
+
+ public static void main(String... args) throws Exception {
+ int errors = 0;
+ errors += new APIDeps().run();
+ if (errors > 0)
+ throw new Exception(errors + " errors found");
+ }
+
+ int run() throws IOException {
+ File testDir = new File(System.getProperty("test.classes", "."));
+ String testDirBasename = testDir.toPath().getFileName().toString();
+ File mDir = new File(testDir, "m");
+ // all dependencies
+ test(new File(mDir, "Bar.class"),
+ new String[] {"java.lang.Object", "java.lang.String",
+ "java.util.Set", "java.util.HashSet",
+ "java.lang.management.ManagementFactory",
+ "java.lang.management.RuntimeMXBean",
+ "b.B", "c.C", "d.D", "f.F", "g.G"},
+ new String[] {"compact1", "compact3", testDirBasename},
+ new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
+ test(new File(mDir, "Foo.class"),
+ new String[] {"c.I", "e.E", "f.F", "m.Bar"},
+ new String[] {testDirBasename},
+ new String[] {"-classpath", testDir.getPath(), "-verbose", "-P"});
+ test(new File(mDir, "Gee.class"),
+ new String[] {"g.G", "sun.misc.Lock"},
+ new String[] {testDirBasename, "JDK internal API"},
+ new String[] {"-classpath", testDir.getPath(), "-verbose"});
+ // parse only APIs
+ test(mDir,
+ new String[] {"java.lang.Object", "java.lang.String",
+ "java.util.Set",
+ "c.C", "d.D", "c.I", "e.E", "m.Bar"},
+ new String[] {"compact1", testDirBasename, mDir.getName()},
+ new String[] {"-classpath", testDir.getPath(), "-verbose", "-P", "-apionly"});
+ return errors;
+ }
+
+ void test(File file, String[] expect, String[] profiles) {
+ test(file, expect, profiles, new String[0]);
+ }
+
+ void test(File file, String[] expect, String[] profiles, String[] options) {
+ List<String> args = new ArrayList<>(Arrays.asList(options));
+ if (file != null) {
+ args.add(file.getPath());
+ }
+ checkResult("api-dependencies", expect, profiles,
+ jdeps(args.toArray(new String[0])));
+ }
+
+ Map<String,String> jdeps(String... args) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ System.err.println("jdeps " + Arrays.toString(args));
+ int rc = com.sun.tools.jdeps.Main.run(args, pw);
+ pw.close();
+ String out = sw.toString();
+ if (!out.isEmpty())
+ System.err.println(out);
+ if (rc != 0)
+ throw new Error("jdeps failed: rc=" + rc);
+ return findDeps(out);
+ }
+
+ // Pattern used to parse lines
+ private static Pattern linePattern = Pattern.compile(".*\r?\n");
+ private static Pattern pattern = Pattern.compile("\\s+ -> (\\S+) +(.*)");
+
+ // Use the linePattern to break the given String into lines, applying
+ // the pattern to each line to see if we have a match
+ private static Map<String,String> findDeps(String out) {
+ Map<String,String> result = new HashMap<>();
+ Matcher lm = linePattern.matcher(out); // Line matcher
+ Matcher pm = null; // Pattern matcher
+ int lines = 0;
+ while (lm.find()) {
+ lines++;
+ CharSequence cs = lm.group(); // The current line
+ if (pm == null)
+ pm = pattern.matcher(cs);
+ else
+ pm.reset(cs);
+ if (pm.find())
+ result.put(pm.group(1), pm.group(2).trim());
+ if (lm.end() == out.length())
+ break;
+ }
+ return result;
+ }
+
+ void checkResult(String label, String[] expect, Collection<String> found) {
+ List<String> list = Arrays.asList(expect);
+ if (!isEqual(list, found))
+ error("Unexpected " + label + " found: '" + found + "', expected: '" + list + "'");
+ }
+
+ void checkResult(String label, String[] expect, String[] profiles, Map<String,String> result) {
+ // check the dependencies
+ checkResult(label, expect, result.keySet());
+ // check profile information
+ Set<String> values = new TreeSet<>();
+ String internal = "JDK internal API";
+ for (String s: result.values()) {
+ if (s.startsWith(internal)){
+ values.add(internal);
+ } else {
+ values.add(s);
+ }
+ }
+ checkResult(label, profiles, values);
+ }
+
+ boolean isEqual(List<String> expected, Collection<String> found) {
+ if (expected.size() != found.size())
+ return false;
+
+ List<String> list = new ArrayList<>(found);
+ list.removeAll(expected);
+ return list.isEmpty();
+ }
+
+ void error(String msg) {
+ System.err.println("Error: " + msg);
+ errors++;
+ }
+
+ int errors;
+}
--- a/langtools/test/tools/jdeps/Basic.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/jdeps/Basic.java Mon Oct 28 12:28:57 2013 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8003562 8005428
+ * @bug 8003562 8005428 8015912
* @summary Basic tests for jdeps tool
* @build Test p.Foo
* @run main Basic
@@ -79,40 +79,33 @@
new String[] {"compact1", "compact1", "compact3"});
// test class-level dependency output
test(new File(testDir, "Test.class"),
- new String[] {"java.lang.Object", "p.Foo"},
- new String[] {"compact1", "not found"},
- new String[] {"-V", "class"});
+ new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
+ new String[] {"compact1", "compact1", "not found"},
+ new String[] {"-verbose:class"});
// test -p option
test(new File(testDir, "Test.class"),
new String[] {"p.Foo"},
new String[] {"not found"},
- new String[] {"--verbose-level=class", "-p", "p"});
+ new String[] {"-verbose:class", "-p", "p"});
// test -e option
test(new File(testDir, "Test.class"),
new String[] {"p.Foo"},
new String[] {"not found"},
- new String[] {"-V", "class", "-e", "p\\..*"});
+ new String[] {"-verbose:class", "-e", "p\\..*"});
test(new File(testDir, "Test.class"),
new String[] {"java.lang"},
new String[] {"compact1"},
- new String[] {"-V", "package", "-e", "java\\.lang\\..*"});
- // test -classpath and wildcard options
+ new String[] {"-verbose:package", "-e", "java\\.lang\\..*"});
+ // test -classpath and -include options
test(null,
- new String[] {"com.sun.tools.jdeps", "java.lang", "java.util",
- "java.util.regex", "java.io", "java.nio.file",
+ new String[] {"java.lang", "java.util",
"java.lang.management"},
- new String[] {(symbolFileExist? "not found" : "JDK internal API (classes)"),
- "compact1", "compact1", "compact1",
- "compact1", "compact1", "compact3"},
- new String[] {"--classpath", testDir.getPath(), "*"});
- /* Temporary disable this test case. Test.class has a dependency
- * on java.lang.String on certain windows machine (8008479).
- // -v shows intra-dependency
- test(new File(testDir, "Test.class"),
- new String[] {"java.lang.Object", "p.Foo"},
- new String[] {"compact1", testDir.getName()},
- new String[] {"-v", "--classpath", testDir.getPath(), "Test.class"});
- */
+ new String[] {"compact1", "compact1", "compact3"},
+ new String[] {"-classpath", testDir.getPath(), "-include", "p.+|Test.class"});
+ test(new File(testDir, "Test.class"),
+ new String[] {"java.lang.Object", "java.lang.String", "p.Foo"},
+ new String[] {"compact1", "compact1", testDir.getName()},
+ new String[] {"-v", "-classpath", testDir.getPath(), "Test.class"});
return errors;
}
--- a/langtools/test/tools/jdeps/Test.java Mon Oct 28 10:52:07 2013 +0100
+++ b/langtools/test/tools/jdeps/Test.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,4 +25,7 @@
public void test() {
p.Foo f = new p.Foo();
}
+ private String name() {
+ return "this test";
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/b/B.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * 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 b;
+
+import java.lang.annotation.*;
+import static java.lang.annotation.ElementType.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target({TYPE, METHOD, FIELD})
+public @interface B {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/c/C.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * 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 c;
+
+public class C {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/c/I.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package c;
+
+public interface I {
+ void run();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/d/D.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * 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 d;
+
+public class D {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/e/E.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package e;
+
+// use compact2
+public class E extends java.rmi.RemoteException {
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/f/F.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package f;
+
+public class F {
+ public F() {
+ // jdk internal API
+ sun.misc.Unsafe.getUnsafe();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/g/G.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package g;
+
+public class G {
+ // Full JRE
+ private static final boolean gui = java.beans.Beans.isGuiAvailable();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/m/Bar.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,50 @@
+/*
+ * 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 m;
+
+import java.util.*;
+
+@b.B
+public class Bar {
+ public final Set<String> set = new HashSet<>();
+ protected d.D d;
+ private f.F f;
+
+ public Bar() {
+ // compact3
+ java.lang.management.ManagementFactory.getRuntimeMXBean();
+ }
+
+ protected c.C c() {
+ return new c.C();
+ }
+
+ /* package private */ void setF(f.F o) {
+ f = o;
+ }
+
+ private g.G g() {
+ return new g.G();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/m/Foo.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * 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 m;
+
+public class Foo extends Bar implements c.I {
+ public void foo() throws e.E {
+ }
+ public void run() {
+ setF(new f.F());
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/jdeps/m/Gee.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,30 @@
+/*
+ * 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 m;
+
+
+class Gee extends g.G {
+ public sun.misc.Lock lock;
+}
+
--- a/make/jprt.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/make/jprt.properties Mon Oct 28 12:28:57 2013 -0700
@@ -36,9 +36,7 @@
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
- solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
linux_i586_2.6-{product|fastdebug}, \
linux_x64_2.6-{product|fastdebug}, \
@@ -51,9 +49,7 @@
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
- solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
- solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
@@ -114,9 +110,7 @@
# JCK test targets in test/Makefile (no windows)
jprt.my.jck.test.target.set= \
- solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
- solaris_i586_5.10-product-c1-JCK7TESTRULE, \
solaris_x64_5.10-product-c2-JCK7TESTRULE, \
linux_i586_2.6-product-c1-JCK7TESTRULE, \
linux_x64_2.6-product-c2-JCK7TESTRULE
--- a/make/scripts/webrev.ksh Mon Oct 28 10:52:07 2013 +0100
+++ b/make/scripts/webrev.ksh Mon Oct 28 12:28:57 2013 -0700
@@ -27,7 +27,7 @@
# Documentation is available via 'webrev -h'.
#
-WEBREV_UPDATED=24.1-hg+openjdk.java.net
+WEBREV_UPDATED=25.0-hg+openjdk.java.net
HTML='<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
@@ -39,7 +39,8 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
-STDHEAD='<meta http-equiv="cache-control" content="no-cache" />
+STDHEAD='<meta charset="utf-8">
+<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
<!--
@@ -136,7 +137,19 @@
#
html_quote()
{
- sed -e "s/&/\&/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand
+ sed -e "s/&/\&/g" -e "s/&#\([x]*[0-9A-Fa-f]\{2,5\}\);/\&#\1;/g" -e "s/</\</g" -e "s/>/\>/g" "$@" | expand
+}
+
+#
+# input_cmd | html_quote | output_cmd
+# or
+# html_dequote filename | output_cmd
+#
+# Replace HTML entities with literals
+#
+html_dequote()
+{
+ sed -e "s/"/\"/g" -e "s/'/\'/g" -e "s/&/\&/g" -e "s/</<'/g" -e "s/>/>/g" "$@" | expand
}
#
@@ -150,23 +163,6 @@
}
#
-# input_cmd | sac2url | output_cmd
-#
-# Scan for ARC cases and insert <a> links to the relevent SAC database.
-# This is slightly complicated because inside the SWAN, SAC cases are
-# grouped by ARC: PSARC/2006/123. But on OpenSolaris.org, they are
-# referenced as 2006/123 (without labelling the ARC).
-#
-sac2url()
-{
- if [[ -z $Oflag ]]; then
- sed -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'\1/\2/\3\">\1 \2/\3</a>|g'
- else
- sed -e 's|\([A-Z]\{1,2\}ARC\)[ /]\([0-9]\{4\}\)/\([0-9]\{3\}\)|<a href=\"'$SACURL'/\2/\3\">\1 \2/\3</a>|g'
- fi
-}
-
-#
# strip_unchanged <infile> | output_cmd
#
# Removes chunks of sdiff documents that have not changed. This makes it
@@ -1055,79 +1051,6 @@
print "</pre></body></html>"
}
-#
-# teamwarecomments {text|html} parent-file child-file
-#
-# Find the first delta in the child that's not in the parent. Get the
-# newest delta from the parent, get all deltas from the child starting
-# with that delta, and then get all info starting with the second oldest
-# delta in that list (the first delta unique to the child).
-#
-# This code adapted from Bill Shannon's "spc" script
-#
-comments_from_teamware()
-{
- fmt=$1
- pfile=$PWS/$2
- cfile=$CWS/$3
-
- psid=$($SCCS prs -d:I: $pfile 2>/dev/null)
- if [[ -z "$psid" ]]; then
- psid=1.1
- fi
-
- set -A sids $($SCCS prs -l -r$psid -d:I: $cfile 2>/dev/null)
- N=${#sids[@]}
-
- nawkprg='
- /^COMMENTS:/ {p=1; next}
- /^D [0-9]+\.[0-9]+/ {printf "--- %s ---\n", $2; p=0; }
- NF == 0u { next }
- {if (p==0) next; print $0 }'
-
- if [[ $N -ge 2 ]]; then
- sid1=${sids[$((N-2))]} # Gets 2nd to last sid
-
- if [[ $fmt == "text" ]]; then
- $SCCS prs -l -r$sid1 $cfile 2>/dev/null | \
- $AWK "$nawkprg"
- return
- fi
-
- $SCCS prs -l -r$sid1 $cfile 2>/dev/null | \
- html_quote | bug2url | sac2url | $AWK "$nawkprg"
- fi
-}
-
-#
-# wxcomments {text|html} filepath
-#
-# Given the pathname of a file, find its location in a "wx" active file
-# list and print the following sccs comment. Output is either text or
-# HTML; if the latter, embedded bugids (sequence of 5 or more digits) are
-# turned into URLs.
-#
-comments_from_wx()
-{
- typeset fmt=$1
- typeset p=$2
-
- comm=`$AWK '
- $1 == "'$p'" {
- do getline ; while (NF > 0)
- getline
- while (NF > 0) { print ; getline }
- exit
- }' < $wxfile`
-
- if [[ $fmt == "text" ]]; then
- print "$comm"
- return
- fi
-
- print "$comm" | html_quote | bug2url | sac2url
-}
-
comments_from_mercurial()
{
fmt=$1
@@ -1161,7 +1084,7 @@
return
fi
- print "$comm" | html_quote | bug2url | sac2url
+ print "$comm" | html_quote | bug2url
)
fi
}
@@ -1178,15 +1101,7 @@
typeset p=$2
typeset pp=$3
- if [[ -n $wxfile ]]; then
- comments_from_wx $fmt $p
- else
- if [[ $SCM_MODE == "teamware" ]]; then
- comments_from_teamware $fmt $pp $p
- elif [[ $SCM_MODE == "mercurial" ]]; then
- comments_from_mercurial $fmt $pp $p
- fi
- fi
+ comments_from_mercurial $fmt $pp $p
}
#
@@ -1333,74 +1248,6 @@
print "</span>"
}
-
-#
-# flist_from_wx
-#
-# Sets up webrev to source its information from a wx-formatted file.
-# Sets the global 'wxfile' variable.
-#
-function flist_from_wx
-{
- typeset argfile=$1
- if [[ -n ${argfile%%/*} ]]; then
- #
- # If the wx file pathname is relative then make it absolute
- # because the webrev does a "cd" later on.
- #
- wxfile=$PWD/$argfile
- else
- wxfile=$argfile
- fi
-
- $AWK '{ c = 1; print;
- while (getline) {
- if (NF == 0) { c = -c; continue }
- if (c > 0) print
- }
- }' $wxfile > $FLIST
-
- print " Done."
-}
-
-#
-# flist_from_teamware [ <args-to-putback-n> ]
-#
-# Generate the file list by extracting file names from a putback -n. Some
-# names may come from the "update/create" messages and others from the
-# "currently checked out" warning. Renames are detected here too. Extract
-# values for CODEMGR_WS and CODEMGR_PARENT from the output of the putback
-# -n as well, but remove them if they are already defined.
-#
-function flist_from_teamware
-{
- if [[ -n $codemgr_parent ]]; then
- if [[ ! -d $codemgr_parent/Codemgr_wsdata ]]; then
- print -u2 "parent $codemgr_parent doesn't look like a" \
- "valid teamware workspace"
- exit 1
- fi
- parent_args="-p $codemgr_parent"
- fi
-
- print " File list from: 'putback -n $parent_args $*' ... \c"
-
- putback -n $parent_args $* 2>&1 |
- $AWK '
- /^update:|^create:/ {print $2}
- /^Parent workspace:/ {printf("CODEMGR_PARENT=%s\n",$3)}
- /^Child workspace:/ {printf("CODEMGR_WS=%s\n",$3)}
- /^The following files are currently checked out/ {p = 1; next}
- NF == 0 {p=0 ; next}
- /^rename/ {old=$3}
- $1 == "to:" {print $2, old}
- /^"/ {next}
- p == 1 {print $1}' |
- sort -r -k 1,1 -u | sort > $FLIST
-
- print " Done."
-}
-
function outgoing_from_mercurial_forest
{
hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK '
@@ -1710,47 +1557,13 @@
#
function detect_scm
{
- #
- # If CODEMGR_WS is specified in the flist file, we assume teamware.
- #
- if [[ -r $FLIST ]]; then
- egrep '^CODEMGR_WS=' $FLIST > /dev/null 2>&1
- if [[ $? -eq 0 ]]; then
- print "teamware"
- return
- fi
- fi
-
- #
- # The presence of $CODEMGR_WS and a Codemgr_wsdata directory
- # is our clue that this is a teamware workspace.
- # Same if true if current directory has a Codemgr_wsdata sub-dir
- #
- if [[ -z "$CODEMGR_WS" ]]; then
- CODEMGR_WS=`workspace name 2>/dev/null`
- fi
-
- if [[ -n $CODEMGR_WS && -d "$CODEMGR_WS/Codemgr_wsdata" ]]; then
- print "teamware"
- elif [[ -d $PWD/Codemgr_wsdata ]]; then
- print "teamware"
- elif hg root >/dev/null ; then
+ if hg root >/dev/null ; then
print "mercurial"
else
print "unknown"
fi
}
-#
-# Extract the parent workspace from the Codemgr_wsdata/parent file
-#
-function parent_from_teamware
-{
- if [[ -f "$1/Codemgr_wsdata/parent" ]]; then
- tail -1 "$1/Codemgr_wsdata/parent"
- fi
-}
-
function look_for_prog
{
typeset path
@@ -1777,48 +1590,6 @@
fi
}
-function build_old_new_teamware
-{
- # If the child's version doesn't exist then
- # get a readonly copy.
-
- if [[ ! -f $F && -f SCCS/s.$F ]]; then
- $SCCS get -s $F
- fi
-
- #
- # Snag new version of file.
- #
- rm -f $newdir/$DIR/$F
- cp $F $newdir/$DIR/$F
-
- #
- # Get the parent's version of the file. First see whether the
- # child's version is checked out and get the parent's version
- # with keywords expanded or unexpanded as appropriate.
- #
- if [ -f $PWS/$PDIR/SCCS/s.$PF -o \
- -f $PWS/$PDIR/SCCS/p.$PF ]; then
- rm -f $olddir/$PDIR/$PF
- if [ -f SCCS/p.$F ]; then
- $SCCS get -s -p -k $PWS/$PDIR/$PF \
- > $olddir/$PDIR/$PF
- else
- $SCCS get -s -p $PWS/$PDIR/$PF \
- > $olddir/$PDIR/$PF
- fi
- else
- if [[ -f $PWS/$PDIR/$PF ]]; then
- # Parent is not a real workspace, but just a raw
- # directory tree - use the file that's there as
- # the old file.
-
- rm -f $olddir/$DIR/$F
- cp $PWS/$PDIR/$PF $olddir/$DIR/$F
- fi
- fi
-}
-
#
# Find the parent for $1
#
@@ -1938,10 +1709,6 @@
function build_old_new
{
- if [[ $SCM_MODE == "teamware" ]]; then
- build_old_new_teamware $@
- fi
-
if [[ $SCM_MODE == "mercurial" ]]; then
build_old_new_mercurial $@
fi
@@ -1953,37 +1720,31 @@
#
function usage
{
- print "Usage:\twebrev [common-options]
- webrev [common-options] ( <file> | - )
- webrev [common-options] -w <wx file>
- webrev [common-options] -l [arguments to 'putback']
+ print "Usage:\twebrev [options]
+ webrev [options] ( <file> | - )
Options:
-v: Print the version of this tool.
-b: Do not ignore changes in the amount of white space.
-c <CR#>: Include link to CR (aka bugid) in the main page.
- -O: Print bugids/arc cases suitable for OpenJDK.
-i <filename>: Include <filename> in the index.html file.
-o <outdir>: Output webrev to specified directory.
-p <compare-against>: Use specified parent wkspc or basis for comparison
- -w <wxfile>: Use specified wx active file.
-u <username>: Use that username instead of 'guessing' one.
-m: Forces the use of Mercurial
- -t: Forces the use of Teamware
Mercurial only options:
-r rev: Compare against a specified revision
-N: Skip 'hg outgoing', use only 'hg status'
-f: Use the forest extension
+Arguments:
+ <file>: Optional file containing list of files to include in webrev
+ -: read list of files to include in webrev from standard input
+
Environment:
WDIR: Control the output directory.
WEBREV_BUGURL: Control the URL prefix for bugids.
- WEBREV_SACURL: Control the URL prefix for ARC cases.
-
-SCM Environment:
- Teamware: CODEMGR_WS: Workspace location.
- Teamware: CODEMGR_PARENT: Parent workspace location.
"
@@ -2003,7 +1764,6 @@
set +o noclobber
[[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
-[[ -z $WX ]] && WX=`look_for_prog wx`
[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
[[ -z $PERL ]] && PERL=`look_for_prog perl`
@@ -2011,7 +1771,6 @@
[[ -z $AWK ]] && AWK=`look_for_prog nawk`
[[ -z $AWK ]] && AWK=`look_for_prog gawk`
[[ -z $AWK ]] && AWK=`look_for_prog awk`
-[[ -z $WSPACE ]] && WSPACE=`look_for_prog workspace`
[[ -z $JAR ]] && JAR=`look_for_prog jar`
[[ -z $ZIP ]] && ZIP=`look_for_prog zip`
[[ -z $GETENT ]] && GETENT=`look_for_prog getent`
@@ -2033,8 +1792,6 @@
#
# These aren't fatal, but we want to note them to the user.
-# We don't warn on the absence of 'wx' until later when we've
-# determined that we actually need to try to invoke it.
#
# [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
# [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
@@ -2050,13 +1807,11 @@
oflag=
pflag=
uflag=
-lflag=
-wflag=
Oflag=
rflag=
Nflag=
forestflag=
-while getopts "c:i:o:p:r:u:lmtwONvfb" opt
+while getopts "c:i:o:p:r:u:mONvfb" opt
do
case $opt in
b) bflag=1;;
@@ -2081,19 +1836,7 @@
m) SCM_MODE="mercurial";;
- t) SCM_MODE="teamware";;
-
- #
- # If -l has been specified, we need to abort further options
- # processing, because subsequent arguments are going to be
- # arguments to 'putback -n'.
- #
- l) lflag=1
- break;;
-
- w) wflag=1;;
-
- O) Oflag=1;;
+ O) Oflag=1;; # ignored (bugs are now all visible at bugs.openjdk.java.net)
N) Nflag=1;;
@@ -2112,10 +1855,6 @@
FLIST=/tmp/$$.flist
HG_LIST_FROM_COMMIT=
-if [[ -n $wflag && -n $lflag ]]; then
- usage
-fi
-
if [[ -n $forestflag && -n $rflag ]]; then
print "The -r <rev> flag is incompatible with the use of forests"
exit 2
@@ -2130,27 +1869,25 @@
codemgr_parent="$codemgr_parent/raw_files/new"
fi
-if [[ -z $wflag && -z $lflag ]]; then
- shift $(($OPTIND - 1))
+shift $(($OPTIND - 1))
- if [[ $1 == "-" ]]; then
- cat > $FLIST
- flist_mode="stdin"
- flist_done=1
- shift
- elif [[ -n $1 ]]; then
- if [[ ! -r $1 ]]; then
- print -u2 "$1: no such file or not readable"
- usage
- fi
- cat $1 > $FLIST
- flist_mode="file"
- flist_file=$1
- flist_done=1
- shift
- else
- flist_mode="auto"
+if [[ $1 == "-" ]]; then
+ cat > $FLIST
+ flist_mode="stdin"
+ flist_done=1
+ shift
+elif [[ -n $1 ]]; then
+ if [[ ! -r $1 ]]; then
+ print -u2 "$1: no such file or not readable"
+ usage
fi
+ cat $1 > $FLIST
+ flist_mode="file"
+ flist_file=$1
+ flist_done=1
+ shift
+else
+ flist_mode="auto"
fi
#
@@ -2161,11 +1898,9 @@
SCM_MODE=`detect_scm $FLIST`
fi
if [[ $SCM_MODE == "unknown" ]]; then
- print -u2 "Unable to determine SCM type currently in use."
- print -u2 "For teamware: webrev looks for \$CODEMGR_WS either in"
- print -u2 " the environment or in the file list."
- print -u2 "For mercurial: webrev runs 'hg root'."
- exit 1
+ print -u2 "Unable to determine SCM type currently in use."
+ print -u2 "For mercurial: webrev runs 'hg root'."
+ exit 1
fi
print -u2 " SCM detected: $SCM_MODE"
@@ -2199,7 +1934,7 @@
#
# for forest we have to rely on properly set default and
# default-push because they can be different from the top one.
- # unless of course it was explicitely speficied with -p
+ # unless of course it was explicitly specified with -p
if [[ -z $pflag ]]; then
OUTPWS=
fi
@@ -2281,46 +2016,7 @@
fi
fi
-if [[ -n $lflag ]]; then
- #
- # If the -l flag is given instead of the name of a file list,
- # then generate the file list by extracting file names from a
- # putback -n.
- #
- shift $(($OPTIND - 1))
- if [[ $SCM_MODE == "teamware" ]]; then
- flist_from_teamware "$*"
- elif [[ $SCM_MODE == "mercurial" ]]; then
- flist_from_mercurial
- fi
- flist_done=1
- shift $#
-
-elif [[ -n $wflag ]]; then
- #
- # If the -w is given then assume the file list is in Bonwick's "wx"
- # command format, i.e. pathname lines alternating with SCCS comment
- # lines with blank lines as separators. Use the SCCS comments later
- # in building the index.html file.
- #
- shift $(($OPTIND - 1))
- wxfile=$1
- if [[ -z $wxfile && -n $CODEMGR_WS ]]; then
- if [[ -r $CODEMGR_WS/wx/active ]]; then
- wxfile=$CODEMGR_WS/wx/active
- fi
- fi
-
- [[ -z $wxfile ]] && print -u2 "wx file not specified, and could not " \
- "be auto-detected (check \$CODEMGR_WS)" && exit 1
-
- print -u2 " File list from: wx 'active' file '$wxfile' ... \c"
- flist_from_wx $wxfile
- flist_done=1
- if [[ -n "$*" ]]; then
- shift
- fi
-elif [[ $flist_mode == "stdin" ]]; then
+if [[ $flist_mode == "stdin" ]]; then
print -u2 " File list from: standard input"
elif [[ $flist_mode == "file" ]]; then
print -u2 " File list from: $flist_file"
@@ -2330,110 +2026,7 @@
print -u2 "WARNING: unused arguments: $*"
fi
-if [[ $SCM_MODE == "teamware" ]]; then
- #
- # Parent (internally $codemgr_parent) and workspace ($codemgr_ws) can
- # be set in a number of ways, in decreasing precedence:
- #
- # 1) on the command line (only for the parent)
- # 2) in the user environment
- # 3) in the flist
- # 4) automatically based on the workspace (only for the parent)
- #
-
- #
- # Here is case (2): the user environment
- #
- [[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS
- [[ -z $codemgr_ws && -n $WSPACE ]] && codemgr_ws=`$WSPACE name`
-
- if [[ -n $codemgr_ws && ! -d $codemgr_ws ]]; then
- print -u2 "$codemgr_ws: no such workspace"
- exit 1
- fi
-
- [[ -z $codemgr_parent && -n $CODEMGR_PARENT ]] && \
- codemgr_parent=$CODEMGR_PARENT
-
- if [[ -n $codemgr_parent && ! -d $codemgr_parent ]]; then
- print -u2 "$codemgr_parent: no such directory"
- exit 1
- fi
-
- #
- # If we're in auto-detect mode and we haven't already gotten the file
- # list, then see if we can get it by probing for wx.
- #
- if [[ -z $flist_done && $flist_mode == "auto" && -n $codemgr_ws ]]; then
- if [[ ! -x $WX ]]; then
- print -u2 "WARNING: wx not found!"
- fi
-
- #
- # We need to use wx list -w so that we get renamed files, etc.
- # but only if a wx active file exists-- otherwise wx will
- # hang asking us to initialize our wx information.
- #
- if [[ -x $WX && -f $codemgr_ws/wx/active ]]; then
- print -u2 " File list from: 'wx list -w' ... \c"
- $WX list -w > $FLIST
- $WX comments > /tmp/$$.wx_comments
- wxfile=/tmp/$$.wx_comments
- print -u2 "done"
- flist_done=1
- fi
- fi
-
- #
- # If by hook or by crook we've gotten a file list by now (perhaps
- # from the command line), eval it to extract environment variables from
- # it: This is step (3).
- #
- env_from_flist
-
- #
- # Continuing step (3): If we still have no file list, we'll try to get
- # it from teamware.
- #
- if [[ -z $flist_done ]]; then
- flist_from_teamware
- env_from_flist
- fi
-
- if [[ -z $codemgr_ws && -d $PWD/Codemgr_wsdata ]]; then
- codemgr_ws=$PWD
- fi
- #
- # Observe true directory name of CODEMGR_WS, as used later in
- # webrev title.
- #
- if [[ -n $codemgr_ws ]]; then
- codemgr_ws=$(cd $codemgr_ws;print $PWD)
- fi
-
- if [[ -n $codemgr_parent ]]; then
- codemgr_parent=$(cd $codemgr_parent;print $PWD)
- fi
-
- #
- # (4) If we still don't have a value for codemgr_parent, get it
- # from workspace.
- #
- [[ -z $codemgr_parent && -n $WSPACE ]] && codemgr_parent=`$WSPACE parent`
- [[ -z $codemgr_parent ]] && codemgr_parent=`parent_from_teamware $codemgr_ws`
-
- if [[ ! -d $codemgr_parent ]]; then
- print -u2 "$CODEMGR_PARENT: no such parent workspace"
- exit 1
- fi
-
- #
- # Reset CODEMGR_WS to make sure teamware commands are happy.
- #
- CODEMGR_WS=$codemgr_ws
- CWS=$codemgr_ws
- PWS=$codemgr_parent
-elif [[ $SCM_MODE == "mercurial" ]]; then
+if [[ $SCM_MODE == "mercurial" ]]; then
if [[ -z $flist_done ]]; then
flist_from_mercurial $PWS
fi
@@ -2527,30 +2120,12 @@
#
# Bug IDs will be replaced by a URL. Order of precedence
-# is: default location, $WEBREV_BUGURL, the -O flag.
+# is: default location, $WEBREV_BUGURL
#
BUGURL='https://bugs.openjdk.java.net/browse/'
[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL"
-if [[ -n "$Oflag" ]]; then
- CRID=`echo $CRID | sed -e 's/JDK-//'`
- BUGURL='http://bugs.sun.com/bugdatabase/view_bug.do?bug_id='
- IDPREFIX=''
-else
- IDPREFIX='JDK-'
-fi
-
+IDPREFIX='JDK-'
-#
-# Likewise, ARC cases will be replaced by a URL. Order of precedence
-# is: default, $WEBREV_SACURL, the -O flag.
-#
-# Note that -O also triggers different substitution behavior for
-# SACURL. See sac2url().
-#
-SACURL='http://sac.eng.sun.com'
-[[ -n $WEBREV_SACURL ]] && SACURL="$WEBREV_SACURL"
-[[ -n $Oflag ]] && \
- SACURL='http://www.opensolaris.org/os/community/arc/caselog'
rm -f $WDIR/$WNAME.patch
rm -f $WDIR/$WNAME.changeset
@@ -2651,20 +2226,6 @@
cd $CWS/$DIR
#
- # If we're in OpenSolaris mode, we enforce a minor policy:
- # help to make sure the reviewer doesn't accidentally publish
- # source which is in usr/closed/*
- #
- if [[ -n $Oflag ]]; then
- pclosed=${P##usr/closed/}
- if [[ $pclosed != $P ]]; then
- print "*** Omitting closed source for OpenSolaris" \
- "mode review"
- continue
- fi
- fi
-
- #
# We stash old and new files into parallel directories in /tmp
# and do our diffs there. This makes it possible to generate
# clean looking diffs which don't have absolute paths present.
@@ -2968,18 +2529,15 @@
print "<table>"
-if [[ -z $uflag ]]
-then
- if [[ $SCM_MODE == "mercurial" ]]
- then
+if [[ -z $uflag ]]; then
+ if [[ $SCM_MODE == "mercurial" ]]; then
#
# Let's try to extract the user name from the .hgrc file
#
username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'`
fi
- if [[ -z $username ]]
- then
+ if [[ -z $username ]]; then
#
# Figure out the username and gcos name. To maintain compatibility
# with passwd(4), we must support '&' substitutions.
@@ -3047,27 +2605,21 @@
print "</div></td></tr>"
fi
# Add links to referenced CRs, if any
-# external URL has a <title> like:
-# <title>Bug ID: 6641309 Wrong Cookie separator used in HttpURLConnection</title>
-# while internal URL has <title> like:
-# <title>[#JDK-6641309] Wrong Cookie separator used in HttpURLConnection</title>
-#
+# URL has a <title> like:
+# <title>[#JDK-8024688] b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair - Java Bug System</title>
+# we format this to:
+# JDK-8024688: b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair
if [[ -n $CRID ]]; then
for id in $CRID
do
- if [[ -z "$Oflag" ]]; then
- #add "JDK-" to raw bug id for openjdk.java.net links.
- id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
- fi
+ #add "JDK-" to raw bug id for openjdk.java.net links.
+ id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
+
print "<tr><th>Bug id:</th><td>"
url="${BUGURL}${id}"
- if [[ -n "$Oflag" ]]; then
- cleanup='s/Bug ID: \([0-9]\{5,\}\) \(.*\)/JDK-\1 : \2/'
- else
- cleanup='s|\[#\(JDK-[0-9]\{5,\}\)\] \(.*\)|\1 : \2|'
- fi
+
if [[ -n $WGET ]]; then
- msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\(.*\)<\/title>/\1/' | sed "$cleanup" | html_quote`
+ msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\[#\(.*\)\] \(.*\) - Java Bug System<\/title>/\1 : \2/' | html_dequote | html_quote`
fi
if [[ -z $msg ]]; then
msg="${id}"
@@ -3184,16 +2736,6 @@
print "<b>$P</b> $oldname"
fi
- #
- # Check for usr/closed
- #
- if [ ! -z "$Oflag" ]; then
- if [[ $P == usr/closed/* ]]; then
- print " <i>Closed source: omitted from" \
- "this review</i>"
- fi
- fi
-
print "</p><blockquote>\c"
# Insert delta comments if any
comments=`getcomments html $P $PP`
--- a/nashorn/.hgtags Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/.hgtags Mon Oct 28 12:28:57 2013 -0700
@@ -221,3 +221,4 @@
6ec2f9e5ed5bd60c2900976e6a54fdcac2f37e9e jdk8-b109
d49a8c2173f5f90c9a39cc4af8e03cfa8f35ee4c jdk8-b110
75fd3486e584f20475c064a2cd4d01ac6406a511 jdk8-b111
+6a4fdb3bb4e34af4c5bb8db467bb01e13b1a7e31 jdk8-b112
--- a/nashorn/src/jdk/internal/dynalink/beans/SingleDynamicMethod.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/internal/dynalink/beans/SingleDynamicMethod.java Mon Oct 28 12:28:57 2013 -0700
@@ -91,6 +91,7 @@
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.LinkerServices;
import jdk.internal.dynalink.support.Guards;
+import jdk.internal.dynalink.support.Lookup;
/**
* Base class for dynamic methods that dispatch to a single target Java method or constructor. Handles adaptation of the
@@ -100,6 +101,9 @@
* @version $Id: $
*/
abstract class SingleDynamicMethod extends DynamicMethod {
+
+ private static final MethodHandle CAN_CONVERT_TO = Lookup.findOwnStatic(MethodHandles.lookup(), "canConvertTo", boolean.class, LinkerServices.class, Class.class, Object.class);
+
SingleDynamicMethod(String name) {
super(name);
}
@@ -201,23 +205,69 @@
return createConvertingInvocation(target, linkerServices, callSiteType).asVarargsCollector(
callSiteLastArgType);
}
- if(!linkerServices.canConvert(callSiteLastArgType, varArgType)) {
- // Call site signature guarantees the argument can definitely not be an array (i.e. it is primitive);
- // link immediately to a vararg-packing method handle.
- return createConvertingInvocation(collectArguments(fixTarget, argsLen), linkerServices, callSiteType);
+
+ // This method handle takes the single argument and packs it into a newly allocated single-element array. It
+ // will be used when the incoming argument can't be converted to the vararg array type (the "vararg packer"
+ // method).
+ final MethodHandle varArgCollectingInvocation = createConvertingInvocation(collectArguments(fixTarget,
+ argsLen), linkerServices, callSiteType);
+
+ // Is call site type assignable from an array type (e.g. Object:int[], or Object[]:String[])
+ final boolean isAssignableFromArray = callSiteLastArgType.isAssignableFrom(varArgType);
+ // Do we have a custom conversion that can potentially convert the call site type to an array?
+ final boolean isCustomConvertible = linkerServices.canConvert(callSiteLastArgType, varArgType);
+ if(!isAssignableFromArray && !isCustomConvertible) {
+ // Call site signature guarantees the argument can definitely not be converted to an array (i.e. it is
+ // primitive), and no conversion can help with it either. Link immediately to a vararg-packing method
+ // handle.
+ return varArgCollectingInvocation;
}
- // Call site signature makes no guarantees that the single argument in the vararg position will be
- // compatible across all invocations. Need to insert an appropriate guard and fall back to generic vararg
- // method when it is not.
- return MethodHandles.guardWithTest(Guards.isInstance(varArgType, fixParamsLen, callSiteType),
- createConvertingInvocation(fixTarget, linkerServices, callSiteType),
- createConvertingInvocation(collectArguments(fixTarget, argsLen), linkerServices, callSiteType));
+
+ // This method handle employs language-specific conversions to convert the last argument into an array of
+ // vararg type.
+ final MethodHandle arrayConvertingInvocation = createConvertingInvocation(MethodHandles.filterArguments(
+ fixTarget, fixParamsLen, linkerServices.getTypeConverter(callSiteLastArgType, varArgType)),
+ linkerServices, callSiteType);
+
+ // This method handle determines whether the value can be converted to the array of vararg type using a
+ // language-specific conversion.
+ final MethodHandle canConvertArgToArray = MethodHandles.insertArguments(CAN_CONVERT_TO, 0, linkerServices,
+ varArgType);
+
+ // This one adjusts the previous one for the location of the argument and the call site type.
+ final MethodHandle canConvertLastArgToArray = MethodHandles.dropArguments(canConvertArgToArray, 0,
+ MethodType.genericMethodType(fixParamsLen).parameterList()).asType(callSiteType.changeReturnType(boolean.class));
+
+ // This one takes the previous ones and combines them into a method handle that converts the argument into
+ // a vararg array when it can, otherwise falls back to the vararg packer.
+ final MethodHandle convertToArrayWhenPossible = MethodHandles.guardWithTest(canConvertLastArgToArray,
+ arrayConvertingInvocation, varArgCollectingInvocation);
+
+ if(isAssignableFromArray) {
+ return MethodHandles.guardWithTest(
+ // Is incoming parameter already a compatible array?
+ Guards.isInstance(varArgType, fixParamsLen, callSiteType),
+ // Yes: just pass it to the method
+ createConvertingInvocation(fixTarget, linkerServices, callSiteType),
+ // No: either go through a custom conversion, or if it is not possible, go directly to the
+ // vararg packer.
+ isCustomConvertible ? convertToArrayWhenPossible : varArgCollectingInvocation);
+ }
+
+ // Just do the custom conversion with fallback to the vararg packer logic.
+ assert isCustomConvertible;
+ return convertToArrayWhenPossible;
}
// Remaining case: more than one vararg.
return createConvertingInvocation(collectArguments(fixTarget, argsLen), linkerServices, callSiteType);
}
+ @SuppressWarnings("unused")
+ private static boolean canConvertTo(final LinkerServices linkerServices, Class<?> to, Object obj) {
+ return obj == null ? false : linkerServices.canConvert(obj.getClass(), to);
+ }
+
/**
* Creates a method handle out of the original target that will collect the varargs for the exact component type of
* the varArg array. Note that this will nicely trigger language-specific type converters for exactly those varargs
--- a/nashorn/src/jdk/internal/dynalink/support/Guards.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/internal/dynalink/support/Guards.java Mon Oct 28 12:28:57 2013 -0700
@@ -88,6 +88,7 @@
import java.lang.invoke.MethodType;
import java.util.logging.Level;
import java.util.logging.Logger;
+import jdk.internal.dynalink.DynamicLinker;
import jdk.internal.dynalink.linker.LinkerServices;
/**
@@ -115,11 +116,11 @@
public static MethodHandle isOfClass(Class<?> clazz, MethodType type) {
final Class<?> declaredType = type.parameterType(0);
if(clazz == declaredType) {
- LOG.log(Level.WARNING, "isOfClassGuardAlwaysTrue", new Object[] { clazz.getName(), 0, type });
+ LOG.log(Level.WARNING, "isOfClassGuardAlwaysTrue", new Object[] { clazz.getName(), 0, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantTrue(type);
}
if(!declaredType.isAssignableFrom(clazz)) {
- LOG.log(Level.WARNING, "isOfClassGuardAlwaysFalse", new Object[] { clazz.getName(), 0, type });
+ LOG.log(Level.WARNING, "isOfClassGuardAlwaysFalse", new Object[] { clazz.getName(), 0, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantFalse(type);
}
return getClassBoundArgumentTest(IS_OF_CLASS, clazz, 0, type);
@@ -152,11 +153,11 @@
public static MethodHandle isInstance(Class<?> clazz, int pos, MethodType type) {
final Class<?> declaredType = type.parameterType(pos);
if(clazz.isAssignableFrom(declaredType)) {
- LOG.log(Level.WARNING, "isInstanceGuardAlwaysTrue", new Object[] { clazz.getName(), pos, type });
+ LOG.log(Level.WARNING, "isInstanceGuardAlwaysTrue", new Object[] { clazz.getName(), pos, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantTrue(type);
}
if(!declaredType.isAssignableFrom(clazz)) {
- LOG.log(Level.WARNING, "isInstanceGuardAlwaysFalse", new Object[] { clazz.getName(), pos, type });
+ LOG.log(Level.WARNING, "isInstanceGuardAlwaysFalse", new Object[] { clazz.getName(), pos, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantFalse(type);
}
return getClassBoundArgumentTest(IS_INSTANCE, clazz, pos, type);
@@ -174,11 +175,11 @@
public static MethodHandle isArray(int pos, MethodType type) {
final Class<?> declaredType = type.parameterType(pos);
if(declaredType.isArray()) {
- LOG.log(Level.WARNING, "isArrayGuardAlwaysTrue", new Object[] { pos, type });
+ LOG.log(Level.WARNING, "isArrayGuardAlwaysTrue", new Object[] { pos, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantTrue(type);
}
if(!declaredType.isAssignableFrom(Object[].class)) {
- LOG.log(Level.WARNING, "isArrayGuardAlwaysFalse", new Object[] { pos, type });
+ LOG.log(Level.WARNING, "isArrayGuardAlwaysFalse", new Object[] { pos, type, DynamicLinker.getLinkedCallSiteLocation() });
return constantFalse(type);
}
return asType(IS_ARRAY, pos, type);
--- a/nashorn/src/jdk/internal/dynalink/support/messages.properties Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/internal/dynalink/support/messages.properties Mon Oct 28 12:28:57 2013 -0700
@@ -76,11 +76,11 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-isInstanceGuardAlwaysTrue=isInstance guard for {0} in position {1} in method type {2} will always return true
-isInstanceGuardAlwaysFalse=isInstance guard for {0} in position {1} in method type {2} will always return false
+isInstanceGuardAlwaysTrue=isInstance guard for {0} in position {1} in method type {2} at {3} will always return true
+isInstanceGuardAlwaysFalse=isInstance guard for {0} in position {1} in method type {2} at {3} will always return false
-isOfClassGuardAlwaysTrue=isOfClass guard for {0} in position {1} in method type {2} will always return true
-isOfClassGuardAlwaysFalse=isOfClass guard for {0} in position {1} in method type {2} will always return false
+isOfClassGuardAlwaysTrue=isOfClass guard for {0} in position {1} in method type {2} at {3} will always return true
+isOfClassGuardAlwaysFalse=isOfClass guard for {0} in position {1} in method type {2} at {3} will always return false
-isArrayGuardAlwaysTrue=isArray guard in position {0} in method type {1} will always return true
-isArrayGuardAlwaysFalse=isArray guard in position {0} in method type {1} will always return false
\ No newline at end of file
+isArrayGuardAlwaysTrue=isArray guard in position {0} in method type {1} at {2} will always return true
+isArrayGuardAlwaysFalse=isArray guard in position {0} in method type {1} at {2} will always return false
\ No newline at end of file
--- a/nashorn/src/jdk/nashorn/api/scripting/JSObject.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/api/scripting/JSObject.java Mon Oct 28 12:28:57 2013 -0700
@@ -46,7 +46,7 @@
* @param args arguments to method
* @return result of call
*/
- public Object call(Object thiz, Object... args) {
+ public Object call(final Object thiz, final Object... args) {
throw new UnsupportedOperationException("call");
}
@@ -57,7 +57,7 @@
* @param args arguments to method
* @return result of constructor call
*/
- public Object newObject(Object... args) {
+ public Object newObject(final Object... args) {
throw new UnsupportedOperationException("newObject");
}
@@ -67,7 +67,7 @@
* @param s JavaScript expression to evaluate
* @return evaluation result
*/
- public Object eval(String s) {
+ public Object eval(final String s) {
throw new UnsupportedOperationException("eval");
}
@@ -78,7 +78,7 @@
* @param args arguments to be passed to the member function
* @return result of call
*/
- public Object callMember(String name, Object... args) {
+ public Object callMember(final String name, final Object... args) {
throw new UnsupportedOperationException("call");
}
@@ -88,7 +88,7 @@
* @param name of member
* @return member
*/
- public Object getMember(String name) {
+ public Object getMember(final String name) {
return null;
}
@@ -98,7 +98,7 @@
* @param index index slot to retrieve
* @return member
*/
- public Object getSlot(int index) {
+ public Object getSlot(final int index) {
return null;
}
@@ -108,7 +108,7 @@
* @param name name of member
* @return true if this object has a member of the given name
*/
- public boolean hasMember(String name) {
+ public boolean hasMember(final String name) {
return false;
}
@@ -118,7 +118,7 @@
* @param slot index to check
* @return true if this object has a slot
*/
- public boolean hasSlot(int slot) {
+ public boolean hasSlot(final int slot) {
return false;
}
@@ -127,7 +127,8 @@
*
* @param name name of the member
*/
- public void removeMember(String name) {
+ public void removeMember(final String name) {
+ //empty
}
/**
@@ -136,7 +137,8 @@
* @param name name of the member
* @param value value of the member
*/
- public void setMember(String name, Object value) {
+ public void setMember(final String name, final Object value) {
+ //empty
}
/**
@@ -145,7 +147,8 @@
* @param index index of the member slot
* @param value value of the member
*/
- public void setSlot(int index, Object value) {
+ public void setSlot(final int index, final Object value) {
+ //empty
}
// property and value iteration
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java Mon Oct 28 12:28:57 2013 -0700
@@ -285,11 +285,10 @@
final URL url = ((URLReader)reader).getURL();
final Charset cs = ((URLReader)reader).getCharset();
return new Source(url.toString(), url, cs);
- } else {
- return new Source(getScriptName(ctxt), Source.readFully(reader));
}
- } catch (final IOException ioExp) {
- throw new ScriptException(ioExp);
+ return new Source(getScriptName(ctxt), Source.readFully(reader));
+ } catch (final IOException e) {
+ throw new ScriptException(e);
}
}
@@ -576,15 +575,14 @@
return new CompiledScript() {
@Override
public Object eval(final ScriptContext ctxt) throws ScriptException {
- final ScriptObject global = getNashornGlobalFrom(ctxt);
+ final ScriptObject globalObject = getNashornGlobalFrom(ctxt);
// Are we running the script in the correct global?
- if (func.getScope() == global) {
- return evalImpl(func, ctxt, global);
- } else {
- // ScriptContext with a different global. Compile again!
- // Note that we may still hit per-global compilation cache.
- return evalImpl(compileImpl(source, ctxt), ctxt, global);
+ if (func.getScope() == globalObject) {
+ return evalImpl(func, ctxt, globalObject);
}
+ // ScriptContext with a different global. Compile again!
+ // Note that we may still hit per-global compilation cache.
+ return evalImpl(compileImpl(source, ctxt), ctxt, globalObject);
}
@Override
public ScriptEngine getEngine() {
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptUtils.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptUtils.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.api.scripting;
+import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptRuntime;
/**
@@ -57,4 +58,17 @@
public static String format(final String format, final Object[] args) {
return Formatter.format(format, args);
}
+
+ /**
+ * Create a wrapper function that calls {@code func} synchronized on {@code sync} or, if that is undefined,
+ * {@code self}. Used to implement "sync" function in resources/mozilla_compat.js.
+ *
+ * @param func the function to invoke
+ * @param sync the object to synchronize on
+ * @return a synchronizing wrapper function
+ */
+ public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
+ return func.makeSynchronizedFunction(sync);
+ }
+
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/Attr.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Attr.java Mon Oct 28 12:28:57 2013 -0700
@@ -480,6 +480,10 @@
}
//unknown parameters are promoted to object type.
+ if (newFunctionNode.hasLazyChildren()) {
+ //the final body has already been assigned as we have left the function node block body by now
+ objectifySymbols(body);
+ }
newFunctionNode = finalizeParameters(newFunctionNode);
newFunctionNode = finalizeTypes(newFunctionNode);
for (final Symbol symbol : newFunctionNode.getDeclaredSymbols()) {
@@ -489,11 +493,6 @@
}
}
- if (newFunctionNode.hasLazyChildren()) {
- //the final body has already been assigned as we have left the function node block body by now
- objectifySymbols(body);
- }
-
List<VarNode> syntheticInitializers = null;
if (body.getFlag(Block.NEEDS_SELF_SYMBOL)) {
@@ -503,8 +502,8 @@
syntheticInitializers.add(createSyntheticInitializer(newFunctionNode.getIdent(), CALLEE, newFunctionNode));
}
- if(newFunctionNode.needsArguments()) {
- if(syntheticInitializers == null) {
+ if (newFunctionNode.needsArguments()) {
+ if (syntheticInitializers == null) {
syntheticInitializers = new ArrayList<>(1);
}
// "var arguments = :arguments"
@@ -512,12 +511,12 @@
ARGUMENTS, newFunctionNode));
}
- if(syntheticInitializers != null) {
- final List<Statement> stmts = body.getStatements();
+ if (syntheticInitializers != null) {
+ final List<Statement> stmts = newFunctionNode.getBody().getStatements();
final List<Statement> newStatements = new ArrayList<>(stmts.size() + syntheticInitializers.size());
newStatements.addAll(syntheticInitializers);
newStatements.addAll(stmts);
- newFunctionNode = newFunctionNode.setBody(lc, body.setStatements(lc, newStatements));
+ newFunctionNode = newFunctionNode.setBody(lc, newFunctionNode.getBody().setStatements(lc, newStatements));
}
if (returnTypes.peek().isUnknown()) {
@@ -558,12 +557,6 @@
}
@Override
- public Node leaveCONVERT(final UnaryNode unaryNode) {
- assert false : "There should be no convert operators in IR during Attribution";
- return end(unaryNode);
- }
-
- @Override
public Node leaveIdentNode(final IdentNode identNode) {
final String name = identNode.getName();
@@ -991,7 +984,7 @@
@Override
public Node leaveNEW(final UnaryNode unaryNode) {
- return end(ensureSymbol(Type.OBJECT, unaryNode));
+ return end(ensureSymbol(Type.OBJECT, unaryNode.setRHS(((CallNode)unaryNode.rhs()).setIsNew())));
}
@Override
@@ -1287,7 +1280,9 @@
private Node leaveCmp(final BinaryNode binaryNode) {
ensureTypeNotUnknown(binaryNode.lhs());
ensureTypeNotUnknown(binaryNode.rhs());
-
+ Type widest = Type.widest(binaryNode.lhs().getType(), binaryNode.rhs().getType());
+ ensureSymbol(widest, binaryNode.lhs());
+ ensureSymbol(widest, binaryNode.rhs());
return end(ensureSymbol(Type.BOOLEAN, binaryNode));
}
@@ -1630,7 +1625,7 @@
if (!Type.areEquivalent(from, to) && Type.widest(from, to) == to) {
LOG.fine("Had to post pass widen '", node, "' ", Debug.id(node), " from ", node.getType(), " to ", to);
Symbol symbol = node.getSymbol();
- if(symbol.isShared() && symbol.wouldChangeType(to)) {
+ if (symbol.isShared() && symbol.wouldChangeType(to)) {
symbol = temporarySymbols.getTypedTemporarySymbol(to);
}
newType(symbol, to);
@@ -1646,40 +1641,105 @@
return !node.isLazy();
}
- /**
- * Eg.
- *
- * var d = 17;
- * var e;
- * e = d; //initially typed as int for node type, should retype as double
- * e = object;
- *
- * var d = 17;
- * var e;
- * e -= d; //initially type number, should number remain with a final conversion supplied by Store. ugly, but the computation result of the sub is numeric
- * e = object;
- *
- */
+ //
+ // Eg.
+ //
+ // var d = 17;
+ // var e;
+ // e = d; //initially typed as int for node type, should retype as double
+ // e = object;
+ //
+ // var d = 17;
+ // var e;
+ // e -= d; //initially type number, should number remain with a final conversion supplied by Store. ugly, but the computation result of the sub is numeric
+ // e = object;
+ //
@SuppressWarnings("fallthrough")
@Override
public Node leaveBinaryNode(final BinaryNode binaryNode) {
final Type widest = Type.widest(binaryNode.lhs().getType(), binaryNode.rhs().getType());
BinaryNode newBinaryNode = binaryNode;
- switch (binaryNode.tokenType()) {
- default:
- if (!binaryNode.isAssignment() || binaryNode.isSelfModifying()) {
+
+ if (isAdd(binaryNode)) {
+ newBinaryNode = (BinaryNode)widen(newBinaryNode, widest);
+ if (newBinaryNode.getType().isObject() && !isAddString(newBinaryNode)) {
+ return new RuntimeNode(newBinaryNode, Request.ADD);
+ }
+ } else if (binaryNode.isComparison()) {
+ final Expression lhs = newBinaryNode.lhs();
+ final Expression rhs = newBinaryNode.rhs();
+
+ Type cmpWidest = Type.widest(lhs.getType(), rhs.getType());
+
+ boolean newRuntimeNode = false, finalized = false;
+ switch (newBinaryNode.tokenType()) {
+ case EQ_STRICT:
+ case NE_STRICT:
+ if (lhs.getType().isBoolean() != rhs.getType().isBoolean()) {
+ newRuntimeNode = true;
+ cmpWidest = Type.OBJECT;
+ finalized = true;
+ }
+ //fallthru
+ default:
+ if (newRuntimeNode || cmpWidest.isObject()) {
+ return new RuntimeNode(newBinaryNode, Request.requestFor(binaryNode)).setIsFinal(finalized);
+ }
break;
}
+
+ return newBinaryNode;
+ } else {
+ if (!binaryNode.isAssignment() || binaryNode.isSelfModifying()) {
+ return newBinaryNode;
+ }
+ checkThisAssignment(binaryNode);
newBinaryNode = newBinaryNode.setLHS(widen(newBinaryNode.lhs(), widest));
- case ADD:
newBinaryNode = (BinaryNode)widen(newBinaryNode, widest);
}
+
return newBinaryNode;
+
+ }
+
+ private boolean isAdd(final Node node) {
+ return node.isTokenType(TokenType.ADD);
+ }
+
+ /**
+ * Determine if the outcome of + operator is a string.
+ *
+ * @param node Node to test.
+ * @return true if a string result.
+ */
+ private boolean isAddString(final Node node) {
+ if (node instanceof BinaryNode && isAdd(node)) {
+ final BinaryNode binaryNode = (BinaryNode)node;
+ final Node lhs = binaryNode.lhs();
+ final Node rhs = binaryNode.rhs();
+
+ return isAddString(lhs) || isAddString(rhs);
+ }
+
+ return node instanceof LiteralNode<?> && ((LiteralNode<?>)node).isString();
+ }
+
+ private void checkThisAssignment(final BinaryNode binaryNode) {
+ if (binaryNode.isAssignment()) {
+ if (binaryNode.lhs() instanceof AccessNode) {
+ final AccessNode accessNode = (AccessNode) binaryNode.lhs();
+
+ if (accessNode.getBase().getSymbol().isThis()) {
+ lc.getCurrentFunction().addThisProperty(accessNode.getProperty().getName());
+ }
+ }
+ }
}
});
lc.replace(currentFunctionNode, newFunctionNode);
currentFunctionNode = newFunctionNode;
} while (!changed.isEmpty());
+
return currentFunctionNode;
}
@@ -1692,7 +1752,6 @@
final Expression lhs = binaryNode.lhs();
newType(lhs.getSymbol(), destType); //may not narrow if dest is already wider than destType
-// ensureSymbol(destType, binaryNode); //for OP= nodes, the node can carry a narrower types than its lhs rhs. This is perfectly fine
return end(ensureSymbol(destType, binaryNode));
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/BranchOptimizer.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/BranchOptimizer.java Mon Oct 28 12:28:57 2013 -0700
@@ -56,10 +56,6 @@
branchOptimizer(node, label, state);
}
- private void load(final Expression node) {
- codegen.load(node);
- }
-
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) {
final Expression rhs = unaryNode.rhs();
@@ -67,18 +63,16 @@
case NOT:
branchOptimizer(rhs, label, !state);
return;
- case CONVERT:
+ default:
if (unaryNode.getType().isBoolean()) {
branchOptimizer(rhs, label, state);
return;
}
break;
- default:
- break;
}
// convert to boolean
- load(unaryNode);
+ codegen.load(unaryNode);
method.convert(Type.BOOLEAN);
if (state) {
method.ifne(label);
@@ -118,45 +112,33 @@
case EQ:
case EQ_STRICT:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol();
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? EQ : NE, true, label);
return;
case NE:
case NE_STRICT:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol();
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? NE : EQ, true, label);
return;
case GE:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol();
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? GE : LT, !state, label);
return;
case GT:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol();
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? GT : LE, !state, label);
return;
case LE:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol();
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? LE : GT, state, label);
return;
case LT:
- assert rhs.getType().isEquivalentTo(lhs.getType()) : "type mismatch: " + lhs.getSymbol() + " to " + rhs.getSymbol() + " in " + binaryNode;
- load(lhs);
- load(rhs);
+ codegen.loadBinaryOperands(lhs, rhs, Type.widest(lhs.getType(), rhs.getType()));
method.conditionalJump(state ? LT : GE, state, label);
return;
@@ -164,7 +146,7 @@
break;
}
- load(binaryNode);
+ codegen.load(binaryNode);
method.convert(Type.BOOLEAN);
if (state) {
method.ifne(label);
@@ -187,7 +169,7 @@
}
}
- load(node);
+ codegen.load(node);
method.convert(Type.BOOLEAN);
if (state) {
method.ifne(label);
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java Mon Oct 28 12:28:57 2013 -0700
@@ -43,7 +43,6 @@
import static jdk.nashorn.internal.codegen.CompilerConstants.interfaceCallNoLookup;
import static jdk.nashorn.internal.codegen.CompilerConstants.methodDescriptor;
import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
-import static jdk.nashorn.internal.codegen.CompilerConstants.staticField;
import static jdk.nashorn.internal.codegen.CompilerConstants.typeDescriptor;
import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
import static jdk.nashorn.internal.ir.Symbol.IS_INTERNAL;
@@ -60,7 +59,6 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
-import java.util.Locale;
import java.util.Set;
import java.util.TreeMap;
import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
@@ -111,7 +109,6 @@
import jdk.nashorn.internal.ir.VarNode;
import jdk.nashorn.internal.ir.WhileNode;
import jdk.nashorn.internal.ir.WithNode;
-import jdk.nashorn.internal.ir.debug.ASTWriter;
import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.objects.Global;
@@ -217,12 +214,12 @@
* @param identNode an identity node to load
* @return the method generator used
*/
- private MethodEmitter loadIdent(final IdentNode identNode) {
+ private MethodEmitter loadIdent(final IdentNode identNode, final Type type) {
final Symbol symbol = identNode.getSymbol();
if (!symbol.isScope()) {
assert symbol.hasSlot() || symbol.isParam();
- return method.load(symbol);
+ return method.load(symbol).convert(type);
}
final String name = symbol.getName();
@@ -243,11 +240,11 @@
if (isFastScope(symbol)) {
// Only generate shared scope getter for fast-scope symbols so we know we can dial in correct scope.
if (symbol.getUseCount() > SharedScopeCall.FAST_SCOPE_GET_THRESHOLD) {
- return loadSharedScopeVar(identNode.getType(), symbol, flags);
+ return loadSharedScopeVar(type, symbol, flags);
}
- return loadFastScopeVar(identNode.getType(), symbol, flags, identNode.isFunction());
+ return loadFastScopeVar(type, symbol, flags, identNode.isFunction());
}
- return method.dynamicGet(identNode.getType(), identNode.getName(), flags, identNode.isFunction());
+ return method.dynamicGet(type, identNode.getName(), flags, identNode.isFunction());
}
}
@@ -313,9 +310,9 @@
return method.dynamicGet(valueType, symbol.getName(), flags | CALLSITE_FAST_SCOPE, isMethod);
}
- private MethodEmitter storeFastScopeVar(final Type valueType, final Symbol symbol, final int flags) {
+ private MethodEmitter storeFastScopeVar(final Symbol symbol, final int flags) {
loadFastScopeProto(symbol, true);
- method.dynamicSet(valueType, symbol.getName(), flags | CALLSITE_FAST_SCOPE);
+ method.dynamicSet(symbol.getName(), flags | CALLSITE_FAST_SCOPE);
return method;
}
@@ -359,14 +356,61 @@
* @return the method emitter used
*/
MethodEmitter load(final Expression node) {
- return load(node, false);
+ return load(node, node.hasType() ? node.getType() : null, false);
+ }
+
+ private static boolean safeLiteral(final Expression rhs) {
+ return rhs instanceof LiteralNode && !(rhs instanceof ArrayLiteralNode);
+ }
+
+ MethodEmitter loadBinaryOperands(final Expression lhs, final Expression rhs, final Type type) {
+ return loadBinaryOperands(lhs, rhs, type, false);
}
- private MethodEmitter load(final Expression node, final boolean baseAlreadyOnStack) {
+ private MethodEmitter loadBinaryOperands(final Expression lhs, final Expression rhs, final Type type, final boolean baseAlreadyOnStack) {
+ // ECMAScript 5.1 specification (sections 11.5-11.11 and 11.13) prescribes that when evaluating a binary
+ // expression "LEFT op RIGHT", the order of operations must be: LOAD LEFT, LOAD RIGHT, CONVERT LEFT, CONVERT
+ // RIGHT, EXECUTE OP. Unfortunately, doing it in this order defeats potential optimizations that arise when we
+ // can combine a LOAD with a CONVERT operation (e.g. use a dynamic getter with the conversion target type as its
+ // return value). What we do here is reorder LOAD RIGHT and CONVERT LEFT when possible; it is possible only when
+ // we can prove that executing CONVERT LEFT can't have a side effect that changes the value of LOAD RIGHT.
+ // Basically, if we know that either LEFT is not an object, or RIGHT is a constant literal, then we can do the
+ // reordering and collapse LOAD/CONVERT into a single operation; otherwise we need to do the more costly
+ // separate operations to preserve specification semantics.
+ final Type lhsType = lhs.getType();
+ if (lhsType.isObject() && !safeLiteral(rhs)) {
+ // Can't reorder. Load and convert separately.
+ load(lhs, lhsType, baseAlreadyOnStack);
+ load(rhs, rhs.getType(), false);
+ // Avoid empty SWAP, SWAP bytecode sequence if CONVERT LEFT is a no-op
+ if (!lhsType.isEquivalentTo(type)) {
+ method.swap();
+ method.convert(type);
+ method.swap();
+ }
+ method.convert(type);
+ } else {
+ // Can reorder. Combine load and convert into single operations.
+ load(lhs, type, baseAlreadyOnStack);
+ load(rhs, type, false);
+ }
+
+ return method;
+ }
+
+ MethodEmitter loadBinaryOperands(final BinaryNode node) {
+ return loadBinaryOperands(node.lhs(), node.rhs(), node.getType(), false);
+ }
+
+ private MethodEmitter load(final Expression node, final Type type) {
+ return load(node, type, false);
+ }
+
+ private MethodEmitter load(final Expression node, final Type type, final boolean baseAlreadyOnStack) {
final Symbol symbol = node.getSymbol();
// If we lack symbols, we just generate what we see.
- if (symbol == null) {
+ if (symbol == null || type == null) {
node.accept(this);
return method;
}
@@ -378,10 +422,10 @@
*/
final CodeGenerator codegen = this;
- node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
+ node.accept(new NodeVisitor<LexicalContext>(lc) {
@Override
public boolean enterIdentNode(final IdentNode identNode) {
- loadIdent(identNode);
+ loadIdent(identNode, type);
return false;
}
@@ -391,7 +435,7 @@
load(accessNode.getBase()).convert(Type.OBJECT);
}
assert method.peekType().isObject();
- method.dynamicGet(node.getType(), accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
+ method.dynamicGet(type, accessNode.getProperty().getName(), getCallSiteFlags(), accessNode.isFunction());
return false;
}
@@ -401,7 +445,7 @@
load(indexNode.getBase()).convert(Type.OBJECT);
load(indexNode.getIndex());
}
- method.dynamicGetIndex(node.getType(), getCallSiteFlags(), indexNode.isFunction());
+ method.dynamicGetIndex(type, getCallSiteFlags(), indexNode.isFunction());
return false;
}
@@ -409,14 +453,36 @@
public boolean enterFunctionNode(FunctionNode functionNode) {
// function nodes will always leave a constructed function object on stack, no need to load the symbol
// separately as in enterDefault()
+ lc.pop(functionNode);
functionNode.accept(codegen);
+ // NOTE: functionNode.accept() will produce a different FunctionNode that we discard. This incidentally
+ // doesn't cause problems as we're never touching FunctionNode again after it's visited here - codegen
+ // is the last element in the compilation pipeline, the AST it produces is not used externally. So, we
+ // re-push the original functionNode.
+ lc.push(functionNode);
+ method.convert(type);
return false;
}
@Override
+ public boolean enterCallNode(CallNode callNode) {
+ return codegen.enterCallNode(callNode, type);
+ }
+
+ @Override
+ public boolean enterLiteralNode(LiteralNode<?> literalNode) {
+ return codegen.enterLiteralNode(literalNode, type);
+ }
+
+ @Override
public boolean enterDefault(final Node otherNode) {
+ final Node currentDiscard = codegen.lc.getCurrentDiscard();
otherNode.accept(codegen); // generate code for whatever we are looking at.
- method.load(symbol); // load the final symbol to the stack (or nop if no slot, then result is already there)
+ if(currentDiscard != otherNode) {
+ method.load(symbol); // load the final symbol to the stack (or nop if no slot, then result is already there)
+ assert method.peekType() != null;
+ method.convert(type);
+ }
return false;
}
});
@@ -583,15 +649,19 @@
return argCount;
}
+
@Override
public boolean enterCallNode(final CallNode callNode) {
+ return enterCallNode(callNode, callNode.getType());
+ }
+
+ private boolean enterCallNode(final CallNode callNode, final Type callNodeType) {
lineNumber(callNode.getLineNumber());
final List<Expression> args = callNode.getArgs();
final Expression function = callNode.getFunction();
final Block currentBlock = lc.getCurrentBlock();
final CodeGeneratorLexicalContext codegenLexicalContext = lc;
- final Type callNodeType = callNode.getType();
function.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@@ -612,16 +682,14 @@
}
private void scopeCall(final IdentNode node, final int flags) {
- load(node);
- method.convert(Type.OBJECT); // foo() makes no sense if foo == 3
+ load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
// ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly.
method.loadNull(); //the 'this'
method.dynamicCall(callNodeType, 2 + loadArgs(args), flags);
}
private void evalCall(final IdentNode node, final int flags) {
- load(node);
- method.convert(Type.OBJECT); // foo() makes no sense if foo == 3
+ load(node, Type.OBJECT); // Type.OBJECT as foo() makes no sense if foo == 3
final Label not_eval = new Label("not_eval");
final Label eval_done = new Label("eval_done");
@@ -638,8 +706,7 @@
final CallNode.EvalArgs evalArgs = callNode.getEvalArgs();
// load evaluated code
- load(evalArgs.getCode());
- method.convert(Type.OBJECT);
+ load(evalArgs.getCode(), Type.OBJECT);
// special/extra 'eval' arguments
load(evalArgs.getThis());
method.load(evalArgs.getLocation());
@@ -690,13 +757,11 @@
@Override
public boolean enterAccessNode(final AccessNode node) {
- load(node.getBase());
- method.convert(Type.OBJECT);
+ load(node.getBase(), Type.OBJECT);
method.dup();
method.dynamicGet(node.getType(), node.getProperty().getName(), getCallSiteFlags(), true);
method.swap();
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags());
- assert method.peekType().equals(callNodeType);
return false;
}
@@ -727,18 +792,17 @@
@Override
public boolean enterIndexNode(final IndexNode node) {
- load(node.getBase());
- method.convert(Type.OBJECT);
+ load(node.getBase(), Type.OBJECT);
method.dup();
- load(node.getIndex());
final Type indexType = node.getIndex().getType();
if (indexType.isObject() || indexType.isBoolean()) {
- method.convert(Type.OBJECT); //TODO
+ load(node.getIndex(), Type.OBJECT); //TODO
+ } else {
+ load(node.getIndex());
}
method.dynamicGetIndex(node.getType(), getCallSiteFlags(), true);
method.swap();
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags());
- assert method.peekType().equals(callNode.getType());
return false;
}
@@ -746,11 +810,9 @@
@Override
protected boolean enterDefault(final Node node) {
// Load up function.
- load(function);
- method.convert(Type.OBJECT); //TODO, e.g. booleans can be used as functions
+ load(function, Type.OBJECT); //TODO, e.g. booleans can be used as functions
method.loadNull(); // ScriptFunction will figure out the correct this when it sees CALLSITE_SCOPE
method.dynamicCall(callNodeType, 2 + loadArgs(args), getCallSiteFlags() | CALLSITE_SCOPE);
- assert method.peekType().equals(callNode.getType());
return false;
}
@@ -853,8 +915,7 @@
final Expression init = forNode.getInit();
- load(modify);
- assert modify.getType().isObject();
+ load(modify, Type.OBJECT);
method.invoke(forNode.isForEach() ? ScriptRuntime.TO_VALUE_ITERATOR : ScriptRuntime.TO_PROPERTY_ITERATOR);
method.store(iter);
method._goto(forNode.getContinueLabel());
@@ -1203,8 +1264,7 @@
if (element == null) {
method.loadEmpty(elementType);
} else {
- assert elementType.isEquivalentTo(element.getType()) : "array element type doesn't match array type";
- load(element);
+ load(element, elementType);
}
method.arraystore();
@@ -1274,7 +1334,7 @@
}
// literal values
- private MethodEmitter load(final LiteralNode<?> node) {
+ private MethodEmitter loadLiteral(final LiteralNode<?> node, final Type type) {
final Object value = node.getValue();
if (value == null) {
@@ -1294,15 +1354,26 @@
} else if (value instanceof Boolean) {
method.load((Boolean)value);
} else if (value instanceof Integer) {
- method.load((Integer)value);
+ if(type.isEquivalentTo(Type.NUMBER)) {
+ method.load(((Integer)value).doubleValue());
+ } else if(type.isEquivalentTo(Type.LONG)) {
+ method.load(((Integer)value).longValue());
+ } else {
+ method.load((Integer)value);
+ }
} else if (value instanceof Long) {
- method.load((Long)value);
+ if(type.isEquivalentTo(Type.NUMBER)) {
+ method.load(((Long)value).doubleValue());
+ } else {
+ method.load((Long)value);
+ }
} else if (value instanceof Double) {
method.load((Double)value);
} else if (node instanceof ArrayLiteralNode) {
- final ArrayType type = (ArrayType)node.getType();
- loadArray((ArrayLiteralNode)node, type);
- globalAllocateArray(type);
+ final ArrayLiteralNode arrayLiteral = (ArrayLiteralNode)node;
+ final ArrayType atype = arrayLiteral.getArrayType();
+ loadArray(arrayLiteral, atype);
+ globalAllocateArray(atype);
} else {
assert false : "Unknown literal for " + node.getClass() + " " + value.getClass() + " " + value;
}
@@ -1346,8 +1417,12 @@
@Override
public boolean enterLiteralNode(final LiteralNode<?> literalNode) {
+ return enterLiteralNode(literalNode, literalNode.getType());
+ }
+
+ private boolean enterLiteralNode(final LiteralNode<?> literalNode, final Type type) {
assert literalNode.getSymbol() != null : literalNode + " has no symbol";
- load(literalNode).store(literalNode.getSymbol());
+ loadLiteral(literalNode, type).convert(type).store(literalNode.getSymbol());
return false;
}
@@ -1622,10 +1697,8 @@
return enterCmp(lhs, rhs, Condition.GT, type, symbol);
case ADD:
Type widest = Type.widest(lhs.getType(), rhs.getType());
- load(lhs);
- method.convert(widest);
- load(rhs);
- method.convert(widest);
+ load(lhs, widest);
+ load(rhs, widest);
method.add();
method.convert(type);
method.store(symbol);
@@ -1638,15 +1711,15 @@
}
if (nullCheck(runtimeNode, args, new FunctionSignature(false, false, runtimeNode.getType(), args).toString())) {
- return false;
+ return false;
}
if (!runtimeNode.isFinal() && specializationCheck(runtimeNode.getRequest(), runtimeNode, args)) {
- return false;
+ return false;
}
for (final Expression arg : args) {
- load(arg).convert(Type.OBJECT); //TODO this should not be necessary below Lower
+ load(arg).convert(Type.OBJECT);
}
method.invokestatic(
@@ -1903,24 +1976,15 @@
method.lookupswitch(defaultLabel, ints, labels);
}
} else {
- load(expression);
-
- if (expression.getType().isInteger()) {
- method.convert(Type.NUMBER).dup();
- method.store(tag);
- method.conditionalJump(Condition.NE, true, defaultLabel);
- } else {
- assert tag.getSymbolType().isObject();
- method.convert(Type.OBJECT); //e.g. 1 literal pushed and tag is object
- method.store(tag);
- }
+ load(expression, Type.OBJECT);
+ method.store(tag);
for (final CaseNode caseNode : cases) {
final Expression test = caseNode.getTest();
if (test != null) {
method.load(tag);
- load(test);
+ load(test, Type.OBJECT);
method.invoke(ScriptRuntime.EQ_STRICT);
method.ifne(caseNode.getEntry());
}
@@ -1961,8 +2025,7 @@
final int line = throwNode.getLineNumber();
final int column = source.getColumn(position);
- load(expression);
- assert expression.getType().isObject();
+ load(expression, Type.OBJECT);
method.load(source.getName());
method.load(line);
@@ -2087,29 +2150,28 @@
lineNumber(varNode);
- final Symbol varSymbol = varNode.getName().getSymbol();
- assert varSymbol != null : "variable node " + varNode + " requires a name with a symbol";
+ final IdentNode identNode = varNode.getName();
+ final Symbol identSymbol = identNode.getSymbol();
+ assert identSymbol != null : "variable node " + varNode + " requires a name with a symbol";
assert method != null;
- final boolean needsScope = varSymbol.isScope();
+ final boolean needsScope = identSymbol.isScope();
if (needsScope) {
method.loadCompilerConstant(SCOPE);
}
- load(init);
if (needsScope) {
+ load(init);
int flags = CALLSITE_SCOPE | getCallSiteFlags();
- final IdentNode identNode = varNode.getName();
- final Type type = identNode.getType();
- if (isFastScope(varSymbol)) {
- storeFastScopeVar(type, varSymbol, flags);
+ if (isFastScope(identSymbol)) {
+ storeFastScopeVar(identSymbol, flags);
} else {
- method.dynamicSet(type, identNode.getName(), flags);
+ method.dynamicSet(identNode.getName(), flags);
}
} else {
- method.convert(varNode.getName().getType()); // aw: convert moved here
- method.store(varSymbol);
+ load(init, identNode.getType());
+ method.store(identSymbol);
}
return false;
@@ -2168,8 +2230,7 @@
tryLabel = null;
}
- load(expression);
- assert expression.getType().isObject() : "with expression needs to be object: " + expression;
+ load(expression, Type.OBJECT);
if (hasScope) {
// Construct a WithObject if we have a scope
@@ -2211,54 +2272,15 @@
@Override
public boolean enterADD(final UnaryNode unaryNode) {
- load(unaryNode.rhs());
- assert unaryNode.rhs().getType().isNumber() : unaryNode.rhs().getType() + " "+ unaryNode.getSymbol();
+ load(unaryNode.rhs(), unaryNode.getType());
+ assert unaryNode.getType().isNumeric();
method.store(unaryNode.getSymbol());
-
return false;
}
@Override
public boolean enterBIT_NOT(final UnaryNode unaryNode) {
- load(unaryNode.rhs()).convert(Type.INT).load(-1).xor().store(unaryNode.getSymbol());
- return false;
- }
-
- // do this better with convert calls to method. TODO
- @Override
- public boolean enterCONVERT(final UnaryNode unaryNode) {
- final Expression rhs = unaryNode.rhs();
- final Type to = unaryNode.getType();
-
- if (to.isObject() && rhs instanceof LiteralNode) {
- final LiteralNode<?> literalNode = (LiteralNode<?>)rhs;
- final Object value = literalNode.getValue();
-
- if (value instanceof Number) {
- assert !to.isArray() : "type hygiene - cannot convert number to array: (" + to.getTypeClass().getSimpleName() + ')' + value;
- if (value instanceof Integer) {
- method.load((Integer)value);
- } else if (value instanceof Long) {
- method.load((Long)value);
- } else if (value instanceof Double) {
- method.load((Double)value);
- } else {
- assert false;
- }
- method.convert(Type.OBJECT);
- } else if (value instanceof Boolean) {
- method.getField(staticField(Boolean.class, value.toString().toUpperCase(Locale.ENGLISH), Boolean.class));
- } else {
- load(rhs);
- method.convert(unaryNode.getType());
- }
- } else {
- load(rhs);
- method.convert(unaryNode.getType());
- }
-
- method.store(unaryNode.getSymbol());
-
+ load(unaryNode.rhs(), Type.INT).load(-1).xor().store(unaryNode.getSymbol());
return false;
}
@@ -2276,9 +2298,7 @@
@Override
protected void evaluate() {
- load(rhs, true);
-
- method.convert(type);
+ load(rhs, type, true);
if (!isPostfix) {
if (type.isInteger()) {
method.load(isIncrement ? 1 : -1);
@@ -2344,12 +2364,11 @@
public boolean enterNOT(final UnaryNode unaryNode) {
final Expression rhs = unaryNode.rhs();
- load(rhs);
+ load(rhs, Type.BOOLEAN);
final Label trueLabel = new Label("true");
final Label afterLabel = new Label("after");
- method.convert(Type.BOOLEAN);
method.ifne(trueLabel);
method.load(true);
method._goto(afterLabel);
@@ -2363,8 +2382,8 @@
@Override
public boolean enterSUB(final UnaryNode unaryNode) {
- load(unaryNode.rhs()).neg().store(unaryNode.getSymbol());
-
+ assert unaryNode.getType().isNumeric();
+ load(unaryNode.rhs()).convert(unaryNode.getType()).neg().store(unaryNode.getSymbol());
return false;
}
@@ -2377,9 +2396,7 @@
}
private void enterNumericAdd(final Expression lhs, final Expression rhs, final Type type, final Symbol symbol) {
- assert lhs.getType().equals(rhs.getType()) && lhs.getType().equals(type) : lhs.getType() + " != " + rhs.getType() + " != " + type + " " + new ASTWriter(lhs) + " " + new ASTWriter(rhs);
- load(lhs);
- load(rhs);
+ loadBinaryOperands(lhs, rhs, type);
method.add(); //if the symbol is optimistic, it always needs to be written, not on the stack?
method.store(symbol);
}
@@ -2393,8 +2410,7 @@
if (type.isNumeric()) {
enterNumericAdd(lhs, rhs, type, binaryNode.getSymbol());
} else {
- load(lhs).convert(Type.OBJECT);
- load(rhs).convert(Type.OBJECT);
+ loadBinaryOperands(binaryNode);
method.add();
method.store(binaryNode.getSymbol());
}
@@ -2439,13 +2455,16 @@
if (!lhsType.isEquivalentTo(rhsType)) {
//this is OK if scoped, only locals are wrong
- assert !(lhs instanceof IdentNode) || lhs.getSymbol().isScope() : new ASTWriter(binaryNode);
}
new Store<BinaryNode>(binaryNode, lhs) {
@Override
protected void evaluate() {
- load(rhs);
+ if ((lhs instanceof IdentNode) && !lhs.getSymbol().isScope()) {
+ load(rhs, lhsType);
+ } else {
+ load(rhs);
+ }
}
}.store();
@@ -2484,8 +2503,7 @@
@Override
protected void evaluate() {
- load(assignNode.lhs(), true).convert(opType);
- load(assignNode.rhs()).convert(opType);
+ loadBinaryOperands(assignNode.lhs(), assignNode.rhs(), opType, true);
op();
method.convert(assignNode.getType());
}
@@ -2656,8 +2674,7 @@
protected abstract void op();
protected void evaluate(final BinaryNode node) {
- load(node.lhs());
- load(node.rhs());
+ loadBinaryOperands(node);
op();
method.store(node.getSymbol());
}
@@ -2739,11 +2756,7 @@
final Type widest = Type.widest(lhsType, rhsType);
assert widest.isNumeric() || widest.isBoolean() : widest;
- load(lhs);
- method.convert(widest);
- load(rhs);
- method.convert(widest);
-
+ loadBinaryOperands(lhs, rhs, widest);
final Label trueLabel = new Label("trueLabel");
final Label afterLabel = new Label("skip");
@@ -2862,6 +2875,12 @@
public boolean enterSHR(final BinaryNode binaryNode) {
new BinaryArith() {
@Override
+ protected void evaluate(final BinaryNode node) {
+ loadBinaryOperands(node.lhs(), node.rhs(), Type.INT);
+ op();
+ method.store(node.getSymbol());
+ }
+ @Override
protected void op() {
method.shr();
method.convert(Type.LONG).load(JSType.MAX_UINT).and();
@@ -2893,26 +2912,22 @@
final Label falseLabel = new Label("ternary_false");
final Label exitLabel = new Label("ternary_exit");
- Type widest = Type.widest(trueExpr.getType(), falseExpr.getType());
+ Type widest = Type.widest(ternaryNode.getType(), Type.widest(trueExpr.getType(), falseExpr.getType()));
if (trueExpr.getType().isArray() || falseExpr.getType().isArray()) { //loadArray creates a Java array type on the stack, calls global allocate, which creates a native array type
widest = Type.OBJECT;
}
- load(test);
- assert test.getType().isBoolean() : "lhs in ternary must be boolean";
-
+ load(test, Type.BOOLEAN);
// we still keep the conversion here as the AccessSpecializer can have separated the types, e.g. var y = x ? x=55 : 17
// will left as (Object)x=55 : (Object)17 by Lower. Then the first term can be {I}x=55 of type int, which breaks the
// symmetry for the temporary slot for this TernaryNode. This is evidence that we assign types and explicit conversions
- // to early, or Apply the AccessSpecializer too late. We are mostly probably looking for a separate type pass to
+ // too early, or Apply the AccessSpecializer too late. We are mostly probably looking for a separate type pass to
// do this property. Then we never need any conversions in CodeGenerator
method.ifeq(falseLabel);
- load(trueExpr);
- method.convert(widest);
+ load(trueExpr, widest);
method._goto(exitLabel);
method.label(falseLabel);
- load(falseExpr);
- method.convert(widest);
+ load(falseExpr, widest);
method.label(exitLabel);
method.store(symbol);
@@ -3044,8 +3059,7 @@
final BaseNode baseNode = (BaseNode)target;
final Expression base = baseNode.getBase();
- load(base);
- method.convert(Type.OBJECT);
+ load(base, Type.OBJECT);
depth += Type.OBJECT.getSlots();
if (isSelfModifying()) {
@@ -3064,10 +3078,11 @@
enterBaseNode();
final Expression index = node.getIndex();
- // could be boolean here as well
- load(index);
if (!index.getType().isNumeric()) {
- method.convert(Type.OBJECT);
+ // could be boolean here as well
+ load(index, Type.OBJECT);
+ } else {
+ load(index);
}
depth += index.getType().getSlots();
@@ -3136,8 +3151,6 @@
* need to do a conversion on non-equivalent types exists, but is
* very rare. See for example test/script/basic/access-specializer.js
*/
- method.convert(target.getType());
-
target.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
@Override
protected boolean enterDefault(Node node) {
@@ -3145,24 +3158,17 @@
}
@Override
- public boolean enterUnaryNode(final UnaryNode node) {
- if (node.tokenType() == TokenType.CONVERT && node.getSymbol() != null) {
- method.convert(node.rhs().getType());
- }
- return true;
- }
-
- @Override
public boolean enterIdentNode(final IdentNode node) {
final Symbol symbol = node.getSymbol();
assert symbol != null;
if (symbol.isScope()) {
if (isFastScope(symbol)) {
- storeFastScopeVar(node.getType(), symbol, CALLSITE_SCOPE | getCallSiteFlags());
+ storeFastScopeVar(symbol, CALLSITE_SCOPE | getCallSiteFlags());
} else {
- method.dynamicSet(node.getType(), node.getName(), CALLSITE_SCOPE | getCallSiteFlags());
+ method.dynamicSet(node.getName(), CALLSITE_SCOPE | getCallSiteFlags());
}
} else {
+ method.convert(node.getType());
method.store(symbol);
}
return false;
@@ -3171,7 +3177,7 @@
@Override
public boolean enterAccessNode(final AccessNode node) {
- method.dynamicSet(node.getProperty().getType(), node.getProperty().getName(), getCallSiteFlags());
+ method.dynamicSet(node.getProperty().getName(), getCallSiteFlags());
return false;
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompilationPhase.java Mon Oct 28 12:28:57 2013 -0700
@@ -162,7 +162,7 @@
LOWERING_PHASE(EnumSet.of(INITIALIZED, PARSED, CONSTANT_FOLDED)) {
@Override
FunctionNode transform(final Compiler compiler, final FunctionNode fn) {
- return (FunctionNode)fn.accept(new Lower());
+ return (FunctionNode)fn.accept(new Lower(compiler.getCodeInstaller()));
}
@Override
--- a/nashorn/src/jdk/nashorn/internal/codegen/CompileUnit.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CompileUnit.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,7 +28,7 @@
/**
* Used to track split class compilation.
*/
-public class CompileUnit {
+public class CompileUnit implements Comparable<CompileUnit> {
/** Current class name */
private final String className;
@@ -116,4 +116,9 @@
public String toString() {
return "[classname=" + className + " weight=" + weight + '/' + Splitter.SPLIT_THRESHOLD + ']';
}
+
+ @Override
+ public int compareTo(CompileUnit o) {
+ return className.compareTo(o.className);
+ }
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java Mon Oct 28 12:28:57 2013 -0700
@@ -36,8 +36,6 @@
import static jdk.nashorn.internal.codegen.CompilerConstants.THIS;
import static jdk.nashorn.internal.codegen.CompilerConstants.VARARGS;
-import jdk.nashorn.internal.ir.TemporarySymbols;
-
import java.io.File;
import java.lang.reflect.Field;
import java.security.AccessController;
@@ -48,18 +46,20 @@
import java.util.Comparator;
import java.util.EnumSet;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.TreeSet;
import java.util.logging.Level;
import jdk.internal.dynalink.support.NameCodec;
import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
+import jdk.nashorn.internal.ir.TemporarySymbols;
import jdk.nashorn.internal.ir.debug.ClassHistogramElement;
import jdk.nashorn.internal.ir.debug.ObjectSizeCalculator;
import jdk.nashorn.internal.runtime.CodeInstaller;
@@ -256,8 +256,8 @@
this.sequence = sequence;
this.installer = installer;
this.constantData = new ConstantData();
- this.compileUnits = new HashSet<>();
- this.bytecode = new HashMap<>();
+ this.compileUnits = new TreeSet<>();
+ this.bytecode = new LinkedHashMap<>();
}
private void initCompiler(final FunctionNode functionNode) {
--- a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,49 +28,22 @@
import static jdk.nashorn.internal.codegen.CompilerConstants.CALLEE;
import static jdk.nashorn.internal.codegen.CompilerConstants.SCOPE;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import jdk.nashorn.internal.codegen.types.Type;
-import jdk.nashorn.internal.ir.AccessNode;
-import jdk.nashorn.internal.ir.Assignment;
import jdk.nashorn.internal.ir.BinaryNode;
import jdk.nashorn.internal.ir.Block;
-import jdk.nashorn.internal.ir.CallNode;
-import jdk.nashorn.internal.ir.CaseNode;
-import jdk.nashorn.internal.ir.CatchNode;
import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.ExpressionStatement;
import jdk.nashorn.internal.ir.ForNode;
import jdk.nashorn.internal.ir.FunctionNode;
import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
-import jdk.nashorn.internal.ir.IdentNode;
-import jdk.nashorn.internal.ir.IfNode;
-import jdk.nashorn.internal.ir.IndexNode;
import jdk.nashorn.internal.ir.LexicalContext;
-import jdk.nashorn.internal.ir.LiteralNode;
-import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
import jdk.nashorn.internal.ir.Node;
-import jdk.nashorn.internal.ir.ReturnNode;
-import jdk.nashorn.internal.ir.RuntimeNode;
-import jdk.nashorn.internal.ir.RuntimeNode.Request;
-import jdk.nashorn.internal.ir.SwitchNode;
import jdk.nashorn.internal.ir.Symbol;
import jdk.nashorn.internal.ir.TemporarySymbols;
-import jdk.nashorn.internal.ir.TernaryNode;
-import jdk.nashorn.internal.ir.ThrowNode;
-import jdk.nashorn.internal.ir.TypeOverride;
import jdk.nashorn.internal.ir.UnaryNode;
-import jdk.nashorn.internal.ir.VarNode;
-import jdk.nashorn.internal.ir.WhileNode;
-import jdk.nashorn.internal.ir.WithNode;
import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
-import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.parser.Token;
import jdk.nashorn.internal.parser.TokenType;
-import jdk.nashorn.internal.runtime.Debug;
import jdk.nashorn.internal.runtime.DebugLogger;
-import jdk.nashorn.internal.runtime.JSType;
/**
* Lower to more primitive operations. After lowering, an AST has symbols and
@@ -97,272 +70,32 @@
}
@Override
- public Node leaveCallNode(final CallNode callNode) {
- // AccessSpecializer - call return type may change the access for this location
- final Node function = callNode.getFunction();
- if (function instanceof FunctionNode) {
- return setTypeOverride(callNode, ((FunctionNode)function).getReturnType());
- }
- return callNode;
- }
-
- private Node leaveUnary(final UnaryNode unaryNode) {
- return unaryNode.setRHS(convert(unaryNode.rhs(), unaryNode.getType()));
- }
-
- @Override
- public Node leaveADD(final UnaryNode unaryNode) {
- return leaveUnary(unaryNode);
- }
-
- @Override
- public Node leaveBIT_NOT(final UnaryNode unaryNode) {
- return leaveUnary(unaryNode);
- }
-
- @Override
- public Node leaveCONVERT(final UnaryNode unaryNode) {
- assert unaryNode.rhs().tokenType() != TokenType.CONVERT : "convert(convert encountered. check its origin and remove it";
- return unaryNode;
- }
-
- @Override
- public Node leaveDECINC(final UnaryNode unaryNode) {
- return specialize(unaryNode).node;
- }
-
- @Override
- public Node leaveNEW(final UnaryNode unaryNode) {
- assert unaryNode.getSymbol() != null && unaryNode.getSymbol().getSymbolType().isObject();
- return unaryNode.setRHS(((CallNode)unaryNode.rhs()).setIsNew());
- }
-
- @Override
- public Node leaveSUB(final UnaryNode unaryNode) {
- return leaveUnary(unaryNode);
- }
-
- /**
- * Add is a special binary, as it works not only on arithmetic, but for
- * strings etc as well.
- */
- @Override
- public Expression leaveADD(final BinaryNode binaryNode) {
- final Expression lhs = binaryNode.lhs();
- final Expression rhs = binaryNode.rhs();
-
- final Type type = binaryNode.getType();
-
- if (type.isObject()) {
- if (!isAddString(binaryNode)) {
- return new RuntimeNode(binaryNode, Request.ADD);
- }
+ public Node leaveForNode(final ForNode forNode) {
+ if (forNode.isForIn()) {
+ return forNode;
}
- return binaryNode.setLHS(convert(lhs, type)).setRHS(convert(rhs, type));
- }
-
- @Override
- public Node leaveAND(final BinaryNode binaryNode) {
- return binaryNode;
- }
-
- @Override
- public Node leaveASSIGN(final BinaryNode binaryNode) {
- final SpecializedNode specialized = specialize(binaryNode);
- final BinaryNode specBinaryNode = (BinaryNode)specialized.node;
- Type destType = specialized.type;
- if (destType == null) {
- destType = specBinaryNode.getType();
- }
- // Register assignments to this object in case this is used as constructor
- if (binaryNode.lhs() instanceof AccessNode) {
- AccessNode accessNode = (AccessNode) binaryNode.lhs();
-
- if (accessNode.getBase().getSymbol().isThis()) {
- lc.getCurrentFunction().addThisProperty(accessNode.getProperty().getName());
- }
- }
- return specBinaryNode.setRHS(convert(specBinaryNode.rhs(), destType));
- }
-
- @Override
- public Node leaveASSIGN_ADD(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_BIT_AND(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_BIT_OR(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_BIT_XOR(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_DIV(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
+ final Expression init = forNode.getInit();
+ final Expression test = forNode.getTest();
+ final Expression modify = forNode.getModify();
- @Override
- public Node leaveASSIGN_MOD(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_MUL(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_SAR(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_SHL(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- @Override
- public Node leaveASSIGN_SHR(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
+ assert test != null || forNode.hasGoto() : "forNode " + forNode + " needs goto and is missing it in " + lc.getCurrentFunction();
- @Override
- public Node leaveASSIGN_SUB(final BinaryNode binaryNode) {
- return leaveASSIGN(binaryNode);
- }
-
- private boolean symbolIsInteger(final Expression node) {
- final Symbol symbol = node.getSymbol();
- assert symbol != null && symbol.getSymbolType().isInteger() : "int coercion expected: " + Debug.id(symbol) + " " + symbol + " " + lc.getCurrentFunction().getSource();
- return true;
- }
-
- @Override
- public Node leaveBIT_AND(final BinaryNode binaryNode) {
- assert symbolIsInteger(binaryNode);
- return leaveBinary(binaryNode, Type.INT, Type.INT);
- }
-
- @Override
- public Node leaveBIT_OR(final BinaryNode binaryNode) {
- assert symbolIsInteger(binaryNode);
- return leaveBinary(binaryNode, Type.INT, Type.INT);
- }
-
- @Override
- public Node leaveBIT_XOR(final BinaryNode binaryNode) {
- assert symbolIsInteger(binaryNode);
- return leaveBinary(binaryNode, Type.INT, Type.INT);
+ return forNode.
+ setInit(lc, init == null ? null : discard(init)).
+ setModify(lc, modify == null ? null : discard(modify));
}
@Override
public Node leaveCOMMALEFT(final BinaryNode binaryNode) {
assert binaryNode.getSymbol() != null;
- final BinaryNode newBinaryNode = binaryNode.setRHS(discard(binaryNode.rhs()));
- // AccessSpecializer - the type of lhs, which is the remaining value of this node may have changed
- // in that case, update the node type as well
- return propagateType(newBinaryNode, newBinaryNode.lhs().getType());
+ return binaryNode.setRHS(discard(binaryNode.rhs()));
}
@Override
public Node leaveCOMMARIGHT(final BinaryNode binaryNode) {
assert binaryNode.getSymbol() != null;
- final BinaryNode newBinaryNode = binaryNode.setLHS(discard(binaryNode.lhs()));
- // AccessSpecializer - the type of rhs, which is the remaining value of this node may have changed
- // in that case, update the node type as well
- return propagateType(newBinaryNode, newBinaryNode.rhs().getType());
- }
-
- @Override
- public Node leaveDIV(final BinaryNode binaryNode) {
- return leaveBinaryArith(binaryNode);
- }
-
-
- @Override
- public Node leaveEQ(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.EQ);
- }
-
- @Override
- public Node leaveEQ_STRICT(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.EQ_STRICT);
- }
-
- @Override
- public Node leaveGE(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.GE);
- }
-
- @Override
- public Node leaveGT(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.GT);
- }
-
- @Override
- public Node leaveLE(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.LE);
- }
-
- @Override
- public Node leaveLT(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.LT);
- }
-
- @Override
- public Node leaveMOD(final BinaryNode binaryNode) {
- return leaveBinaryArith(binaryNode);
- }
-
- @Override
- public Node leaveMUL(final BinaryNode binaryNode) {
- return leaveBinaryArith(binaryNode);
- }
-
- @Override
- public Node leaveNE(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.NE);
- }
-
- @Override
- public Node leaveNE_STRICT(final BinaryNode binaryNode) {
- return leaveCmp(binaryNode, Request.NE_STRICT);
- }
-
- @Override
- public Node leaveOR(final BinaryNode binaryNode) {
- return binaryNode;
- }
-
- @Override
- public Node leaveSAR(final BinaryNode binaryNode) {
- return leaveBinary(binaryNode, Type.INT, Type.INT);
- }
-
- @Override
- public Node leaveSHL(final BinaryNode binaryNode) {
- return leaveBinary(binaryNode, Type.INT, Type.INT);
- }
-
- @Override
- public Node leaveSHR(final BinaryNode binaryNode) {
- assert binaryNode.getSymbol() != null && binaryNode.getSymbol().getSymbolType().isLong() : "long coercion expected: " + binaryNode.getSymbol();
- return leaveBinary(binaryNode, Type.INT, Type.INT);
- }
-
- @Override
- public Node leaveSUB(final BinaryNode binaryNode) {
- return leaveBinaryArith(binaryNode);
+ return binaryNode.setLHS(discard(binaryNode.lhs()));
}
@Override
@@ -372,38 +105,12 @@
}
@Override
- public Node leaveCatchNode(final CatchNode catchNode) {
- final Expression exceptionCondition = catchNode.getExceptionCondition();
- if (exceptionCondition != null) {
- return catchNode.setExceptionCondition(convert(exceptionCondition, Type.BOOLEAN));
- }
- return catchNode;
- }
-
- @Override
public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
temporarySymbols.reuse();
return expressionStatement.setExpression(discard(expressionStatement.getExpression()));
}
@Override
- public Node leaveForNode(final ForNode forNode) {
- final Expression init = forNode.getInit();
- final Expression test = forNode.getTest();
- final Expression modify = forNode.getModify();
-
- if (forNode.isForIn()) {
- return forNode.setModify(lc, convert(forNode.getModify(), Type.OBJECT)); // NASHORN-400
- }
- assert test != null || forNode.hasGoto() : "forNode " + forNode + " needs goto and is missing it in " + lc.getCurrentFunction();
-
- return forNode.
- setInit(lc, init == null ? null : discard(init)).
- setTest(lc, test == null ? null : convert(test, Type.BOOLEAN)).
- setModify(lc, modify == null ? null : discard(modify));
- }
-
- @Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
if (functionNode.isLazy()) {
return false;
@@ -430,113 +137,6 @@
return functionNode.setState(lc, CompilationState.FINALIZED);
}
- @Override
- public Node leaveIfNode(final IfNode ifNode) {
- return ifNode.setTest(convert(ifNode.getTest(), Type.BOOLEAN));
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public boolean enterLiteralNode(final LiteralNode literalNode) {
- if (literalNode instanceof ArrayLiteralNode) {
- final ArrayLiteralNode arrayLiteralNode = (ArrayLiteralNode)literalNode;
- final Expression[] array = arrayLiteralNode.getValue();
- final Type elementType = arrayLiteralNode.getElementType();
-
- for (int i = 0; i < array.length; i++) {
- final Node element = array[i];
- if (element != null) {
- array[i] = convert((Expression)element.accept(this), elementType);
- }
- }
- }
-
- return false;
- }
-
- @Override
- public Node leaveReturnNode(final ReturnNode returnNode) {
- final Expression expr = returnNode.getExpression();
- if (expr != null) {
- return returnNode.setExpression(convert(expr, lc.getCurrentFunction().getReturnType()));
- }
- return returnNode;
- }
-
- @Override
- public Node leaveRuntimeNode(final RuntimeNode runtimeNode) {
- final List<Expression> args = runtimeNode.getArgs();
- for (final Expression arg : args) {
- assert !arg.getType().isUnknown();
- }
- return runtimeNode;
- }
-
- @Override
- public Node leaveSwitchNode(final SwitchNode switchNode) {
- final boolean allInteger = switchNode.getTag().getSymbolType().isInteger();
-
- if (allInteger) {
- return switchNode;
- }
-
- final Expression expression = switchNode.getExpression();
- final List<CaseNode> cases = switchNode.getCases();
- final List<CaseNode> newCases = new ArrayList<>();
-
- for (final CaseNode caseNode : cases) {
- final Expression test = caseNode.getTest();
- newCases.add(test != null ? caseNode.setTest(convert(test, Type.OBJECT)) : caseNode);
- }
-
- return switchNode.
- setExpression(lc, convert(expression, Type.OBJECT)).
- setCases(lc, newCases);
- }
-
- @Override
- public Node leaveTernaryNode(final TernaryNode ternaryNode) {
- return ternaryNode.setTest(convert(ternaryNode.getTest(), Type.BOOLEAN));
- }
-
- @Override
- public Node leaveThrowNode(final ThrowNode throwNode) {
- return throwNode.setExpression(convert(throwNode.getExpression(), Type.OBJECT));
- }
-
- @Override
- public Node leaveVarNode(final VarNode varNode) {
- final Expression init = varNode.getInit();
- if (init != null) {
- final SpecializedNode specialized = specialize(varNode);
- final VarNode specVarNode = (VarNode)specialized.node;
- Type destType = specialized.type;
- if (destType == null) {
- destType = specVarNode.getName().getType();
- }
- assert specVarNode.getName().hasType() : specVarNode + " doesn't have a type";
- final Expression convertedInit = convert(init, destType);
- temporarySymbols.reuse();
- return specVarNode.setInit(convertedInit);
- }
- temporarySymbols.reuse();
- return varNode;
- }
-
- @Override
- public Node leaveWhileNode(final WhileNode whileNode) {
- final Expression test = whileNode.getTest();
- if (test != null) {
- return whileNode.setTest(lc, convert(test, Type.BOOLEAN));
- }
- return whileNode;
- }
-
- @Override
- public Node leaveWithNode(final WithNode withNode) {
- return withNode.setExpression(lc, convert(withNode.getExpression(), Type.OBJECT));
- }
-
private static void updateSymbolsLog(final FunctionNode functionNode, final Symbol symbol, final boolean loseSlot) {
if (LOG.isEnabled()) {
if (!symbol.isScope()) {
@@ -583,260 +183,6 @@
}
}
- /**
- * Exit a comparison node and do the appropriate replacements. We need to introduce runtime
- * nodes late for comparisons as types aren't known until the last minute
- *
- * Both compares and adds may turn into runtimes node at this level as when we first bump
- * into the op in Attr, we may type it according to what we know there, which may be wrong later
- *
- * e.g. i (int) < 5 -> normal compare
- * i = object
- * then the post pass that would add the conversion to the 5 needs to
- *
- * @param binaryNode binary node to leave
- * @param request runtime request
- * @return lowered cmp node
- */
- @SuppressWarnings("fallthrough")
- private Node leaveCmp(final BinaryNode binaryNode, final RuntimeNode.Request request) {
- final Expression lhs = binaryNode.lhs();
- final Expression rhs = binaryNode.rhs();
-
- Type widest = Type.widest(lhs.getType(), rhs.getType());
-
- boolean newRuntimeNode = false, finalized = false;
- switch (request) {
- case EQ_STRICT:
- case NE_STRICT:
- if (lhs.getType().isBoolean() != rhs.getType().isBoolean()) {
- newRuntimeNode = true;
- widest = Type.OBJECT;
- finalized = true;
- }
- //fallthru
- default:
- if (newRuntimeNode || widest.isObject()) {
- return new RuntimeNode(binaryNode, request).setIsFinal(finalized);
- }
- break;
- }
-
- return binaryNode.setLHS(convert(lhs, widest)).setRHS(convert(rhs, widest));
- }
-
- /**
- * Compute the binary arithmetic type given the lhs and an rhs of a binary expression
- * @param lhsType the lhs type
- * @param rhsType the rhs type
- * @return the correct binary type
- */
- private static Type binaryArithType(final Type lhsType, final Type rhsType) {
- if (!Compiler.shouldUseIntegerArithmetic()) {
- return Type.NUMBER;
- }
- return Type.widest(lhsType, rhsType, Type.NUMBER);
- }
-
- private Node leaveBinaryArith(final BinaryNode binaryNode) {
- final Type type = binaryArithType(binaryNode.lhs().getType(), binaryNode.rhs().getType());
- return leaveBinary(binaryNode, type, type);
- }
-
- private Node leaveBinary(final BinaryNode binaryNode, final Type lhsType, final Type rhsType) {
- Node b = binaryNode.setLHS(convert(binaryNode.lhs(), lhsType)).setRHS(convert(binaryNode.rhs(), rhsType));
- return b;
- }
-
- /**
- * A symbol (and {@link jdk.nashorn.internal.runtime.Property}) can be tagged as "may be primitive".
- * This is used a hint for dual fields that it is even worth it to try representing this
- * field as something other than java.lang.Object.
- *
- * @param node node in which to tag symbols as primitive
- * @param to which primitive type to use for tagging
- */
- private static void setCanBePrimitive(final Node node, final Type to) {
- final HashSet<Node> exclude = new HashSet<>();
-
- node.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
- private void setCanBePrimitive(final Symbol symbol) {
- LOG.info("*** can be primitive symbol ", symbol, " ", Debug.id(symbol));
- symbol.setCanBePrimitive(to);
- }
-
- @Override
- public boolean enterIdentNode(final IdentNode identNode) {
- if (!exclude.contains(identNode)) {
- setCanBePrimitive(identNode.getSymbol());
- }
- return false;
- }
-
- @Override
- public boolean enterAccessNode(final AccessNode accessNode) {
- setCanBePrimitive(accessNode.getProperty().getSymbol());
- return false;
- }
-
- @Override
- public boolean enterIndexNode(final IndexNode indexNode) {
- exclude.add(indexNode.getBase()); //prevent array base node to be flagged as primitive, but k in a[k++] is fine
- return true;
- }
- });
- }
-
- private static class SpecializedNode {
- final Node node;
- final Type type;
-
- SpecializedNode(Node node, Type type) {
- this.node = node;
- this.type = type;
- }
- }
-
- <T extends Expression> SpecializedNode specialize(final Assignment<T> assignment) {
- final Node node = ((Node)assignment);
- final T lhs = assignment.getAssignmentDest();
- final Expression rhs = assignment.getAssignmentSource();
-
- if (!canHaveCallSiteType(lhs)) {
- return new SpecializedNode(node, null);
- }
-
- final Type to;
- if (node.isSelfModifying()) {
- to = node.getWidestOperationType();
- } else {
- to = rhs.getType();
- }
-
- if (!isSupportedCallSiteType(to)) {
- //meaningless to specialize to boolean or object
- return new SpecializedNode(node, null);
- }
-
- final Node newNode = assignment.setAssignmentDest(setTypeOverride(lhs, to));
- final Node typePropagatedNode;
- if(newNode instanceof Expression) {
- typePropagatedNode = propagateType((Expression)newNode, to);
- } else if(newNode instanceof VarNode) {
- // VarNode, being a statement, doesn't have its own symbol; it uses the symbol of its name instead.
- final VarNode varNode = (VarNode)newNode;
- typePropagatedNode = varNode.setName((IdentNode)propagateType(varNode.getName(), to));
- } else {
- throw new AssertionError();
- }
- return new SpecializedNode(typePropagatedNode, to);
- }
-
-
- /**
- * Is this a node that can have its type overridden. This is true for
- * AccessNodes, IndexNodes and IdentNodes
- *
- * @param node the node to check
- * @return true if node can have a callsite type
- */
- private static boolean canHaveCallSiteType(final Node node) {
- return node instanceof TypeOverride && ((TypeOverride<?>)node).canHaveCallSiteType();
- }
-
- /**
- * Is the specialization type supported. Currently we treat booleans as objects
- * and have no special boolean type accessor, thus booleans are ignored.
- * TODO - support booleans? NASHORN-590
- *
- * @param castTo the type to check
- * @return true if call site type is supported
- */
- private static boolean isSupportedCallSiteType(final Type castTo) {
- return castTo.isNumeric(); // don't specializable for boolean
- }
-
- /**
- * Override the type of a node for e.g. access specialization of scope
- * objects. Normally a variable can only get a wider type and narrower type
- * sets are ignored. Not that a variable can still be on object type as
- * per the type analysis, but a specific access may be narrower, e.g. if it
- * is used in an arithmetic op. This overrides a type, regardless of
- * type environment and is used primarily by the access specializer
- *
- * @param node node for which to change type
- * @param to new type
- */
- @SuppressWarnings("unchecked")
- <T extends Expression> T setTypeOverride(final T node, final Type to) {
- final Type from = node.getType();
- if (!node.getType().equals(to)) {
- LOG.info("Changing call override type for '", node, "' from ", node.getType(), " to ", to);
- if (!to.isObject() && from.isObject()) {
- setCanBePrimitive(node, to);
- }
- }
- LOG.info("Type override for lhs in '", node, "' => ", to);
- return ((TypeOverride<T>)node).setType(temporarySymbols, lc, to);
- }
-
- /**
- * Add an explicit conversion. This is needed when attribution has created types
- * that do not mesh into an op type, e.g. a = b, where b is object and a is double
- * at the end of Attr, needs explicit conversion logic.
- *
- * An explicit conversion can be one of the following:
- * + Convert a literal - just replace it with another literal
- * + Convert a scope object - just replace the type of the access, e.g. get()D->get()I
- * + Explicit convert placement, e.g. a = (double)b - all other cases
- *
- * No other part of the world after {@link Attr} may introduce new symbols. This
- * is the only place.
- *
- * @param node node to convert
- * @param to destination type
- * @return conversion node
- */
- private Expression convert(final Expression node, final Type to) {
- assert !to.isUnknown() : "unknown type for " + node + " class=" + node.getClass();
- assert node != null : "node is null";
- assert node.getSymbol() != null : "node " + node + " " + node.getClass() + " has no symbol! " + lc.getCurrentFunction();
- assert node.tokenType() != TokenType.CONVERT : "assert convert in convert " + node + " in " + lc.getCurrentFunction();
-
- final Type from = node.getType();
-
- if (Type.areEquivalent(from, to)) {
- return node;
- }
-
- if (from.isObject() && to.isObject()) {
- return node;
- }
-
- Expression resultNode = node;
-
- if (node instanceof LiteralNode && !(node instanceof ArrayLiteralNode) && !to.isObject()) {
- final LiteralNode<?> newNode = new LiteralNodeConstantEvaluator((LiteralNode<?>)node, to).eval();
- if (newNode != null) {
- resultNode = newNode;
- }
- } else {
- if (canHaveCallSiteType(node) && isSupportedCallSiteType(to)) {
- assert node instanceof TypeOverride;
- return setTypeOverride(node, to);
- }
- resultNode = new UnaryNode(Token.recast(node.getToken(), TokenType.CONVERT), node);
- }
-
- LOG.info("CONVERT('", node, "', ", to, ") => '", resultNode, "'");
-
- assert !node.isTerminal();
-
- //This is the only place in this file that can create new temporaries
- //FinalizeTypes may not introduce ANY node that is not a conversion.
- return temporarySymbols.ensureSymbol(lc, to, resultNode);
- }
-
private static Expression discard(final Expression node) {
if (node.getSymbol() != null) {
final UnaryNode discard = new UnaryNode(Token.recast(node.getToken(), TokenType.DISCARD), node);
@@ -849,82 +195,5 @@
return node;
}
- /**
- * Whenever an expression like an addition or an assignment changes type, it
- * may be that case that {@link Attr} created a symbol for an intermediate
- * result of the expression, say for an addition. This also has to be updated
- * if the expression type changes.
- *
- * Assignments use their lhs as node symbol, and in this case we can't modify
- * it. Then {@link CodeGenerator.Store} needs to do an explicit conversion.
- * This is happens very rarely.
- *
- * @param node
- * @param to
- */
- private Expression propagateType(final Expression node, final Type to) {
- Symbol symbol = node.getSymbol();
- if (symbol.isTemp() && symbol.getSymbolType() != to) {
- symbol = symbol.setTypeOverrideShared(to, temporarySymbols);
- LOG.info("Type override for temporary in '", node, "' => ", to);
- }
- return node.setSymbol(lc, symbol);
- }
- /**
- * Determine if the outcome of + operator is a string.
- *
- * @param node Node to test.
- * @return true if a string result.
- */
- private boolean isAddString(final Node node) {
- if (node instanceof BinaryNode && node.isTokenType(TokenType.ADD)) {
- final BinaryNode binaryNode = (BinaryNode)node;
- final Node lhs = binaryNode.lhs();
- final Node rhs = binaryNode.rhs();
-
- return isAddString(lhs) || isAddString(rhs);
- }
-
- return node instanceof LiteralNode<?> && ((LiteralNode<?>)node).isString();
- }
-
- /**
- * Whenever an explicit conversion is needed and the convertee is a literal, we can
- * just change the literal
- */
- class LiteralNodeConstantEvaluator extends FoldConstants.ConstantEvaluator<LiteralNode<?>> {
- private final Type type;
-
- LiteralNodeConstantEvaluator(final LiteralNode<?> parent, final Type type) {
- super(parent);
- this.type = type;
- }
-
- @Override
- protected LiteralNode<?> eval() {
- final Object value = ((LiteralNode<?>)parent).getValue();
-
- LiteralNode<?> literalNode = null;
-
- if (type.isString()) {
- literalNode = LiteralNode.newInstance(token, finish, JSType.toString(value));
- } else if (type.isBoolean()) {
- literalNode = LiteralNode.newInstance(token, finish, JSType.toBoolean(value));
- } else if (type.isInteger()) {
- literalNode = LiteralNode.newInstance(token, finish, JSType.toInt32(value));
- } else if (type.isLong()) {
- literalNode = LiteralNode.newInstance(token, finish, JSType.toLong(value));
- } else if (type.isNumber() || parent.getType().isNumeric() && !parent.getType().isNumber()) {
- literalNode = LiteralNode.newInstance(token, finish, JSType.toNumber(value));
- }
-
- if (literalNode != null) {
- //inherit literal symbol for attr.
- literalNode = (LiteralNode<?>)literalNode.setSymbol(lc, parent.getSymbol());
- }
-
- return literalNode;
- }
- }
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FoldConstants.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,8 @@
package jdk.nashorn.internal.codegen;
+import java.util.ArrayList;
+import java.util.List;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.BinaryNode;
import jdk.nashorn.internal.ir.Block;
@@ -37,8 +39,10 @@
import jdk.nashorn.internal.ir.LiteralNode;
import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
import jdk.nashorn.internal.ir.Node;
+import jdk.nashorn.internal.ir.Statement;
import jdk.nashorn.internal.ir.TernaryNode;
import jdk.nashorn.internal.ir.UnaryNode;
+import jdk.nashorn.internal.ir.VarNode;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.runtime.DebugLogger;
import jdk.nashorn.internal.runtime.JSType;
@@ -89,11 +93,21 @@
public Node leaveIfNode(final IfNode ifNode) {
final Node test = ifNode.getTest();
if (test instanceof LiteralNode.PrimitiveLiteralNode) {
- final Block shortCut = ((LiteralNode.PrimitiveLiteralNode<?>)test).isTrue() ? ifNode.getPass() : ifNode.getFail();
- if (shortCut != null) {
- return new BlockStatement(ifNode.getLineNumber(), shortCut);
+ final boolean isTrue = ((LiteralNode.PrimitiveLiteralNode<?>)test).isTrue();
+ final Block executed = isTrue ? ifNode.getPass() : ifNode.getFail();
+ final Block dropped = isTrue ? ifNode.getFail() : ifNode.getPass();
+ final List<Statement> statements = new ArrayList<>();
+
+ if (executed != null) {
+ statements.addAll(executed.getStatements()); // Get statements form executed branch
}
- return new EmptyNode(ifNode);
+ if (dropped != null) {
+ extractVarNodes(dropped, statements); // Get var-nodes from non-executed branch
+ }
+ if (statements.isEmpty()) {
+ return new EmptyNode(ifNode);
+ }
+ return BlockStatement.createReplacement(ifNode, ifNode.getFinish(), statements);
}
return ifNode;
}
@@ -131,6 +145,17 @@
protected abstract LiteralNode<?> eval();
}
+ private static void extractVarNodes(final Block block, final List<Statement> statements) {
+ final LexicalContext lc = new LexicalContext();
+ block.accept(lc, new NodeVisitor<LexicalContext>(lc) {
+ @Override
+ public boolean enterVarNode(VarNode varNode) {
+ statements.add(varNode.setInit(null));
+ return false;
+ }
+ });
+ }
+
private static class UnaryNodeConstantEvaluator extends ConstantEvaluator<UnaryNode> {
UnaryNodeConstantEvaluator(final UnaryNode parent) {
super(parent);
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java Mon Oct 28 12:28:57 2013 -0700
@@ -68,6 +68,7 @@
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.parser.Token;
import jdk.nashorn.internal.parser.TokenType;
+import jdk.nashorn.internal.runtime.CodeInstaller;
import jdk.nashorn.internal.runtime.DebugLogger;
import jdk.nashorn.internal.runtime.ScriptRuntime;
import jdk.nashorn.internal.runtime.Source;
@@ -86,10 +87,13 @@
private static final DebugLogger LOG = new DebugLogger("lower");
+ // needed only to get unique eval id
+ private final CodeInstaller installer;
+
/**
* Constructor.
*/
- Lower() {
+ Lower(final CodeInstaller installer) {
super(new BlockLexicalContext() {
@Override
@@ -132,6 +136,7 @@
return block.setIsTerminal(this, false);
}
});
+ this.installer = installer;
}
@Override
@@ -529,11 +534,17 @@
*/
private String evalLocation(final IdentNode node) {
final Source source = lc.getCurrentFunction().getSource();
+ final int pos = node.position();
+ // Code installer is null when running with --compile-only, use 0 as id in that case
+ final long id = installer == null ? 0 : installer.getUniqueEvalId();
return new StringBuilder().
append(source.getName()).
append('#').
- append(source.getLine(node.position())).
- append("<eval>").
+ append(source.getLine(pos)).
+ append(':').
+ append(source.getColumn(pos)).
+ append("<eval>@").
+ append(id).
toString();
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java Mon Oct 28 12:28:57 2013 -0700
@@ -69,7 +69,6 @@
import java.lang.reflect.Array;
import java.util.EnumSet;
import java.util.List;
-
import jdk.internal.dynalink.support.NameCodec;
import jdk.internal.org.objectweb.asm.Handle;
import jdk.internal.org.objectweb.asm.MethodVisitor;
@@ -1560,7 +1559,7 @@
MethodEmitter convert(final Type to) {
final Type type = peekType().convert(method, to);
if (type != null) {
- if (peekType() != to) {
+ if (!peekType().isEquivalentTo(to)) {
debug("convert", peekType(), "->", to);
}
popType();
@@ -1790,15 +1789,14 @@
* @param name name of property
* @param flags call site flags
*/
- void dynamicSet(final Type valueType, final String name, final int flags) {
+ void dynamicSet(final String name, final int flags) {
debug("dynamic_set", name, peekType());
- Type type = valueType;
+ Type type = peekType();
if (type.isObject() || type.isBoolean()) { //promote strings to objects etc
type = Type.OBJECT;
convert(Type.OBJECT); //TODO bad- until we specialize boolean setters,
}
-
popType(type);
popType(Type.SCOPE);
--- a/nashorn/src/jdk/nashorn/internal/codegen/Namespace.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Namespace.java Mon Oct 28 12:28:57 2013 -0700
@@ -81,7 +81,7 @@
final int count = counter + 1;
namespaceDirectory.put(base, count);
- return base + "$" + count;
+ return base + '-' + count;
}
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java Mon Oct 28 12:28:57 2013 -0700
@@ -297,11 +297,6 @@
}
@Override
- public Node leaveCONVERT(final UnaryNode unaryNode) {
- return unaryNodeWeight(unaryNode);
- }
-
- @Override
public Node leaveDECINC(final UnaryNode unaryNode) {
return unaryNodeWeight(unaryNode);
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/BooleanType.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/BooleanType.java Mon Oct 28 12:28:57 2013 -0700
@@ -136,8 +136,7 @@
invokeStatic(method, JSType.TO_LONG);
} else if (to.isString()) {
invokeStatic(method, VALUE_OF);
- invokeStatic(method, JSType.TO_PRIMITIVE);
- invokeStatic(method, JSType.TO_STRING);
+ invokeStatic(method, JSType.TO_PRIMITIVE_TO_STRING);
} else if (to.isObject()) {
invokeStatic(method, VALUE_OF);
} else {
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/ObjectType.java Mon Oct 28 12:28:57 2013 -0700
@@ -153,8 +153,7 @@
} else if (to.isBoolean()) {
invokeStatic(method, JSType.TO_BOOLEAN);
} else if (to.isString()) {
- invokeStatic(method, JSType.TO_PRIMITIVE);
- invokeStatic(method, JSType.TO_STRING);
+ invokeStatic(method, JSType.TO_PRIMITIVE_TO_STRING);
} else {
assert false : "Illegal conversion " + this + " -> " + to + " " + isString() + " " + toString;
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/codegen/types/Type.java Mon Oct 28 12:28:57 2013 -0700
@@ -441,7 +441,12 @@
if (type0.isArray() && type1.isArray()) {
return ((ArrayType)type0).getElementType() == ((ArrayType)type1).getElementType() ? type0 : Type.OBJECT;
} else if (type0.isArray() != type1.isArray()) {
- return Type.OBJECT; //array and non array is always object, widest(Object[], int) NEVER returns Object[], which has most weight. that does not make sense
+ //array and non array is always object, widest(Object[], int) NEVER returns Object[], which has most weight. that does not make sense
+ return Type.OBJECT;
+ } else if (type0.isObject() && type1.isObject() && ((ObjectType)type0).getTypeClass() != ((ObjectType)type1).getTypeClass()) {
+ // Object<type=String> and Object<type=ScriptFunction> will produce Object
+ // TODO: maybe find most specific common superclass?
+ return Type.OBJECT;
}
return type0.weight() > type1.weight() ? type0 : type1;
}
--- a/nashorn/src/jdk/nashorn/internal/ir/AccessNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/AccessNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,6 @@
package jdk.nashorn.internal.ir;
-import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.annotations.Immutable;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -46,12 +45,12 @@
* @param property property
*/
public AccessNode(final long token, final int finish, final Expression base, final IdentNode property) {
- super(token, finish, base, false, false);
+ super(token, finish, base, false);
this.property = property.setIsPropertyName();
}
- private AccessNode(final AccessNode accessNode, final Expression base, final IdentNode property, final boolean isFunction, final boolean hasCallSiteType) {
- super(accessNode, base, isFunction, hasCallSiteType);
+ private AccessNode(final AccessNode accessNode, final Expression base, final IdentNode property, final boolean isFunction) {
+ super(accessNode, base, isFunction);
this.property = property;
}
@@ -73,13 +72,6 @@
public void toString(final StringBuilder sb) {
final boolean needsParen = tokenType().needsParens(getBase().tokenType(), true);
- if (hasCallSiteType()) {
- sb.append('{');
- final String desc = getType().getDescriptor();
- sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
- sb.append('}');
- }
-
if (needsParen) {
sb.append('(');
}
@@ -107,21 +99,14 @@
if (this.base == base) {
return this;
}
- return new AccessNode(this, base, property, isFunction(), hasCallSiteType());
+ return new AccessNode(this, base, property, isFunction());
}
private AccessNode setProperty(final IdentNode property) {
if (this.property == property) {
return this;
}
- return new AccessNode(this, base, property, isFunction(), hasCallSiteType());
- }
-
- @Override
- public AccessNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
- logTypeChange(type);
- final AccessNode newAccessNode = (AccessNode)setSymbol(lc, getSymbol().setTypeOverrideShared(type, ts));
- return new AccessNode(newAccessNode, base, property.setType(ts, lc, type), isFunction(), hasCallSiteType());
+ return new AccessNode(this, base, property, isFunction());
}
@Override
@@ -129,7 +114,7 @@
if (isFunction()) {
return this;
}
- return new AccessNode(this, base, property, true, hasCallSiteType());
+ return new AccessNode(this, base, property, true);
}
}
--- a/nashorn/src/jdk/nashorn/internal/ir/BaseNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/BaseNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,10 +25,6 @@
package jdk.nashorn.internal.ir;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.DEBUG_FIELDS;
-
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
-import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.annotations.Immutable;
/**
@@ -38,15 +34,13 @@
* @see IndexNode
*/
@Immutable
-public abstract class BaseNode extends Expression implements FunctionCall, TypeOverride<BaseNode> {
+public abstract class BaseNode extends Expression implements FunctionCall {
/** Base Node. */
protected final Expression base;
private final boolean isFunction;
- private final boolean hasCallSiteType;
-
/**
* Constructor
*
@@ -54,13 +48,11 @@
* @param finish finish
* @param base base node
* @param isFunction is this a function
- * @param hasCallSiteType does this access have a callsite type
*/
- public BaseNode(final long token, final int finish, final Expression base, final boolean isFunction, final boolean hasCallSiteType) {
+ public BaseNode(final long token, final int finish, final Expression base, final boolean isFunction) {
super(token, base.getStart(), finish);
this.base = base;
this.isFunction = isFunction;
- this.hasCallSiteType = hasCallSiteType;
}
/**
@@ -68,13 +60,11 @@
* @param baseNode node to inherit from
* @param base base
* @param isFunction is this a function
- * @param hasCallSiteType does this access have a callsite type
*/
- protected BaseNode(final BaseNode baseNode, final Expression base, final boolean isFunction, final boolean hasCallSiteType) {
+ protected BaseNode(final BaseNode baseNode, final Expression base, final boolean isFunction) {
super(baseNode);
this.base = base;
this.isFunction = isFunction;
- this.hasCallSiteType = hasCallSiteType;
}
/**
@@ -96,26 +86,4 @@
*/
public abstract BaseNode setIsFunction();
- @Override
- public boolean canHaveCallSiteType() {
- return true; //carried by the symbol and always the same nodetype==symboltype
- }
-
- /**
- * Does the access have a call site type override?
- * @return true if overridden
- */
- protected boolean hasCallSiteType() {
- return hasCallSiteType;
- }
-
- /**
- * Debug type change
- * @param type new type
- */
- protected final void logTypeChange(final Type type) {
- if (DEBUG_FIELDS && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
- ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
- }
- }
}
--- a/nashorn/src/jdk/nashorn/internal/ir/CallNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/CallNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -36,9 +36,7 @@
* IR representation for a function call.
*/
@Immutable
-public final class CallNode extends LexicalContextExpression implements TypeOverride<CallNode> {
-
- private final Type type;
+public final class CallNode extends LexicalContextExpression {
/** Function identifier or function body. */
private final Expression function;
@@ -150,18 +148,16 @@
this.function = function;
this.args = args;
this.flags = 0;
- this.type = null;
this.evalArgs = null;
this.lineNumber = lineNumber;
}
- private CallNode(final CallNode callNode, final Expression function, final List<Expression> args, final int flags, final Type type, final EvalArgs evalArgs) {
+ private CallNode(final CallNode callNode, final Expression function, final List<Expression> args, final int flags, final EvalArgs evalArgs) {
super(callNode);
this.lineNumber = callNode.lineNumber;
this.function = function;
this.args = args;
this.flags = flags;
- this.type = type;
this.evalArgs = evalArgs;
}
@@ -175,29 +171,9 @@
@Override
public Type getType() {
- if (hasCallSiteType()) {
- return type;
- }
return function instanceof FunctionNode ? ((FunctionNode)function).getReturnType() : Type.OBJECT;
}
- @Override
- public CallNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
- if (this.type == type) {
- return this;
- }
- return new CallNode(this, function, args, flags, type, evalArgs);
- }
-
- private boolean hasCallSiteType() {
- return this.type != null;
- }
-
- @Override
- public boolean canHaveCallSiteType() {
- return true;
- }
-
/**
* Assist in IR navigation.
*
@@ -212,7 +188,6 @@
setFunction((Expression)function.accept(visitor)).
setArgs(Node.accept(visitor, Expression.class, args)).
setFlags(flags).
- setType(null, lc, type).
setEvalArgs(evalArgs == null ?
null :
evalArgs.setCode((Expression)evalArgs.getCode().accept(visitor)).
@@ -229,13 +204,6 @@
@Override
public void toString(final StringBuilder sb) {
- if (hasCallSiteType()) {
- sb.append('{');
- final String desc = getType().getDescriptor();
- sb.append(desc.charAt(desc.length() - 1) == ';' ? 'O' : getType().getDescriptor());
- sb.append('}');
- }
-
function.toString(sb);
sb.append('(');
@@ -271,7 +239,7 @@
if (this.args == args) {
return this;
}
- return new CallNode(this, function, args, flags, type, evalArgs);
+ return new CallNode(this, function, args, flags, evalArgs);
}
/**
@@ -293,7 +261,7 @@
if (this.evalArgs == evalArgs) {
return this;
}
- return new CallNode(this, function, args, flags, type, evalArgs);
+ return new CallNode(this, function, args, flags, evalArgs);
}
/**
@@ -321,7 +289,7 @@
if (this.function == function) {
return this;
}
- return new CallNode(this, function, args, flags, type, evalArgs);
+ return new CallNode(this, function, args, flags, evalArgs);
}
/**
@@ -344,6 +312,6 @@
if (this.flags == flags) {
return this;
}
- return new CallNode(this, function, args, flags, type, evalArgs);
+ return new CallNode(this, function, args, flags, evalArgs);
}
}
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,9 +28,7 @@
import static jdk.nashorn.internal.codegen.CompilerConstants.__DIR__;
import static jdk.nashorn.internal.codegen.CompilerConstants.__FILE__;
import static jdk.nashorn.internal.codegen.CompilerConstants.__LINE__;
-import static jdk.nashorn.internal.codegen.ObjectClassGenerator.DEBUG_FIELDS;
-import jdk.nashorn.internal.codegen.ObjectClassGenerator;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.annotations.Immutable;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -39,7 +37,7 @@
* IR representation for an identifier.
*/
@Immutable
-public final class IdentNode extends Expression implements PropertyKey, TypeOverride<IdentNode>, FunctionCall {
+public final class IdentNode extends Expression implements PropertyKey, FunctionCall {
private static final int PROPERTY_NAME = 1 << 0;
private static final int INITIALIZED_HERE = 1 << 1;
private static final int FUNCTION = 1 << 2;
@@ -101,19 +99,6 @@
return callSiteType != null;
}
- @Override
- public IdentNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
- // do NOT, repeat NOT touch the symbol here. it might be a local variable or whatever. This is the override if it isn't
- if (this.callSiteType == type) {
- return this;
- }
- if (DEBUG_FIELDS && getSymbol() != null && !Type.areEquivalent(getSymbol().getSymbolType(), type)) {
- ObjectClassGenerator.LOG.info(getClass().getName(), " ", this, " => ", type, " instead of ", getType());
- }
-
- return new IdentNode(this, name, type, flags);
- }
-
/**
* Assist in IR navigation.
*
@@ -154,31 +139,6 @@
}
/**
- * We can only override type if the symbol lives in the scope, as otherwise
- * it is strongly determined by the local variable already allocated.
- *
- * <p>We also return true if the symbol represents the return value of a function with a
- * non-generic return type as in this case we need to propagate the type instead of
- * converting to object, for example if the symbol is used as the left hand side of an
- * assignment such as in the code below.</p>
- *
- * <pre>
- * try {
- * return 2;
- * } finally {
- * return 3;
- * }
- * }
- * </pre>
- *
- * @return true if can have callsite type
- */
- @Override
- public boolean canHaveCallSiteType() {
- return getSymbol() != null && (getSymbol().isScope() || getSymbol().isNonGenericReturn());
- }
-
- /**
* Check if this IdentNode is a property name
* @return true if this is a property name
*/
--- a/nashorn/src/jdk/nashorn/internal/ir/IndexNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/IndexNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,7 +25,6 @@
package jdk.nashorn.internal.ir;
-import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.annotations.Immutable;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -46,12 +45,12 @@
* @param index index for access
*/
public IndexNode(final long token, final int finish, final Expression base, final Expression index) {
- super(token, finish, base, false, false);
+ super(token, finish, base, false);
this.index = index;
}
- private IndexNode(final IndexNode indexNode, final Expression base, final Expression index, final boolean isFunction, final boolean hasCallSiteType) {
- super(indexNode, base, isFunction, hasCallSiteType);
+ private IndexNode(final IndexNode indexNode, final Expression base, final Expression index, final boolean isFunction) {
+ super(indexNode, base, isFunction);
this.index = index;
}
@@ -69,13 +68,6 @@
public void toString(final StringBuilder sb) {
final boolean needsParen = tokenType().needsParens(base.tokenType(), true);
- if (hasCallSiteType()) {
- sb.append('{');
- final String desc = getType().getDescriptor();
- sb.append(desc.charAt(desc.length() - 1) == ';' ? "O" : getType().getDescriptor());
- sb.append('}');
- }
-
if (needsParen) {
sb.append('(');
}
@@ -103,7 +95,7 @@
if (this.base == base) {
return this;
}
- return new IndexNode(this, base, index, isFunction(), hasCallSiteType());
+ return new IndexNode(this, base, index, isFunction());
}
/**
@@ -115,7 +107,7 @@
if(this.index == index) {
return this;
}
- return new IndexNode(this, base, index, isFunction(), hasCallSiteType());
+ return new IndexNode(this, base, index, isFunction());
}
@Override
@@ -123,14 +115,7 @@
if (isFunction()) {
return this;
}
- return new IndexNode(this, base, index, true, hasCallSiteType());
- }
-
- @Override
- public IndexNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
- logTypeChange(type);
- final IndexNode newIndexNode = (IndexNode)setSymbol(lc, getSymbol().setTypeOverrideShared(type, ts));
- return new IndexNode(newIndexNode, base, index, isFunction(), true);
+ return new IndexNode(this, base, index, true);
}
}
--- a/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/LiteralNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -28,10 +28,13 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+
import jdk.nashorn.internal.codegen.CompileUnit;
+import jdk.nashorn.internal.codegen.types.ArrayType;
import jdk.nashorn.internal.codegen.types.Type;
import jdk.nashorn.internal.ir.annotations.Immutable;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+import jdk.nashorn.internal.objects.NativeArray;
import jdk.nashorn.internal.parser.Lexer.LexerToken;
import jdk.nashorn.internal.parser.Token;
import jdk.nashorn.internal.parser.TokenType;
@@ -526,12 +529,6 @@
return object;
} else if (object instanceof LiteralNode) {
return objectAsConstant(((LiteralNode<?>)object).getValue());
- } else if (object instanceof UnaryNode) {
- final UnaryNode unaryNode = (UnaryNode)object;
-
- if (unaryNode.isTokenType(TokenType.CONVERT) && unaryNode.getType().isObject()) {
- return objectAsConstant(unaryNode.rhs());
- }
}
return POSTSET_MARKER;
@@ -782,8 +779,11 @@
return value;
}
- @Override
- public Type getType() {
+ /**
+ * Get the array element type as Java format, e.g. [I
+ * @return array element type
+ */
+ public ArrayType getArrayType() {
if (elementType.isInteger()) {
return Type.INT_ARRAY;
} else if (elementType.isLong()) {
@@ -795,6 +795,11 @@
}
}
+ @Override
+ public Type getType() {
+ return Type.typeFor(NativeArray.class);
+ }
+
/**
* Get the element type of this array literal
* @return element type
--- a/nashorn/src/jdk/nashorn/internal/ir/RuntimeNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/RuntimeNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,7 +38,7 @@
* IR representation for a runtime call.
*/
@Immutable
-public class RuntimeNode extends Expression implements TypeOverride<RuntimeNode> {
+public class RuntimeNode extends Expression {
/**
* Request enum used for meta-information about the runtime request
@@ -159,6 +159,36 @@
}
/**
+ * Derive a runtime node request type for a node
+ * @param node the node
+ * @return request type
+ */
+ public static Request requestFor(final Node node) {
+ assert node.isComparison();
+ switch (node.tokenType()) {
+ case EQ_STRICT:
+ return Request.EQ_STRICT;
+ case NE_STRICT:
+ return Request.NE_STRICT;
+ case EQ:
+ return Request.EQ;
+ case NE:
+ return Request.NE;
+ case LT:
+ return Request.LT;
+ case LE:
+ return Request.LE;
+ case GT:
+ return Request.GT;
+ case GE:
+ return Request.GE;
+ default:
+ assert false;
+ return null;
+ }
+ }
+
+ /**
* Is this an EQ or EQ_STRICT?
*
* @param request a request
@@ -268,9 +298,6 @@
/** Call arguments. */
private final List<Expression> args;
- /** Call site override - e.g. we know that a ScriptRuntime.ADD will return an int */
- private final Type callSiteType;
-
/** is final - i.e. may not be removed again, lower in the code pipeline */
private final boolean isFinal;
@@ -287,16 +314,14 @@
this.request = request;
this.args = args;
- this.callSiteType = null;
this.isFinal = false;
}
- private RuntimeNode(final RuntimeNode runtimeNode, final Request request, final Type callSiteType, final boolean isFinal, final List<Expression> args) {
+ private RuntimeNode(final RuntimeNode runtimeNode, final Request request, final boolean isFinal, final List<Expression> args) {
super(runtimeNode);
this.request = request;
this.args = args;
- this.callSiteType = callSiteType;
this.isFinal = isFinal;
}
@@ -335,7 +360,6 @@
this.request = request;
this.args = args;
- this.callSiteType = null;
this.isFinal = false;
}
@@ -376,7 +400,7 @@
if (this.isFinal == isFinal) {
return this;
}
- return new RuntimeNode(this, request, callSiteType, isFinal, args);
+ return new RuntimeNode(this, request, isFinal, args);
}
/**
@@ -384,24 +408,7 @@
*/
@Override
public Type getType() {
- return hasCallSiteType() ? callSiteType : request.getReturnType();
- }
-
- @Override
- public RuntimeNode setType(final TemporarySymbols ts, final LexicalContext lc, final Type type) {
- if (this.callSiteType == type) {
- return this;
- }
- return new RuntimeNode(this, request, type, isFinal, args);
- }
-
- @Override
- public boolean canHaveCallSiteType() {
- return request == Request.ADD;
- }
-
- private boolean hasCallSiteType() {
- return callSiteType != null;
+ return request.getReturnType();
}
@Override
@@ -450,7 +457,7 @@
if (this.args == args) {
return this;
}
- return new RuntimeNode(this, request, callSiteType, isFinal, args);
+ return new RuntimeNode(this, request, isFinal, args);
}
/**
--- a/nashorn/src/jdk/nashorn/internal/ir/TypeOverride.java Mon Oct 28 10:52:07 2013 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.ir;
-
-import jdk.nashorn.internal.codegen.types.Type;
-
-/**
- * A type override makes it possible to change the return type of a node, if we know
- * that the linker can provide it directly. For example, an identity node that is
- * in the scope, can very well look like an object to the compiler of the method it
- * is in, but if someone does (int)x, it make senses to ask for it directly
- * with an int getter instead of loading it as an object and explicitly converting it
- * by using JSType.toInt32. Especially in scenarios where the field is already stored
- * as a primitive, this will be much faster than the "object is all I see" scope
- * available in the method
- * @param <T> the type of the node implementing the interface
- */
-
-public interface TypeOverride<T extends Node> {
- /**
- * Set the override type
- *
- * @param ts temporary symbols
- * @param lc the current lexical context
- * @param type the type
- * @return a node equivalent to this one except for the requested change.
- */
- public T setType(final TemporarySymbols ts, final LexicalContext lc, final Type type);
-
- /**
- * Returns true if this node can have a callsite override, e.g. all scope ident nodes
- * which lead to dynamic getters can have it, local variable nodes (slots) can't.
- * Call nodes can have it unconditionally and so on
- *
- * @return true if it is possible to assign a type override to this node
- */
- public boolean canHaveCallSiteType();
-
-}
--- a/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/UnaryNode.java Mon Oct 28 12:28:57 2013 -0700
@@ -26,7 +26,6 @@
package jdk.nashorn.internal.ir;
import static jdk.nashorn.internal.parser.TokenType.BIT_NOT;
-import static jdk.nashorn.internal.parser.TokenType.CONVERT;
import static jdk.nashorn.internal.parser.TokenType.DECPOSTFIX;
import static jdk.nashorn.internal.parser.TokenType.INCPOSTFIX;
@@ -150,19 +149,10 @@
final TokenType type = tokenType();
final String name = type.getName();
final boolean isPostfix = type == DECPOSTFIX || type == INCPOSTFIX;
- final boolean isConvert = type == CONVERT && getSymbol() != null;
boolean rhsParen = type.needsParens(rhs().tokenType(), false);
- int convertPos = 0;
- if (isConvert) {
- convertPos = sb.length();
- sb.append("(");
- sb.append(getType());
- sb.append(")(");
- }
-
- if (!isPostfix && !isConvert) {
+ if (!isPostfix) {
if (name == null) {
sb.append(type.name());
rhsParen = true;
@@ -186,16 +176,6 @@
if (isPostfix) {
sb.append(type == DECPOSTFIX ? "--" : "++");
}
-
- if (isConvert) {
- // strip extra cast parenthesis which makes the printout harder to read
- final boolean endsWithParenthesis = sb.charAt(sb.length() - 1) == ')';
- if (!endsWithParenthesis) {
- sb.append(')');
- } else {
- sb.setCharAt(convertPos, ' ');
- }
- }
}
/**
--- a/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java Mon Oct 28 12:28:57 2013 -0700
@@ -51,8 +51,6 @@
return enterADD(unaryNode);
case BIT_NOT:
return enterBIT_NOT(unaryNode);
- case CONVERT:
- return enterCONVERT(unaryNode);
case DELETE:
return enterDELETE(unaryNode);
case DISCARD:
@@ -84,8 +82,6 @@
return leaveADD(unaryNode);
case BIT_NOT:
return leaveBIT_NOT(unaryNode);
- case CONVERT:
- return leaveCONVERT(unaryNode);
case DELETE:
return leaveDELETE(unaryNode);
case DISCARD:
@@ -323,26 +319,6 @@
}
/**
- * Unary enter - callback for entering a conversion
- *
- * @param unaryNode the node
- * @return true if traversal should continue and node children be traversed, false otherwise
- */
- public boolean enterCONVERT(final UnaryNode unaryNode) {
- return enterDefault(unaryNode);
- }
-
- /**
- * Unary leave - callback for leaving a conversion
- *
- * @param unaryNode the node
- * @return processed node, which will replace the original one, or the original node
- */
- public Node leaveCONVERT(final UnaryNode unaryNode) {
- return leaveDefault(unaryNode);
- }
-
- /**
* Unary enter - callback for entering a ++ or -- operator
*
* @param unaryNode the node
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java Mon Oct 28 12:28:57 2013 -0700
@@ -491,8 +491,8 @@
// GlobalObject interface implementation
@Override
- public boolean isOfContext(final Context context) {
- return this.context == context;
+ public boolean isOfContext(final Context ctxt) {
+ return this.context == ctxt;
}
@Override
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java Mon Oct 28 12:28:57 2013 -0700
@@ -851,6 +851,10 @@
@Function(attributes = Attribute.NOT_ENUMERABLE)
public static Object slice(final Object self, final Object start, final Object end) {
final Object obj = Global.toObject(self);
+ if (!(obj instanceof ScriptObject)) {
+ return ScriptRuntime.UNDEFINED;
+ }
+
final ScriptObject sobj = (ScriptObject)obj;
final long len = JSType.toUint32(sobj.getLength());
final long relativeStart = JSType.toLong(start);
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeError.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeError.java Mon Oct 28 12:28:57 2013 -0700
@@ -30,6 +30,7 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
+
import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.internal.objects.annotations.Attribute;
import jdk.nashorn.internal.objects.annotations.Constructor;
@@ -135,11 +136,12 @@
* @param errorObj the error object
* @return undefined
*/
+ @SuppressWarnings("unused")
@Function(attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object captureStackTrace(final Object self, final Object errorObj) {
Global.checkObject(errorObj);
final ScriptObject sobj = (ScriptObject)errorObj;
- final ECMAException exp = new ECMAException(sobj, null);
+ new ECMAException(sobj, null); //constructor has side effects
sobj.delete("stack", false);
final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", GET_STACK);
final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", SET_STACK);
--- a/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.internal.objects;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
import java.lang.invoke.MethodHandle;
@@ -255,6 +256,12 @@
return makeFunction(name, methodHandle, null);
}
+ @Override
+ public ScriptFunction makeSynchronizedFunction(final Object sync) {
+ final MethodHandle mh = MH.insertArguments(ScriptFunction.INVOKE_SYNC, 0, this, sync);
+ return makeFunction(getName(), mh);
+ }
+
/**
* Same as {@link ScriptFunction#makeBoundFunction(Object, Object[])}. The only reason we override it is so that we
* can expose it to methods in this package.
--- a/nashorn/src/jdk/nashorn/internal/parser/Parser.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/Parser.java Mon Oct 28 12:28:57 2013 -0700
@@ -2107,13 +2107,13 @@
final String ident = (String)expectValue(IDENT);
if (type != COLON) {
- final long getSetToken = token;
+ final long getSetToken = propertyToken;
switch (ident) {
case "get":
final PropertyKey getIdent = propertyName();
final String getterName = getIdent.getPropertyName();
- final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, "get " + NameCodec.encode(getterName));
+ final IdentNode getNameNode = new IdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName));
expect(LPAREN);
expect(RPAREN);
functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER);
@@ -2122,7 +2122,7 @@
case "set":
final PropertyKey setIdent = propertyName();
final String setterName = setIdent.getPropertyName();
- final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, "set " + NameCodec.encode(setterName));
+ final IdentNode setNameNode = new IdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName));
expect(LPAREN);
final IdentNode argIdent = getIdent();
verifyStrictIdent(argIdent, "setter argument");
--- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java Mon Oct 28 12:28:57 2013 -0700
@@ -178,7 +178,6 @@
ARRAY (LITERAL, null),
COMMALEFT (IR, null),
- CONVERT (IR, null),
DISCARD (IR, null),
DECPOSTFIX (IR, null),
INCPOSTFIX (IR, null);
--- a/nashorn/src/jdk/nashorn/internal/runtime/CodeInstaller.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/CodeInstaller.java Mon Oct 28 12:28:57 2013 -0700
@@ -68,4 +68,10 @@
* @return unique script id
*/
public long getUniqueScriptId();
+
+ /**
+ * Get next unique eval id
+ * @return unique eval id
+ */
+ public long getUniqueEvalId();
}
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java Mon Oct 28 12:28:57 2013 -0700
@@ -139,6 +139,11 @@
public long getUniqueScriptId() {
return context.getUniqueScriptId();
}
+
+ @Override
+ public long getUniqueEvalId() {
+ return context.getUniqueEvalId();
+ }
}
/** Is Context global debug mode enabled ? */
@@ -238,10 +243,14 @@
/** Unique id for script. Used only when --loader-per-compile=false */
private final AtomicLong uniqueScriptId;
+ /** Unique id for 'eval' */
+ private final AtomicLong uniqueEvalId;
+
private static final ClassLoader myLoader = Context.class.getClassLoader();
private static final StructureLoader sharedLoader;
- /*package-private*/ ClassLoader getSharedLoader() {
+ /*package-private*/ @SuppressWarnings("static-method")
+ ClassLoader getSharedLoader() {
return sharedLoader;
}
@@ -320,6 +329,7 @@
this.uniqueScriptId = new AtomicLong();
}
this.errors = errors;
+ this.uniqueEvalId = new AtomicLong();
// if user passed -classpath option, make a class loader with that and set it as
// thread context class loader so that script can access classes from that path.
@@ -625,11 +635,11 @@
* @param clazz Class object
* @throw SecurityException if not accessible
*/
- public static void checkPackageAccess(final Class clazz) {
+ public static void checkPackageAccess(final Class<?> clazz) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
- Class bottomClazz = clazz;
- while(bottomClazz.isArray()) {
+ Class<?> bottomClazz = clazz;
+ while (bottomClazz.isArray()) {
bottomClazz = bottomClazz.getComponentType();
}
checkPackageAccess(sm, bottomClazz.getName());
@@ -664,7 +674,7 @@
* @param clazz Class object
* @return true if package is accessible, false otherwise
*/
- private static boolean isAccessiblePackage(final Class clazz) {
+ private static boolean isAccessiblePackage(final Class<?> clazz) {
try {
checkPackageAccess(clazz);
return true;
@@ -838,7 +848,7 @@
return Context.getContextTrusted();
}
- private URL getResourceURL(final String resName) throws IOException {
+ private URL getResourceURL(final String resName) {
// try the classPathLoader if we have and then
// try the appLoader if non-null.
if (classPathLoader != null) {
@@ -954,6 +964,10 @@
}, CREATE_LOADER_ACC_CTXT);
}
+ private long getUniqueEvalId() {
+ return uniqueEvalId.getAndIncrement();
+ }
+
private long getUniqueScriptId() {
return uniqueScriptId.getAndIncrement();
}
--- a/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/DebugLogger.java Mon Oct 28 12:28:57 2013 -0700
@@ -65,7 +65,17 @@
} else {
this.logger = Logging.getLogger(loggerName);
}
- this.isEnabled = logger.getLevel() != Level.OFF;
+ assert logger != null;
+ this.isEnabled = getLevel() != Level.OFF;
+ }
+
+ /**
+ * Do not currently support chaining this with parent logger. Logger level null
+ * means disabled
+ * @return level
+ */
+ private Level getLevel() {
+ return logger.getLevel() == null ? Level.OFF : logger.getLevel();
}
/**
@@ -126,7 +136,7 @@
* @return true if level is above the given one
*/
public boolean levelAbove(final Level level) {
- return logger.getLevel().intValue() > level.intValue();
+ return getLevel().intValue() > level.intValue();
}
/**
--- a/nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/GlobalObject.java Mon Oct 28 12:28:57 2013 -0700
@@ -38,9 +38,10 @@
public interface GlobalObject {
/**
* Is this global of the given Context?
+ * @param ctxt the context
* @return true if this global belongs to the given Context
*/
- public boolean isOfContext(Context context);
+ public boolean isOfContext(final Context ctxt);
/**
* Does this global belong to a strict Context?
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSType.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSType.java Mon Oct 28 12:28:57 2013 -0700
@@ -31,6 +31,8 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Array;
+import java.util.Deque;
+import java.util.List;
import jdk.internal.dynalink.beans.StaticClass;
import jdk.nashorn.api.scripting.JSObject;
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
@@ -104,14 +106,20 @@
/** JavaScript compliant conversion function from number to int64 */
public static final Call TO_INT64_D = staticCall(myLookup, JSType.class, "toInt64", long.class, double.class);
- /** JavaScript compliant conversion function from Object to String */
- public static final Call TO_STRING = staticCall(myLookup, JSType.class, "toString", String.class, Object.class);
-
/** JavaScript compliant conversion function from number to String */
public static final Call TO_STRING_D = staticCall(myLookup, JSType.class, "toString", String.class, double.class);
- /** JavaScript compliant conversion function from Object to primitive */
- public static final Call TO_PRIMITIVE = staticCall(myLookup, JSType.class, "toPrimitive", Object.class, Object.class);
+ /** Combined call to toPrimitive followed by toString. */
+ public static final Call TO_PRIMITIVE_TO_STRING = staticCall(myLookup, JSType.class, "toPrimitiveToString", String.class, Object.class);
+
+ /** Method handle to convert a JS Object to a Java array. */
+ public static final Call TO_JAVA_ARRAY = staticCall(myLookup, JSType.class, "toJavaArray", Object.class, Object.class, Class.class);
+
+ /** Method handle to convert a JS Object to a Java List. */
+ public static final Call TO_JAVA_LIST = staticCall(myLookup, JSType.class, "toJavaList", List.class, Object.class);
+
+ /** Method handle to convert a JS Object to a Java deque. */
+ public static final Call TO_JAVA_DEQUE = staticCall(myLookup, JSType.class, "toJavaDeque", Deque.class, Object.class);
private static final double INT32_LIMIT = 4294967296.0;
@@ -273,6 +281,17 @@
}
/**
+ * Combines a hintless toPrimitive and a toString call.
+ *
+ * @param obj an object
+ *
+ * @return the string form of the primitive form of the object
+ */
+ public static String toPrimitiveToString(Object obj) {
+ return toString(toPrimitive(obj));
+ }
+
+ /**
* JavaScript compliant conversion of number to boolean
*
* @param num a number
@@ -874,7 +893,7 @@
if (obj instanceof ScriptObject) {
return convertArray(((ScriptObject)obj).getArray().asObjectArray(), componentType);
} else if (obj instanceof JSObject) {
- final ArrayLikeIterator itr = ArrayLikeIterator.arrayLikeIterator(obj);
+ final ArrayLikeIterator<?> itr = ArrayLikeIterator.arrayLikeIterator(obj);
final int len = (int) itr.getLength();
final Object[] res = new Object[len];
int idx = 0;
@@ -882,6 +901,8 @@
res[idx++] = itr.next();
}
return convertArray(res, componentType);
+ } else if(obj == null) {
+ return null;
} else {
throw new IllegalArgumentException("not a script object");
}
@@ -911,6 +932,24 @@
}
/**
+ * Converts a JavaScript object to a Java List. See {@link ListAdapter} for details.
+ * @param obj the object to convert. Can be any array-like object.
+ * @return a List that is live-backed by the JavaScript object.
+ */
+ public static List<?> toJavaList(final Object obj) {
+ return ListAdapter.create(obj);
+ }
+
+ /**
+ * Converts a JavaScript object to a Java Deque. See {@link ListAdapter} for details.
+ * @param obj the object to convert. Can be any array-like object.
+ * @return a Deque that is live-backed by the JavaScript object.
+ */
+ public static Deque<?> toJavaDeque(final Object obj) {
+ return ListAdapter.create(obj);
+ }
+
+ /**
* Check if an object is null or undefined
*
* @param obj object to check
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java Mon Oct 28 12:28:57 2013 -0700
@@ -119,10 +119,11 @@
});
}
+ /** wrapped object */
protected final Object obj;
// allow subclasses only in this package
- ListAdapter(Object obj) {
+ ListAdapter(final Object obj) {
this.obj = obj;
}
@@ -143,22 +144,32 @@
}
@Override
- public final Object get(int index) {
+ public final Object get(final int index) {
checkRange(index);
return getAt(index);
}
+ /**
+ * Get object at an index
+ * @param index index in list
+ * @return object
+ */
protected abstract Object getAt(final int index);
@Override
- public Object set(int index, Object element) {
+ public Object set(final int index, final Object element) {
checkRange(index);
final Object prevValue = getAt(index);
setAt(index, element);
return prevValue;
}
- protected abstract void setAt(int index, Object element);
+ /**
+ * Set object at an index
+ * @param index index in list
+ * @param element element
+ */
+ protected abstract void setAt(final int index, final Object element);
private void checkRange(int index) {
if(index < 0 || index >= size()) {
@@ -167,18 +178,18 @@
}
@Override
- public final void push(Object e) {
+ public final void push(final Object e) {
addFirst(e);
}
@Override
- public final boolean add(Object e) {
+ public final boolean add(final Object e) {
addLast(e);
return true;
}
@Override
- public final void addFirst(Object e) {
+ public final void addFirst(final Object e) {
try {
final InvokeByName unshiftInvoker = getUNSHIFT();
final Object fn = unshiftInvoker.getGetter().invokeExact(obj);
@@ -192,7 +203,7 @@
}
@Override
- public final void addLast(Object e) {
+ public final void addLast(final Object e) {
try {
final InvokeByName pushInvoker = getPUSH();
final Object fn = pushInvoker.getGetter().invokeExact(obj);
@@ -206,7 +217,7 @@
}
@Override
- public final void add(int index, Object e) {
+ public final void add(final int index, final Object e) {
try {
if(index < 0) {
throw invalidIndex(index);
@@ -225,35 +236,35 @@
throw invalidIndex(index);
}
}
- } catch(RuntimeException | Error ex) {
+ } catch(final RuntimeException | Error ex) {
throw ex;
- } catch(Throwable t) {
+ } catch(final Throwable t) {
throw new RuntimeException(t);
}
}
- private static void checkFunction(Object fn, InvokeByName invoke) {
+ private static void checkFunction(final Object fn, final InvokeByName invoke) {
if(!(Bootstrap.isCallable(fn))) {
throw new UnsupportedOperationException("The script object doesn't have a function named " + invoke.getName());
}
}
- private static IndexOutOfBoundsException invalidIndex(int index) {
+ private static IndexOutOfBoundsException invalidIndex(final int index) {
return new IndexOutOfBoundsException(String.valueOf(index));
}
@Override
- public final boolean offer(Object e) {
+ public final boolean offer(final Object e) {
return offerLast(e);
}
@Override
- public final boolean offerFirst(Object e) {
+ public final boolean offerFirst(final Object e) {
addFirst(e);
return true;
}
@Override
- public final boolean offerLast(Object e) {
+ public final boolean offerLast(final Object e) {
addLast(e);
return true;
}
@@ -287,7 +298,7 @@
}
@Override
- public final Object remove(int index) {
+ public final Object remove(final int index) {
if(index < 0) {
throw invalidIndex(index);
} else if (index == 0) {
@@ -333,11 +344,11 @@
}
@Override
- protected final void removeRange(int fromIndex, int toIndex) {
+ protected final void removeRange(final int fromIndex, final int toIndex) {
invokeSpliceRemove(fromIndex, toIndex - fromIndex);
}
- private void invokeSpliceRemove(int fromIndex, int count) {
+ private void invokeSpliceRemove(final int fromIndex, final int count) {
try {
final InvokeByName spliceRemoveInvoker = getSPLICE_REMOVE();
final Object fn = spliceRemoveInvoker.getGetter().invokeExact(obj);
@@ -419,16 +430,16 @@
}
@Override
- public final boolean removeFirstOccurrence(Object o) {
+ public final boolean removeFirstOccurrence(final Object o) {
return removeOccurrence(o, iterator());
}
@Override
- public final boolean removeLastOccurrence(Object o) {
+ public final boolean removeLastOccurrence(final Object o) {
return removeOccurrence(o, descendingIterator());
}
- private static boolean removeOccurrence(Object o, Iterator<Object> it) {
+ private static boolean removeOccurrence(final Object o, final Iterator<Object> it) {
while(it.hasNext()) {
final Object e = it.next();
if(o == null ? e == null : o.equals(e)) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Mon Oct 28 12:28:57 2013 -0700
@@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
+import jdk.internal.dynalink.support.NameCodec;
import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.CompilerConstants;
@@ -52,7 +53,7 @@
public final class RecompilableScriptFunctionData extends ScriptFunctionData {
/** FunctionNode with the code for this ScriptFunction */
- private volatile FunctionNode functionNode;
+ private FunctionNode functionNode;
/** Source from which FunctionNode was parsed. */
private final Source source;
@@ -64,7 +65,7 @@
private final PropertyMap allocatorMap;
/** Code installer used for all further recompilation/specialization of this ScriptFunction */
- private volatile CodeInstaller<ScriptEnvironment> installer;
+ private CodeInstaller<ScriptEnvironment> installer;
/** Name of class where allocator function resides */
private final String allocatorClassName;
@@ -100,9 +101,7 @@
* @param allocatorMap allocator map to seed instances with, when constructing
*/
public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) {
- super(functionNode.isAnonymous() ?
- "" :
- functionNode.getIdent().getName(),
+ super(functionName(functionNode),
functionNode.getParameters().size(),
functionNode.isStrict(),
false,
@@ -139,6 +138,20 @@
return sb.toString() + super.toString();
}
+ private static String functionName(final FunctionNode fn) {
+ if (fn.isAnonymous()) {
+ return "";
+ } else {
+ final FunctionNode.Kind kind = fn.getKind();
+ if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) {
+ final String name = NameCodec.decode(fn.getIdent().getName());
+ return name.substring(4); // 4 is "get " or "set "
+ } else {
+ return fn.getIdent().getName();
+ }
+ }
+ }
+
private static long tokenFor(final FunctionNode fn) {
final int position = Token.descPosition(fn.getFirstToken());
final int length = Token.descPosition(fn.getLastToken()) - position + Token.descLength(fn.getLastToken());
@@ -165,7 +178,7 @@
}
@Override
- protected void ensureCodeGenerated() {
+ protected synchronized void ensureCodeGenerated() {
if (!code.isEmpty()) {
return; // nothing to do, we have code, at least some.
}
@@ -323,7 +336,7 @@
}
@Override
- MethodHandle getBestInvoker(final MethodType callSiteType, final Object[] args) {
+ synchronized MethodHandle getBestInvoker(final MethodType callSiteType, final Object[] args) {
final MethodType runtimeType = runtimeType(callSiteType, args);
assert runtimeType.parameterCount() == callSiteType.parameterCount();
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunction.java Mon Oct 28 12:28:57 2013 -0700
@@ -59,6 +59,9 @@
/** Method handle for name getter for this ScriptFunction */
public static final MethodHandle G$NAME = findOwnMH("G$name", Object.class, Object.class);
+ /** Method handle used for implementing sync() in mozilla_compat */
+ public static final MethodHandle INVOKE_SYNC = findOwnMH("invokeSync", Object.class, ScriptFunction.class, Object.class, Object.class, Object[].class);
+
/** Method handle for allocate function for this ScriptFunction */
static final MethodHandle ALLOCATE = findOwnMH("allocate", Object.class);
@@ -301,6 +304,14 @@
public abstract void setPrototype(Object prototype);
/**
+ * Create a function that invokes this function synchronized on {@code sync} or the self object
+ * of the invocation.
+ * @param sync the Object to synchronize on, or undefined
+ * @return synchronized function
+ */
+ public abstract ScriptFunction makeSynchronizedFunction(Object sync);
+
+ /**
* Return the most appropriate invoke handle if there are specializations
* @param type most specific method type to look for invocation with
* @param args args for trampoline invocation
@@ -326,7 +337,7 @@
* @param self self reference
* @return bound invoke handle
*/
- public final MethodHandle getBoundInvokeHandle(final ScriptObject self) {
+ public final MethodHandle getBoundInvokeHandle(final Object self) {
return MH.bindTo(bindToCalleeIfNeeded(data.getGenericInvoker()), self);
}
@@ -614,6 +625,15 @@
return result;
}
+ @SuppressWarnings("unused")
+ private static Object invokeSync(final ScriptFunction func, final Object sync, final Object self, final Object... args)
+ throws Throwable {
+ final Object syncObj = sync == UNDEFINED ? self : sync;
+ synchronized (syncObj) {
+ return func.invoke(self, args);
+ }
+ }
+
private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
final Class<?> own = ScriptFunction.class;
final MethodType mt = MH.type(rtype, types);
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java Mon Oct 28 12:28:57 2013 -0700
@@ -675,7 +675,7 @@
/**
* Heuristic to figure out if the method handle has a callee argument. If it's type is either
- * {@code (boolean, Object, ScriptFunction, ...)} or {@code (Object, ScriptFunction, ...)}, then we'll assume it has
+ * {@code (boolean, ScriptFunction, ...)} or {@code (ScriptFunction, ...)}, then we'll assume it has
* a callee argument. We need this as the constructor above is not passed this information, and can't just blindly
* assume it's false (notably, it's being invoked for creation of new scripts, and scripts have scopes, therefore
* they also always receive a callee).
@@ -692,11 +692,11 @@
return false;
}
- if (type.parameterType(0) == boolean.class) {
- return length > 1 && type.parameterType(1) == ScriptFunction.class;
+ if (type.parameterType(0) == ScriptFunction.class) {
+ return true;
}
- return type.parameterType(0) == ScriptFunction.class;
+ return length > 1 && type.parameterType(0) == boolean.class && type.parameterType(1) == ScriptFunction.class;
}
/**
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptLoader.java Mon Oct 28 12:28:57 2013 -0700
@@ -64,6 +64,7 @@
return context.getSharedLoader().loadClass(name);
}
} catch (final ClassNotFoundException ignored) {
+ //ignored
}
// throw the original exception from here
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java Mon Oct 28 12:28:57 2013 -0700
@@ -37,6 +37,8 @@
import static jdk.nashorn.internal.runtime.PropertyDescriptor.VALUE;
import static jdk.nashorn.internal.runtime.PropertyDescriptor.WRITABLE;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex;
+import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -131,6 +133,7 @@
static final MethodHandle GETPROTO = findOwnMH("getProto", ScriptObject.class);
static final MethodHandle SETPROTOCHECK = findOwnMH("setProtoCheck", void.class, Object.class);
+ static final MethodHandle MEGAMORPHIC_GET = findOwnMH("megamorphicGet", Object.class, String.class, boolean.class);
static final MethodHandle SETFIELD = findOwnMH("setField", void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, MethodHandle.class, Object.class, Object.class);
static final MethodHandle SETSPILL = findOwnMH("setSpill", void.class, CallSiteDescriptor.class, PropertyMap.class, PropertyMap.class, int.class, Object.class, Object.class);
@@ -388,7 +391,7 @@
return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable);
}
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -592,7 +595,7 @@
* @param value value to define
*/
protected final void defineOwnProperty(final int index, final Object value) {
- assert ArrayIndex.isValidArrayIndex(index) : "invalid array index";
+ assert isValidArrayIndex(index) : "invalid array index";
final long longIndex = ArrayIndex.toLongIndex(index);
if (longIndex >= getArray().length()) {
// make array big enough to hold..
@@ -602,9 +605,9 @@
}
private void checkIntegerKey(final String key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
final ArrayData data = getArray();
if (data.has(index)) {
@@ -614,7 +617,7 @@
}
private void removeArraySlot(final String key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -717,6 +720,28 @@
}
/**
+ * Low level property API. This is similar to {@link #findProperty(String, boolean)} but returns a
+ * {@code boolean} value instead of a {@link FindProperty} object.
+ * @param key Property key.
+ * @param deep Whether the search should look up proto chain.
+ * @return true if the property was found.
+ */
+ boolean hasProperty(final String key, final boolean deep) {
+ if (getMap().findProperty(key) != null) {
+ return true;
+ }
+
+ if (deep) {
+ final ScriptObject myProto = getProto();
+ if (myProto != null) {
+ return myProto.hasProperty(key, deep);
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Add a new property to the object.
* <p>
* This a more "low level" way that doesn't involve {@link PropertyDescriptor}s
@@ -1708,8 +1733,11 @@
*/
protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) {
final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
+ if (request.isCallSiteUnstable()) {
+ return findMegaMorphicGetMethod(desc, name, "getMethod".equals(operator));
+ }
+
final FindProperty find = findProperty(name, true);
-
MethodHandle methodHandle;
if (find == null) {
@@ -1727,10 +1755,6 @@
throw new AssertionError(); // never invoked with any other operation
}
- if (request.isCallSiteUnstable()) {
- return findMegaMorphicGetMethod(desc, name);
- }
-
final Class<?> returnType = desc.getMethodType().returnType();
final Property property = find.getProperty();
methodHandle = find.getGetter(returnType);
@@ -1757,11 +1781,21 @@
return new GuardedInvocation(Lookup.emptyGetter(returnType), getMap().getProtoGetSwitchPoint(proto, name), guard);
}
- private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name) {
- final MethodType mhType = desc.getMethodType().insertParameterTypes(1, Object.class);
- final GuardedInvocation inv = findGetIndexMethod(mhType);
-
- return inv.replaceMethods(MH.insertArguments(inv.getInvocation(), 1, name), inv.getGuard());
+ private static GuardedInvocation findMegaMorphicGetMethod(final CallSiteDescriptor desc, final String name, final boolean isMethod) {
+ final MethodHandle invoker = MH.insertArguments(MEGAMORPHIC_GET, 1, name, isMethod);
+ final MethodHandle guard = getScriptObjectGuard(desc.getMethodType());
+ return new GuardedInvocation(invoker, guard);
+ }
+
+ @SuppressWarnings("unused")
+ private Object megamorphicGet(final String key, final boolean isMethod) {
+ final FindProperty find = findProperty(key, true);
+
+ if (find != null) {
+ return getObjectValue(find);
+ }
+
+ return isMethod ? getNoSuchMethod(key) : invokeNoSuchProperty(key);
}
/**
@@ -1810,7 +1844,7 @@
*/
protected GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) {
final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
- if(request.isCallSiteUnstable()) {
+ if (request.isCallSiteUnstable()) {
return findMegaMorphicSetMethod(desc, name);
}
@@ -2045,6 +2079,26 @@
return UNDEFINED;
}
+ /**
+ * Get __noSuchMethod__ as a function bound to this object and {@code name} if it is defined.
+ * @param name the method name
+ * @return the bound function, or undefined
+ */
+ private Object getNoSuchMethod(final String name) {
+ final FindProperty find = findProperty(NO_SUCH_METHOD_NAME, true);
+
+ if (find == null) {
+ return invokeNoSuchProperty(name);
+ }
+
+ final Object value = getObjectValue(find);
+ if (! (value instanceof ScriptFunction)) {
+ return UNDEFINED;
+ }
+
+ return ((ScriptFunction)value).makeBoundFunction(this, new Object[] {name});
+ }
+
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc, final String name) {
return new GuardedInvocation(Lookup.emptyGetter(desc.getMethodType().returnType()), getMap().getProtoGetSwitchPoint(proto, name), NashornGuards.getMapGuard(getMap()));
}
@@ -2308,7 +2362,7 @@
}
private int getInt(final int index, final String key) {
- if (ArrayIndex.isValidArrayIndex(index)) {
+ if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
final FindProperty find = object.findProperty(key, false, false, this);
@@ -2339,7 +2393,7 @@
@Override
public int getInt(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2351,7 +2405,7 @@
@Override
public int getInt(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2363,7 +2417,7 @@
@Override
public int getInt(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2385,7 +2439,7 @@
}
private long getLong(final int index, final String key) {
- if (ArrayIndex.isValidArrayIndex(index)) {
+ if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
final FindProperty find = object.findProperty(key, false, false, this);
@@ -2416,7 +2470,7 @@
@Override
public long getLong(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2428,7 +2482,7 @@
@Override
public long getLong(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2440,7 +2494,7 @@
@Override
public long getLong(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2462,7 +2516,7 @@
}
private double getDouble(final int index, final String key) {
- if (ArrayIndex.isValidArrayIndex(index)) {
+ if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
final FindProperty find = object.findProperty(key, false, false, this);
@@ -2493,7 +2547,7 @@
@Override
public double getDouble(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2505,7 +2559,7 @@
@Override
public double getDouble(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2517,7 +2571,7 @@
@Override
public double getDouble(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2539,7 +2593,7 @@
}
private Object get(final int index, final String key) {
- if (ArrayIndex.isValidArrayIndex(index)) {
+ if (isValidArrayIndex(index)) {
for (ScriptObject object = this; ; ) {
final FindProperty find = object.findProperty(key, false, false, this);
@@ -2570,7 +2624,7 @@
@Override
public Object get(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2582,7 +2636,7 @@
@Override
public Object get(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2594,7 +2648,7 @@
@Override
public Object get(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -2710,9 +2764,9 @@
@Override
public void set(final Object key, final int value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2722,14 +2776,15 @@
return;
}
- set(key, JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final Object key, final long value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2739,14 +2794,15 @@
return;
}
- set(key, JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final Object key, final double value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2756,14 +2812,15 @@
return;
}
- set(key, JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final Object key, final Object value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2773,17 +2830,15 @@
return;
}
- final String propName = JSType.toString(key);
- final FindProperty find = findProperty(propName, true);
-
- setObject(find, strict, propName, value);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, value);
}
@Override
public void set(final double key, final int value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2793,14 +2848,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final double key, final long value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2810,14 +2866,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final double key, final double value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2827,14 +2884,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final double key, final Object value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2844,14 +2902,15 @@
return;
}
- set(JSType.toObject(key), value, strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, value);
}
@Override
public void set(final long key, final int value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2861,31 +2920,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
public void set(final long key, final long value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
- if (getArray().has(index)) {
- setArray(getArray().set(index, value, strict));
- } else {
- doesNotHave(index, value, strict);
- }
-
- return;
- }
-
- set(JSType.toObject(key), JSType.toObject(value), strict);
- }
-
- @Override
- public void set(final long key, final double value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2895,14 +2938,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
- public void set(final long key, final Object value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public void set(final long key, final double value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2912,14 +2956,15 @@
return;
}
- set(JSType.toObject(key), value, strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
- public void set(final int key, final int value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public void set(final long key, final Object value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2929,14 +2974,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, value);
}
@Override
- public void set(final int key, final long value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public void set(final int key, final int value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2946,14 +2992,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
- public void set(final int key, final double value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public void set(final int key, final long value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2963,14 +3010,15 @@
return;
}
- set(JSType.toObject(key), JSType.toObject(value), strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
}
@Override
- public void set(final int key, final Object value, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public void set(final int key, final double value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
if (getArray().has(index)) {
setArray(getArray().set(index, value, strict));
} else {
@@ -2980,14 +3028,33 @@
return;
}
- set(JSType.toObject(key), value, strict);
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, JSType.toObject(value));
+ }
+
+ @Override
+ public void set(final int key, final Object value, final boolean strict) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
+ if (getArray().has(index)) {
+ setArray(getArray().set(index, value, strict));
+ } else {
+ doesNotHave(index, value, strict);
+ }
+
+ return;
+ }
+
+ final String propName = JSType.toString(key);
+ setObject(findProperty(propName, true), strict, propName, value);
}
@Override
public boolean has(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
for (ScriptObject self = this; self != null; self = self.getProto()) {
if (self.getArray().has(index)) {
return true;
@@ -2995,33 +3062,14 @@
}
}
- final FindProperty find = findProperty(JSType.toString(key), true);
-
- return find != null;
+ return hasProperty(JSType.toString(key), true);
}
@Override
public boolean has(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
- for (ScriptObject self = this; self != null; self = self.getProto()) {
- if (self.getArray().has(index)) {
- return true;
- }
- }
- }
-
- final FindProperty find = findProperty(JSType.toString(key), true);
-
- return find != null;
- }
-
- @Override
- public boolean has(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
for (ScriptObject self = this; self != null; self = self.getProto()) {
if (self.getArray().has(index)) {
return true;
@@ -3029,16 +3077,14 @@
}
}
- final FindProperty find = findProperty(JSType.toString(key), true);
-
- return find != null;
+ return hasProperty(JSType.toString(key), true);
}
@Override
- public boolean has(final int key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (ArrayIndex.isValidArrayIndex(index)) {
+ public boolean has(final long key) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
for (ScriptObject self = this; self != null; self = self.getProto()) {
if (self.getArray().has(index)) {
return true;
@@ -3046,66 +3092,47 @@
}
}
- final FindProperty find = findProperty(JSType.toString(key), true);
-
- return find != null;
+ return hasProperty(JSType.toString(key), true);
+ }
+
+ @Override
+ public boolean has(final int key) {
+ final int index = getArrayIndex(key);
+
+ if (isValidArrayIndex(index)) {
+ for (ScriptObject self = this; self != null; self = self.getProto()) {
+ if (self.getArray().has(index)) {
+ return true;
+ }
+ }
+ }
+
+ return hasProperty(JSType.toString(key), true);
}
@Override
public boolean hasOwnProperty(final Object key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (getArray().has(index)) {
- return true;
- }
-
- final FindProperty find = findProperty(JSType.toString(key), false);
-
- return find != null;
+ return getArray().has(getArrayIndex(key)) || hasProperty(JSType.toString(key), false);
}
@Override
public boolean hasOwnProperty(final int key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (getArray().has(index)) {
- return true;
- }
-
- final FindProperty find = findProperty(JSType.toString(key), false);
-
- return find != null;
+ return getArray().has(getArrayIndex(key)) || hasProperty(JSType.toString(key), false);
}
@Override
public boolean hasOwnProperty(final long key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (getArray().has(index)) {
- return true;
- }
-
- final FindProperty find = findProperty(JSType.toString(key), false);
-
- return find != null;
+ return getArray().has(getArrayIndex(key)) || hasProperty(JSType.toString(key), false);
}
@Override
public boolean hasOwnProperty(final double key) {
- final int index = ArrayIndex.getArrayIndex(key);
-
- if (getArray().has(index)) {
- return true;
- }
-
- final FindProperty find = findProperty(JSType.toString(key), false);
-
- return find != null;
+ return getArray().has(getArrayIndex(key)) || hasProperty(JSType.toString(key), false);
}
@Override
public boolean delete(final int key, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -3121,7 +3148,7 @@
@Override
public boolean delete(final long key, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -3137,7 +3164,7 @@
@Override
public boolean delete(final double key, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
@@ -3153,7 +3180,7 @@
@Override
public boolean delete(final Object key, final boolean strict) {
- final int index = ArrayIndex.getArrayIndex(key);
+ final int index = getArrayIndex(key);
final ArrayData array = getArray();
if (array.has(index)) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java Mon Oct 28 12:28:57 2013 -0700
@@ -316,6 +316,10 @@
return expression;
}
+ /**
+ * Get the parent scope for this {@code WithObject}
+ * @return the parent scope
+ */
public ScriptObject getParentScope() {
return getProto();
}
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/JavaArrayIterator.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/JavaArrayIterator.java Mon Oct 28 12:28:57 2013 -0700
@@ -77,4 +77,4 @@
public void remove() {
throw new UnsupportedOperationException("remove");
}
-}
\ No newline at end of file
+}
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseJavaArrayIterator.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/ReverseJavaArrayIterator.java Mon Oct 28 12:28:57 2013 -0700
@@ -55,4 +55,4 @@
protected long bumpIndex() {
return index--;
}
-}
\ No newline at end of file
+}
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java Mon Oct 28 12:28:57 2013 -0700
@@ -140,7 +140,7 @@
@SuppressWarnings("unused")
private static Object get(final Object jsobj, final Object key) {
if (key instanceof Integer) {
- return ((JSObject)jsobj).getSlot((int)(Integer)key);
+ return ((JSObject)jsobj).getSlot((Integer)key);
} else if (key instanceof Number) {
final int index = getIndex((Number)key);
if (index > -1) {
@@ -155,7 +155,7 @@
@SuppressWarnings("unused")
private static void put(final Object jsobj, final Object key, final Object value) {
if (key instanceof Integer) {
- ((JSObject)jsobj).setSlot((int)(Integer)key, value);
+ ((JSObject)jsobj).setSlot((Integer)key, value);
} else if (key instanceof Number) {
((JSObject)jsobj).setSlot(getIndex((Number)key), value);
} else if (key instanceof String) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Mon Oct 28 12:28:57 2013 -0700
@@ -93,7 +93,7 @@
* its last argument preceded by original constructor arguments. This constructor will use the passed function as the
* implementation for all abstract methods. For consistency, any concrete methods sharing the single abstract method
* name will also be overridden by the function. When methods on the adapter instance are invoked, the ScriptFunction is
- * invoked with {@code null} as its "this".
+ * invoked with global or UNDEFINED as its "this" depending whether the function is non-strict or not.
* </li>
* <li>
* If the adapter being generated can have class-level overrides, constructors taking same arguments as the superclass
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java Mon Oct 28 12:28:57 2013 -0700
@@ -29,6 +29,7 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodType;
+import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.ScriptRuntime;
@@ -53,8 +54,8 @@
* @return the appropriately adapted method handle for invoking the script function.
*/
public static MethodHandle getHandle(final ScriptFunction fn, final MethodType type) {
- // JS "this" will be null for SAMs
- return adaptHandle(fn.getBoundInvokeHandle(null), type);
+ // JS "this" will be global object or undefined depending on if 'fn' is strict or not
+ return adaptHandle(fn.getBoundInvokeHandle(fn.isStrict()? ScriptRuntime.UNDEFINED : Context.getGlobal()), type);
}
/**
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java Mon Oct 28 12:28:57 2013 -0700
@@ -25,9 +25,9 @@
package jdk.nashorn.internal.runtime.linker;
+import static jdk.nashorn.internal.lookup.Lookup.MH;
import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-import static jdk.nashorn.internal.lookup.Lookup.MH;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -211,6 +211,20 @@
return null;
} else if (obj instanceof Long) {
return (Long) obj;
+ } else if (obj instanceof Integer) {
+ return ((Integer)obj).longValue();
+ } else if (obj instanceof Double) {
+ final Double d = (Double)obj;
+ if(Double.isInfinite(d.doubleValue())) {
+ return 0L;
+ }
+ return d.longValue();
+ } else if (obj instanceof Float) {
+ final Float f = (Float)obj;
+ if(Float.isInfinite(f.floatValue())) {
+ return 0L;
+ }
+ return f.longValue();
} else if (obj instanceof Number) {
return ((Number)obj).longValue();
} else if (obj instanceof String || obj instanceof ConsString) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java Mon Oct 28 12:28:57 2013 -0700
@@ -30,6 +30,8 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Modifier;
+import java.util.Deque;
+import java.util.List;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.ConversionComparator;
import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -38,6 +40,8 @@
import jdk.internal.dynalink.linker.LinkerServices;
import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
import jdk.internal.dynalink.support.Guards;
+import jdk.nashorn.internal.objects.NativeArray;
+import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.Undefined;
@@ -47,6 +51,13 @@
* includes {@link ScriptFunction} and its subclasses) as well as {@link Undefined}.
*/
final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator {
+ private static final ClassValue<MethodHandle> ARRAY_CONVERTERS = new ClassValue<MethodHandle>() {
+ @Override
+ protected MethodHandle computeValue(Class<?> type) {
+ return createArrayConverter(type);
+ }
+ };
+
/**
* Returns true if {@code ScriptObject} is assignable from {@code type}, or it is {@code Undefined}.
*/
@@ -103,6 +114,12 @@
if (mh != null) {
return new GuardedInvocation(mh, canLinkTypeStatic(sourceType) ? null : IS_NASHORN_OR_UNDEFINED_TYPE);
}
+
+ GuardedInvocation inv = getArrayConverter(sourceType, targetType);
+ if(inv != null) {
+ return inv;
+ }
+
return getSamTypeConverter(sourceType, targetType);
}
@@ -129,6 +146,41 @@
return null;
}
+ /**
+ * Returns a guarded invocation that converts from a source type that is NativeArray to a Java array or List or
+ * Deque type.
+ * @param sourceType the source type (presumably NativeArray a superclass of it)
+ * @param targetType the target type (presumably an array type, or List or Deque)
+ * @return a guarded invocation that converts from the source type to the target type. null is returned if
+ * either the source type is neither NativeArray, nor a superclass of it, or if the target type is not an array
+ * type, List, or Deque.
+ */
+ private static GuardedInvocation getArrayConverter(final Class<?> sourceType, final Class<?> targetType) {
+ final boolean isSourceTypeNativeArray = sourceType == NativeArray.class;
+ // If source type is more generic than ScriptFunction class, we'll need to use a guard
+ final boolean isSourceTypeGeneric = !isSourceTypeNativeArray && sourceType.isAssignableFrom(NativeArray.class);
+
+ if (isSourceTypeNativeArray || isSourceTypeGeneric) {
+ final MethodHandle guard = isSourceTypeGeneric ? IS_NATIVE_ARRAY : null;
+ if(targetType.isArray()) {
+ return new GuardedInvocation(ARRAY_CONVERTERS.get(targetType), guard);
+ }
+ if(targetType == List.class) {
+ return new GuardedInvocation(JSType.TO_JAVA_LIST.methodHandle(), guard);
+ }
+ if(targetType == Deque.class) {
+ return new GuardedInvocation(JSType.TO_JAVA_DEQUE.methodHandle(), guard);
+ }
+ }
+ return null;
+ }
+
+ private static MethodHandle createArrayConverter(final Class<?> type) {
+ assert type.isArray();
+ final MethodHandle converter = MH.insertArguments(JSType.TO_JAVA_ARRAY.methodHandle(), 1, type.getComponentType());
+ return MH.asType(converter, converter.type().changeReturnType(type));
+ }
+
private static boolean isAutoConvertibleFromFunction(final Class<?> clazz) {
return isAbstractClass(clazz) && !ScriptObject.class.isAssignableFrom(clazz) &&
JavaAdapterFactory.isAutoConvertibleFromFunction(clazz);
@@ -148,7 +200,26 @@
@Override
public Comparison compareConversion(final Class<?> sourceType, final Class<?> targetType1, final Class<?> targetType2) {
+ if(sourceType == NativeArray.class) {
+ // Prefer lists, as they're less costly to create than arrays.
+ if(isList(targetType1)) {
+ if(!isList(targetType2)) {
+ return Comparison.TYPE_1_BETTER;
+ }
+ } else if(isList(targetType2)) {
+ return Comparison.TYPE_2_BETTER;
+ }
+ // Then prefer arrays
+ if(targetType1.isArray()) {
+ if(!targetType2.isArray()) {
+ return Comparison.TYPE_1_BETTER;
+ }
+ } else if(targetType2.isArray()) {
+ return Comparison.TYPE_2_BETTER;
+ }
+ }
if(ScriptObject.class.isAssignableFrom(sourceType)) {
+ // Prefer interfaces
if(targetType1.isInterface()) {
if(!targetType2.isInterface()) {
return Comparison.TYPE_1_BETTER;
@@ -160,7 +231,12 @@
return Comparison.INDETERMINATE;
}
+ private static boolean isList(Class<?> clazz) {
+ return clazz == List.class || clazz == Deque.class;
+ }
+
private static final MethodHandle IS_SCRIPT_FUNCTION = Guards.isInstance(ScriptFunction.class, MH.type(Boolean.TYPE, Object.class));
+ private static final MethodHandle IS_NATIVE_ARRAY = Guards.isOfClass(NativeArray.class, MH.type(Boolean.TYPE, Object.class));
private static final MethodHandle IS_NASHORN_OR_UNDEFINED_TYPE = findOwnMH("isNashornTypeOrUndefined",
Boolean.TYPE, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js Mon Oct 28 12:28:57 2013 -0700
@@ -41,7 +41,12 @@
}
});
+
// importPackage
+// avoid unnecessary chaining of __noSuchProperty__ again
+// in case user loads this script more than once.
+if (typeof importPackage == 'undefined') {
+
Object.defineProperty(this, "importPackage", {
configurable: true, enumerable: false, writable: true,
value: (function() {
@@ -91,6 +96,19 @@
})()
});
+}
+
+// sync
+Object.defineProperty(this, "sync", {
+ configurable: true, enumerable: false, writable: true,
+ value: function(func, syncobj) {
+ if (arguments.length < 1 || arguments.length > 2 ) {
+ throw "sync(function [,object]) parameter count mismatch";
+ }
+ return Packages.jdk.nashorn.api.scripting.ScriptUtils.makeSynchronizedFunction(func, syncobj);
+ }
+});
+
// Object.prototype.__defineGetter__
Object.defineProperty(Object.prototype, "__defineGetter__", {
configurable: true, enumerable: false, writable: true,
@@ -344,13 +362,16 @@
// Rhino: global.importClass
Object.defineProperty(this, "importClass", {
configurable: true, enumerable: false, writable: true,
- value: function(clazz) {
- if (Java.isType(clazz)) {
- var className = Java.typeName(clazz);
- var simpleName = className.substring(className.lastIndexOf('.') + 1);
- this[simpleName] = clazz;
- } else {
- throw new TypeError(clazz + " is not a Java class");
+ value: function() {
+ for (var arg in arguments) {
+ var clazz = arguments[arg];
+ if (Java.isType(clazz)) {
+ var className = Java.typeName(clazz);
+ var simpleName = className.substring(className.lastIndexOf('.') + 1);
+ this[simpleName] = clazz;
+ } else {
+ throw new TypeError(clazz + " is not a Java class");
+ }
}
}
});
--- a/nashorn/test/script/assert.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/assert.js Mon Oct 28 12:28:57 2013 -0700
@@ -61,3 +61,22 @@
}
}
});
+
+Object.defineProperty(this, "printError", {
+ configuable: true,
+ enumerable: false,
+ writable: true,
+ value: function (e) {
+ var msg = e.message;
+ var str = e.name + ':';
+ if (e.lineNumber > 0) {
+ str += e.lineNumber + ':';
+ }
+ if (e.columnNumber > 0) {
+ str += e.columnNumber + ':';
+ }
+ str += msg.substring(msg.indexOf(' ') + 1);
+ print(str);
+ }
+});
+
--- a/nashorn/test/script/basic/JDK-8019508.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019508.js Mon Oct 28 12:28:57 2013 -0700
@@ -36,7 +36,7 @@
if (! (e instanceof SyntaxError)) {
fail("expected SyntaxError, got " + e);
}
- print(e.message.replace(/\\/g, '/'));
+ printError(e);
}
}
--- a/nashorn/test/script/basic/JDK-8019508.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019508.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,12 +1,12 @@
-test/script/basic/JDK-8019508.js#33<eval>:1:2 Expected property id but found ,
+SyntaxError:33:Expected property id but found ,
({,})
^
-test/script/basic/JDK-8019508.js#33<eval>:1:2 Expected property id but found ,
+SyntaxError:33:Expected property id but found ,
({, a:2 })
^
-test/script/basic/JDK-8019508.js#33<eval>:1:6 Expected property id but found ,
+SyntaxError:33:Expected property id but found ,
({a:3,,})
^
-test/script/basic/JDK-8019508.js#33<eval>:1:6 Expected comma but found ident
+SyntaxError:33:Expected comma but found ident
({a:3 b:2}
^
--- a/nashorn/test/script/basic/JDK-8019553.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019553.js Mon Oct 28 12:28:57 2013 -0700
@@ -33,7 +33,7 @@
eval(str);
fail("SyntaxError expected for: " + str);
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
}
--- a/nashorn/test/script/basic/JDK-8019553.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019553.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,12 +1,12 @@
-SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found +
+SyntaxError:33:Expected l-value but found +
++ +3
^
-SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found -
+SyntaxError:33:Expected l-value but found -
++ -7
^
-SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found +
+SyntaxError:33:Expected l-value but found +
-- +2
^
-SyntaxError: test/script/basic/JDK-8019553.js#33<eval>:1:3 Expected l-value but found -
+SyntaxError:33:Expected l-value but found -
-- -8
^
--- a/nashorn/test/script/basic/JDK-8019791.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019791.js Mon Oct 28 12:28:57 2013 -0700
@@ -33,7 +33,7 @@
eval('"" ~ ""');
print("FAILED: SyntaxError expected for: \"\" ~ \"\"");
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
// Used to crash instead of SyntaxError
@@ -41,7 +41,7 @@
eval("function() { if (1~0) return 0; return 1 }");
print("FAILED: SyntaxError expected for: if (1~0) ");
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
// The following are valid, but used to crash
--- a/nashorn/test/script/basic/JDK-8019791.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019791.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,6 +1,6 @@
-SyntaxError: test/script/basic/JDK-8019791.js#33<eval>:1:3 Expected ; but found ~
+SyntaxError:33:Expected ; but found ~
"" ~ ""
^
-SyntaxError: test/script/basic/JDK-8019791.js#41<eval>:1:18 Expected ) but found ~
+SyntaxError:41:Expected ) but found ~
function() { if (1~0) return 0; return 1 }
^
--- a/nashorn/test/script/basic/JDK-8019805.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019805.js Mon Oct 28 12:28:57 2013 -0700
@@ -32,5 +32,5 @@
eval("for each(var v=0;false;);");
print("FAILED: for each(var v=0; false;); should have thrown error");
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
--- a/nashorn/test/script/basic/JDK-8019805.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8019805.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,3 +1,3 @@
-SyntaxError: test/script/basic/JDK-8019805.js#32<eval>:1:16 for each can only be used with for..in
+SyntaxError:32:for each can only be used with for..in
for each(var v=0;false;);
^
--- a/nashorn/test/script/basic/JDK-8025488.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/JDK-8025488.js Mon Oct 28 12:28:57 2013 -0700
@@ -40,4 +40,4 @@
}
var e = new MyError();
-print(e.stack);
+print(e.stack.replace(/\\/g, '/'));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026008.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026008: Constant folding removes var statement
+ *
+ * @test
+ * @run
+ */
+
+if (false) {
+ var x1 = 10;
+ if (false) {
+ var x2;
+ }
+} else {
+ print(x1, x2);
+}
+
+if (undefined) {
+ var z1;
+ if (null) {
+ var z2;
+ }
+}
+
+print(z1, z2);
+
+if (1) {
+ print(y1, y2);
+} else if (0) {
+ var y1 = 1;
+} else {
+ var y2 = 2
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026008.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,3 @@
+undefined undefined
+undefined undefined
+undefined undefined
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026016.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026016: too many relinks dominate avatar.js http benchmark
+ *
+ * @test
+ * @run
+ */
+
+function accessMegamorphic() {
+ for (var i = 0; i < 26; i++) {
+ var o = {};
+ o[String.fromCharCode(i + 97)] = 1;
+ o._;
+ }
+}
+
+function invokeMegamorphic() {
+ for (var i = 0; i < 26; i++) {
+ var o = {};
+ o[String.fromCharCode(i + 97)] = 1;
+ try {
+ o._(i);
+ } catch (e) {
+ print(e);
+ }
+ }
+}
+
+Object.prototype.__noSuchProperty__ = function() {
+ print("no such property", Array.prototype.slice.call(arguments));
+};
+
+invokeMegamorphic();
+accessMegamorphic();
+
+Object.prototype.__noSuchMethod__ = function() {
+ print("no such method", Array.prototype.slice.call(arguments));
+};
+
+invokeMegamorphic();
+accessMegamorphic();
+
+Object.prototype.__noSuchMethod__ = "nofunction";
+
+invokeMegamorphic();
+accessMegamorphic();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026016.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,182 @@
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+TypeError: Cannot call undefined
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such method _,0
+no such method _,1
+no such method _,2
+no such method _,3
+no such method _,4
+no such method _,5
+no such method _,6
+no such method _,7
+no such method _,8
+no such method _,9
+no such method _,10
+no such method _,11
+no such method _,12
+no such method _,13
+no such method _,14
+no such method _,15
+no such method _,16
+no such method _,17
+no such method _,18
+no such method _,19
+no such method _,20
+no such method _,21
+no such method _,22
+no such method _,23
+no such method _,24
+no such method _,25
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+TypeError: Cannot call undefined
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
+no such property _
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026112.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026112: Function("with(x ? 1e81 : (x2.constructor = 0.1)){}") throws AssertionError: double is not compatible with object
+ *
+ * @test
+ * @run
+ */
+
+Function("with(x ? 1e81 : (x2.constructor = 0.1)){}")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026125.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026125: Array.prototype.slice.call(Java.type("java.util.HashMap")) throws ClassCastException: jdk.internal.dynalink.beans.StaticClass cannot be cast to jdk.nashorn.internal.runtime.ScriptObject
+ *
+ * @test
+ * @run
+ */
+
+Array.prototype.splice.call(Java.type("java.util.HashMap"))
+Array.prototype.slice.call(Java.type("java.util.HashMap"))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026137.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026137: Binary evaluation order in JavaScript is load load
+ * convert convert, not load convert load convert.
+ *
+ * @test
+ * @run
+ */
+
+try {
+ (function f() { Object.defineProperty({},"x",{get: function(){return {valueOf:function(){throw 0}}}}).x - Object.defineProperty({},"x",{get: function(){throw 1}}).x })()
+}
+catch (e) {
+ print(e);
+}
+
+try {
+ ({valueOf: function(){throw 0}}) - ({valueOf: function(){throw 1}} - 1)
+} catch (e) {
+ print(e);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026137.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,2 @@
+1
+1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026162.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026162: "this" in SAM adapter functions is wrong
+ *
+ * @test
+ * @run
+ */
+
+var global = this;
+
+new java.lang.Runnable(
+ function func() {
+ if (this !== global) {
+ fail("Expected 'this' to be global instance");
+ }
+ }
+).run();
+
+new java.lang.Runnable(
+ function func() {
+ 'use strict';
+ if (typeof this != 'undefined') {
+ fail("Expected 'undefined' to be global instance");
+ }
+ }
+).run();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026167.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026167: Class cache/reuse of 'eval' scripts results in ClassCastException in some cases.
+ *
+ * @test
+ * @run
+ */
+
+var m = new javax.script.ScriptEngineManager();
+var e = m.getEngineByName('js');
+
+// leave the whitespace - need both eval("e") at same column for this test!
+
+e.eval('function f(e) { eval("e") } f()');
+e.eval('function f() { var e = 33; eval("e") } f()');
+
+function f() {
+ Function.call.call(function x() { eval("x") }); eval("x")
+}
+
+try {
+ f();
+ fail("Should have thrown ReferenceError");
+} catch (e) {
+ if (! (e instanceof ReferenceError)) {
+ fail("ReferenceError expected but got " + e);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026248.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026248: importClass has to be a varargs function
+ *
+ * @test
+ * @run
+ */
+
+load('nashorn:mozilla_compat.js')
+
+importClass(java.io.File, java.io.InputStream)
+
+print(File)
+print(InputStream)
+
+importClass(java.util.Map, java.util.HashMap, java.io.PrintStream)
+
+print(HashMap)
+print(Map)
+print(PrintStream)
+
+importClass.call(this, java.util.Collections, java.util.List);
+print(Collections)
+print(List)
+
+importClass.apply(this, [ java.util.Queue, java.math.BigInteger, java.math.BigDecimal ]);
+print(Queue)
+print(BigInteger)
+print(BigDecimal)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026248.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,10 @@
+[JavaClass java.io.File]
+[JavaClass java.io.InputStream]
+[JavaClass java.util.HashMap]
+[JavaClass java.util.Map]
+[JavaClass java.io.PrintStream]
+[JavaClass java.util.Collections]
+[JavaClass java.util.List]
+[JavaClass java.util.Queue]
+[JavaClass java.math.BigInteger]
+[JavaClass java.math.BigDecimal]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026264.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026264: Getter, setter function name mangling issues
+ *
+ * @test
+ * @run
+ */
+
+var obj = {
+ get ":"(){},
+ set ":"(x){},
+ get ""(){},
+ set ""(x){}
+};
+
+var desc = Object.getOwnPropertyDescriptor(obj, ":");
+if (desc.get.name != ':') {
+ fail("getter name is expected to be ':' got " + desc.get.name);
+}
+
+if (desc.set.name != ':') {
+ fail("setter name is expected to be ':' got " + desc.set.name);
+}
+
+desc = Object.getOwnPropertyDescriptor(obj, "");
+if (desc.get.name != '') {
+ fail("getter name is expected to be '' got " + desc.get.name);
+}
+
+if (desc.set.name != '') {
+ fail("setter name is expected to be '' got " + desc.set.name);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026292.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026292: Megamorphic setter fails with boolean value
+ *
+ * @test
+ * @run
+ */
+
+function megamorphic(o) {
+ o.w = true;
+ if (!o.w)
+ throw new Error();
+}
+
+// Calls below must exceed megamorphic callsite threshhold
+for (var i = 0; i < 10; i++) {
+ megamorphic({a: 1});
+ megamorphic({b: 1});
+ megamorphic({c: 1});
+ megamorphic({d: 1});
+ megamorphic({e: 1});
+ megamorphic({f: 1});
+ megamorphic({g: 1});
+ megamorphic({h: 1});
+ megamorphic({i: 1});
+ megamorphic({j: 1});
+ megamorphic({k: 1});
+ megamorphic({l: 1});
+ megamorphic({m: 1});
+ megamorphic({n: 1});
+ megamorphic({o: 1});
+ megamorphic({p: 1});
+ megamorphic({q: 1});
+ megamorphic({r: 1});
+ megamorphic({s: 1});
+ megamorphic({t: 1});
+ megamorphic({u: 1});
+ megamorphic({v: 1});
+ megamorphic({w: 1});
+ megamorphic({x: 1});
+ megamorphic({y: 1});
+ megamorphic({z: 1});
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026302.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026302: source representation of getter and setter methods is wrong
+ *
+ * @test
+ * @run
+ */
+
+var obj = {
+ get "foo"() {},
+ set "foo"(x) {},
+ get bar() {},
+ set bar(x) {},
+ get ":"() {},
+ set ":"(x) {},
+ get 12() {},
+ set 12(x) {},
+ get 1.8e-8() {},
+ set 1.8e-8(x) {}
+}
+
+for (var prop in obj) {
+ var desc = Object.getOwnPropertyDescriptor(obj, prop);
+ print(desc.get);
+ print(desc.set);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026302.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,10 @@
+get "foo"() {}
+set "foo"(x) {}
+get bar() {}
+set bar(x) {}
+get ":"() {}
+set ":"(x) {}
+get 12() {}
+set 12(x) {}
+get 1.8e-8() {}
+set 1.8e-8(x) {}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026317.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026317: $ in the function name results in wrong function being invoked
+ *
+ * @test
+ * @run
+ */
+
+function case1() {
+ function g() {
+ return 0
+ }
+ function g() {
+ return 1
+ }
+ function g$1() {
+ return 2
+ }
+
+ return g$1()
+}
+
+print(case1());
+
+function case2() {
+ function g() {
+ return 0
+ }
+
+ var h = function g() {
+ return 1
+ }
+
+ function g$1() {
+ return 2
+ }
+
+ return h()
+}
+
+print(case2());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026317.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,2 @@
+2
+1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026367.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026367: Add a sync keyword to mozilla_compat
+ *
+ * @test
+ * @run
+ */
+
+if (typeof sync === "undefined") {
+ load("nashorn:mozilla_compat.js");
+}
+
+var obj = {
+ count: 0,
+ // Sync called with one argument will synchronize on this-object of invocation
+ inc: sync(function(d) {
+ this.count += d;
+ }),
+ // Pass explicit object to synchronize on as second argument
+ dec: sync(function(d) {
+ this.count -= d;
+ }, obj)
+};
+
+var t1 = new java.lang.Thread(function() {
+ for (var i = 0; i < 100000; i++) obj.inc(1);
+});
+var t2 = new java.lang.Thread(function() {
+ for (var i = 0; i < 100000; i++) obj.dec(1);
+});
+
+t1.start();
+t2.start();
+t1.join();
+t2.join();
+
+if (obj.count !== 0) {
+ throw new Error("Expected count == 0, got " + obj.count);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026692.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026692: eval() throws NullPointerException with --compile-only
+ *
+ * @test
+ * @option --compile-only
+ * @run
+ */
+
+eval("");
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8026693.js Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8026693: getType() called on DISCARD node
+ *
+ * @test
+ * @run
+ */
+
+function f() {
+ if(x, y) z;
+}
--- a/nashorn/test/script/basic/NASHORN-100.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-100.js Mon Oct 28 12:28:57 2013 -0700
@@ -35,5 +35,5 @@
if (! (e instanceof SyntaxError)) {
fail("#2 expected SyntaxError got " + e);
}
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
--- a/nashorn/test/script/basic/NASHORN-100.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-100.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,3 +1,3 @@
-SyntaxError: test/script/basic/NASHORN-100.js#32<eval>:1:0 Invalid return statement
+SyntaxError:32:Invalid return statement
return;
^
--- a/nashorn/test/script/basic/NASHORN-293.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-293.js Mon Oct 28 12:28:57 2013 -0700
@@ -40,15 +40,13 @@
try {
eval(src);
} catch (e) {
- var location = e.fileName ? e.fileName.slice(-9) : "unknown source";
- print(e.name, "@", location);
+ printError(e);
}
}
for (var i = 0; i < 3; i++) {
try {
eval(src);
} catch (e) {
- var location = e.fileName ? e.fileName.slice(-9) : "unknown source";
- print(e.name, "@", location);
+ printError(e);
}
}
--- a/nashorn/test/script/basic/NASHORN-293.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-293.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,9 +1,9 @@
hello
hello
hello
-TypeError @ #41<eval>
-TypeError @ #41<eval>
-TypeError @ #41<eval>
-TypeError @ #49<eval>
-TypeError @ #49<eval>
-TypeError @ #49<eval>
+TypeError:1:read property "foo" from undefined
+TypeError:1:read property "foo" from undefined
+TypeError:1:read property "foo" from undefined
+TypeError:1:read property "foo" from undefined
+TypeError:1:read property "foo" from undefined
+TypeError:1:read property "foo" from undefined
--- a/nashorn/test/script/basic/NASHORN-40.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-40.js Mon Oct 28 12:28:57 2013 -0700
@@ -31,11 +31,11 @@
try {
eval("print(.foo)");
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
try {
eval(".bar = 3423;");
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
--- a/nashorn/test/script/basic/NASHORN-40.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-40.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,6 +1,6 @@
-SyntaxError: test/script/basic/NASHORN-40.js#32<eval>:1:6 Expected an operand but found .
+SyntaxError:32:Expected an operand but found .
print(.foo)
^
-SyntaxError: test/script/basic/NASHORN-40.js#38<eval>:1:0 Expected an operand but found .
+SyntaxError:38:Expected an operand but found .
.bar = 3423;
^
--- a/nashorn/test/script/basic/NASHORN-51.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-51.js Mon Oct 28 12:28:57 2013 -0700
@@ -35,28 +35,28 @@
eval(literals[i] + "++");
print("ERROR!! post increment : " + literals[i]);
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
try {
eval(literals[i] + "--");
print("ERROR!! post decrement : " + literals[i]);
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
try {
eval("++" + literals[i]);
print("ERROR!! pre increment : " + literals[i]);
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
try {
eval("--" + literals[i]);
print("ERROR!! pre decrement : " + literals[i]);
} catch (e) {
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
}
--- a/nashorn/test/script/basic/NASHORN-51.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-51.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,72 +1,72 @@
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
1++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
1--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++1
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--1
^
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
0++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
0--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++0
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--0
^
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
3.14++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
3.14--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++3.14
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--3.14
^
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
true++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
true--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++true
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--true
^
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
false++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
false--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++false
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--false
^
-ReferenceError: test/script/basic/NASHORN-51.js#35<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:35:Invalid left hand side for assignment
null++
^
-ReferenceError: test/script/basic/NASHORN-51.js#42<eval>:1:0 Invalid left hand side for assignment
+ReferenceError:42:Invalid left hand side for assignment
null--
^
-ReferenceError: test/script/basic/NASHORN-51.js#49<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:49:Invalid left hand side for assignment
++null
^
-ReferenceError: test/script/basic/NASHORN-51.js#56<eval>:1:2 Invalid left hand side for assignment
+ReferenceError:56:Invalid left hand side for assignment
--null
^
--- a/nashorn/test/script/basic/NASHORN-98.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-98.js Mon Oct 28 12:28:57 2013 -0700
@@ -34,7 +34,7 @@
if (! (e instanceof SyntaxError)) {
fail("syntax error expected here got " + e);
}
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
try {
@@ -43,5 +43,5 @@
if (! (e instanceof SyntaxError)) {
fail("syntax error expected here got " + e);
}
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
--- a/nashorn/test/script/basic/NASHORN-98.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/NASHORN-98.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -1,6 +1,6 @@
-SyntaxError: test/script/basic/NASHORN-98.js#32<eval>:1:13 Expected comma but found decimal
+SyntaxError:32:Expected comma but found decimal
var x = [ 23 34 ]
^
-SyntaxError: test/script/basic/NASHORN-98.js#41<eval>:1:18 Expected comma but found ident
+SyntaxError:41:Expected comma but found ident
var x = { foo: 33 bar: 'hello' }
^
--- a/nashorn/test/script/basic/eval.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/eval.js Mon Oct 28 12:28:57 2013 -0700
@@ -69,5 +69,5 @@
eval("print('hello)");
} catch (e) {
print("is syntax error? " + (e instanceof SyntaxError));
- print(e.toString().replace(/\\/g, '/'));
+ printError(e);
}
--- a/nashorn/test/script/basic/eval.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/eval.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -10,6 +10,6 @@
100
3300
is syntax error? true
-SyntaxError: test/script/basic/eval.js#69<eval>:1:13 Missing close quote
+SyntaxError:69:Missing close quote
print('hello)
^
--- a/nashorn/test/script/basic/objects.js.EXPECTED Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/basic/objects.js.EXPECTED Mon Oct 28 12:28:57 2013 -0700
@@ -29,18 +29,18 @@
abc is configurable? true
abc is enumerable? true
abc's value = undefined
-abc's get = abc() { return "abc"; }
+abc's get = get abc() { return "abc"; }
abc's set = undefined
xyz is writable? undefined
xyz is configurable? true
xyz is enumerable? true
xyz's value = undefined
xyz's get = undefined
-xyz's set = xyz(val) { print(val); }
+xyz's set = set xyz(val) { print(val); }
hey is writable? undefined
hey is configurable? true
hey is enumerable? true
hey's value = undefined
-hey's get = hey() { return "hey"; }
-hey's set = hey(val) { print(val); }
+hey's get = get hey() { return "hey"; }
+hey's set = set hey(val) { print(val); }
undefined
--- a/nashorn/test/script/sandbox/loadcompat.js Mon Oct 28 10:52:07 2013 +0100
+++ b/nashorn/test/script/sandbox/loadcompat.js Mon Oct 28 12:28:57 2013 -0700
@@ -48,3 +48,7 @@
if (typeof importPackage != 'function') {
fail("importPackage function is missing in compatibility script");
}
+
+if (typeof sync != 'function') {
+ fail("sync function is missing in compatibility script");
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java Mon Oct 28 12:28:57 2013 -0700
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
+
+import java.util.Arrays;
+import java.util.List;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+public class ArrayConversionTest {
+ private static ScriptEngine e = null;
+
+ public static void main(final String[] args) {
+ TestNG.main(args);
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws ScriptException {
+ e = new ScriptEngineManager().getEngineByName("nashorn");
+ }
+
+ @AfterClass
+ public static void tearDownClass() {
+ e = null;
+ }
+
+ @Test
+ public void testIntArrays() throws ScriptException {
+ runTest("assertNullIntArray", "null");
+ runTest("assertEmptyIntArray", "[]");
+ runTest("assertSingle42IntArray", "[42]");
+ runTest("assertSingle42IntArray", "['42']");
+ runTest("assertIntArrayConversions", "[false, true, NaN, Infinity, -Infinity, 0.4, 0.6, null, undefined, [], {}, [1], [1, 2]]");
+ }
+
+ @Test
+ public void testIntIntArrays() throws ScriptException {
+ runTest("assertNullIntIntArray", "null");
+ runTest("assertEmptyIntIntArray", "[]");
+ runTest("assertSingleEmptyIntIntArray", "[[]]");
+ runTest("assertSingleNullIntIntArray", "[null]");
+ runTest("assertLargeIntIntArray", "[[false], [1], [2, 3], [4, 5, 6], ['7', {valueOf: function() { return 8 }}]]");
+ }
+
+ @Test
+ public void testObjectObjectArrays() throws ScriptException {
+ runTest("assertLargeObjectObjectArray", "[[false], [1], ['foo', 42.3], [{x: 17}]]");
+ }
+
+ @Test
+ public void testBooleanArrays() throws ScriptException {
+ runTest("assertBooleanArrayConversions", "[false, true, '', 'false', 0, 1, 0.4, 0.6, {}, [], [false], [true], NaN, Infinity, null, undefined]");
+ }
+
+ @Test
+ public void testArrayAmbiguity() throws ScriptException {
+ runTest("x", "'abc'");
+ runTest("x", "['foo', 'bar']");
+ }
+
+ @Test
+ public void testListArrays() throws ScriptException {
+ runTest("assertListArray", "[['foo', 'bar'], ['apple', 'orange']]");
+ }
+
+ @Test
+ public void testVarArgs() throws ScriptException {
+ // Sole NativeArray in vararg position becomes vararg array itself
+ runTest("assertVarArg_42_17", "[42, 17]");
+ // NativeArray in vararg position becomes an argument if there are more arguments
+ runTest("assertVarArg_array_17", "[42], 18");
+ // Only NativeArray is converted to vararg array, other objects (e.g. a function) aren't
+ runTest("assertVarArg_function", "function() { return 'Hello' }");
+ }
+
+ private static void runTest(final String testMethodName, final String argument) throws ScriptException {
+ e.eval("Java.type('" + ArrayConversionTest.class.getName() + "')." + testMethodName + "(" + argument + ")");
+ }
+
+ public static void assertNullIntArray(int[] array) {
+ assertNull(array);
+ }
+
+ public static void assertNullIntIntArray(int[][] array) {
+ assertNull(array);
+ }
+
+ public static void assertEmptyIntArray(int[] array) {
+ assertEquals(0, array.length);
+ }
+
+ public static void assertSingle42IntArray(int[] array) {
+ assertEquals(1, array.length);
+ assertEquals(42, array[0]);
+ }
+
+
+ public static void assertIntArrayConversions(int[] array) {
+ assertEquals(13, array.length);
+ assertEquals(0, array[0]); // false
+ assertEquals(1, array[1]); // true
+ assertEquals(0, array[2]); // NaN
+ assertEquals(0, array[3]); // Infinity
+ assertEquals(0, array[4]); // -Infinity
+ assertEquals(0, array[5]); // 0.4
+ assertEquals(0, array[6]); // 0.6 - floor, not round
+ assertEquals(0, array[7]); // null
+ assertEquals(0, array[8]); // undefined
+ assertEquals(0, array[9]); // []
+ assertEquals(0, array[10]); // {}
+ assertEquals(1, array[11]); // [1]
+ assertEquals(0, array[12]); // [1, 2]
+ }
+
+ public static void assertEmptyIntIntArray(int[][] array) {
+ assertEquals(0, array.length);
+ }
+
+ public static void assertSingleEmptyIntIntArray(int[][] array) {
+ assertEquals(1, array.length);
+ assertTrue(Arrays.equals(new int[0], array[0]));
+ }
+
+ public static void assertSingleNullIntIntArray(int[][] array) {
+ assertEquals(1, array.length);
+ assertNull(null, array[0]);
+ }
+
+ public static void assertLargeIntIntArray(int[][] array) {
+ assertEquals(5, array.length);
+ assertTrue(Arrays.equals(new int[] { 0 }, array[0]));
+ assertTrue(Arrays.equals(new int[] { 1 }, array[1]));
+ assertTrue(Arrays.equals(new int[] { 2, 3 }, array[2]));
+ assertTrue(Arrays.equals(new int[] { 4, 5, 6 }, array[3]));
+ assertTrue(Arrays.equals(new int[] { 7, 8 }, array[4]));
+ }
+
+ public static void assertLargeObjectObjectArray(Object[][] array) throws ScriptException {
+ assertEquals(4, array.length);
+ assertTrue(Arrays.equals(new Object[] { Boolean.FALSE }, array[0]));
+ assertTrue(Arrays.equals(new Object[] { 1 }, array[1]));
+ assertTrue(Arrays.equals(new Object[] { "foo", 42.3d }, array[2]));
+ assertEquals(1, array[3].length);
+ e.getBindings(ScriptContext.ENGINE_SCOPE).put("obj", array[3][0]);
+ assertEquals(17, e.eval("obj.x"));
+ }
+
+ public static void assertBooleanArrayConversions(boolean[] array) {
+ assertEquals(16, array.length);
+ assertFalse(array[0]); // false
+ assertTrue(array[1]); // true
+ assertFalse(array[2]); // ''
+ assertTrue(array[3]); // 'false' (yep, every non-empty string converts to true)
+ assertFalse(array[4]); // 0
+ assertTrue(array[5]); // 1
+ assertTrue(array[6]); // 0.4
+ assertTrue(array[7]); // 0.6
+ assertTrue(array[8]); // {}
+ assertTrue(array[9]); // []
+ assertTrue(array[10]); // [false]
+ assertTrue(array[11]); // [true]
+ assertFalse(array[12]); // NaN
+ assertTrue(array[13]); // Infinity
+ assertFalse(array[14]); // null
+ assertFalse(array[15]); // undefined
+ }
+
+ public static void assertListArray(List<?>[] array) {
+ assertEquals(2, array.length);
+ assertEquals(Arrays.asList("foo", "bar"), array[0]);
+ assertEquals(Arrays.asList("apple", "orange"), array[1]);
+ }
+
+ public static void assertVarArg_42_17(Object... args) throws ScriptException {
+ assertEquals(2, args.length);
+ assertEquals(42, ((Number)args[0]).intValue());
+ assertEquals(17, ((Number)args[1]).intValue());
+ }
+
+ public static void assertVarArg_array_17(Object... args) throws ScriptException {
+ assertEquals(2, args.length);
+ e.getBindings(ScriptContext.ENGINE_SCOPE).put("arr", args[0]);
+ assertTrue((Boolean)e.eval("arr instanceof Array && arr.length == 1 && arr[0] == 42"));
+ assertEquals(18, ((Number)args[1]).intValue());
+ }
+
+ public static void assertVarArg_function(Object... args) throws ScriptException {
+ assertEquals(1, args.length);
+ e.getBindings(ScriptContext.ENGINE_SCOPE).put("fn", args[0]);
+ assertEquals("Hello", e.eval("fn()"));
+ }
+
+
+
+ public static void x(String y) {
+ assertEquals("abc", y);
+ }
+ public static void x(String[] y) {
+ assertTrue(Arrays.equals(new String[] { "foo", "bar"}, y));
+ }
+}