--- a/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -364,3 +364,4 @@
caf97b37ebec84288c112d21d3a60cb628cba1e8 jdk-9+119
9330543436402b8f3bd070524846a464d8143557 jdk-9+120
18e5cdecb37a2f03ba74f6c8f022858bcbaacf56 jdk-9+121
+7693aa00e131493ceb42b93305e2f014c9922a3b jdk-9+122
--- a/.hgtags-top-repo Fri Jun 10 15:13:40 2016 -0700
+++ b/.hgtags-top-repo Tue Jun 14 10:22:07 2016 -0700
@@ -364,3 +364,4 @@
3463a3f14f0f0e8a68f29ac6405454f2fa2f598a jdk-9+119
647e0142a5a52749db572b5e6638d561def6479e jdk-9+120
cae471d3b87783e0a3deea658e1e1c84b2485b6c jdk-9+121
+346be2df0f5b31d423807f53a719d1b9a67f3354 jdk-9+122
--- a/common/autoconf/basics.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/basics.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -99,8 +99,8 @@
$ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD
$ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD
OUTPUT=`$3 $1 -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
$2="[$]$2 $1"
JVM_ARG_OK=true
@@ -715,7 +715,7 @@
if test -n "$SDKNAME"; then
# Call xcodebuild to determine SYSROOT
- SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+ SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | $GREP '^Path: ' | $SED 's/Path: //'`
fi
else
if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
@@ -994,18 +994,18 @@
TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
if test -f $DELETEDIR/TestIfFindSupportsDelete; then
# No, it does not.
- rm $DELETEDIR/TestIfFindSupportsDelete
+ $RM $DELETEDIR/TestIfFindSupportsDelete
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
# AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
- FIND_DELETE="-print | xargs rm"
+ FIND_DELETE="-print | $XARGS $RM"
else
- FIND_DELETE="-exec rm \{\} \+"
+ FIND_DELETE="-exec $RM \{\} \+"
fi
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
fi
- rmdir $DELETEDIR
+ $RMDIR $DELETEDIR
AC_SUBST(FIND_DELETE)
])
@@ -1080,10 +1080,10 @@
if test "x$CODESIGN" != "x"; then
# Verify that the openjdk_codesign certificate is present
AC_MSG_CHECKING([if openjdk_codesign certificate is present])
- rm -f codesign-testfile
- touch codesign-testfile
- codesign -s openjdk_codesign codesign-testfile 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD || CODESIGN=
- rm -f codesign-testfile
+ $RM codesign-testfile
+ $TOUCH codesign-testfile
+ $CODESIGN -s openjdk_codesign codesign-testfile 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD || CODESIGN=
+ $RM codesign-testfile
if test "x$CODESIGN" = x; then
AC_MSG_RESULT([no])
else
--- a/common/autoconf/basics_windows.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/basics_windows.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -330,7 +330,7 @@
fi
AC_MSG_CHECKING([cygwin root directory as unix-style path])
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
- cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
+ cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"`
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
AC_MSG_RESULT([$CYGWIN_ROOT_PATH])
@@ -349,7 +349,7 @@
AC_MSG_CHECKING([msys root directory as unix-style path])
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
- MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
+ MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(MSYS_ROOT_PATH)
AC_MSG_RESULT([$MSYS_ROOT_PATH])
WINDOWS_ENV_ROOT_PATH="$MSYS_ROOT_PATH"
@@ -392,7 +392,7 @@
# 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`
+ | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
fi
--- a/common/autoconf/boot-jdk.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/boot-jdk.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -74,7 +74,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`]
@@ -445,7 +445,7 @@
BUILD_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`]
--- a/common/autoconf/build-performance.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/build-performance.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -383,7 +383,7 @@
else
AC_MSG_RESULT([yes])
fi
- rm -f conftest.h conftest.hpp.gch
+ $RM conftest.h conftest.hpp.gch
fi
fi
--- a/common/autoconf/flags.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/flags.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -155,7 +155,7 @@
AC_MSG_RESULT(no)
COMPILER_COMMAND_FILE_FLAG=
fi
- rm -rf command.file
+ $RM command.file
fi
fi
AC_SUBST(COMPILER_TARGET_BITS_FLAG)
--- a/common/autoconf/generated-configure.sh Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/generated-configure.sh Tue Jun 14 10:22:07 2016 -0700
@@ -5092,7 +5092,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1464173584
+DATE_WHEN_GENERATED=1465306933
###############################################################################
#
@@ -16171,7 +16171,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cygwin root directory as unix-style path" >&5
$as_echo_n "checking cygwin root directory as unix-style path... " >&6; }
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
- cygwin_winpath_root=`cd / ; cmd /c cd | grep ".*"`
+ cygwin_winpath_root=`cd / ; cmd /c cd | $GREP ".*"`
# Force cygpath to report the proper root by including a trailing space, and then stripping it off again.
CYGWIN_ROOT_PATH=`$CYGPATH -u "$cygwin_winpath_root " | $CUT -f 1 -d " "`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGWIN_ROOT_PATH" >&5
@@ -16194,7 +16194,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking msys root directory as unix-style path" >&5
$as_echo_n "checking msys root directory as unix-style path... " >&6; }
# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away
- MSYS_ROOT_PATH=`cd / ; cmd /c cd | grep ".*"`
+ MSYS_ROOT_PATH=`cd / ; cmd /c cd | $GREP ".*"`
windows_path="$MSYS_ROOT_PATH"
if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
@@ -17185,7 +17185,7 @@
if test -n "$SDKNAME"; then
# Call xcodebuild to determine SYSROOT
- SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | grep '^Path: ' | sed 's/Path: //'`
+ SYSROOT=`"$XCODEBUILD" -sdk $SDKNAME -version | $GREP '^Path: ' | $SED 's/Path: //'`
fi
else
if test $HAVE_SYSTEM_FRAMEWORK_HEADERS -eq 0; then
@@ -21142,12 +21142,12 @@
TEST_DELETE=`$FIND "$DELETEDIR" -name TestIfFindSupportsDelete $FIND_DELETE 2>&1`
if test -f $DELETEDIR/TestIfFindSupportsDelete; then
# No, it does not.
- rm $DELETEDIR/TestIfFindSupportsDelete
+ $RM $DELETEDIR/TestIfFindSupportsDelete
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
# AIX 'find' is buggy if called with '-exec {} \+' and an empty file list
- FIND_DELETE="-print | xargs rm"
- else
- FIND_DELETE="-exec rm \{\} \+"
+ FIND_DELETE="-print | $XARGS $RM"
+ else
+ FIND_DELETE="-exec $RM \{\} \+"
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -21155,7 +21155,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
- rmdir $DELETEDIR
+ $RMDIR $DELETEDIR
@@ -23800,10 +23800,10 @@
# Verify that the openjdk_codesign certificate is present
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if openjdk_codesign certificate is present" >&5
$as_echo_n "checking if openjdk_codesign certificate is present... " >&6; }
- rm -f codesign-testfile
- touch codesign-testfile
- codesign -s openjdk_codesign codesign-testfile 2>&5 >&5 || CODESIGN=
- rm -f codesign-testfile
+ $RM codesign-testfile
+ $TOUCH codesign-testfile
+ $CODESIGN -s openjdk_codesign codesign-testfile 2>&5 >&5 || CODESIGN=
+ $RM codesign-testfile
if test "x$CODESIGN" = x; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
@@ -24293,7 +24293,7 @@
elif test "x$with_copyright_year" != x; then
COPYRIGHT_YEAR="$with_copyright_year"
else
- COPYRIGHT_YEAR=`date +'%Y'`
+ COPYRIGHT_YEAR=`$DATE +'%Y'`
fi
@@ -24815,7 +24815,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25017,7 +25017,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25207,7 +25207,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25396,7 +25396,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25585,7 +25585,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -25765,7 +25765,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26096,7 +26096,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26427,7 +26427,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26645,7 +26645,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -26828,7 +26828,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27039,7 +27039,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27222,7 +27222,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27433,7 +27433,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27616,7 +27616,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -27827,7 +27827,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28010,7 +28010,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28208,7 +28208,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28389,7 +28389,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28588,7 +28588,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28769,7 +28769,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -28967,7 +28967,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29148,7 +29148,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29347,7 +29347,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29528,7 +29528,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -29708,7 +29708,7 @@
BOOT_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"|(1\.[89]\.)'`
@@ -30612,8 +30612,8 @@
$ECHO "Check if jvm arg is ok: -Xpatch:foo=bar" >&5
$ECHO "Command: $JAVA -Xpatch:foo=bar -version" >&5
OUTPUT=`$JAVA -Xpatch:foo=bar -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
dummy="$dummy -Xpatch:foo=bar"
JVM_ARG_OK=true
@@ -30697,7 +30697,7 @@
BUILD_JDK_FOUND=no
else
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
- BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | head -n 1`
+ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
# Extra M4 quote needed to protect [] in grep expression.
FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP '\"9([\.+-].*)?\"'`
@@ -47860,7 +47860,7 @@
$as_echo "yes" >&6; }
USING_BROKEN_SUSE_LD=yes
fi
- rm -rf version-script.map main.c a.out
+ $RM version-script.map main.c a.out
fi
@@ -48294,7 +48294,7 @@
$as_echo "no" >&6; }
COMPILER_COMMAND_FILE_FLAG=
fi
- rm -rf command.file
+ $RM command.file
fi
fi
@@ -53498,7 +53498,7 @@
# 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`
+ | tr ' ' '\n' | $GREP '^/./' | $SORT | $UNIQ`
fixpath_argument_list=`echo $all_unique_prefixes | tr ' ' '@'`
FIXPATH="$FIXPATH_BIN -m$fixpath_argument_list"
fi
@@ -63947,7 +63947,7 @@
fi
fi
done
- llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
+ llvm_version=$("${LLVM_CONFIG}" --version | $SED 's/\.//; s/svn.*//')
LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
unset LLVM_LDFLAGS
@@ -65050,8 +65050,8 @@
$ECHO "Check if jvm arg is ok: -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput" >&5
$ECHO "Command: $JAVA -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput -version" >&5
OUTPUT=`$JAVA -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs="$boot_jdk_jvmargs -XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput"
JVM_ARG_OK=true
@@ -65067,8 +65067,8 @@
$ECHO "Check if jvm arg is ok: $with_boot_jdk_jvmargs" >&5
$ECHO "Command: $JAVA $with_boot_jdk_jvmargs -version" >&5
OUTPUT=`$JAVA $with_boot_jdk_jvmargs -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs="$boot_jdk_jvmargs $with_boot_jdk_jvmargs"
JVM_ARG_OK=true
@@ -65095,8 +65095,8 @@
$ECHO "Check if jvm arg is ok: -Xms64M" >&5
$ECHO "Command: $JAVA -Xms64M -version" >&5
OUTPUT=`$JAVA -Xms64M -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xms64M"
JVM_ARG_OK=true
@@ -65130,8 +65130,8 @@
$ECHO "Check if jvm arg is ok: -Xmx${JVM_MAX_HEAP}M" >&5
$ECHO "Command: $JAVA -Xmx${JVM_MAX_HEAP}M -version" >&5
OUTPUT=`$JAVA -Xmx${JVM_MAX_HEAP}M -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -Xmx${JVM_MAX_HEAP}M"
JVM_ARG_OK=true
@@ -65145,8 +65145,8 @@
$ECHO "Check if jvm arg is ok: -XX:ThreadStackSize=$STACK_SIZE" >&5
$ECHO "Command: $JAVA -XX:ThreadStackSize=$STACK_SIZE -version" >&5
OUTPUT=`$JAVA -XX:ThreadStackSize=$STACK_SIZE -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_big="$boot_jdk_jvmargs_big -XX:ThreadStackSize=$STACK_SIZE"
JVM_ARG_OK=true
@@ -65175,8 +65175,8 @@
$ECHO "Check if jvm arg is ok: -XX:+UseSerialGC" >&5
$ECHO "Command: $JAVA -XX:+UseSerialGC -version" >&5
OUTPUT=`$JAVA -XX:+UseSerialGC -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:+UseSerialGC"
JVM_ARG_OK=true
@@ -65190,8 +65190,8 @@
$ECHO "Check if jvm arg is ok: -Xms32M" >&5
$ECHO "Command: $JAVA -Xms32M -version" >&5
OUTPUT=`$JAVA -Xms32M -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xms32M"
JVM_ARG_OK=true
@@ -65205,8 +65205,8 @@
$ECHO "Check if jvm arg is ok: -Xmx512M" >&5
$ECHO "Command: $JAVA -Xmx512M -version" >&5
OUTPUT=`$JAVA -Xmx512M -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -Xmx512M"
JVM_ARG_OK=true
@@ -65220,8 +65220,8 @@
$ECHO "Check if jvm arg is ok: -XX:TieredStopAtLevel=1" >&5
$ECHO "Command: $JAVA -XX:TieredStopAtLevel=1 -version" >&5
OUTPUT=`$JAVA -XX:TieredStopAtLevel=1 -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
boot_jdk_jvmargs_small="$boot_jdk_jvmargs_small -XX:TieredStopAtLevel=1"
JVM_ARG_OK=true
@@ -65270,8 +65270,8 @@
$ECHO "Check if jvm arg is ok: -d64" >&5
$ECHO "Command: $SJAVAC_SERVER_JAVA -d64 -version" >&5
OUTPUT=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64"
JVM_ARG_OK=true
@@ -65308,8 +65308,8 @@
$ECHO "Check if jvm arg is ok: -Xms${MS_VALUE}M -Xmx${MX_VALUE}M" >&5
$ECHO "Command: $SJAVAC_SERVER_JAVA -Xms${MS_VALUE}M -Xmx${MX_VALUE}M -version" >&5
OUTPUT=`$SJAVAC_SERVER_JAVA -Xms${MS_VALUE}M -Xmx${MX_VALUE}M -version 2>&1`
- FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
- FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
+ FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
+ FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -Xms${MS_VALUE}M -Xmx${MX_VALUE}M"
JVM_ARG_OK=true
@@ -66140,7 +66140,7 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
fi
- rm -f conftest.h conftest.hpp.gch
+ $RM conftest.h conftest.hpp.gch
fi
fi
--- a/common/autoconf/jdk-options.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/jdk-options.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -224,7 +224,7 @@
elif test "x$with_copyright_year" != x; then
COPYRIGHT_YEAR="$with_copyright_year"
else
- COPYRIGHT_YEAR=`date +'%Y'`
+ COPYRIGHT_YEAR=`$DATE +'%Y'`
fi
AC_SUBST(COPYRIGHT_YEAR)
])
--- a/common/autoconf/libraries.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/libraries.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -122,7 +122,7 @@
fi
fi
done
- llvm_version=$("${LLVM_CONFIG}" --version | sed 's/\.//; s/svn.*//')
+ llvm_version=$("${LLVM_CONFIG}" --version | $SED 's/\.//; s/svn.*//')
LLVM_CFLAGS="${LLVM_CFLAGS} -DSHARK_LLVM_VERSION=${llvm_version}"
unset LLVM_LDFLAGS
--- a/common/autoconf/toolchain.m4 Fri Jun 10 15:13:40 2016 -0700
+++ b/common/autoconf/toolchain.m4 Tue Jun 14 10:22:07 2016 -0700
@@ -934,7 +934,7 @@
AC_MSG_RESULT(yes)
USING_BROKEN_SUSE_LD=yes
fi
- rm -rf version-script.map main.c a.out
+ $RM version-script.map main.c a.out
fi
AC_SUBST(USING_BROKEN_SUSE_LD)
--- a/corba/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/corba/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -364,3 +364,4 @@
daf533920b1266603b5cbdab31908d2a931c5361 jdk-9+119
5943b791e131e79b969d4cea053aecda34801723 jdk-9+120
9a5fc5a27560ac272c1341f8f3838338fba49059 jdk-9+121
+a39131aafc51a6fd8836e6ebe1b04458702ce7d6 jdk-9+122
--- a/hotspot/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/hotspot/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -524,3 +524,4 @@
15f3fe264872766bcb205696198f0c1502420e17 jdk-9+119
0be6f4f5d18671184e62583668cb1d783dffa128 jdk-9+120
7e293105dbb0789a468655f81320c891f491f371 jdk-9+121
+af6b4ad908e732d23021f12e8322b204433d5cf6 jdk-9+122
--- a/jaxp/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/jaxp/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -364,3 +364,4 @@
f92e8518bb34a9628b11e662bf7308561a55eb3b jdk-9+119
ecbe72546137cd29cb73d4dcc81cc099e847d543 jdk-9+120
a265b8116058c56179c321c38618570b780329be jdk-9+121
+f8899b1884e2c4a000dbcc5b1a80954245fe462e jdk-9+122
--- a/jaxws/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/jaxws/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -367,3 +367,4 @@
331a825f849afd2e5126c93c88e55bd9ef0c6b8f jdk-9+119
ecd0d6a71c7ccf93584ba4dacdd4fa8455efd741 jdk-9+120
fb771fa3a986ccfcb00d743b1956b98c380d1dd8 jdk-9+121
+342705d785ffd9e999991a3d4baae2eca58ea7c3 jdk-9+122
--- a/jdk/src/java.base/macosx/classes/module-info.java.extra Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/macosx/classes/module-info.java.extra Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,4 +24,3 @@
*/
exports jdk.internal.loader to java.desktop;
-provides java.security.Provider with apple.security.AppleProvider;
--- a/jdk/src/java.base/share/classes/java/lang/Class.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java Tue Jun 14 10:22:07 2016 -0700
@@ -480,6 +480,24 @@
* any exception thrown by the constructor in a (checked) {@link
* java.lang.reflect.InvocationTargetException}.
*
+ * <p>The call
+ *
+ * <pre>{@code
+ * clazz.newInstance()
+ * }</pre>
+ *
+ * can be replaced by
+ *
+ * <pre>{@code
+ * clazz.getConstructor().newInstance()
+ * }</pre>
+ *
+ * The latter sequence of calls is inferred to be able to throw
+ * the additional exception types {@link
+ * InvocationTargetException} and {@link
+ * NoSuchMethodException}. Both of these exception types are
+ * subclasses of {@link ReflectiveOperationException}.
+ *
* @return a newly allocated instance of the class represented by this
* object.
* @throws IllegalAccessException if the class or its nullary
--- a/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java Tue Jun 14 10:22:07 2016 -0700
@@ -790,10 +790,10 @@
private final String osName;
private final String osArch;
private final String osVersion;
- private final Set<String> conceals;
private final Set<String> packages;
private final ModuleHashes hashes;
+
private ModuleDescriptor(String name,
boolean automatic,
boolean synthetic,
@@ -806,7 +806,7 @@
String osName,
String osArch,
String osVersion,
- Set<String> conceals,
+ Set<String> packages,
ModuleHashes hashes)
{
@@ -836,10 +836,7 @@
this.osVersion = osVersion;
this.hashes = hashes;
- assert !exports.keySet().stream().anyMatch(conceals::contains)
- : "Module " + name + ": Package sets overlap";
- this.conceals = emptyOrUnmodifiableSet(conceals);
- this.packages = computePackages(this.exports, this.conceals);
+ this.packages = emptyOrUnmodifiableSet(packages);
}
/**
@@ -862,8 +859,9 @@
this.osVersion = md.osVersion;
this.hashes = null; // need to ignore
- this.packages = emptyOrUnmodifiableSet(pkgs);
- this.conceals = computeConcealedPackages(this.exports, this.packages);
+ Set<String> packages = new HashSet<>(md.packages);
+ packages.addAll(pkgs);
+ this.packages = emptyOrUnmodifiableSet(packages);
}
/**
@@ -882,7 +880,6 @@
String osName,
String osArch,
String osVersion,
- Set<String> conceals,
Set<String> packages,
ModuleHashes hashes) {
this.name = name;
@@ -892,7 +889,6 @@
this.exports = Collections.unmodifiableSet(exports);
this.uses = Collections.unmodifiableSet(uses);
this.provides = Collections.unmodifiableMap(provides);
- this.conceals = Collections.unmodifiableSet(conceals);
this.packages = Collections.unmodifiableSet(packages);
this.version = version;
@@ -1055,7 +1051,9 @@
* @return A possibly-empty unmodifiable set of the concealed packages
*/
public Set<String> conceals() {
- return conceals;
+ Set<String> conceals = new HashSet<>(packages);
+ exports.stream().map(Exports::source).forEach(conceals::remove);
+ return emptyOrUnmodifiableSet(conceals);
}
/**
@@ -1605,6 +1603,8 @@
public ModuleDescriptor build() {
assert name != null;
+ Set<String> packages = new HashSet<>(conceals);
+ packages.addAll(exportedPackages());
return new ModuleDescriptor(name,
automatic,
synthetic,
@@ -1617,7 +1617,7 @@
osName,
osArch,
osVersion,
- conceals,
+ packages,
hashes);
}
@@ -1692,7 +1692,7 @@
&& Objects.equals(osName, that.osName)
&& Objects.equals(osArch, that.osArch)
&& Objects.equals(osVersion, that.osVersion)
- && Objects.equals(conceals, that.conceals)
+ && Objects.equals(packages, that.packages)
&& Objects.equals(hashes, that.hashes));
}
@@ -1723,7 +1723,7 @@
hc = hc * 43 + Objects.hashCode(osName);
hc = hc * 43 + Objects.hashCode(osArch);
hc = hc * 43 + Objects.hashCode(osVersion);
- hc = hc * 43 + Objects.hashCode(conceals);
+ hc = hc * 43 + Objects.hashCode(packages);
hc = hc * 43 + Objects.hashCode(hashes);
if (hc == 0)
hc = -1;
@@ -1879,37 +1879,6 @@
return ModuleInfo.read(bb, null);
}
-
- /**
- * Computes the set of packages from exports and concealed packages.
- * It returns the concealed packages set if there is no exported package.
- */
- private static Set<String> computePackages(Set<Exports> exports,
- Set<String> conceals)
- {
- if (exports.isEmpty())
- return conceals;
-
- Set<String> pkgs = new HashSet<>(conceals);
- exports.stream().map(Exports::source).forEach(pkgs::add);
- return emptyOrUnmodifiableSet(pkgs);
- }
-
- /**
- * Computes the set of concealed packages from exports and all packages.
- * It returns the packages set if there are no exported packages.
- */
- private static Set<String> computeConcealedPackages(Set<Exports> exports,
- Set<String> pkgs)
- {
- if (exports.isEmpty())
- return pkgs;
-
- Set<String> conceals = new HashSet<>(pkgs);
- exports.stream().map(Exports::source).forEach(conceals::remove);
- return emptyOrUnmodifiableSet(conceals);
- }
-
private static <K,V> Map<K,V> emptyOrUnmodifiableMap(Map<K,V> map) {
if (map.isEmpty()) {
return Collections.emptyMap();
@@ -1975,14 +1944,14 @@
boolean automatic,
boolean synthetic,
Set<Requires> requires,
- Set<String> uses, Set<Exports> exports,
+ Set<String> uses,
+ Set<Exports> exports,
Map<String, Provides> provides,
Version version,
String mainClass,
String osName,
String osArch,
String osVersion,
- Set<String> conceals,
Set<String> packages,
ModuleHashes hashes) {
return new ModuleDescriptor(name,
@@ -1997,7 +1966,6 @@
osName,
osArch,
osVersion,
- conceals,
packages,
hashes);
}
--- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.MethodAccessor;
import jdk.internal.reflect.Reflection;
+import sun.reflect.annotation.ExceptionProxy;
+import sun.reflect.annotation.TypeNotPresentExceptionProxy;
import sun.reflect.generics.repository.MethodRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
@@ -641,8 +643,13 @@
SharedSecrets.getJavaLangAccess().
getConstantPool(getDeclaringClass()),
getDeclaringClass());
- if (result instanceof sun.reflect.annotation.ExceptionProxy)
+ if (result instanceof ExceptionProxy) {
+ if (result instanceof TypeNotPresentExceptionProxy) {
+ TypeNotPresentExceptionProxy proxy = (TypeNotPresentExceptionProxy)result;
+ throw new TypeNotPresentException(proxy.typeName(), proxy.getCause());
+ }
throw new AnnotationFormatError("Invalid default: " + this);
+ }
return result;
}
--- a/jdk/src/java.base/share/classes/java/security/DrbgParameters.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/java/security/DrbgParameters.java Tue Jun 14 10:22:07 2016 -0700
@@ -383,6 +383,10 @@
private Instantiation(int strength, Capability capability,
byte[] personalizationString) {
+ if (strength < -1) {
+ throw new IllegalArgumentException(
+ "Illegal security strength: " + strength);
+ }
this.strength = strength;
this.capability = capability;
this.personalizationString = (personalizationString == null) ?
@@ -446,6 +450,10 @@
private NextBytes(int strength, boolean predictionResistance,
byte[] additionalInput) {
+ if (strength < -1) {
+ throw new IllegalArgumentException(
+ "Illegal security strength: " + strength);
+ }
this.strength = strength;
this.predictionResistance = predictionResistance;
this.additionalInput = (additionalInput == null) ?
@@ -502,6 +510,7 @@
* byte array will be copied.
* @return a new {@code Instantiation} object
* @throws NullPointerException if {@code capability} is {@code null}
+ * @throws IllegalArgumentException if {@code strength} is less than -1
*/
public static Instantiation instantiation(int strength,
Capability capability,
@@ -518,6 +527,7 @@
* @param predictionResistance prediction resistance requested
* @param additionalInput additional input, can be {@code null}.
* The content of this byte array will be copied.
+ * @throws IllegalArgumentException if {@code strength} is less than -1
* @return a new {@code NextBytes} object
*/
public static NextBytes nextBytes(int strength,
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java Tue Jun 14 10:22:07 2016 -0700
@@ -99,7 +99,6 @@
String osName,
String osArch,
String osVersion,
- Set<String> conceals,
Set<String> packages,
ModuleHashes hashes);
--- a/jdk/src/java.base/share/classes/jdk/internal/module/Builder.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/jdk/internal/module/Builder.java Tue Jun 14 10:22:07 2016 -0700
@@ -66,8 +66,7 @@
final Set<Requires> requires;
final Set<Exports> exports;
final Map<String, Provides> provides;
- final Set<String> conceals;
- final int numPackages;
+ Set<String> packages;
Set<String> uses;
Version version;
String mainClass;
@@ -78,14 +77,12 @@
Map<String, String> hashes;
Builder(String name, int reqs, int exports,
- int provides, int conceals, int packages) {
+ int provides, int packages) {
this.name = name;
this.requires = reqs > 0 ? new HashSet<>(reqs) : Collections.emptySet();
this.exports = exports > 0 ? new HashSet<>(exports) : Collections.emptySet();
this.provides = provides > 0 ? new HashMap<>(provides) : Collections.emptyMap();
- this.conceals = conceals > 0 ? new HashSet<>(conceals) : Collections.emptySet();
this.uses = Collections.emptySet();
- this.numPackages = packages;
}
/**
@@ -169,18 +166,10 @@
}
/**
- * Adds a set of (possible empty) concealed packages.
+ * Adds a set of (possible empty) packages.
*/
- public Builder conceals(Set<String> packages) {
- conceals.addAll(packages);
- return this;
- }
-
- /**
- * Adds a concealed package.
- */
- public Builder conceals(String pn) {
- conceals.add(pn);
+ public Builder packages(Set<String> packages) {
+ this.packages = packages;
return this;
}
@@ -273,22 +262,6 @@
}
/**
- * Returns the set of packages that is the union of the exported and
- * concealed packages.
- */
- private Set<String> computePackages(Set<Exports> exports, Set<String> conceals) {
- if (exports.isEmpty())
- return conceals;
-
- Set<String> pkgs = new HashSet<>(numPackages);
- pkgs.addAll(conceals);
- for (Exports e : exports) {
- pkgs.add(e.source());
- }
- return pkgs;
- }
-
- /**
* Builds a {@code ModuleDescriptor} from the components.
*/
public ModuleDescriptor build() {
@@ -309,8 +282,7 @@
osName,
osArch,
osVersion,
- conceals,
- computePackages(exports, conceals),
+ packages,
moduleHashes);
}
}
--- a/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeNotPresentExceptionProxy.java Tue Jun 14 10:22:07 2016 -0700
@@ -46,6 +46,14 @@
return new TypeNotPresentException(typeName, cause);
}
+ public String typeName() {
+ return typeName;
+ }
+
+ public Throwable getCause() {
+ return cause;
+ }
+
@Override
public String toString() {
return typeName + ".class /* Warning: type not present! */";
--- a/jdk/src/java.base/share/classes/sun/security/provider/SHA3.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SHA3.java Tue Jun 14 10:22:07 2016 -0700
@@ -61,14 +61,14 @@
0x8000000000008080L, 0x80000001L, 0x8000000080008008L,
};
- private byte[] state;
+ private byte[] state = new byte[WIDTH];
+ private final long[] lanes = new long[DM*DM];
/**
* Creates a new SHA-3 object.
*/
SHA3(String name, int digestLength) {
super(name, digestLength, (WIDTH - (2 * digestLength)));
- implReset();
}
/**
@@ -79,7 +79,7 @@
for (int i = 0; i < buffer.length; i++) {
state[i] ^= b[ofs++];
}
- state = keccak(state);
+ keccak();
}
/**
@@ -95,7 +95,7 @@
for (int i = 0; i < buffer.length; i++) {
state[i] ^= buffer[i];
}
- state = keccak(state);
+ keccak();
System.arraycopy(state, 0, out, ofs, engineGetDigestLength());
}
@@ -103,15 +103,8 @@
* Resets the internal state to start a new hash.
*/
void implReset() {
- state = new byte[WIDTH];
- }
-
- /**
- * Utility function for circular shift the specified long
- * value to the left for n bits.
- */
- private static long circularShiftLeft(long lane, int n) {
- return ((lane << n) | (lane >>> (64 - n)));
+ Arrays.fill(state, (byte)0);
+ Arrays.fill(lanes, 0L);
}
/**
@@ -132,115 +125,119 @@
}
/**
- * Utility function for transforming the specified state from
- * the byte array format into array of lanes as defined in
- * section 3.1.2.
+ * Utility function for transforming the specified byte array 's'
+ * into array of lanes 'm' as defined in section 3.1.2.
*/
- private static long[][] bytes2Lanes(byte[] s) {
- if (s.length != WIDTH) {
- throw new ProviderException("Error: incorrect input size " +
- s.length);
+ private static void bytes2Lanes(byte[] s, long[] m) {
+ int sOfs = 0;
+ // Conversion traverses along x-axis before y-axis
+ for (int y = 0; y < DM; y++, sOfs += 40) {
+ b2lLittle(s, sOfs, m, DM*y, 40);
}
- // The conversion traverses along x-axis before y-axis. So, y is the
- // first dimension and x is the second dimension.
- long[][] s2 = new long[DM][DM];
- int sOfs = 0;
- for (int y = 0; y < DM; y++, sOfs += 40) {
- b2lLittle(s, sOfs, s2[y], 0, 40);
- }
- return s2;
}
/**
- * Utility function for transforming the specified arrays of
- * lanes into a byte array as defined in section 3.1.3.
+ * Utility function for transforming the specified array of
+ * lanes 'm' into a byte array 's' as defined in section 3.1.3.
*/
- private static byte[] lanes2Bytes(long[][] m) {
- byte[] s = new byte[WIDTH];
+ private static void lanes2Bytes(long[] m, byte[] s) {
int sOfs = 0;
- // The conversion traverses along x-axis before y-axis. So, y is the
- // first dimension and x is the second dimension.
+ // Conversion traverses along x-axis before y-axis
for (int y = 0; y < DM; y++, sOfs += 40) {
- l2bLittle(m[y], 0, s, sOfs, 40);
+ l2bLittle(m, DM*y, s, sOfs, 40);
}
- return s;
}
/**
* Step mapping Theta as defined in section 3.2.1 .
*/
- private static long[][] smTheta(long[][] a) {
- long[] c = new long[DM];
- for (int i = 0; i < DM; i++) {
- c[i] = a[0][i]^a[1][i]^a[2][i]^a[3][i]^a[4][i];
- }
- long[] d = new long[DM];
- for (int i = 0; i < DM; i++) {
- long c1 = c[(i + 4) % DM];
- // left shift and wrap the leftmost bit into the rightmost bit
- long c2 = circularShiftLeft(c[(i + 1) % DM], 1);
- d[i] = c1^c2;
- }
- for (int y = 0; y < DM; y++) {
- for (int x = 0; x < DM; x++) {
- a[y][x] ^= d[x];
- }
+ private static long[] smTheta(long[] a) {
+ long c0 = a[0]^a[5]^a[10]^a[15]^a[20];
+ long c1 = a[1]^a[6]^a[11]^a[16]^a[21];
+ long c2 = a[2]^a[7]^a[12]^a[17]^a[22];
+ long c3 = a[3]^a[8]^a[13]^a[18]^a[23];
+ long c4 = a[4]^a[9]^a[14]^a[19]^a[24];
+ long d0 = c4 ^ Long.rotateLeft(c1, 1);
+ long d1 = c0 ^ Long.rotateLeft(c2, 1);
+ long d2 = c1 ^ Long.rotateLeft(c3, 1);
+ long d3 = c2 ^ Long.rotateLeft(c4, 1);
+ long d4 = c3 ^ Long.rotateLeft(c0, 1);
+ for (int y = 0; y < a.length; y += DM) {
+ a[y] ^= d0;
+ a[y+1] ^= d1;
+ a[y+2] ^= d2;
+ a[y+3] ^= d3;
+ a[y+4] ^= d4;
}
return a;
}
/**
- * Step mapping Rho as defined in section 3.2.2.
+ * Merged Step mapping Rho (section 3.2.2) and Pi (section 3.2.3).
+ * for performance. Optimization is achieved by precalculating
+ * shift constants for the following loop
+ * int xNext, yNext;
+ * for (int t = 0, x = 1, y = 0; t <= 23; t++, x = xNext, y = yNext) {
+ * int numberOfShift = ((t + 1)*(t + 2)/2) % 64;
+ * a[y][x] = Long.rotateLeft(a[y][x], numberOfShift);
+ * xNext = y;
+ * yNext = (2 * x + 3 * y) % DM;
+ * }
+ * and with inplace permutation.
*/
- private static long[][] smRho(long[][] a) {
- long[][] a2 = new long[DM][DM];
- a2[0][0] = a[0][0];
- int xNext, yNext;
- for (int t = 0, x = 1, y = 0; t <= 23; t++, x = xNext, y = yNext) {
- int numberOfShift = ((t + 1)*(t + 2)/2) % 64;
- a2[y][x] = circularShiftLeft(a[y][x], numberOfShift);
- xNext = y;
- yNext = (2 * x + 3 * y) % DM;
- }
- return a2;
- }
-
- /**
- * Step mapping Pi as defined in section 3.2.3.
- */
- private static long[][] smPi(long[][] a) {
- long[][] a2 = new long[DM][DM];
- for (int y = 0; y < DM; y++) {
- for (int x = 0; x < DM; x++) {
- a2[y][x] = a[x][(x + 3 * y) % DM];
- }
- }
- return a2;
+ private static long[] smPiRho(long[] a) {
+ long tmp = Long.rotateLeft(a[10], 3);
+ a[10] = Long.rotateLeft(a[1], 1);
+ a[1] = Long.rotateLeft(a[6], 44);
+ a[6] = Long.rotateLeft(a[9], 20);
+ a[9] = Long.rotateLeft(a[22], 61);
+ a[22] = Long.rotateLeft(a[14], 39);
+ a[14] = Long.rotateLeft(a[20], 18);
+ a[20] = Long.rotateLeft(a[2], 62);
+ a[2] = Long.rotateLeft(a[12], 43);
+ a[12] = Long.rotateLeft(a[13], 25);
+ a[13] = Long.rotateLeft(a[19], 8);
+ a[19] = Long.rotateLeft(a[23], 56);
+ a[23] = Long.rotateLeft(a[15], 41);
+ a[15] = Long.rotateLeft(a[4], 27);
+ a[4] = Long.rotateLeft(a[24], 14);
+ a[24] = Long.rotateLeft(a[21], 2);
+ a[21] = Long.rotateLeft(a[8], 55);
+ a[8] = Long.rotateLeft(a[16], 45);
+ a[16] = Long.rotateLeft(a[5], 36);
+ a[5] = Long.rotateLeft(a[3], 28);
+ a[3] = Long.rotateLeft(a[18], 21);
+ a[18] = Long.rotateLeft(a[17], 15);
+ a[17] = Long.rotateLeft(a[11], 10);
+ a[11] = Long.rotateLeft(a[7], 6);
+ a[7] = tmp;
+ return a;
}
/**
* Step mapping Chi as defined in section 3.2.4.
*/
- private static long[][] smChi(long[][] a) {
- long[][] a2 = new long[DM][DM];
- for (int y = 0; y < DM; y++) {
- for (int x = 0; x < DM; x++) {
- a2[y][x] = a[y][x] ^
- ((a[y][(x + 1) % DM] ^ 0xFFFFFFFFFFFFFFFFL) &
- a[y][(x + 2) % DM]);
- }
+ private static long[] smChi(long[] a) {
+ for (int y = 0; y < a.length; y+=DM) {
+ long ay0 = a[y];
+ long ay1 = a[y+1];
+ long ay2 = a[y+2];
+ long ay3 = a[y+3];
+ long ay4 = a[y+4];
+ a[y] = ay0 ^ ((~ay1) & ay2);
+ a[y+1] = ay1 ^ ((~ay2) & ay3);
+ a[y+2] = ay2 ^ ((~ay3) & ay4);
+ a[y+3] = ay3 ^ ((~ay4) & ay0);
+ a[y+4] = ay4 ^ ((~ay0) & ay1);
}
- return a2;
+ return a;
}
/**
* Step mapping Iota as defined in section 3.2.5.
- *
- * @return the processed state array
- * @param state the state array to be processed
*/
- private static long[][] smIota(long[][] a, int rndIndex) {
- a[0][0] ^= RC_CONSTANTS[rndIndex];
+ private static long[] smIota(long[] a, int rndIndex) {
+ a[0] ^= RC_CONSTANTS[rndIndex];
return a;
}
@@ -248,12 +245,15 @@
* The function Keccak as defined in section 5.2 with
* rate r = 1600 and capacity c = (digest length x 2).
*/
- private static byte[] keccak(byte[] state) {
- long[][] lanes = bytes2Lanes(state);
+ private void keccak() {
+ // convert the 200-byte state into 25 lanes
+ bytes2Lanes(state, lanes);
+ // process the lanes through step mappings
for (int ir = 0; ir < NR; ir++) {
- lanes = smIota(smChi(smPi(smRho(smTheta(lanes)))), ir);
+ smIota(smChi(smPiRho(smTheta(lanes))), ir);
}
- return lanes2Bytes(lanes);
+ // convert the resulting 25 lanes back into 200-byte state
+ lanes2Bytes(lanes, state);
}
public Object clone() throws CloneNotSupportedException {
--- a/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/locale/LocaleMatcher.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -228,7 +228,8 @@
rangeForRegex = rangeForRegex.substring(0, index);
// if range ends with an extension key, truncate it.
- if (rangeForRegex.lastIndexOf('-') == rangeForRegex.length()-2) {
+ index = rangeForRegex.lastIndexOf('-');
+ if (index >= 0 && index == rangeForRegex.length()-2) {
rangeForRegex =
rangeForRegex.substring(0, rangeForRegex.length()-2);
}
--- a/jdk/src/java.base/share/conf/security/java.security Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/share/conf/security/java.security Tue Jun 14 10:22:07 2016 -0700
@@ -33,9 +33,9 @@
#
# Each provider must implement a subclass of the Provider class.
# To register a provider in this master security properties file,
-# specify the Provider subclass name and priority in the format
+# specify the provider and priority in the format
#
-# security.provider.<n>=<className>
+# security.provider.<n>=<provName | className>
#
# This declares a provider, and specifies its preference
# order n. The preference order is the order in which providers are
@@ -43,20 +43,15 @@
# requested). The order is 1-based; 1 is the most preferred, followed
# by 2, and so on.
#
+# <provName> must specify the name of the Provider as passed to its super
+# class java.security.Provider constructor. This is for providers loaded
+# through the ServiceLoader mechanism.
+#
# <className> must specify the subclass of the Provider class whose
# constructor sets the values of various properties that are required
# for the Java Security API to look up the algorithms or other
-# facilities implemented by the provider.
-#
-# There must be at least one provider specification in java.security.
-# There is a default provider that comes standard with the JDK. It
-# is called the "SUN" provider, and its Provider subclass
-# named Sun appears in the sun.security.provider package. Thus, the
-# "SUN" provider is registered via the following:
-#
-# security.provider.1=sun.security.provider.Sun
-#
-# (The number 1 is used for the default provider.)
+# facilities implemented by the provider. This is for providers loaded
+# through classpath.
#
# Note: Providers can be dynamically registered instead by calls to
# either the addProvider or insertProviderAt method in the Security
--- a/jdk/src/java.base/unix/native/libnet/NetworkInterface.c Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.base/unix/native/libnet/NetworkInterface.c Tue Jun 14 10:22:07 2016 -0700
@@ -135,7 +135,8 @@
#endif
static netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs,
- struct sockaddr *ifr_addrP, int family, short prefix);
+ struct sockaddr *ifr_addrP, struct sockaddr *ifr_broadaddrP,
+ struct sockaddr *ifr_subnetaddrP, int family, short prefix);
static void freeif(netif *ifs);
static int openSocket(JNIEnv *env, int proto);
@@ -145,6 +146,7 @@
static struct sockaddr *getBroadcast(JNIEnv *env, int sock, const char *name,
struct sockaddr *brdcast_store);
static short getSubnet(JNIEnv *env, int sock, const char *ifname);
+static short computeMaskFromAddress(struct sockaddr *ifr_subnetaddrP);
static int getIndex(int sock, const char *ifname);
static int getFlags(int sock, const char *ifname, int *flags);
@@ -864,7 +866,8 @@
}
netif *addif(JNIEnv *env, int sock, const char *if_name, netif *ifs,
- struct sockaddr *ifr_addrP, int family, short prefix)
+ struct sockaddr *ifr_addrP, struct sockaddr *ifr_broadaddrP,
+ struct sockaddr *ifr_subnetaddrP, int family, short prefix)
{
netif *currif = ifs, *parent;
netaddr *addrP;
@@ -912,19 +915,30 @@
addrP->mask = prefix;
addrP->next = 0;
if (family == AF_INET) {
- // Deal with broadcast addr & subnet mask
- struct sockaddr *brdcast_to =
- (struct sockaddr *) ((char *)addrP + sizeof(netaddr) + addr_size);
- addrP->brdcast = getBroadcast(env, sock, name, brdcast_to);
- if ((*env)->ExceptionCheck(env) == JNI_TRUE) {
- return ifs;
- }
- if ((mask = getSubnet(env, sock, name)) != -1) {
- addrP->mask = mask;
- } else if((*env)->ExceptionCheck(env)) {
- return ifs;
- }
- }
+ // Deal with broadcast addr & subnet mask
+ if (ifr_broadaddrP != NULL) { // just set it, if already known
+ addrP->brdcast =
+ (struct sockaddr *)((char *)addrP + sizeof(netaddr) + addr_size);
+ memcpy(addrP->brdcast, ifr_broadaddrP, addr_size);
+ } else { // otherwise look it up
+ struct sockaddr *brdcast_to =
+ (struct sockaddr *)((char *)addrP + sizeof(netaddr) + addr_size);
+ addrP->brdcast = getBroadcast(env, sock, name, brdcast_to);
+ if ((*env)->ExceptionCheck(env) == JNI_TRUE) {
+ return ifs;
+ }
+ }
+
+ if (ifr_subnetaddrP != NULL) { // just compute the mask, if already known
+ addrP->mask = computeMaskFromAddress(ifr_subnetaddrP);
+ } else { // otherwise look it up
+ if ((mask = getSubnet(env, sock, name)) != -1) {
+ addrP->mask = mask;
+ } else if((*env)->ExceptionCheck(env)) {
+ return ifs;
+ }
+ }
+ }
// Deal with virtual interface with colon notation e.g. eth0:1
name_colonP = strchr(name, ':');
@@ -1023,6 +1037,20 @@
return ifs;
}
+static short computeMaskFromAddress(struct sockaddr *ifr_subnetaddrP) {
+ short ret = 0;
+ unsigned int mask;
+
+ mask = ntohl(((struct sockaddr_in*)ifr_subnetaddrP)->sin_addr.s_addr);
+
+ while (mask) {
+ mask <<= 1;
+ ret++;
+ }
+
+ return ret;
+}
+
/*
* Opens a socket for further ioct calls. proto is one of AF_INET or AF_INET6.
*/
@@ -1122,13 +1150,43 @@
// Iterate through each interface
ifreqP = ifc.ifc_req;
+ struct sockaddr addr, broadaddr, netmask;
for (i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++, ifreqP++) {
+ struct sockaddr* broadaddrP = NULL;
+ struct sockaddr* subnetaddrP = NULL;
+
+ // Ignore non IPv4 Interfaces
+ if ((struct sockaddr *)&(ifreqP->ifr_addr) != NULL &&
+ ((struct sockaddr *)&(ifreqP->ifr_addr))->sa_family != AF_INET) {
+ continue;
+ }
+
+ memcpy(&addr, &(ifreqP->ifr_addr), sizeof(struct sockaddr));
+
+ // set broadaddrP, if applicable
+ if ((ifreqP->ifr_flags & IFF_POINTOPOINT) == 0 &&
+ ifreqP->ifr_flags & IFF_BROADCAST) {
+
+ if (ioctl(sock, SIOCGIFBRDADDR, ifreqP) == 0) {
+ memcpy(&broadaddr, &(ifreqP->ifr_broadaddr), sizeof(struct sockaddr));
+ broadaddrP = &broadaddr;
+ }
+ // restore the address, for subsequent calls
+ memcpy(&(ifreqP->ifr_addr), &addr, sizeof(struct sockaddr));
+ }
+
+ if (ioctl(sock, SIOCGIFNETMASK, ifreqP) == 0) {
#if defined(_AIX)
- if (ifreqP->ifr_addr.sa_family != AF_INET) continue;
+ memcpy(&netmask, &(ifreqP->ifr_addr), sizeof(struct sockaddr));
+#else
+ memcpy(&netmask, &(ifreqP->ifr_netmask), sizeof(struct sockaddr));
#endif
+ subnetaddrP = &netmask;
+ }
+
// Add to the list
ifs = addif(env, sock, ifreqP->ifr_name, ifs,
- (struct sockaddr *)&(ifreqP->ifr_addr), AF_INET, 0);
+ &addr, broadaddrP, subnetaddrP, AF_INET, 0);
// If an exception occurred then free the list
if ((*env)->ExceptionOccurred(env)) {
@@ -1177,7 +1235,7 @@
addr.sin6_scope_id = if_idx;
ifs = addif(env, sock, devname, ifs, (struct sockaddr *)&addr,
- AF_INET6, (short)prefix);
+ NULL, NULL, AF_INET6, (short)prefix);
// If an exception occurred then return the list as is.
if ((*env)->ExceptionOccurred(env)) {
@@ -1261,7 +1319,8 @@
// Add to the list
ifs = addif(env, sock, ifreqP->ifr_name, ifs,
- (struct sockaddr *)&(ifreqP->ifr_addr), AF_INET6, 0);
+ (struct sockaddr *)&(ifreqP->ifr_addr),
+ NULL, NULL, AF_INET6, 0);
// If an exception occurred then free the list
if ((*env)->ExceptionOccurred(env)) {
@@ -1346,14 +1405,7 @@
return -1;
}
- mask = ntohl(((struct sockaddr_in*)&(if2.ifr_addr))->sin_addr.s_addr);
- ret = 0;
- while (mask) {
- mask <<= 1;
- ret++;
- }
-
- return ret;
+ return computeMaskFromAddress(&(if2.ifr_addr));
}
/*
@@ -1595,8 +1647,8 @@
// add to the list
ifs = addif(env, sock,ifr->lifr_name, ifs,
- (struct sockaddr *)&(ifr->lifr_addr), family,
- (short)ifr->lifr_addrlen);
+ (struct sockaddr *)&(ifr->lifr_addr),
+ NULL, NULL, family, (short)ifr->lifr_addrlen);
// If an exception occurred we return immediately
if ((*env)->ExceptionOccurred(env)) {
@@ -1674,15 +1726,7 @@
return -1;
}
- mask = ntohl(((struct sockaddr_in*)&(if2.lifr_addr))->sin_addr.s_addr);
- ret = 0;
-
- while (mask) {
- mask <<= 1;
- ret++;
- }
-
- return ret;
+ return computeMaskFromAddress(&(if2.lifr_addr));
}
@@ -1889,13 +1933,21 @@
}
for (ifa = origifa; ifa != NULL; ifa = ifa->ifa_next) {
+ struct sockaddr* ifa_broadaddr = NULL;
// Skip non-AF_INET entries.
if (ifa->ifa_addr == NULL || ifa->ifa_addr->sa_family != AF_INET)
continue;
+ // set ifa_broadaddr, if there is one
+ if ((ifa->ifa_flags & IFF_POINTOPOINT) == 0 &&
+ ifa->ifa_flags & IFF_BROADCAST) {
+ ifa_broadaddr = ifa->ifa_broadaddr;
+ }
+
// Add to the list.
- ifs = addif(env, sock, ifa->ifa_name, ifs, ifa->ifa_addr, AF_INET, 0);
+ ifs = addif(env, sock, ifa->ifa_name, ifs, ifa->ifa_addr,
+ ifa_broadaddr, ifa->ifa_netmask, AF_INET, 0);
// If an exception occurred then free the list.
if ((*env)->ExceptionOccurred(env)) {
@@ -1971,8 +2023,9 @@
// Add to the list.
sin6 = (struct sockaddr_in6 *)&ifr6.ifr_addr;
- ifs = addif(env, sock, ifa->ifa_name, ifs, ifa->ifa_addr, AF_INET6,
- (short)prefix(&sin6->sin6_addr, sizeof(struct in6_addr)));
+ ifs = addif(env, sock, ifa->ifa_name, ifs, ifa->ifa_addr, NULL, NULL,
+ AF_INET6,
+ (short)prefix(&sin6->sin6_addr, sizeof(struct in6_addr)));
// If an exception occurred then free the list.
if ((*env)->ExceptionOccurred(env)) {
@@ -2059,14 +2112,7 @@
return -1;
}
- mask = ntohl(((struct sockaddr_in*)&(if2.ifr_addr))->sin_addr.s_addr);
- ret = 0;
- while (mask) {
- mask <<= 1;
- ret++;
- }
-
- return ret;
+ return computeMaskFromAddress(&(if2.ifr_addr));
}
/*
--- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/Application.java Tue Jun 14 10:22:07 2016 -0700
@@ -372,7 +372,6 @@
* Acceptable values are from 0 to 100, any other disables progress indication.
*
* @param value progress value
- * @since 1.9
*/
public void setDockIconProgress(final int value) {
iconHandler.setDockIconProgress(value);
--- a/jdk/src/java.httpclient/share/classes/sun/net/httpclient/hpack/HeaderTable.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.httpclient/share/classes/sun/net/httpclient/hpack/HeaderTable.java Tue Jun 14 10:22:07 2016 -0700
@@ -310,14 +310,14 @@
@Override
public int hashCode() {
- return 31 * (name.hashCode()) + value.hashCode();
+ return 31 * name.hashCode() + value.hashCode();
}
}
//
- // In order to be able to find an index of an entry with the given contents
- // in the dynamic table an effective inverse mapping is needed. Here's a
- // simple idea behind such a mapping.
+ // To quickly find an index of an entry in the dynamic table with the given
+ // contents an effective inverse mapping is needed. Here's a simple idea
+ // behind such a mapping.
//
// # The problem:
//
@@ -325,21 +325,21 @@
//
// get: index -> x
//
- // What we also want is an O(1) reverse lookup:
+ // What we want is an O(1) reverse lookup:
//
// indexOf: x -> index
//
// # Solution:
//
- // Let's store an inverse mapping as a Map<X, Integer>. This have a problem
- // that when a new element is added to the queue all indexes in the map
- // becomes invalid. Namely, each i becomes shifted by 1 to the right:
+ // Let's store an inverse mapping in a Map<x, Integer>. This have a problem
+ // that when a new element is added to the queue, all indexes in the map
+ // become invalid. Namely, the new element is assigned with an index of 1,
+ // and each index i, i > 1 becomes shifted by 1 to the left:
//
- // i -> i + 1
+ // 1, 1, 2, 3, ... , n-1, n
//
- // And the new element is assigned with an index of 1. This would seem to
- // require a pass through the map incrementing all indexes (map values) by
- // 1, which is O(n).
+ // Re-establishing the invariant would seem to require a pass through the
+ // map incrementing all indexes (map values) by 1, which is O(n).
//
// The good news is we can do much better then this!
//
@@ -373,7 +373,7 @@
//
// Where 'recalibrate()' goes through the table doing this:
//
- // value -= counter
+ // value -= counter
//
// That's given, of course, the size of the table itself is less than
// Long.MAX_VALUE :-)
--- a/jdk/src/java.logging/share/classes/java/util/logging/Formatter.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/Formatter.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -101,23 +101,23 @@
* formatting.
* <ul>
* <li>If there are no parameters, no formatter is used.
- * <li>Otherwise, if the string contains "{0" then
- * java.text.MessageFormat is used to format the string.
+ * <li>Otherwise, if the string contains "{{@literal<digit>}"
+ * where {@literal <digit>} is in [0-9],
+ * java.text.MessageFormat is used to format the string.
* <li>Otherwise no formatting is performed.
* </ul>
*
* @param record the log record containing the raw message
* @return a localized and formatted message
*/
- public synchronized String formatMessage(LogRecord record) {
+ public String formatMessage(LogRecord record) {
String format = record.getMessage();
java.util.ResourceBundle catalog = record.getResourceBundle();
if (catalog != null) {
try {
- format = catalog.getString(record.getMessage());
+ format = catalog.getString(format);
} catch (java.util.MissingResourceException ex) {
// Drop through. Use record message as format
- format = record.getMessage();
}
}
// Do the formatting.
@@ -130,11 +130,16 @@
// Is it a java.text style format?
// Ideally we could match with
// Pattern.compile("\\{\\d").matcher(format).find())
- // However the cost is 14% higher, so we cheaply check for
- // 1 of the first 4 parameters
- if (format.indexOf("{0") >= 0 || format.indexOf("{1") >=0 ||
- format.indexOf("{2") >=0|| format.indexOf("{3") >=0) {
- return java.text.MessageFormat.format(format, parameters);
+ // However the cost is 14% higher, so we cheaply use indexOf
+ // and charAt to look for that pattern.
+ int index = -1;
+ int fence = format.length() - 1;
+ while ((index = format.indexOf('{', index+1)) > -1) {
+ if (index >= fence) break;
+ char digit = format.charAt(index+1);
+ if (digit >= '0' & digit <= '9') {
+ return java.text.MessageFormat.format(format, parameters);
+ }
}
return format;
--- a/jdk/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java Tue Jun 14 10:22:07 2016 -0700
@@ -153,7 +153,7 @@
* @return a formatted log record
*/
@Override
- public synchronized String format(LogRecord record) {
+ public String format(LogRecord record) {
ZonedDateTime zdt = ZonedDateTime.ofInstant(
record.getInstant(), ZoneId.systemDefault());
String source;
--- a/jdk/src/java.prefs/macosx/classes/java/util/prefs/MacOSXPreferences.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.prefs/macosx/classes/java/util/prefs/MacOSXPreferences.java Tue Jun 14 10:22:07 2016 -0700
@@ -44,27 +44,39 @@
private final String path;
// User root and system root nodes
- private static MacOSXPreferences userRoot = null;
- private static MacOSXPreferences systemRoot = null;
+ private static volatile MacOSXPreferences userRoot;
+ private static volatile MacOSXPreferences systemRoot;
// Returns user root node, creating it if necessary.
// Called by MacOSXPreferencesFactory
- static synchronized Preferences getUserRoot() {
- if (userRoot == null) {
- userRoot = new MacOSXPreferences(true);
+ static Preferences getUserRoot() {
+ MacOSXPreferences root = userRoot;
+ if (root == null) {
+ synchronized (MacOSXPreferences.class) {
+ root = userRoot;
+ if (root == null) {
+ userRoot = root = new MacOSXPreferences(true);
+ }
+ }
}
- return userRoot;
+ return root;
}
// Returns system root node, creating it if necessary.
// Called by MacOSXPreferencesFactory
- static synchronized Preferences getSystemRoot() {
- if (systemRoot == null) {
- systemRoot = new MacOSXPreferences(false);
+ static Preferences getSystemRoot() {
+ MacOSXPreferences root = systemRoot;
+ if (root == null) {
+ synchronized (MacOSXPreferences.class) {
+ root = systemRoot;
+ if (root == null) {
+ systemRoot = root = new MacOSXPreferences(false);
+ }
+ }
}
- return systemRoot;
+ return root;
}
--- a/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java Tue Jun 14 10:22:07 2016 -0700
@@ -94,14 +94,20 @@
/**
* The user root.
*/
- static Preferences userRoot = null;
+ private static volatile Preferences userRoot;
- static synchronized Preferences getUserRoot() {
- if (userRoot == null) {
- setupUserRoot();
- userRoot = new FileSystemPreferences(true);
+ static Preferences getUserRoot() {
+ Preferences root = userRoot;
+ if (root == null) {
+ synchronized (FileSystemPreferences.class) {
+ root = userRoot;
+ if (root == null) {
+ setupUserRoot();
+ userRoot = root = new FileSystemPreferences(true);
+ }
+ }
}
- return userRoot;
+ return root;
}
private static void setupUserRoot() {
@@ -155,14 +161,20 @@
/**
* The system root.
*/
- static Preferences systemRoot;
+ private static volatile Preferences systemRoot;
- static synchronized Preferences getSystemRoot() {
- if (systemRoot == null) {
- setupSystemRoot();
- systemRoot = new FileSystemPreferences(false);
+ static Preferences getSystemRoot() {
+ Preferences root = systemRoot;
+ if (root == null) {
+ synchronized (FileSystemPreferences.class) {
+ root = systemRoot;
+ if (root == null) {
+ setupSystemRoot();
+ systemRoot = root = new FileSystemPreferences(false);
+ }
+ }
}
- return systemRoot;
+ return root;
}
private static void setupSystemRoot() {
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferences.java Tue Jun 14 10:22:07 2016 -0700
@@ -91,14 +91,40 @@
/**
* User root node.
*/
- static final Preferences userRoot =
- new WindowsPreferences(USER_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH);
+ private static volatile Preferences userRoot;
+
+ static Preferences getUserRoot() {
+ Preferences root = userRoot;
+ if (root == null) {
+ synchronized (WindowsPreferences.class) {
+ root = userRoot;
+ if (root == null) {
+ root = new WindowsPreferences(USER_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH);
+ userRoot = root;
+ }
+ }
+ }
+ return root;
+ }
/**
* System root node.
*/
- static final Preferences systemRoot =
- new WindowsPreferences(SYSTEM_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH);
+ private static volatile Preferences systemRoot;
+
+ static Preferences getSystemRoot() {
+ Preferences root = systemRoot;
+ if (root == null) {
+ synchronized (WindowsPreferences.class) {
+ root = systemRoot;
+ if (root == null) {
+ root = new WindowsPreferences(SYSTEM_ROOT_NATIVE_HANDLE, WINDOWS_ROOT_PATH);
+ systemRoot = root;
+ }
+ }
+ }
+ return root;
+ }
/* Windows error codes. */
private static final int ERROR_SUCCESS = 0;
--- a/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/java.prefs/windows/classes/java/util/prefs/WindowsPreferencesFactory.java Tue Jun 14 10:22:07 2016 -0700
@@ -39,13 +39,13 @@
* Returns WindowsPreferences.userRoot
*/
public Preferences userRoot() {
- return WindowsPreferences.userRoot;
+ return WindowsPreferences.getUserRoot();
}
/**
* Returns WindowsPreferences.systemRoot
*/
public Preferences systemRoot() {
- return WindowsPreferences.systemRoot;
+ return WindowsPreferences.getSystemRoot();
}
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.c Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.c Tue Jun 14 10:22:07 2016 -0700
@@ -28,7 +28,6 @@
#include <strings.h>
#include <jni.h>
#include "jni_util.h"
-#include <libsoftcrypto.h>
#include "nativeCrypto.h"
#include "nativeFunc.h"
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.h Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.h Tue Jun 14 10:22:07 2016 -0700
@@ -23,12 +23,38 @@
* questions.
*/
+#include <libsoftcrypto.h> // redirects to libucrypto.h starting 11.3
+
#ifndef _Included_com_oracle_security_ucrypto_NativeCrypto
#define _Included_com_oracle_security_ucrypto_NativeCrypto
#ifdef __cplusplus
extern "C" {
#endif
+// used by nativeCrypto.c
+#ifdef _LIBUCRYPTO_H // workaround for Solaris bug; see 8157627
+#define CK_AES_CTR_PARAMS crypto_ctr_params_t
+#define ulCounterBits ct_ctr_bits
+#define cb ct_cb
+
+#define CK_AES_CCM_PARAMS crypto_ccm_params_t
+#define ulMACSize cc_mac_size
+#define ulNonceSize cc_nonce_size
+#define ulAuthDataSize cc_auth_data_size
+#define ulDataSize cc_data_size
+#define nonce cc_nonce
+#define authData cc_auth_data
+
+#define CK_AES_GCM_PARAMS crypto_gcm_params_t
+#define pIv gc_iv
+#define ulIvLen gc_iv_len
+#define ulIvBits gc_iv_bits
+#define pAAD gc_aad
+#define ulAADLen gc_aad_len
+#define ulTagBits gc_tag_bits
+#endif
+
+// used by nativeCryptoMD.c
#undef com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5
#define com_oracle_security_ucrypto_NativeDigestMD_MECH_MD5 1L
#undef com_oracle_security_ucrypto_NativeDigestMD_MECH_SHA1
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCryptoMD.c Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCryptoMD.c Tue Jun 14 10:22:07 2016 -0700
@@ -28,7 +28,6 @@
#include <strings.h>
#include <jni.h>
#include "jni_util.h"
-#include <libsoftcrypto.h>
#include "nativeCrypto.h"
#include "nativeFunc.h"
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeFunc.h Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeFunc.h Tue Jun 14 10:22:07 2016 -0700
@@ -28,7 +28,7 @@
#include <md5.h>
#include <sha1.h>
#include <sha2.h>
-#include <libsoftcrypto.h>
+#include <libsoftcrypto.h> // redirects to libucrypto.h starting 11.3
jboolean* loadNative();
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/sys_old/crypto/common.h Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,637 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.
- */
-
-#ifndef _SYS_CRYPTO_COMMON_H
-#define _SYS_CRYPTO_COMMON_H
-
-/*
- * Header file for the common data structures of the cryptographic framework
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/stream.h>
-#include <sys/mutex.h>
-#include <sys/condvar.h>
-
-/* Convenience defines/macros */
-
-#define CRYPTO_ARG_INPLACE(input, output) \
- if ((output) == NULL) \
- (output) = (input);
-
-#ifdef _KERNEL
-
-#include <sys/kmem.h>
-#define CRYPTO_KMFLAG(x) crypto_kmflag((x))
-#define CRYPTO_ALLOC(sz, kmflag) kmem_alloc((sz), (kmflag))
-#define CRYPTO_ZALLOC(sz, kmflag) kmem_zalloc((sz), (kmflag))
-#define CRYPTO_FREE(ptr, sz) kmem_free((ptr), (sz))
-#define CRYPTO_ZFREE(ptr, sz) if (ptr != NULL) { \
- bzero((ptr), (sz)), \
- kmem_free((ptr), (sz)); \
- }
-
-#else /* _KERNEL */
-
-#include <malloc.h>
-#define CRYPTO_KMFLAG(x) (0)
-#define CRYPTO_ALLOC(sz, kmflag) malloc((sz))
-#define CRYPTO_ZALLOC(sz, kmflag) calloc(1, (sz))
-#define CRYPTO_FREE(ptr, sz) free((ptr))
-#define CRYPTO_ZFREE(ptr, sz) if (ptr != NULL) { \
- bzero((ptr), (sz)), \
- free((ptr)); \
- }
-
-#endif /* _KERNEL */
-
-/* Cryptographic Mechanisms */
-
-#define CRYPTO_MAX_MECH_NAME 32
-typedef char crypto_mech_name_t[CRYPTO_MAX_MECH_NAME];
-
-typedef uint64_t crypto_mech_type_t;
-
-typedef struct crypto_mechanism {
- crypto_mech_type_t cm_type; /* mechanism type */
- caddr_t cm_param; /* mech. parameter */
- size_t cm_param_len; /* mech. parameter len */
-} crypto_mechanism_t;
-
-#ifdef _SYSCALL32
-
-typedef struct crypto_mechanism32 {
- crypto_mech_type_t cm_type; /* mechanism type */
- caddr32_t cm_param; /* mech. parameter */
- size32_t cm_param_len; /* mech. parameter len */
-} crypto_mechanism32_t;
-
-#endif /* _SYSCALL32 */
-
-#ifdef _KERNEL
-/* CK_AES_CTR_PARAMS provides parameters to the CKM_AES_CTR mechanism */
-typedef struct CK_AES_CTR_PARAMS {
- ulong_t ulCounterBits;
- uint8_t cb[16];
-} CK_AES_CTR_PARAMS;
-#endif
-
-/* CK_AES_CCM_PARAMS provides parameters to the CKM_AES_CCM mechanism */
-typedef struct CK_AES_CCM_PARAMS {
- ulong_t ulMACSize;
- ulong_t ulNonceSize;
- ulong_t ulAuthDataSize;
- ulong_t ulDataSize; /* used for plaintext or ciphertext */
- uchar_t *nonce;
- uchar_t *authData;
-} CK_AES_CCM_PARAMS;
-
-/* CK_AES_GCM_PARAMS provides parameters to the CKM_AES_GCM mechanism */
-typedef struct CK_AES_GCM_PARAMS {
- uchar_t *pIv;
- ulong_t ulIvLen;
- ulong_t ulIvBits;
- uchar_t *pAAD;
- ulong_t ulAADLen;
- ulong_t ulTagBits;
-} CK_AES_GCM_PARAMS;
-
-/* CK_AES_GMAC_PARAMS provides parameters to the CKM_AES_GMAC mechanism */
-typedef struct CK_AES_GMAC_PARAMS {
- uchar_t *pIv;
- uchar_t *pAAD;
- ulong_t ulAADLen;
-} CK_AES_GMAC_PARAMS;
-
-#ifdef _KERNEL
-/*
- * CK_ECDH1_DERIVE_PARAMS provides the parameters to the
- * CKM_ECDH1_KEY_DERIVE mechanism
- */
-typedef struct CK_ECDH1_DERIVE_PARAMS {
- ulong_t kdf;
- ulong_t ulSharedDataLen;
- uchar_t *pSharedData;
- ulong_t ulPublicDataLen;
- uchar_t *pPublicData;
-} CK_ECDH1_DERIVE_PARAMS;
-#endif
-
-#ifdef _KERNEL
-#ifdef _SYSCALL32
-
-/* needed for 32-bit applications running on 64-bit kernels */
-typedef struct CK_AES_CTR_PARAMS32 {
- uint32_t ulCounterBits;
- uint8_t cb[16];
-} CK_AES_CTR_PARAMS32;
-
-/* needed for 32-bit applications running on 64-bit kernels */
-typedef struct CK_AES_CCM_PARAMS32 {
- uint32_t ulMACSize;
- uint32_t ulNonceSize;
- uint32_t ulAuthDataSize;
- uint32_t ulDataSize;
- caddr32_t nonce;
- caddr32_t authData;
-} CK_AES_CCM_PARAMS32;
-
-/* needed for 32-bit applications running on 64-bit kernels */
-typedef struct CK_AES_GCM_PARAMS32 {
- caddr32_t pIv;
- uint32_t ulIvLen;
- uint32_t ulIvBits;
- caddr32_t pAAD;
- uint32_t ulAADLen;
- uint32_t ulTagBits;
-} CK_AES_GCM_PARAMS32;
-
-/* needed for 32-bit applications running on 64-bit kernels */
-typedef struct CK_AES_GMAC_PARAMS32 {
- caddr32_t pIv;
- caddr32_t pAAD;
- uint32_t ulAADLen;
-} CK_AES_GMAC_PARAMS32;
-
-typedef struct CK_ECDH1_DERIVE_PARAMS32 {
- uint32_t kdf;
- uint32_t ulSharedDataLen;
- caddr32_t pSharedData;
- uint32_t ulPublicDataLen;
- caddr32_t pPublicData;
-} CK_ECDH1_DERIVE_PARAMS32;
-
-#endif /* _SYSCALL32 */
-#endif /* _KERNEL */
-
-/*
- * The measurement unit bit flag for a mechanism's minimum or maximum key size.
- * The unit are mechanism dependent. It can be in bits or in bytes.
- */
-typedef uint32_t crypto_keysize_unit_t;
-
-/*
- * The following bit flags are valid in cm_mech_flags field in
- * the crypto_mech_info_t structure of the SPI.
- *
- * Only the first two bit flags are valid in mi_keysize_unit
- * field in the crypto_mechanism_info_t structure of the API.
- */
-#define CRYPTO_KEYSIZE_UNIT_IN_BITS 0x00000001
-#define CRYPTO_KEYSIZE_UNIT_IN_BYTES 0x00000002
-#define CRYPTO_CAN_SHARE_OPSTATE 0x00000004 /* supports sharing */
-
-
-/* Mechanisms supported out-of-the-box */
-#define SUN_CKM_MD4 "CKM_MD4"
-#define SUN_CKM_MD5 "CKM_MD5"
-#define SUN_CKM_MD5_HMAC "CKM_MD5_HMAC"
-#define SUN_CKM_MD5_HMAC_GENERAL "CKM_MD5_HMAC_GENERAL"
-#define SUN_CKM_SHA1 "CKM_SHA_1"
-#define SUN_CKM_SHA1_HMAC "CKM_SHA_1_HMAC"
-#define SUN_CKM_SHA1_HMAC_GENERAL "CKM_SHA_1_HMAC_GENERAL"
-#define SUN_CKM_SHA256 "CKM_SHA256"
-#define SUN_CKM_SHA256_HMAC "CKM_SHA256_HMAC"
-#define SUN_CKM_SHA256_HMAC_GENERAL "CKM_SHA256_HMAC_GENERAL"
-#define SUN_CKM_SHA384 "CKM_SHA384"
-#define SUN_CKM_SHA384_HMAC "CKM_SHA384_HMAC"
-#define SUN_CKM_SHA384_HMAC_GENERAL "CKM_SHA384_HMAC_GENERAL"
-#define SUN_CKM_SHA512 "CKM_SHA512"
-#define SUN_CKM_SHA512_HMAC "CKM_SHA512_HMAC"
-#define SUN_CKM_SHA512_HMAC_GENERAL "CKM_SHA512_HMAC_GENERAL"
-#define SUN_CKM_DES_CBC "CKM_DES_CBC"
-#define SUN_CKM_DES3_CBC "CKM_DES3_CBC"
-#define SUN_CKM_DES_ECB "CKM_DES_ECB"
-#define SUN_CKM_DES3_ECB "CKM_DES3_ECB"
-#define SUN_CKM_BLOWFISH_CBC "CKM_BLOWFISH_CBC"
-#define SUN_CKM_BLOWFISH_ECB "CKM_BLOWFISH_ECB"
-#define SUN_CKM_AES_CBC "CKM_AES_CBC"
-#define SUN_CKM_AES_ECB "CKM_AES_ECB"
-#define SUN_CKM_AES_CTR "CKM_AES_CTR"
-#define SUN_CKM_AES_CCM "CKM_AES_CCM"
-#define SUN_CKM_AES_GCM "CKM_AES_GCM"
-#define SUN_CKM_AES_GMAC "CKM_AES_GMAC"
-#define SUN_CKM_AES_CFB128 "CKM_AES_CFB128"
-#define SUN_CKM_RC4 "CKM_RC4"
-#define SUN_CKM_RSA_PKCS "CKM_RSA_PKCS"
-#define SUN_CKM_RSA_X_509 "CKM_RSA_X_509"
-#define SUN_CKM_MD5_RSA_PKCS "CKM_MD5_RSA_PKCS"
-#define SUN_CKM_SHA1_RSA_PKCS "CKM_SHA1_RSA_PKCS"
-#define SUN_CKM_SHA256_RSA_PKCS "CKM_SHA256_RSA_PKCS"
-#define SUN_CKM_SHA384_RSA_PKCS "CKM_SHA384_RSA_PKCS"
-#define SUN_CKM_SHA512_RSA_PKCS "CKM_SHA512_RSA_PKCS"
-#define SUN_CKM_EC_KEY_PAIR_GEN "CKM_EC_KEY_PAIR_GEN"
-#define SUN_CKM_ECDH1_DERIVE "CKM_ECDH1_DERIVE"
-#define SUN_CKM_ECDSA_SHA1 "CKM_ECDSA_SHA1"
-#define SUN_CKM_ECDSA "CKM_ECDSA"
-
-/* Shared operation context format for CKM_RC4 */
-typedef struct {
-#if defined(__amd64)
- uint32_t i, j;
- uint32_t arr[256];
- uint32_t flag;
-#else
- uchar_t arr[256];
- uchar_t i, j;
-#endif /* __amd64 */
- uint64_t pad; /* For 64-bit alignment */
-} arcfour_state_t;
-
-/* Data arguments of cryptographic operations */
-
-typedef enum crypto_data_format {
- CRYPTO_DATA_RAW = 1,
- CRYPTO_DATA_UIO,
- CRYPTO_DATA_MBLK
-} crypto_data_format_t;
-
-typedef struct crypto_data {
- crypto_data_format_t cd_format; /* Format identifier */
- off_t cd_offset; /* Offset from the beginning */
- size_t cd_length; /* # of bytes in use */
- caddr_t cd_miscdata; /* ancillary data */
- union {
- /* Raw format */
- iovec_t cdu_raw; /* Pointer and length */
-
- /* uio scatter-gather format */
- uio_t *cdu_uio;
-
- /* mblk scatter-gather format */
- mblk_t *cdu_mp; /* The mblk chain */
-
- } cdu; /* Crypto Data Union */
-} crypto_data_t;
-
-#define cd_raw cdu.cdu_raw
-#define cd_uio cdu.cdu_uio
-#define cd_mp cdu.cdu_mp
-
-#define CRYPTO_SET_RAW_DATA(var, str, len) \
- (var).cd_format = CRYPTO_DATA_RAW; \
- (var).cd_offset = 0; \
- (var).cd_length = (len); \
- (var).cd_miscdata = NULL; \
- (var).cd_raw.iov_base = (caddr_t)(str); \
- (var).cd_raw.iov_len = (len);
-
-#define CRYPTO_DATA_IS_USERSPACE(buf) \
- ((buf->cd_format == CRYPTO_DATA_UIO && \
- buf->cd_uio->uio_segflg == UIO_USERSPACE))
-
-typedef struct crypto_dual_data {
- crypto_data_t dd_data; /* The data */
- off_t dd_offset2; /* Used by dual operation */
- size_t dd_len2; /* # of bytes to take */
-} crypto_dual_data_t;
-
-#define dd_format dd_data.cd_format
-#define dd_offset1 dd_data.cd_offset
-#define dd_len1 dd_data.cd_length
-#define dd_miscdata dd_data.cd_miscdata
-#define dd_raw dd_data.cd_raw
-#define dd_uio dd_data.cd_uio
-#define dd_mp dd_data.cd_mp
-
-/* The keys, and their contents */
-
-typedef enum {
- CRYPTO_KEY_RAW = 1, /* ck_data is a cleartext key */
- CRYPTO_KEY_REFERENCE, /* ck_obj_id is an opaque reference */
- CRYPTO_KEY_ATTR_LIST /* ck_attrs is a list of object attributes */
-} crypto_key_format_t;
-
-typedef uint64_t crypto_attr_type_t;
-
-/* Attribute types to use for passing a RSA public key or a private key. */
-#define SUN_CKA_MODULUS 0x00000120
-#define SUN_CKA_MODULUS_BITS 0x00000121
-#define SUN_CKA_PUBLIC_EXPONENT 0x00000122
-#define SUN_CKA_PRIVATE_EXPONENT 0x00000123
-#define SUN_CKA_PRIME_1 0x00000124
-#define SUN_CKA_PRIME_2 0x00000125
-#define SUN_CKA_EXPONENT_1 0x00000126
-#define SUN_CKA_EXPONENT_2 0x00000127
-#define SUN_CKA_COEFFICIENT 0x00000128
-#define SUN_CKA_PRIME 0x00000130
-#define SUN_CKA_SUBPRIME 0x00000131
-#define SUN_CKA_BASE 0x00000132
-
-#define CKK_EC 0x00000003
-#define CKK_GENERIC_SECRET 0x00000010
-#define CKK_RC4 0x00000012
-#define CKK_AES 0x0000001F
-#define CKK_DES 0x00000013
-#define CKK_DES2 0x00000014
-#define CKK_DES3 0x00000015
-
-#define CKO_PUBLIC_KEY 0x00000002
-#define CKO_PRIVATE_KEY 0x00000003
-#define CKA_CLASS 0x00000000
-#define CKA_VALUE 0x00000011
-#define CKA_KEY_TYPE 0x00000100
-#define CKA_VALUE_LEN 0x00000161
-#define CKA_EC_PARAMS 0x00000180
-#define CKA_EC_POINT 0x00000181
-
-typedef uint32_t crypto_object_id_t;
-
-typedef struct crypto_object_attribute {
- crypto_attr_type_t oa_type; /* attribute type */
- caddr_t oa_value; /* attribute value */
- ssize_t oa_value_len; /* length of attribute value */
-} crypto_object_attribute_t;
-
-typedef struct crypto_key {
- crypto_key_format_t ck_format; /* format identifier */
- union {
- /* for CRYPTO_KEY_RAW ck_format */
- struct {
- uint_t cku_v_length; /* # of bits in ck_data */
- void *cku_v_data; /* ptr to key value */
- } cku_key_value;
-
- /* for CRYPTO_KEY_REFERENCE ck_format */
- crypto_object_id_t cku_key_id; /* reference to object key */
-
- /* for CRYPTO_KEY_ATTR_LIST ck_format */
- struct {
- uint_t cku_a_count; /* number of attributes */
- crypto_object_attribute_t *cku_a_oattr;
- } cku_key_attrs;
- } cku_data; /* Crypto Key union */
-} crypto_key_t;
-
-#ifdef _SYSCALL32
-
-typedef struct crypto_object_attribute32 {
- uint64_t oa_type; /* attribute type */
- caddr32_t oa_value; /* attribute value */
- ssize32_t oa_value_len; /* length of attribute value */
-} crypto_object_attribute32_t;
-
-typedef struct crypto_key32 {
- crypto_key_format_t ck_format; /* format identifier */
- union {
- /* for CRYPTO_KEY_RAW ck_format */
- struct {
- uint32_t cku_v_length; /* # of bytes in ck_data */
- caddr32_t cku_v_data; /* ptr to key value */
- } cku_key_value;
-
- /* for CRYPTO_KEY_REFERENCE ck_format */
- crypto_object_id_t cku_key_id; /* reference to object key */
-
- /* for CRYPTO_KEY_ATTR_LIST ck_format */
- struct {
- uint32_t cku_a_count; /* number of attributes */
- caddr32_t cku_a_oattr;
- } cku_key_attrs;
- } cku_data; /* Crypto Key union */
-} crypto_key32_t;
-
-#endif /* _SYSCALL32 */
-
-#define ck_data cku_data.cku_key_value.cku_v_data
-#define ck_length cku_data.cku_key_value.cku_v_length
-#define ck_obj_id cku_data.cku_key_id
-#define ck_count cku_data.cku_key_attrs.cku_a_count
-#define ck_attrs cku_data.cku_key_attrs.cku_a_oattr
-
-/*
- * Raw key lengths are expressed in number of bits.
- * The following macro returns the minimum number of
- * bytes that can contain the specified number of bits.
- * Round up without overflowing the integer type.
- */
-#define CRYPTO_BITS2BYTES(n) ((n) == 0 ? 0 : (((n) - 1) >> 3) + 1)
-#define CRYPTO_BYTES2BITS(n) ((n) << 3)
-
-/* Providers */
-
-typedef enum {
- CRYPTO_HW_PROVIDER = 0,
- CRYPTO_SW_PROVIDER,
- CRYPTO_LOGICAL_PROVIDER
-} crypto_provider_type_t;
-
-typedef uint32_t crypto_provider_id_t;
-#define KCF_PROVID_INVALID ((uint32_t)-1)
-
-typedef struct crypto_provider_entry {
- crypto_provider_id_t pe_provider_id;
- uint_t pe_mechanism_count;
-} crypto_provider_entry_t;
-
-typedef struct crypto_dev_list_entry {
- char le_dev_name[MAXNAMELEN];
- uint_t le_dev_instance;
- uint_t le_mechanism_count;
-} crypto_dev_list_entry_t;
-
-/* User type for authentication ioctls and SPI entry points */
-
-typedef enum crypto_user_type {
- CRYPTO_SO = 0,
- CRYPTO_USER
-} crypto_user_type_t;
-
-/* Version for provider management ioctls and SPI entry points */
-
-typedef struct crypto_version {
- uchar_t cv_major;
- uchar_t cv_minor;
-} crypto_version_t;
-
-/* session data structure opaque to the consumer */
-typedef void *crypto_session_t;
-
-/* provider data structure opaque to the consumer */
-typedef void *crypto_provider_t;
-
-/* Limits used by both consumers and providers */
-#define CRYPTO_EXT_SIZE_LABEL 32
-#define CRYPTO_EXT_SIZE_MANUF 32
-#define CRYPTO_EXT_SIZE_MODEL 16
-#define CRYPTO_EXT_SIZE_SERIAL 16
-#define CRYPTO_EXT_SIZE_TIME 16
-
-typedef struct crypto_provider_ext_info {
- uchar_t ei_label[CRYPTO_EXT_SIZE_LABEL];
- uchar_t ei_manufacturerID[CRYPTO_EXT_SIZE_MANUF];
- uchar_t ei_model[CRYPTO_EXT_SIZE_MODEL];
- uchar_t ei_serial_number[CRYPTO_EXT_SIZE_SERIAL];
- ulong_t ei_flags;
- ulong_t ei_max_session_count;
- ulong_t ei_max_pin_len;
- ulong_t ei_min_pin_len;
- ulong_t ei_total_public_memory;
- ulong_t ei_free_public_memory;
- ulong_t ei_total_private_memory;
- ulong_t ei_free_private_memory;
- crypto_version_t ei_hardware_version;
- crypto_version_t ei_firmware_version;
- uchar_t ei_time[CRYPTO_EXT_SIZE_TIME];
- int ei_hash_max_input_len;
- int ei_hmac_max_input_len;
-} crypto_provider_ext_info_t;
-
-typedef uint_t crypto_session_id_t;
-
-typedef enum cmd_type {
- COPY_FROM_DATA,
- COPY_TO_DATA,
- COMPARE_TO_DATA,
- MD5_DIGEST_DATA,
- SHA1_DIGEST_DATA,
- SHA2_DIGEST_DATA,
- GHASH_DATA
-} cmd_type_t;
-
-#define CRYPTO_DO_UPDATE 0x01
-#define CRYPTO_DO_FINAL 0x02
-#define CRYPTO_DO_MD5 0x04
-#define CRYPTO_DO_SHA1 0x08
-#define CRYPTO_DO_SIGN 0x10
-#define CRYPTO_DO_VERIFY 0x20
-#define CRYPTO_DO_SHA2 0x40
-
-#define PROVIDER_OWNS_KEY_SCHEDULE 0x00000001
-
-/*
- * Common cryptographic status and error codes.
- */
-#define CRYPTO_SUCCESS 0x00000000
-#define CRYPTO_CANCEL 0x00000001
-#define CRYPTO_HOST_MEMORY 0x00000002
-#define CRYPTO_GENERAL_ERROR 0x00000003
-#define CRYPTO_FAILED 0x00000004
-#define CRYPTO_ARGUMENTS_BAD 0x00000005
-#define CRYPTO_ATTRIBUTE_READ_ONLY 0x00000006
-#define CRYPTO_ATTRIBUTE_SENSITIVE 0x00000007
-#define CRYPTO_ATTRIBUTE_TYPE_INVALID 0x00000008
-#define CRYPTO_ATTRIBUTE_VALUE_INVALID 0x00000009
-#define CRYPTO_CANCELED 0x0000000A
-#define CRYPTO_DATA_INVALID 0x0000000B
-#define CRYPTO_DATA_LEN_RANGE 0x0000000C
-#define CRYPTO_DEVICE_ERROR 0x0000000D
-#define CRYPTO_DEVICE_MEMORY 0x0000000E
-#define CRYPTO_DEVICE_REMOVED 0x0000000F
-#define CRYPTO_ENCRYPTED_DATA_INVALID 0x00000010
-#define CRYPTO_ENCRYPTED_DATA_LEN_RANGE 0x00000011
-#define CRYPTO_KEY_HANDLE_INVALID 0x00000012
-#define CRYPTO_KEY_SIZE_RANGE 0x00000013
-#define CRYPTO_KEY_TYPE_INCONSISTENT 0x00000014
-#define CRYPTO_KEY_NOT_NEEDED 0x00000015
-#define CRYPTO_KEY_CHANGED 0x00000016
-#define CRYPTO_KEY_NEEDED 0x00000017
-#define CRYPTO_KEY_INDIGESTIBLE 0x00000018
-#define CRYPTO_KEY_FUNCTION_NOT_PERMITTED 0x00000019
-#define CRYPTO_KEY_NOT_WRAPPABLE 0x0000001A
-#define CRYPTO_KEY_UNEXTRACTABLE 0x0000001B
-#define CRYPTO_MECHANISM_INVALID 0x0000001C
-#define CRYPTO_MECHANISM_PARAM_INVALID 0x0000001D
-#define CRYPTO_OBJECT_HANDLE_INVALID 0x0000001E
-#define CRYPTO_OPERATION_IS_ACTIVE 0x0000001F
-#define CRYPTO_OPERATION_NOT_INITIALIZED 0x00000020
-#define CRYPTO_PIN_INCORRECT 0x00000021
-#define CRYPTO_PIN_INVALID 0x00000022
-#define CRYPTO_PIN_LEN_RANGE 0x00000023
-#define CRYPTO_PIN_EXPIRED 0x00000024
-#define CRYPTO_PIN_LOCKED 0x00000025
-#define CRYPTO_SESSION_CLOSED 0x00000026
-#define CRYPTO_SESSION_COUNT 0x00000027
-#define CRYPTO_SESSION_HANDLE_INVALID 0x00000028
-#define CRYPTO_SESSION_READ_ONLY 0x00000029
-#define CRYPTO_SESSION_EXISTS 0x0000002A
-#define CRYPTO_SESSION_READ_ONLY_EXISTS 0x0000002B
-#define CRYPTO_SESSION_READ_WRITE_SO_EXISTS 0x0000002C
-#define CRYPTO_SIGNATURE_INVALID 0x0000002D
-#define CRYPTO_SIGNATURE_LEN_RANGE 0x0000002E
-#define CRYPTO_TEMPLATE_INCOMPLETE 0x0000002F
-#define CRYPTO_TEMPLATE_INCONSISTENT 0x00000030
-#define CRYPTO_UNWRAPPING_KEY_HANDLE_INVALID 0x00000031
-#define CRYPTO_UNWRAPPING_KEY_SIZE_RANGE 0x00000032
-#define CRYPTO_UNWRAPPING_KEY_TYPE_INCONSISTENT 0x00000033
-#define CRYPTO_USER_ALREADY_LOGGED_IN 0x00000034
-#define CRYPTO_USER_NOT_LOGGED_IN 0x00000035
-#define CRYPTO_USER_PIN_NOT_INITIALIZED 0x00000036
-#define CRYPTO_USER_TYPE_INVALID 0x00000037
-#define CRYPTO_USER_ANOTHER_ALREADY_LOGGED_IN 0x00000038
-#define CRYPTO_USER_TOO_MANY_TYPES 0x00000039
-#define CRYPTO_WRAPPED_KEY_INVALID 0x0000003A
-#define CRYPTO_WRAPPED_KEY_LEN_RANGE 0x0000003B
-#define CRYPTO_WRAPPING_KEY_HANDLE_INVALID 0x0000003C
-#define CRYPTO_WRAPPING_KEY_SIZE_RANGE 0x0000003D
-#define CRYPTO_WRAPPING_KEY_TYPE_INCONSISTENT 0x0000003E
-#define CRYPTO_RANDOM_SEED_NOT_SUPPORTED 0x0000003F
-#define CRYPTO_RANDOM_NO_RNG 0x00000040
-#define CRYPTO_DOMAIN_PARAMS_INVALID 0x00000041
-#define CRYPTO_BUFFER_TOO_SMALL 0x00000042
-#define CRYPTO_INFORMATION_SENSITIVE 0x00000043
-#define CRYPTO_NOT_SUPPORTED 0x00000044
-
-#define CRYPTO_QUEUED 0x00000045
-#define CRYPTO_BUFFER_TOO_BIG 0x00000046
-#define CRYPTO_INVALID_CONTEXT 0x00000047
-#define CRYPTO_INVALID_MAC 0x00000048
-#define CRYPTO_MECH_NOT_SUPPORTED 0x00000049
-#define CRYPTO_INCONSISTENT_ATTRIBUTE 0x0000004A
-#define CRYPTO_NO_PERMISSION 0x0000004B
-#define CRYPTO_INVALID_PROVIDER_ID 0x0000004C
-#define CRYPTO_VERSION_MISMATCH 0x0000004D
-#define CRYPTO_BUSY 0x0000004E
-#define CRYPTO_UNKNOWN_PROVIDER 0x0000004F
-#define CRYPTO_MODVERIFICATION_FAILED 0x00000050
-#define CRYPTO_OLD_CTX_TEMPLATE 0x00000051
-#define CRYPTO_WEAK_KEY 0x00000052
-#define CRYPTO_FIPS140_ERROR 0x00000053
-/*
- * Don't forget to update CRYPTO_LAST_ERROR and the error_number_table[]
- * in kernelUtil.c when new error code is added.
- */
-#define CRYPTO_LAST_ERROR 0x00000053
-
-/*
- * Special values that can be used to indicate that information is unavailable
- * or that there is not practical limit. These values can be used
- * by fields of the SPI crypto_provider_ext_info(9S) structure.
- * The value of CRYPTO_UNAVAILABLE_INFO should be the same as
- * CK_UNAVAILABLE_INFO in the PKCS#11 spec.
- */
-#define CRYPTO_UNAVAILABLE_INFO ((ulong_t)(-1))
-#define CRYPTO_EFFECTIVELY_INFINITE 0x0
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_CRYPTO_COMMON_H */
--- a/jdk/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/sys_old/crypto/spi.h Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,791 +0,0 @@
-/*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.
- */
-
-#ifndef _SYS_CRYPTO_SPI_H
-#define _SYS_CRYPTO_SPI_H
-
-/*
- * CSPI: Cryptographic Service Provider Interface.
- */
-
-#include <sys/types.h>
-#include <sys/crypto/common.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef _KERNEL
-#include <sys/dditypes.h>
-#include <sys/ddi.h>
-#include <sys/kmem.h>
-
-#define CRYPTO_SPI_VERSION_1 1
-#define CRYPTO_SPI_VERSION_2 2
-#define CRYPTO_SPI_VERSION_3 3
-#define CRYPTO_SPI_VERSION_4 4
-#define CRYPTO_SPI_VERSION_5 5
-
-#define CRYPTO_OPS_OFFSET(f) offsetof(crypto_ops_t, co_##f)
-#define CRYPTO_PROVIDER_OFFSET(f) \
- offsetof(crypto_provider_management_ops_t, f)
-#define CRYPTO_OBJECT_OFFSET(f) offsetof(crypto_object_ops_t, f)
-#define CRYPTO_SESSION_OFFSET(f) offsetof(crypto_session_ops_t, f)
-
-#endif
-
-/*
- * Provider-private handle. This handle is specified by a provider
- * when it registers by means of the pi_provider_handle field of
- * the crypto_provider_info structure, and passed to the provider
- * when its entry points are invoked.
- */
-typedef void *crypto_provider_handle_t;
-
-/*
- * Context templates can be used to by software providers to pre-process
- * keying material, such as key schedules. They are allocated by
- * a software provider create_ctx_template(9E) entry point, and passed
- * as argument to initialization and atomic provider entry points.
- */
-typedef void *crypto_spi_ctx_template_t;
-
-/*
- * Request handles are used by the kernel to identify an asynchronous
- * request being processed by a provider. It is passed by the kernel
- * to a hardware provider when submitting a request, and must be
- * specified by a provider when calling crypto_op_notification(9F)
- */
-typedef void *crypto_req_handle_t;
-
-/*
- * The context structure is passed from kcf to a provider in kernel and
- * internally in libsoftcrypto between ucrypto and the algorithm.
- * It contains the information needed to process a multi-part or
- * single part operation. The context structure is not used
- * by atomic operations.
- *
- * Parameters needed to perform a cryptographic operation, such
- * as keys, mechanisms, input and output buffers, are passed
- * as separate arguments to Provider routines.
- */
-typedef struct crypto_ctx {
- crypto_provider_handle_t cc_provider;
- crypto_session_id_t cc_session;
- void *cc_provider_private; /* owned by provider */
- void *cc_framework_private; /* owned by framework */
- uint32_t cc_flags; /* flags */
- void *cc_opstate; /* state */
-} crypto_ctx_t;
-
-#ifdef _KERNEL
-
-/* Values for cc_flags field */
-#define CRYPTO_INIT_OPSTATE 0x00000001 /* allocate and init cc_opstate */
-#define CRYPTO_USE_OPSTATE 0x00000002 /* .. start using it as context */
-
-/*
- * Extended provider information.
- */
-
-/*
- * valid values for ei_flags field of extended info structure
- * They match the RSA Security, Inc PKCS#11 tokenInfo flags.
- */
-#define CRYPTO_EXTF_RNG 0x00000001
-#define CRYPTO_EXTF_WRITE_PROTECTED 0x00000002
-#define CRYPTO_EXTF_LOGIN_REQUIRED 0x00000004
-#define CRYPTO_EXTF_USER_PIN_INITIALIZED 0x00000008
-#define CRYPTO_EXTF_CLOCK_ON_TOKEN 0x00000040
-#define CRYPTO_EXTF_PROTECTED_AUTHENTICATION_PATH 0x00000100
-#define CRYPTO_EXTF_DUAL_CRYPTO_OPERATIONS 0x00000200
-#define CRYPTO_EXTF_TOKEN_INITIALIZED 0x00000400
-#define CRYPTO_EXTF_USER_PIN_COUNT_LOW 0x00010000
-#define CRYPTO_EXTF_USER_PIN_FINAL_TRY 0x00020000
-#define CRYPTO_EXTF_USER_PIN_LOCKED 0x00040000
-#define CRYPTO_EXTF_USER_PIN_TO_BE_CHANGED 0x00080000
-#define CRYPTO_EXTF_SO_PIN_COUNT_LOW 0x00100000
-#define CRYPTO_EXTF_SO_PIN_FINAL_TRY 0x00200000
-#define CRYPTO_EXTF_SO_PIN_LOCKED 0x00400000
-#define CRYPTO_EXTF_SO_PIN_TO_BE_CHANGED 0x00800000
-
-/*
- * The crypto_control_ops structure contains pointers to control
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_control_ops {
- void (*provider_status)(crypto_provider_handle_t, uint_t *);
-} crypto_control_ops_t;
-
-/*
- * The crypto_ctx_ops structure contains points to context and context
- * templates management operations for cryptographic providers. It is
- * passed through the crypto_ops(9S) structure when providers register
- * with the kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_ctx_ops {
- int (*create_ctx_template)(crypto_provider_handle_t,
- crypto_mechanism_t *, crypto_key_t *,
- crypto_spi_ctx_template_t *, size_t *, crypto_req_handle_t);
- int (*free_context)(crypto_ctx_t *);
-} crypto_ctx_ops_t;
-
-/*
- * The crypto_digest_ops structure contains pointers to digest
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_digest_ops {
- int (*digest_init)(crypto_ctx_t *, crypto_mechanism_t *,
- crypto_req_handle_t);
- int (*digest)(crypto_ctx_t *, crypto_data_t *, crypto_data_t *,
- crypto_req_handle_t);
- int (*digest_update)(crypto_ctx_t *, crypto_data_t *,
- crypto_req_handle_t);
- int (*digest_key)(crypto_ctx_t *, crypto_key_t *, crypto_req_handle_t);
- int (*digest_final)(crypto_ctx_t *, crypto_data_t *,
- crypto_req_handle_t);
- int (*digest_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_data_t *,
- crypto_data_t *, crypto_req_handle_t);
-} crypto_digest_ops_t;
-
-/*
- * The crypto_cipher_ops structure contains pointers to encryption
- * and decryption operations for cryptographic providers. It is
- * passed through the crypto_ops(9S) structure when providers register
- * with the kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_cipher_ops {
- int (*encrypt_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*encrypt)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*encrypt_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*encrypt_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*encrypt_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t, crypto_req_handle_t);
-
- int (*decrypt_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*decrypt)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*decrypt_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*decrypt_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*decrypt_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t, crypto_req_handle_t);
-} crypto_cipher_ops_t;
-
-/*
- * The crypto_mac_ops structure contains pointers to MAC
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_mac_ops {
- int (*mac_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*mac)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*mac_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*mac_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*mac_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*mac_verify_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
-} crypto_mac_ops_t;
-
-/*
- * The crypto_sign_ops structure contains pointers to signing
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_sign_ops {
- int (*sign_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*sign)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*sign_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*sign_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*sign_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*sign_recover_init)(crypto_ctx_t *, crypto_mechanism_t *,
- crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*sign_recover)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*sign_recover_atomic)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *, crypto_key_t *,
- crypto_data_t *, crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
-} crypto_sign_ops_t;
-
-/*
- * The crypto_verify_ops structure contains pointers to verify
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_verify_ops {
- int (*verify_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*verify)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*verify_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*verify_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*verify_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*verify_recover_init)(crypto_ctx_t *, crypto_mechanism_t *,
- crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
- int (*verify_recover)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*verify_recover_atomic)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *, crypto_key_t *,
- crypto_data_t *, crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_req_handle_t);
-} crypto_verify_ops_t;
-
-/*
- * The crypto_dual_ops structure contains pointers to dual
- * cipher and sign/verify operations for cryptographic providers.
- * It is passed through the crypto_ops(9S) structure when
- * providers register with the kernel using
- * crypto_register_provider(9F).
- */
-typedef struct crypto_dual_ops {
- int (*digest_encrypt_update)(
- crypto_ctx_t *, crypto_ctx_t *, crypto_data_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*decrypt_digest_update)(
- crypto_ctx_t *, crypto_ctx_t *, crypto_data_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*sign_encrypt_update)(
- crypto_ctx_t *, crypto_ctx_t *, crypto_data_t *,
- crypto_data_t *, crypto_req_handle_t);
- int (*decrypt_verify_update)(
- crypto_ctx_t *, crypto_ctx_t *, crypto_data_t *,
- crypto_data_t *, crypto_req_handle_t);
-} crypto_dual_ops_t;
-
-/*
- * The crypto_dual_cipher_mac_ops structure contains pointers to dual
- * cipher and MAC operations for cryptographic providers.
- * It is passed through the crypto_ops(9S) structure when
- * providers register with the kernel using
- * crypto_register_provider(9F).
- */
-typedef struct crypto_dual_cipher_mac_ops {
- int (*encrypt_mac_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_mechanism_t *,
- crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*encrypt_mac)(crypto_ctx_t *,
- crypto_data_t *, crypto_dual_data_t *, crypto_data_t *,
- crypto_req_handle_t);
- int (*encrypt_mac_update)(crypto_ctx_t *,
- crypto_data_t *, crypto_dual_data_t *, crypto_req_handle_t);
- int (*encrypt_mac_final)(crypto_ctx_t *,
- crypto_dual_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*encrypt_mac_atomic)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_mechanism_t *,
- crypto_key_t *, crypto_data_t *, crypto_dual_data_t *,
- crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
-
- int (*mac_decrypt_init)(crypto_ctx_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_mechanism_t *,
- crypto_key_t *, crypto_spi_ctx_template_t,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*mac_decrypt)(crypto_ctx_t *,
- crypto_dual_data_t *, crypto_data_t *, crypto_data_t *,
- crypto_req_handle_t);
- int (*mac_decrypt_update)(crypto_ctx_t *,
- crypto_dual_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*mac_decrypt_final)(crypto_ctx_t *,
- crypto_data_t *, crypto_data_t *, crypto_req_handle_t);
- int (*mac_decrypt_atomic)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *, crypto_key_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_dual_data_t *,
- crypto_data_t *, crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
- int (*mac_verify_decrypt_atomic)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *, crypto_key_t *,
- crypto_mechanism_t *, crypto_key_t *, crypto_dual_data_t *,
- crypto_data_t *, crypto_data_t *, crypto_spi_ctx_template_t,
- crypto_spi_ctx_template_t, crypto_req_handle_t);
-} crypto_dual_cipher_mac_ops_t;
-
-/*
- * The crypto_random_number_ops structure contains pointers to random
- * number operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_random_number_ops {
- int (*seed_random)(crypto_provider_handle_t, crypto_session_id_t,
- uchar_t *, size_t, uint_t, uint32_t, crypto_req_handle_t);
- int (*generate_random)(crypto_provider_handle_t, crypto_session_id_t,
- uchar_t *, size_t, crypto_req_handle_t);
-} crypto_random_number_ops_t;
-
-/*
- * Flag values for seed_random.
- */
-#define CRYPTO_SEED_NOW 0x00000001
-
-/*
- * The crypto_session_ops structure contains pointers to session
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_session_ops {
- int (*session_open)(crypto_provider_handle_t, crypto_session_id_t *,
- crypto_req_handle_t);
- int (*session_close)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_req_handle_t);
- int (*session_login)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_user_type_t, char *, size_t, crypto_req_handle_t);
- int (*session_logout)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_req_handle_t);
-} crypto_session_ops_t;
-
-/*
- * The crypto_object_ops structure contains pointers to object
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_object_ops {
- int (*object_create)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_object_attribute_t *, uint_t, crypto_object_id_t *,
- crypto_req_handle_t);
- int (*object_copy)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_object_id_t, crypto_object_attribute_t *, uint_t,
- crypto_object_id_t *, crypto_req_handle_t);
- int (*object_destroy)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_object_id_t, crypto_req_handle_t);
- int (*object_get_size)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_object_id_t, size_t *, crypto_req_handle_t);
- int (*object_get_attribute_value)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_object_id_t,
- crypto_object_attribute_t *, uint_t, crypto_req_handle_t);
- int (*object_set_attribute_value)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_object_id_t,
- crypto_object_attribute_t *, uint_t, crypto_req_handle_t);
- int (*object_find_init)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_object_attribute_t *, uint_t, void **,
- crypto_req_handle_t);
- int (*object_find)(crypto_provider_handle_t, void *,
- crypto_object_id_t *, uint_t, uint_t *, crypto_req_handle_t);
- int (*object_find_final)(crypto_provider_handle_t, void *,
- crypto_req_handle_t);
-} crypto_object_ops_t;
-
-/*
- * The crypto_key_ops structure contains pointers to key
- * operations for cryptographic providers. It is passed through
- * the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_key_ops {
- int (*key_generate)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_object_attribute_t *, uint_t,
- crypto_object_id_t *, crypto_req_handle_t);
- int (*key_generate_pair)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_object_attribute_t *, uint_t,
- crypto_object_attribute_t *, uint_t, crypto_object_id_t *,
- crypto_object_id_t *, crypto_req_handle_t);
- int (*key_wrap)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_object_id_t *,
- uchar_t *, size_t *, crypto_req_handle_t);
- int (*key_unwrap)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, uchar_t *, size_t *,
- crypto_object_attribute_t *, uint_t,
- crypto_object_id_t *, crypto_req_handle_t);
- int (*key_derive)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_object_attribute_t *,
- uint_t, crypto_object_id_t *, crypto_req_handle_t);
- int (*key_check)(crypto_provider_handle_t, crypto_mechanism_t *,
- crypto_key_t *);
-} crypto_key_ops_t;
-
-/*
- * The crypto_provider_management_ops structure contains pointers
- * to management operations for cryptographic providers. It is passed
- * through the crypto_ops(9S) structure when providers register with the
- * kernel using crypto_register_provider(9F).
- */
-typedef struct crypto_provider_management_ops {
- int (*ext_info)(crypto_provider_handle_t,
- crypto_provider_ext_info_t *, crypto_req_handle_t);
- int (*init_token)(crypto_provider_handle_t, char *, size_t,
- char *, crypto_req_handle_t);
- int (*init_pin)(crypto_provider_handle_t, crypto_session_id_t,
- char *, size_t, crypto_req_handle_t);
- int (*set_pin)(crypto_provider_handle_t, crypto_session_id_t,
- char *, size_t, char *, size_t, crypto_req_handle_t);
-} crypto_provider_management_ops_t;
-
-typedef struct crypto_mech_ops {
- int (*copyin_mechanism)(crypto_provider_handle_t,
- crypto_mechanism_t *, crypto_mechanism_t *, int *, int);
- int (*copyout_mechanism)(crypto_provider_handle_t,
- crypto_mechanism_t *, crypto_mechanism_t *, int *, int);
- int (*free_mechanism)(crypto_provider_handle_t, crypto_mechanism_t *);
-} crypto_mech_ops_t;
-
-typedef struct crypto_nostore_key_ops {
- int (*nostore_key_generate)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *,
- crypto_object_attribute_t *, uint_t, crypto_object_attribute_t *,
- uint_t, crypto_req_handle_t);
- int (*nostore_key_generate_pair)(crypto_provider_handle_t,
- crypto_session_id_t, crypto_mechanism_t *,
- crypto_object_attribute_t *, uint_t, crypto_object_attribute_t *,
- uint_t, crypto_object_attribute_t *, uint_t,
- crypto_object_attribute_t *, uint_t, crypto_req_handle_t);
- int (*nostore_key_derive)(crypto_provider_handle_t, crypto_session_id_t,
- crypto_mechanism_t *, crypto_key_t *, crypto_object_attribute_t *,
- uint_t, crypto_object_attribute_t *, uint_t, crypto_req_handle_t);
-} crypto_nostore_key_ops_t;
-
-/*
- * crypto_fips140_ops provides a function for FIPS 140 Power-On Self Test for
- * those providers that are part of the Cryptographic Framework bounday. See
- * crypto_fips140_ops(9s) for details.
- */
-typedef struct crypto_fips140_ops {
- void (*fips140_post)(int *);
-} crypto_fips140_ops_t;
-
-/*
- * The crypto_ops(9S) structure contains the structures containing
- * the pointers to functions implemented by cryptographic providers.
- * It is specified as part of the crypto_provider_info(9S)
- * supplied by a provider when it registers with the kernel
- * by calling crypto_register_provider(9F).
- */
-typedef struct crypto_ops_v1 {
- crypto_control_ops_t *co_control_ops;
- crypto_digest_ops_t *co_digest_ops;
- crypto_cipher_ops_t *co_cipher_ops;
- crypto_mac_ops_t *co_mac_ops;
- crypto_sign_ops_t *co_sign_ops;
- crypto_verify_ops_t *co_verify_ops;
- crypto_dual_ops_t *co_dual_ops;
- crypto_dual_cipher_mac_ops_t *co_dual_cipher_mac_ops;
- crypto_random_number_ops_t *co_random_ops;
- crypto_session_ops_t *co_session_ops;
- crypto_object_ops_t *co_object_ops;
- crypto_key_ops_t *co_key_ops;
- crypto_provider_management_ops_t *co_provider_ops;
- crypto_ctx_ops_t *co_ctx_ops;
-} crypto_ops_v1_t;
-
-typedef struct crypto_ops_v2 {
- crypto_ops_v1_t v1_ops;
- crypto_mech_ops_t *co_mech_ops;
-} crypto_ops_v2_t;
-
-typedef struct crypto_ops_v3 {
- crypto_ops_v2_t v2_ops;
- crypto_nostore_key_ops_t *co_nostore_key_ops;
-} crypto_ops_v3_t;
-
-typedef struct crypto_ops_v4 {
- crypto_ops_v3_t v3_ops;
- crypto_fips140_ops_t *co_fips140_ops;
-} crypto_ops_v4_t;
-
-typedef struct crypto_ops_v5 {
- crypto_ops_v4_t v4_ops;
- boolean_t co_uio_userspace_ok;
-} crypto_ops_v5_t;
-
-typedef struct crypto_ops {
- union {
- crypto_ops_v5_t cou_v5;
- crypto_ops_v4_t cou_v4;
- crypto_ops_v3_t cou_v3;
- crypto_ops_v2_t cou_v2;
- crypto_ops_v1_t cou_v1;
- } cou;
-} crypto_ops_t;
-
-#define co_control_ops cou.cou_v1.co_control_ops
-#define co_digest_ops cou.cou_v1.co_digest_ops
-#define co_cipher_ops cou.cou_v1.co_cipher_ops
-#define co_mac_ops cou.cou_v1.co_mac_ops
-#define co_sign_ops cou.cou_v1.co_sign_ops
-#define co_verify_ops cou.cou_v1.co_verify_ops
-#define co_dual_ops cou.cou_v1.co_dual_ops
-#define co_dual_cipher_mac_ops cou.cou_v1.co_dual_cipher_mac_ops
-#define co_random_ops cou.cou_v1.co_random_ops
-#define co_session_ops cou.cou_v1.co_session_ops
-#define co_object_ops cou.cou_v1.co_object_ops
-#define co_key_ops cou.cou_v1.co_key_ops
-#define co_provider_ops cou.cou_v1.co_provider_ops
-#define co_ctx_ops cou.cou_v1.co_ctx_ops
-#define co_mech_ops cou.cou_v2.co_mech_ops
-#define co_nostore_key_ops cou.cou_v3.co_nostore_key_ops
-#define co_fips140_ops cou.cou_v4.co_fips140_ops
-#define co_uio_userspace_ok cou.cou_v5.co_uio_userspace_ok
-
-/*
- * Provider device specification passed during registration.
- *
- * Software providers set the pi_provider_type field of provider_info_t
- * to CRYPTO_SW_PROVIDER, and set the pd_sw field of
- * crypto_provider_dev_t to the address of their modlinkage.
- *
- * Hardware providers set the pi_provider_type field of provider_info_t
- * to CRYPTO_HW_PROVIDER, and set the pd_hw field of
- * crypto_provider_dev_t to the dev_info structure corresponding
- * to the device instance being registered.
- *
- * Logical providers set the pi_provider_type field of provider_info_t
- * to CRYPTO_LOGICAL_PROVIDER, and set the pd_hw field of
- * crypto_provider_dev_t to the dev_info structure corresponding
- * to the device instance being registered.
- */
-
-typedef union crypto_provider_dev {
- struct modlinkage *pd_sw; /* for CRYPTO_SW_PROVIDER */
- dev_info_t *pd_hw; /* for CRYPTO_HW_PROVIDER */
-} crypto_provider_dev_t;
-
-/*
- * The mechanism info structure crypto_mech_info_t contains a function group
- * bit mask cm_func_group_mask. This field, of type crypto_func_group_t,
- * specifies the provider entry point that can be used a particular
- * mechanism. The function group mask is a combination of the following values.
- */
-
-typedef uint32_t crypto_func_group_t;
-
-#endif /* _KERNEL */
-
-#define CRYPTO_FG_ENCRYPT 0x00000001 /* encrypt_init() */
-#define CRYPTO_FG_DECRYPT 0x00000002 /* decrypt_init() */
-#define CRYPTO_FG_DIGEST 0x00000004 /* digest_init() */
-#define CRYPTO_FG_SIGN 0x00000008 /* sign_init() */
-#define CRYPTO_FG_SIGN_RECOVER 0x00000010 /* sign_recover_init() */
-#define CRYPTO_FG_VERIFY 0x00000020 /* verify_init() */
-#define CRYPTO_FG_VERIFY_RECOVER 0x00000040 /* verify_recover_init() */
-#define CRYPTO_FG_GENERATE 0x00000080 /* key_generate() */
-#define CRYPTO_FG_GENERATE_KEY_PAIR 0x00000100 /* key_generate_pair() */
-#define CRYPTO_FG_WRAP 0x00000200 /* key_wrap() */
-#define CRYPTO_FG_UNWRAP 0x00000400 /* key_unwrap() */
-#define CRYPTO_FG_DERIVE 0x00000800 /* key_derive() */
-#define CRYPTO_FG_MAC 0x00001000 /* mac_init() */
-#define CRYPTO_FG_ENCRYPT_MAC 0x00002000 /* encrypt_mac_init() */
-#define CRYPTO_FG_MAC_DECRYPT 0x00004000 /* decrypt_mac_init() */
-#define CRYPTO_FG_ENCRYPT_ATOMIC 0x00008000 /* encrypt_atomic() */
-#define CRYPTO_FG_DECRYPT_ATOMIC 0x00010000 /* decrypt_atomic() */
-#define CRYPTO_FG_MAC_ATOMIC 0x00020000 /* mac_atomic() */
-#define CRYPTO_FG_DIGEST_ATOMIC 0x00040000 /* digest_atomic() */
-#define CRYPTO_FG_SIGN_ATOMIC 0x00080000 /* sign_atomic() */
-#define CRYPTO_FG_SIGN_RECOVER_ATOMIC 0x00100000 /* sign_recover_atomic() */
-#define CRYPTO_FG_VERIFY_ATOMIC 0x00200000 /* verify_atomic() */
-#define CRYPTO_FG_VERIFY_RECOVER_ATOMIC 0x00400000 /* verify_recover_atomic() */
-#define CRYPTO_FG_ENCRYPT_MAC_ATOMIC 0x00800000 /* encrypt_mac_atomic() */
-#define CRYPTO_FG_MAC_DECRYPT_ATOMIC 0x01000000 /* mac_decrypt_atomic() */
-#define CRYPTO_FG_RESERVED 0x80000000
-
-/*
- * Maximum length of the pi_provider_description field of the
- * crypto_provider_info structure.
- */
-#define CRYPTO_PROVIDER_DESCR_MAX_LEN 64
-
-#ifdef _KERNEL
-
-/* Bit mask for all the simple operations */
-#define CRYPTO_FG_SIMPLEOP_MASK (CRYPTO_FG_ENCRYPT | CRYPTO_FG_DECRYPT | \
- CRYPTO_FG_DIGEST | CRYPTO_FG_SIGN | CRYPTO_FG_VERIFY | CRYPTO_FG_MAC | \
- CRYPTO_FG_ENCRYPT_ATOMIC | CRYPTO_FG_DECRYPT_ATOMIC | \
- CRYPTO_FG_MAC_ATOMIC | CRYPTO_FG_DIGEST_ATOMIC | CRYPTO_FG_SIGN_ATOMIC | \
- CRYPTO_FG_VERIFY_ATOMIC)
-
-/* Bit mask for all the dual operations */
-#define CRYPTO_FG_MAC_CIPHER_MASK (CRYPTO_FG_ENCRYPT_MAC | \
- CRYPTO_FG_MAC_DECRYPT | CRYPTO_FG_ENCRYPT_MAC_ATOMIC | \
- CRYPTO_FG_MAC_DECRYPT_ATOMIC)
-
-/* Add other combos to CRYPTO_FG_DUAL_MASK */
-#define CRYPTO_FG_DUAL_MASK CRYPTO_FG_MAC_CIPHER_MASK
-
-/*
- * The crypto_mech_info structure specifies one of the mechanisms
- * supported by a cryptographic provider. The pi_mechanisms field of
- * the crypto_provider_info structure contains a pointer to an array
- * of crypto_mech_info's.
- */
-typedef struct crypto_mech_info {
- crypto_mech_name_t cm_mech_name;
- crypto_mech_type_t cm_mech_number;
- crypto_func_group_t cm_func_group_mask;
- ssize_t cm_min_key_length;
- ssize_t cm_max_key_length;
- uint32_t cm_mech_flags;
-} crypto_mech_info_t;
-
-/* Alias the old name to the new name for compatibility. */
-#define cm_keysize_unit cm_mech_flags
-
-/*
- * crypto_kcf_provider_handle_t is a handle allocated by the kernel.
- * It is returned after the provider registers with
- * crypto_register_provider(), and must be specified by the provider
- * when calling crypto_unregister_provider(), and
- * crypto_provider_notification().
- */
-typedef uint_t crypto_kcf_provider_handle_t;
-
-/*
- * Provider information. Passed as argument to crypto_register_provider(9F).
- * Describes the provider and its capabilities. Multiple providers can
- * register for the same device instance. In this case, the same
- * pi_provider_dev must be specified with a different pi_provider_handle.
- */
-typedef struct crypto_provider_info_v1 {
- uint_t pi_interface_version;
- char *pi_provider_description;
- crypto_provider_type_t pi_provider_type;
- crypto_provider_dev_t pi_provider_dev;
- crypto_provider_handle_t pi_provider_handle;
- crypto_ops_t *pi_ops_vector;
- uint_t pi_mech_list_count;
- crypto_mech_info_t *pi_mechanisms;
- uint_t pi_logical_provider_count;
- crypto_kcf_provider_handle_t *pi_logical_providers;
-} crypto_provider_info_v1_t;
-
-typedef struct crypto_provider_info_v2 {
- crypto_provider_info_v1_t v1_info;
- uint_t pi_flags;
-} crypto_provider_info_v2_t;
-
-typedef struct crypto_provider_info {
- union {
- crypto_provider_info_v2_t piu_v2;
- crypto_provider_info_v1_t piu_v1;
- } piu;
-} crypto_provider_info_t;
-
-#define pi_interface_version piu.piu_v1.pi_interface_version
-#define pi_provider_description piu.piu_v1.pi_provider_description
-#define pi_provider_type piu.piu_v1.pi_provider_type
-#define pi_provider_dev piu.piu_v1.pi_provider_dev
-#define pi_provider_handle piu.piu_v1.pi_provider_handle
-#define pi_ops_vector piu.piu_v1.pi_ops_vector
-#define pi_mech_list_count piu.piu_v1.pi_mech_list_count
-#define pi_mechanisms piu.piu_v1.pi_mechanisms
-#define pi_logical_provider_count piu.piu_v1.pi_logical_provider_count
-#define pi_logical_providers piu.piu_v1.pi_logical_providers
-#define pi_flags piu.piu_v2.pi_flags
-
-/* hidden providers can only be accessed via a logical provider */
-#define CRYPTO_HIDE_PROVIDER 0x00000001
-/*
- * provider can not do multi-part digest (updates) and has a limit
- * on maximum input data that it can digest. The provider sets
- * this value in crypto_provider_ext_info_t by implementing
- * the ext_info entry point in the co_provider_ops vector.
- */
-#define CRYPTO_HASH_NO_UPDATE 0x00000002
-/*
- * provider can not do multi-part HMAC (updates) and has a limit
- * on maximum input data that it can hmac. The provider sets
- * this value in crypto_provider_ext_info_t by implementing
- * the ext_info entry point in the co_provider_ops vector.
- */
-#define CRYPTO_HMAC_NO_UPDATE 0x00000008
-
-/* provider can handle the request without returning a CRYPTO_QUEUED */
-#define CRYPTO_SYNCHRONOUS 0x00000004
-
-#define CRYPTO_PIFLAGS_RESERVED2 0x40000000
-#define CRYPTO_PIFLAGS_RESERVED1 0x80000000
-
-/*
- * Provider status passed by a provider to crypto_provider_notification(9F)
- * and returned by the provider_stauts(9E) entry point.
- */
-#define CRYPTO_PROVIDER_READY 0
-#define CRYPTO_PROVIDER_BUSY 1
-#define CRYPTO_PROVIDER_FAILED 2
-
-/*
- * Functions exported by Solaris to cryptographic providers. Providers
- * call these functions to register and unregister, notify the kernel
- * of state changes, and notify the kernel when a asynchronous request
- * completed.
- */
-extern int crypto_register_provider(crypto_provider_info_t *,
- crypto_kcf_provider_handle_t *);
-extern int crypto_unregister_provider(crypto_kcf_provider_handle_t);
-extern void crypto_provider_notification(crypto_kcf_provider_handle_t, uint_t);
-extern void crypto_op_notification(crypto_req_handle_t, int);
-extern int crypto_kmflag(crypto_req_handle_t);
-
-#endif /* _KERNEL */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_CRYPTO_SPI_H */
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Tue Jun 14 10:22:07 2016 -0700
@@ -448,29 +448,27 @@
}
void newBuilder(String name, int reqs, int exports, int provides,
- int conceals, int packages) {
+ int packages) {
mv.visitTypeInsn(NEW, MODULE_DESCRIPTOR_BUILDER);
mv.visitInsn(DUP);
mv.visitLdcInsn(name);
pushInt(initialCapacity(reqs));
pushInt(initialCapacity(exports));
pushInt(initialCapacity(provides));
- pushInt(initialCapacity(conceals));
pushInt(initialCapacity(packages));
mv.visitMethodInsn(INVOKESPECIAL, MODULE_DESCRIPTOR_BUILDER,
- "<init>", "(Ljava/lang/String;IIIII)V", false);
+ "<init>", "(Ljava/lang/String;IIII)V", false);
mv.visitVarInsn(ASTORE, BUILDER_VAR);
mv.visitVarInsn(ALOAD, BUILDER_VAR);
}
/*
* Returns the set of concealed packages from ModuleDescriptor, if present
- * or compute it if the module oes not have ConcealedPackages attribute
+ * or compute it if the module does not have ConcealedPackages attribute
*/
Set<String> conceals() {
Set<String> conceals = md.conceals();
- if (md.conceals().isEmpty() &&
- (md.exports().size() + md.conceals().size()) != packages.size()) {
+ if (conceals.isEmpty() && md.exports().size() != packages.size()) {
Set<String> exports = md.exports().stream()
.map(Exports::source)
.collect(Collectors.toSet());
@@ -492,8 +490,7 @@
newBuilder(md.name(), md.requires().size(),
md.exports().size(),
md.provides().size(),
- conceals().size(),
- conceals().size() + md.exports().size());
+ packages.size());
// requires
for (ModuleDescriptor.Requires req : md.requires()) {
@@ -528,10 +525,8 @@
provides(p.service(), p.providers());
}
- // concealed packages
- for (String pn : conceals()) {
- conceals(pn);
- }
+ // all packages
+ packages(packages);
// version
md.version().ifPresent(this::version);
@@ -675,11 +670,13 @@
/*
* Invoke Builder.conceals(String pn)
*/
- void conceals(String pn) {
+ void packages(Set<String> packages) {
mv.visitVarInsn(ALOAD, BUILDER_VAR);
- mv.visitLdcInsn(pn);
+ int varIndex = new StringSetBuilder(packages).build();
+ assert varIndex == STRING_SET_VAR;
+ mv.visitVarInsn(ALOAD, varIndex);
mv.visitMethodInsn(INVOKEVIRTUAL, MODULE_DESCRIPTOR_BUILDER,
- "conceals", STRING_SIG, false);
+ "packages", SET_SIG, false);
mv.visitInsn(POP);
}
@@ -761,7 +758,7 @@
if (localVarIndex == 0) {
// if non-empty and more than one set reference this builder,
// emit to a unique local
- index = refCount == 1 ? STRING_SET_VAR
+ index = refCount <= 1 ? STRING_SET_VAR
: nextLocalVar++;
if (index < MAX_LOCAL_VARS) {
localVarIndex = index;
--- a/jdk/test/Makefile Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/Makefile Tue Jun 14 10:22:07 2016 -0700
@@ -316,8 +316,9 @@
# Always turn on assertions
JTREG_ASSERT_OPTION = -ea -esa
JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
-# Report details on all failed or error tests, times too
-JTREG_BASIC_OPTIONS += -v:fail,error,time
+# jtreg verbosity setting
+JTREG_VERBOSE ?= fail,error,time
+JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE))
# Retain all files for failing tests
JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
--- a/jdk/test/ProblemList.txt Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/ProblemList.txt Tue Jun 14 10:22:07 2016 -0700
@@ -167,8 +167,6 @@
java/net/DatagramSocket/SendDatagramToBadAddress.java 7143960 macosx-all
-sun/net/www/http/ChunkedOutputStream/checkError.java 8041924 linux-all
-
############################################################################
# jdk_nio
@@ -211,15 +209,10 @@
sun/security/krb5/auto/Unreachable.java 7164518 macosx-all no PortUnreachableException on Mac
-java/security/KeyPairGenerator/SolarisShortDSA.java 7041639 solaris-all
-sun/security/tools/keytool/standard.sh 7041639 solaris-all
-
sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all
sun/security/mscapi/ShortRSAKey1024.sh 8153948 windows-all
-java/security/Security/ClassLoaderDeadlock/Deadlock2.sh 8062758 generic-all
-
sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java 8026393 generic-all
sun/security/pkcs11/Cipher/ReinitCipher.java 8077138,8023434 windows-all
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/lang/annotation/Missing/MissingDefault.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Annotation type with a default value whose class will be missing
+ * when MissingTest is run.
+ */
+@Retention(RUNTIME)
+public @interface MissingDefault {
+ Class<?> value() default Missing.class;
+}
--- a/jdk/test/java/lang/annotation/Missing/MissingTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/lang/annotation/Missing/MissingTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,15 +23,16 @@
/*
* @test
- * @bug 6322301
+ * @bug 6322301 5041778
* @summary Verify when missing annotation classes cause exceptions
* @author Joseph D. Darcy
- * @compile MissingTest.java A.java B.java C.java D.java Marker.java Missing.java MissingWrapper.java
+ * @compile MissingTest.java A.java B.java C.java D.java Marker.java Missing.java MissingWrapper.java MissingDefault.java
* @clean Missing
* @run main MissingTest
*/
import java.lang.reflect.*;
+import java.lang.annotation.*;
/**
* This test verifies that a missing annotation class leads to the
@@ -112,7 +113,20 @@
}
}
- public static void main(String argv[]) throws Exception {
+ private static void testMethodGetDefaultValue(Class<?> clazz) throws Exception{
+ Method m = clazz.getMethod("value", (Class<?>[])null);
+
+ try {
+ System.out.println(m.getDefaultValue());
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (TypeNotPresentException tnpe) {
+ ; // Expected
+ } catch (AnnotationFormatError afe) {
+ throw new RuntimeException(afe);
+ }
+ }
+
+ public static void main(String... args) throws Exception {
// Class A has a directly applied annotation whose class is
// missing.
testAnnotation(A.class, false);
@@ -131,5 +145,7 @@
// includes to an annotation class that is missing.
testParameterAnnotation(D.class.getDeclaredMethod("method1", Object.class),
true);
+ // The MissingDefault annotation type has a default value of the Missing class.
+ testMethodGetDefaultValue(MissingDefault.class);
}
}
--- a/jdk/test/java/net/Authenticator/B4769350.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/Authenticator/B4769350.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4769350 8017779
+ * @modules jdk.httpserver
* @run main/othervm B4769350 server
* @run main/othervm B4769350 proxy
* @summary proxy authentication username and password caching only works in serial case
--- a/jdk/test/java/net/Authenticator/Deadlock.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/Authenticator/Deadlock.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/**
* @test
* @bug 6648001
+ * @modules jdk.httpserver
* @run main/othervm/timeout=20 -ea:sun.net.www.protocol.http.AuthenticationInfo -Dhttp.auth.serializeRequests=true Deadlock
* @summary cancelling HTTP authentication causes deadlock
*/
--- a/jdk/test/java/net/CookieHandler/EmptyCookieHeader.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/CookieHandler/EmptyCookieHeader.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/*
* @test
* @bug 8015799
+ * @modules jdk.httpserver
* @summary HttpURLConnection.getHeaderFields() throws IllegalArgumentException
*/
--- a/jdk/test/java/net/CookieHandler/LocalHostCookie.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/CookieHandler/LocalHostCookie.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
/*
* @test
* @bug 7169142
+ * @modules jdk.httpserver
* @summary CookieHandler does not work with localhost
* @run main/othervm LocalHostCookie
*/
--- a/jdk/test/java/net/HttpCookie/IllegalCookieNameTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/HttpCookie/IllegalCookieNameTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
/* @test
* @bug 7183292
+ * @modules jdk.httpserver
*/
import java.net.*;
import java.util.*;
--- a/jdk/test/java/net/ResponseCache/Test.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/ResponseCache/Test.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/* @test
* @summary Fixed a potential NullPointerException when setting a ResponseCache that returns a null CacheRequest
* @bug 4837267
+ * @modules jdk.httpserver
* @author Michael McMahon
*/
--- a/jdk/test/java/net/ResponseCache/Test2.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/ResponseCache/Test2.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
* @test
* @bug 8042622
* @summary Check for CRL results in IllegalArgumentException "white space not allowed"
+ * @modules jdk.httpserver
* @run main/othervm Test2
*/
--- a/jdk/test/java/net/SetFactoryPermission/SetFactoryPermission.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/SetFactoryPermission/SetFactoryPermission.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
* @test
* @bug 8048052
* @summary Test a series of methods which requires "setFactory" runtime permission
+ * @modules java.rmi
* @run main SetFactoryPermission success
* @run main/othervm/policy=policy.fail SetFactoryPermission fail
* @run main/othervm/policy=policy.success SetFactoryPermission success
--- a/jdk/test/java/net/Socks/SocksIPv6Test.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/Socks/SocksIPv6Test.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
/* @test
* @bug 7100957
+ * @modules jdk.httpserver
* @summary Java doesn't correctly handle the SOCKS protocol when used over IPv6.
* @run testng SocksIPv6Test
*/
--- a/jdk/test/java/net/URLClassLoader/ClassLoad.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/URLClassLoader/ClassLoad.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4151665
+ * @modules jdk.httpserver
* @summary Test for FileNotFoundException when loading bogus class
*/
--- a/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/URLClassLoader/closetest/CloseTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
/**
* @test
* @bug 4167874
+ * @modules jdk.httpserver
* @library ../../../../com/sun/net/httpserver
* @library /lib/testlibrary
* @build FileServerHandler jdk.testlibrary.FileUtils
--- a/jdk/test/java/net/URLPermission/URLTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/URLPermission/URLTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -27,6 +27,7 @@
*
* @test
* @bug 8010464
+ * @modules jdk.httpserver
* @key intermittent
* @library /lib/testlibrary/
* @build jdk.testlibrary.SimpleSSLContext
--- a/jdk/test/java/net/httpclient/APIErrors.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/APIErrors.java Tue Jun 14 10:22:07 2016 -0700
@@ -24,6 +24,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @library /lib/testlibrary/
* @build jdk.testlibrary.SimpleSSLContext ProxyServer
* @build TestKit
--- a/jdk/test/java/net/httpclient/BasicAuthTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/BasicAuthTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -25,6 +25,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @run main/othervm BasicAuthTest
* @summary Basic Authentication Test
*/
--- a/jdk/test/java/net/httpclient/ImmutableHeaders.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/ImmutableHeaders.java Tue Jun 14 10:22:07 2016 -0700
@@ -25,6 +25,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @run main/othervm ImmutableHeaders
* @summary ImmutableHeaders
*/
--- a/jdk/test/java/net/httpclient/ManyRequests.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/ManyRequests.java Tue Jun 14 10:22:07 2016 -0700
@@ -24,6 +24,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @library /lib/testlibrary/ /
* @build jdk.testlibrary.SimpleSSLContext EchoHandler
* @compile ../../../com/sun/net/httpserver/LogFilter.java
--- a/jdk/test/java/net/httpclient/RequestBodyTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/RequestBodyTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -23,6 +23,8 @@
/**
* @test @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @library /lib/testlibrary/ /
* @compile ../../../com/sun/net/httpserver/LogFilter.java
* @compile ../../../com/sun/net/httpserver/FileServerHandler.java
--- a/jdk/test/java/net/httpclient/SmokeTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/SmokeTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -24,6 +24,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @library /lib/testlibrary/ /
* @build jdk.testlibrary.SimpleSSLContext ProxyServer EchoHandler
* @compile ../../../com/sun/net/httpserver/LogFilter.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/net/httpclient/TEST.properties Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,1 @@
+modules = java.httpclient
--- a/jdk/test/java/net/httpclient/http2/java.httpclient/sun/net/httpclient/hpack/HeaderTableTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/http2/java.httpclient/sun/net/httpclient/hpack/HeaderTableTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -28,6 +28,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
@@ -35,7 +36,10 @@
import static java.lang.String.format;
import static org.testng.Assert.assertEquals;
-import static sun.net.httpclient.hpack.TestHelper.*;
+import static sun.net.httpclient.hpack.TestHelper.assertExceptionMessageContains;
+import static sun.net.httpclient.hpack.TestHelper.assertThrows;
+import static sun.net.httpclient.hpack.TestHelper.assertVoidThrows;
+import static sun.net.httpclient.hpack.TestHelper.newRandom;
public class HeaderTableTest {
@@ -317,10 +321,24 @@
@Test
public void testToString() {
+ testToString0();
+ }
+
+ @Test
+ public void testToStringDifferentLocale() {
+ Locale.setDefault(Locale.FRENCH);
+ String s = format("%.1f", 3.1);
+ assertEquals("3,1", s); // assumption of the test, otherwise the test is useless
+ testToString0();
+ }
+
+ private void testToString0() {
HeaderTable table = new HeaderTable(0);
{
table.setMaxSize(2048);
- assertEquals("entries: 0; used 0/2048 (0.0%)", table.toString());
+ String expected =
+ format("entries: %d; used %s/%s (%.1f%%)", 0, 0, 2048, 0.0);
+ assertEquals(expected, table.toString());
}
{
@@ -335,7 +353,8 @@
int used = name.length() + value.length() + 32;
double ratio = used * 100.0 / size;
- String expected = format("entries: 1; used %s/%s (%.1f%%)", used, size, ratio);
+ String expected =
+ format("entries: 1; used %s/%s (%.1f%%)", used, size, ratio);
assertEquals(expected, s);
}
@@ -344,7 +363,9 @@
table.put(":method", "");
table.put(":status", "");
String s = table.toString();
- assertEquals("entries: 2; used 78/78 (100.0%)", s);
+ String expected =
+ format("entries: %d; used %s/%s (%.1f%%)", 2, 78, 78, 100.0);
+ assertEquals(expected, s);
}
}
--- a/jdk/test/java/net/httpclient/security/Security.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/httpclient/security/Security.java Tue Jun 14 10:22:07 2016 -0700
@@ -25,6 +25,8 @@
/**
* @test
* @bug 8087112
+ * @modules java.httpclient
+ * jdk.httpserver
* @library /lib/testlibrary/
* @build jdk.testlibrary.SimpleSSLContext
* @compile ../../../../com/sun/net/httpserver/LogFilter.java
--- a/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/net/spi/URLStreamHandlerProvider/Basic.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
/*
* @test
* @bug 8064924
+ * @modules java.compiler
* @summary Basic test for URLStreamHandlerProvider
* @library /lib/testlibrary
* @build jdk.testlibrary.FileUtils jdk.testlibrary.JDKToolFinder
--- a/jdk/test/java/security/Provider/DefaultProviderList.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/security/Provider/DefaultProviderList.java Tue Jun 14 10:22:07 2016 -0700
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 7191662 8157469
+ * @bug 7191662 8157469 8157489
* @summary Ensure non-java.base providers can be found by ServiceLoader
* @author Valerie Peng
*/
@@ -33,6 +33,7 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.ServiceLoader;
+import java.lang.reflect.Module;
public class DefaultProviderList {
@@ -43,37 +44,54 @@
ServiceLoader<Provider> sl = ServiceLoader.load(Provider.class);
boolean failed = false;
+
+ Module baseMod = Object.class.getModule();
+
+ // Test#1: check that all non-base security providers can be found
+ // through ServiceLoader
for (Provider p : defaultProvs) {
String pName = p.getName();
- // only providers outside java.base are loaded by ServiceLoader
- if (pName.equals("SUN") || pName.equals("SunRsaSign") ||
- pName.equals("SunJCE") || pName.equals("SunJSSE") ||
- pName.equals("Apple")) {
- System.out.println("Skip test for provider " + pName);
- continue;
- }
- String pClassName = p.getClass().getName();
- // Should be able to find each one through ServiceLoader
- Iterator<Provider> provIter = sl.iterator();
- boolean found = false;
- while (provIter.hasNext()) {
- Provider pFromSL = provIter.next();
- if (pFromSL.getClass().getName().equals(pClassName)) {
- found = true;
- break;
+ Class pClass = p.getClass();
+
+ if (pClass.getModule() != baseMod) {
+ String pClassName = pClass.getName();
+ Iterator<Provider> provIter = sl.iterator();
+ boolean found = false;
+ while (provIter.hasNext()) {
+ Provider pFromSL = provIter.next();
+
+ // check for match by class name because PKCS11 provider
+ // will have a different name after being configured.
+ if (pFromSL.getClass().getName().equals(pClassName)) {
+ found = true;
+ System.out.println("SL found provider " + pName);
+ break;
+ }
+ }
+ if (!found) {
+ failed = true;
+ System.out.println("Error: SL cannot find provider " +
+ pName);
}
}
- System.out.println("Found " + p.getName() + " = " + found);
- if (!found) {
+ }
+
+ // Test#2: check that all security providers found through ServiceLoader
+ // are not from base module
+ Iterator<Provider> provIter = sl.iterator();
+ while (provIter.hasNext()) {
+ Provider pFromSL = provIter.next();
+ if (pFromSL.getClass().getModule() == baseMod) {
failed = true;
- System.out.println("Error: no provider class " + pClassName +
- " found");
+ System.out.println("Error: base provider " +
+ pFromSL.getName() + " loaded by SL");
}
}
+
if (!failed) {
System.out.println("Test Passed");
} else {
- throw new Exception("One or more provider not loaded by SL");
+ throw new Exception("One or more tests failed");
}
}
}
--- a/jdk/test/java/security/SecureRandom/ApiTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/security/SecureRandom/ApiTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -105,7 +105,7 @@
private static void runForEachAlg(String mech, String alg)
throws Exception {
- for (int strength : new int[]{Integer.MIN_VALUE, -1, 0, 1, 223, 224,
+ for (int strength : new int[]{-1, 0, 1, 223, 224,
192, 255, 256}) {
for (Capability cp : Capability.values()) {
for (byte[] pr : new byte[][]{null, new byte[]{},
--- a/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java Tue Jun 14 10:22:07 2016 -0700
@@ -22,7 +22,7 @@
*/
/* @test
- * @bug 8051408
+ * @bug 8051408 8158534
* @summary Make sure DrbgParameters coded as specified
* @library /test/lib/share/classes
*/
@@ -68,6 +68,9 @@
ins = DrbgParameters.instantiation(-1, NONE, null);
Asserts.assertNull(ins.getPersonalizationString());
+ iae(() -> DrbgParameters.instantiation(-2, NONE, null));
+ npe(() -> DrbgParameters.instantiation(-1, null, null));
+
// NextBytes
p = "NextBytes".getBytes();
DrbgParameters.NextBytes nb = DrbgParameters
@@ -85,6 +88,8 @@
np2 = nb.getAdditionalInput();
Asserts.assertTrue(Arrays.equals(np1, np2));
+ iae(() -> DrbgParameters.nextBytes(-2, false, null));
+
// Reseed
p = "Reseed".getBytes();
DrbgParameters.Reseed rs = DrbgParameters
@@ -101,4 +106,29 @@
np2 = rs.getAdditionalInput();
Asserts.assertTrue(Arrays.equals(np1, np2));
}
+
+ static void iae(RunnableWithException r) throws Exception {
+ checkException(r, IllegalArgumentException.class);
+ }
+
+ static void npe(RunnableWithException r) throws Exception {
+ checkException(r, NullPointerException.class);
+ }
+
+ interface RunnableWithException {
+ void run() throws Exception;
+ }
+
+ static void checkException(RunnableWithException r, Class ex)
+ throws Exception {
+ try {
+ r.run();
+ } catch (Exception e) {
+ if (ex.isAssignableFrom(e.getClass())) {
+ return;
+ }
+ throw e;
+ }
+ throw new Exception("No exception thrown");
+ }
}
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/CreateSerialized.java Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.*;
-import sun.misc.*;
-
-public class CreateSerialized {
- public static void main(String[] args) throws Exception {
- Object o = new com.sun.crypto.provider.SunJCE();
-
- FileOutputStream fos = new FileOutputStream("object.tmp");
- ObjectOutputStream objectOutputStream = new ObjectOutputStream(fos);
- objectOutputStream.writeObject(o);
- fos.close();
- }
-}
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.java Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.*;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.security.*;
-
-public class Deadlock2 {
- public static void main(String[] args) throws Exception {
- File file = new File("object.tmp");
- final byte[] bytes = new byte[(int) file.length()];
- FileInputStream fileInputStream = new FileInputStream(file);
- int read = fileInputStream.read(bytes);
- if (read != file.length()) {
- throw new Exception("Didn't read all");
- }
- Thread.sleep(1000);
-
- Runnable xmlRunnable = new Runnable() {
- public void run() {
- try {
- DocumentBuilderFactory.newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- Runnable readObjectRunnable = new Runnable() {
- public void run() {
- try {
- ObjectInputStream objectInputStream =
- new ObjectInputStream(new ByteArrayInputStream(bytes));
- Object o = objectInputStream.readObject();
- System.out.println(o.getClass());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- Thread thread1 = new Thread(readObjectRunnable, "Read Object");
- Thread thread2 = new Thread(xmlRunnable, "XML");
-
- thread1.start();
- thread2.start();
-
- thread1.join();
- thread2.join();
- }
-}
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2009, 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 6440846
-# @summary make sure we do not deadlock between ExtClassLoader and AppClassLoader
-# @author Valerie Peng
-# @run shell/timeout=20 Deadlock2.sh
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-
-if [ "${TESTSRC}" = "" ] ; then
- TESTSRC="."
-fi
-
-if [ "${TESTCLASSES}" = "" ] ; then
- TESTCLASSES="."
-fi
-
-if [ "${TESTJAVA}" = "" ] ; then
- echo "TESTJAVA not set. Test cannot execute."
- echo "FAILED!!!"
- exit 1
-fi
-
-if [ "${COMPILEJAVA}" = "" ]; then
- COMPILEJAVA="${TESTJAVA}"
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS )
- PATHSEP=":"
- FILESEP="/"
- ;;
- Linux )
- PATHSEP=":"
- FILESEP="/"
- ;;
- CYGWIN* )
- PATHSEP=";"
- FILESEP="/"
- ;;
- Darwin )
- PATHSEP=":"
- FILESEP="/"
- ;;
- AIX )
- PATHSEP=":"
- FILESEP="/"
- ;;
- Windows* )
- PATHSEP=";"
- FILESEP="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# remove old class files
-cd ${TESTCLASSES}
-if [ -d testlib ] ; then
- rm -rf testlib
-fi
-mkdir testlib
-
-# compile and package the test program
-${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
- -d ${TESTCLASSES} \
- ${TESTSRC}${FILESEP}CreateSerialized.java \
- ${TESTSRC}${FILESEP}Deadlock2.java
-
-${COMPILEJAVA}${FILESEP}bin${FILESEP}jar ${TESTTOOLVMOPTS} \
- -cvf testlib${FILESEP}Deadlock2.jar \
- Deadlock2*.class
-
-rm Deadlock2*.class
-
-# create serialized object and run the test
-${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized
-${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
- -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib${PATHSEP}${TESTJAVA}${FILESEP}lib${FILESEP}ext Deadlock2
-STATUS=$?
-
-# clean up
-rm object.tmp CreateSerialized.class
-rm -rf testlib
-exit ${STATUS}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Locale/Bug8135061.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8135061
+ * @summary Checks that the Locale.lookup executes properly without throwing
+ * any exception for some specific language ranges
+ * @run main Bug8135061
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Locale.LanguageRange;
+
+public class Bug8135061 {
+
+ public static void main(String[] args) {
+
+ /* lookup should run without throwing any exception and
+ * return null as the language range does not match with the language
+ * tag
+ */
+ List<LanguageRange> ranges = LanguageRange.parse("nv");
+ Collection<Locale> locales = Collections.singleton(Locale.ENGLISH);
+
+ try {
+ Locale match = Locale.lookup(ranges, locales);
+ if (match != null) {
+ throw new RuntimeException("Locale.lookup returned non-null: "
+ + match);
+ }
+ } catch (Exception ex) {
+ throw new RuntimeException("[Locale.lookup failed on language"
+ + " range: " + ranges + " and language tags "
+ + locales + "]", ex);
+ }
+
+ /* lookup should run without throwing any exception and
+ * return "nv" as the matching tag
+ */
+ ranges = LanguageRange.parse("i-navajo");
+ locales = Collections.singleton(new Locale("nv"));
+
+ try {
+ Locale match = Locale.lookup(ranges, locales);
+ if (!match.toLanguageTag().equals("nv")) {
+ throw new RuntimeException("Locale.lookup returned unexpected"
+ + " result: " + match);
+ }
+ } catch (Exception ex) {
+ throw new RuntimeException("[Locale.lookup failed on language"
+ + " range: " + ranges + " and language tags "
+ + locales + "]", ex);
+ }
+
+ }
+
+}
--- a/jdk/test/java/util/logging/SimpleFormatterFormat.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/java/util/logging/SimpleFormatterFormat.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6381464
+ * @bug 6381464 8153666
* @summary Test the custom simple formatter output
*
* @run main/othervm SimpleFormatterFormat
@@ -60,13 +60,19 @@
"test.foo",
"test.foo",
"test.bar",
+ "test.bar",
+ "test.bar",
"test.bar"
};
private static String[] messages = new String[] {
"severe hello world",
"warning lost connection",
"info welcome",
- "warning exception thrown",
+ "warning beware of traps",
+ "warning { {ok7} }",
+ // keep exception logging as last test case to avoid having
+ // to skip the exception stack trace in the output
+ "warning exception thrown"
};
private static void writeLogRecords(PrintStream logps) throws Exception {
try {
@@ -79,8 +85,11 @@
Logger bar = Logger.getLogger("test.bar");
bar.finest("Dummy message");
bar.info(messages[2]);
- bar.log(Level.WARNING, messages[3], new IllegalArgumentException());
+ bar.log(Level.WARNING, "{0}", new Object[] { messages[3] });
+ bar.log(Level.WARNING, "warning '{' '{'{7}} }", new Object[] {"ok", "ok1", "ok2", "ok3", "ok4", "ok5", "ok6", "ok7", "ok8", "ok9", "ok10"});
+ // Keep this one last - as it also prints the exception stack trace...
+ bar.log(Level.WARNING, messages[messages.length-1], new IllegalArgumentException());
} finally {
logps.flush();
logps.close();
@@ -108,7 +117,7 @@
Matcher m = p.matcher(line);
if (!m.matches()) {
- throw new RuntimeException("Unexpected output format");
+ throw new RuntimeException("Unexpected output format: " + line);
}
if (m.groupCount() != 3) {
throw new RuntimeException("Unexpected group count = " +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/net/www/http/ChunkedOutputStream/CheckError.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 5054016
+ * @summary get the failure immediately when writing individual chunks over socket fail
+ */
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.URL;
+import static java.lang.System.out;
+
+public class CheckError {
+
+ static int BUFFER_SIZE = 8192; // 8k
+ static int TOTAL_BYTES = 1 * 1024 * 1024; // 1M
+
+ public static void main(String[] args) throws Exception {
+
+ HTTPServer server = new HTTPServer();
+ server.start();
+ int port = server.getPort();
+ out.println("Server listening on " + port);
+
+
+ URL url = new URL("http://localhost:" + port);
+ HttpURLConnection conn = (HttpURLConnection)url.openConnection();
+ conn.setRequestMethod("POST");
+ conn.setDoOutput(true);
+ conn.setChunkedStreamingMode(1024);
+
+ out.println("sending " + TOTAL_BYTES + " bytes");
+
+ int byteAtOnce;
+ int sendingBytes = TOTAL_BYTES;
+ byte[] buffer = getBuffer(BUFFER_SIZE);
+ try (OutputStream toServer = conn.getOutputStream()) {
+ while (sendingBytes > 0) {
+ if (sendingBytes > BUFFER_SIZE) {
+ byteAtOnce = BUFFER_SIZE;
+ } else {
+ byteAtOnce = sendingBytes;
+ }
+ toServer.write(buffer, 0, byteAtOnce);
+ sendingBytes -= byteAtOnce;
+ out.print((TOTAL_BYTES - sendingBytes) + " was sent. ");
+ toServer.flush();
+ // gives the server thread time to read, and eventually close;
+ Thread.sleep(500);
+ }
+ } catch (IOException expected) {
+ // Expected IOException due to server.close()
+ out.println("PASSED. Caught expected: " + expected);
+ return;
+ }
+
+ // Expected IOException not received. FAIL
+ throw new RuntimeException("Failed: Expected IOException not received");
+ }
+
+ static byte[] getBuffer(int size) {
+ byte[] buffer = new byte[size];
+ for (int i = 0; i < size; i++)
+ buffer[i] = (byte)i;
+ return buffer;
+ }
+
+ static class HTTPServer extends Thread {
+
+ final ServerSocket serverSocket;
+
+ HTTPServer() throws IOException {
+ serverSocket = new ServerSocket(0);
+ }
+
+ int getPort() {
+ return serverSocket.getLocalPort();
+ }
+
+ public void run() {
+ try (Socket client = serverSocket.accept()) {
+
+ InputStream in = client.getInputStream();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ String line;
+ do {
+ line = reader.readLine();
+ out.println("Server: " + line);
+ } while (line != null && line.length() > 0);
+
+ System.out.println("Server: receiving some data");
+ // just read some data, then close the connection
+ in.read(new byte[1024]);
+
+ in.close();
+ client.close();
+ out.println("Server closed socket");
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
--- a/jdk/test/sun/net/www/http/ChunkedOutputStream/checkError.java Fri Jun 10 15:13:40 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * @test
- * @bug 5054016
- * @key intermittent
- * @run main/othervm/timeout=300 checkError
- * @summary get the failure immediately when writing individual chunks over socket fail
- */
-
-import java.io.*;
-import java.net.*;
-import java.util.StringTokenizer;
-
-
-public class checkError {
- static final int TEST_PASSED = 95;
- static final int TEST_FAILED = 97;
-
- static int testStatus = TEST_PASSED;
-
- static String serverName = "localhost";
- static int bufferSize = 8192; // 8k
- static int totalBytes = 1048576; // 1M
-
- static int j = 0;
-
- static public Object threadStarting = new Object();
- static public Object threadWaiting = new Object();
-
-
- public static void main(String[] args) throws Exception {
- HttpURLConnection conn = null;
- OutputStream toServer = null;
- byte[] buffer = null;
- HTTPServer server = null;
- synchronized(threadWaiting) {
- System.out.println("HTTP-client>Starting default Http-server");
- synchronized(threadStarting) {
- server = new HTTPServer();
- server.start();
- try {
- System.out.println("waiting server to be start");
- threadStarting.wait();
- } catch (InterruptedException e) {
- }
- }
- int port = server.getPort();
- URL url = new URL("http://" + serverName + ":" + port);
- conn = (HttpURLConnection )url.openConnection();
- conn.setRequestMethod("POST");
- conn.setDoOutput(true);
-
- System.out.println("assigning 1024 to the chunk length");
- conn.setChunkedStreamingMode(1024);
- conn.connect();
-
- toServer = conn.getOutputStream();
- buffer = getThickBuffer(bufferSize);
- System.out.println("sending " + totalBytes + " bytes");
- }
-
- int byteAtOnce = 0;
- int sendingBytes = totalBytes;
- try {
- while (sendingBytes > 0) {
- if (sendingBytes > bufferSize) {
- byteAtOnce = bufferSize;
- } else {
- byteAtOnce = sendingBytes;
- }
- toServer.write(buffer, 0, byteAtOnce);
- sendingBytes -= byteAtOnce;
- // System.out.println((totalBytes - sendingBytes) + " was sent");
- toServer.flush();
- }
- } catch (OutOfMemoryError e) {
- e.printStackTrace();
- System.out.println("***ERR***> UNEXPECTED error: " + e);
- testStatus = TEST_FAILED;
- testExit();
- } catch (IOException e) {
- // e.printStackTrace();
- // this is the expected IOException
- // due to server.close()
- testStatus = TEST_PASSED;
- testExit();
- } finally {
- toServer.close();
- }
-
- // we have not received the expected IOException
- // test fail
- testStatus = TEST_FAILED;
- testExit();
-
- }
-
- static void testExit() {
- if (testStatus == TEST_FAILED) {
- throw new RuntimeException("Test Failed: haven't received the expected IOException");
- } else {
- System.out.println("TEST PASSED");
- }
- System.exit(testStatus);
- }
-
- static byte[] getThickBuffer(int size) {
-
- byte[] buffer = new byte[size];
-
- for (int i = 0; i < size; i++) {
- if (j > 9)
- j = 0;
- String s = Integer.toString(j);
- buffer[i] = (byte )s.charAt(0);
- j++;
- }
-
- return buffer;
- }
-}
-
-
-class HTTPServer extends Thread {
-
- static volatile boolean isCompleted;
-
- Socket client;
- ServerSocket serverSocket;
-
- int getPort() {
- return serverSocket.getLocalPort();
- }
-
- public void run() {
-
- synchronized(checkError.threadStarting) {
-
- try {
- serverSocket = new ServerSocket(0, 100);
- } catch (Exception e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- }
- checkError.threadStarting.notify();
- }
-
- try {
- client = serverSocket.accept();
- } catch (Exception e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- }
-
- System.out.println("Server started");
-
- BufferedReader in = null;
- PrintStream out = null;
- InputStreamReader reader = null;
- String version = null;
- String line;
- String method;
-
- synchronized(checkError.threadWaiting) {
- try {
- reader = new InputStreamReader(client.getInputStream());
- in = new BufferedReader(reader);
- line = in.readLine();
-
- } catch (Exception e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- }
- StringTokenizer st = new StringTokenizer(line);
- method = st.nextToken();
- String fileName = st.nextToken();
-
- // save version for replies
- if (st.hasMoreTokens()) version = st.nextToken();
-
- System.out.println("HTTP version: " + version);
-
- }
-
- try {
-
- while (line != null && line.length() > 0) {
- line = in.readLine();
- System.out.println(line);
- }
- } catch (IOException e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- }
-
- if (method.equals("POST")) {
- System.out.println("receiving data");
- byte[] buf = new byte[1024];
- try {
- //reading bytes until chunk whose size is zero,
- // see 19.4.6 Introduction of Transfer-Encoding in RFC2616
- int count = 0;
- while (count <=5) {
- count++;
- in.readLine();
- }
-
- System.out.println("Server socket is closed");
- in.close();
- client.close();
- serverSocket.close();
-
- } catch (IOException e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- } catch (OutOfMemoryError e) {
- e.printStackTrace();
- checkError.testStatus = checkError.TEST_FAILED;
- return;
- }
-
- }
- }
-
-}
--- a/jdk/test/sun/security/ec/TestEC.java Fri Jun 10 15:13:40 2016 -0700
+++ b/jdk/test/sun/security/ec/TestEC.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -59,12 +59,21 @@
public class TestEC {
+ /*
+ * Turn on SSL debugging
+ */
+ private static final boolean debug = true;
+
public static void main(String[] args) throws Exception {
// reset security properties to make sure that the algorithms
// and keys used in this test are not disabled.
Security.setProperty("jdk.tls.disabledAlgorithms", "");
Security.setProperty("jdk.certpath.disabledAlgorithms", "");
+ if (debug) {
+ System.setProperty("javax.net.debug", "all");
+ }
+
ProvidersSnapshot snapshot = ProvidersSnapshot.create();
try {
main0(args);
--- a/langtools/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -364,3 +364,4 @@
6347efd1be03b4fdcf18f64c4fe4be5f60c0831a jdk-9+119
0f81cdd51b42ad38fbceae40985e9bd0bca12180 jdk-9+120
095bd53bdd1ef211a473553a95ee625fcfbc3f59 jdk-9+121
+203a9e1b82b6cc7918f96a92e5a7eb28eafcdd18 jdk-9+122
--- a/langtools/make/intellij/compiler.xml Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/make/intellij/compiler.xml Tue Jun 14 10:22:07 2016 -0700
@@ -6,6 +6,7 @@
<directory url="file://$PROJECT_DIR$/src" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/test" includeSubdirectories="true" />
<directory url="file://$PROJECT_DIR$/build" includeSubdirectories="true" />
+ <directory url="file://$PROJECT_DIR$/make" includeSubdirectories="true" />
</excludeFromCompile>
<resourceExtensions />
<wildcardResourcePatterns />
--- a/langtools/make/intellij/langtools.iml Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/make/intellij/langtools.iml Tue Jun 14 10:22:07 2016 -0700
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
- <output url="file://$MODULE_DIR$/build" />
- <output-test url="file://$MODULE_DIR$/build" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/java.compiler/share/classes" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/jdk.compiler/share/classes" isTestSource="false" />
@@ -13,6 +11,8 @@
<sourceFolder url="file://$MODULE_DIR$/build/gensrc/jdk.compiler" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/gensrc/jdk.javadoc" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/build/gensrc/jdk.jdeps" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/make/tools" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/make/src/classes" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="inheritedJdk" />
--- a/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/java.compiler/share/classes/javax/annotation/processing/RoundEnvironment.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -103,7 +103,7 @@
*
* @implSpec The default implementation of this method creates an
* empty result set, iterates over the annotations in the argument
- * set calling {@link #getElementsAnnotatedWith(TypeElement)} on
+ * array calling {@link #getElementsAnnotatedWith(TypeElement)} on
* each annotation and adding those results to the result
* set. Finally, the contents of the result set are returned as an
* unmodifiable set.
--- a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java Tue Jun 14 10:22:07 2016 -0700
@@ -125,9 +125,8 @@
private static <T> T getSystemTool(Class<T> clazz, String moduleName, String className) {
if (useLegacy) {
try {
- @SuppressWarnings("deprecation")
- T result = Class.forName(className, true, ClassLoader.getSystemClassLoader()).asSubclass(clazz).newInstance();
- return result;
+ return Class.forName(className, true, ClassLoader.getSystemClassLoader()).
+ asSubclass(clazz).getConstructor().newInstance();
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/HiddenTree.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/source/doctree/HiddenTree.java Tue Jun 14 10:22:07 2016 -0700
@@ -34,7 +34,7 @@
* <p>
* @hidden
*
- * @since 1.9
+ * @since 9
*/
public interface HiddenTree extends BlockTagTree {
/**
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Jun 14 10:22:07 2016 -0700
@@ -1149,18 +1149,44 @@
private boolean unrelatedFunctionalInterfaces(Type t, Type s) {
return types.isFunctionalInterface(t.tsym) &&
types.isFunctionalInterface(s.tsym) &&
- types.asSuper(t, s.tsym) == null &&
- types.asSuper(s, t.tsym) == null;
+ unrelatedInterfaces(t, s);
+ }
+
+ /** Whether {@code t} and {@code s} are unrelated interface types; recurs on intersections. **/
+ private boolean unrelatedInterfaces(Type t, Type s) {
+ if (t.isCompound()) {
+ for (Type ti : types.interfaces(t)) {
+ if (!unrelatedInterfaces(ti, s)) {
+ return false;
+ }
+ }
+ return true;
+ } else if (s.isCompound()) {
+ for (Type si : types.interfaces(s)) {
+ if (!unrelatedInterfaces(t, si)) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return types.asSuper(t, s.tsym) == null && types.asSuper(s, t.tsym) == null;
+ }
}
/** Parameters {@code t} and {@code s} are unrelated functional interface types. */
private boolean functionalInterfaceMostSpecific(Type t, Type s, JCTree tree) {
- Type tDesc = types.findDescriptorType(t);
+ Type tDesc = types.findDescriptorType(types.capture(t));
+ Type tDescNoCapture = types.findDescriptorType(t);
Type sDesc = types.findDescriptorType(s);
-
- // compare type parameters -- can't use Types.hasSameBounds because bounds may have ivars
final List<Type> tTypeParams = tDesc.getTypeArguments();
+ final List<Type> tTypeParamsNoCapture = tDescNoCapture.getTypeArguments();
final List<Type> sTypeParams = sDesc.getTypeArguments();
+
+ // compare type parameters
+ if (tDesc.hasTag(FORALL) && !types.hasSameBounds((ForAll) tDesc, (ForAll) tDescNoCapture)) {
+ return false;
+ }
+ // can't use Types.hasSameBounds on sDesc because bounds may have ivars
List<Type> tIter = tTypeParams;
List<Type> sIter = sTypeParams;
while (tIter.nonEmpty() && sIter.nonEmpty()) {
@@ -1181,20 +1207,26 @@
// compare parameters
List<Type> tParams = tDesc.getParameterTypes();
+ List<Type> tParamsNoCapture = tDescNoCapture.getParameterTypes();
List<Type> sParams = sDesc.getParameterTypes();
- while (tParams.nonEmpty() && sParams.nonEmpty()) {
+ while (tParams.nonEmpty() && tParamsNoCapture.nonEmpty() && sParams.nonEmpty()) {
Type tParam = tParams.head;
+ Type tParamNoCapture = types.subst(tParamsNoCapture.head, tTypeParamsNoCapture, tTypeParams);
Type sParam = types.subst(sParams.head, sTypeParams, tTypeParams);
if (tParam.containsAny(tTypeParams) && inferenceContext().free(sParam)) {
return false;
}
- if (!types.isSameType(tParam, inferenceContext().asUndetVar(sParam))) {
+ if (!types.isSubtype(inferenceContext().asUndetVar(sParam), tParam)) {
+ return false;
+ }
+ if (!types.isSameType(tParamNoCapture, inferenceContext().asUndetVar(sParam))) {
return false;
}
tParams = tParams.tail;
+ tParamsNoCapture = tParamsNoCapture.tail;
sParams = sParams.tail;
}
- if (!tParams.isEmpty() || !sParams.isEmpty()) {
+ if (!tParams.isEmpty() || !tParamsNoCapture.isEmpty() || !sParams.isEmpty()) {
return false;
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java Tue Jun 14 10:22:07 2016 -0700
@@ -3216,7 +3216,7 @@
List<JCExpression> moduleNames = null;
if (token.kind == IDENTIFIER && token.name() == names.to) {
nextToken();
- moduleNames = qualidentList();
+ moduleNames = qualidentList(false);
}
accept(SEMI);
defs.append(toP(F.at(pos).Exports(pkgName, moduleNames)));
@@ -3635,7 +3635,7 @@
List<JCExpression> thrown = List.nil();
if (token.kind == THROWS) {
nextToken();
- thrown = qualidentList();
+ thrown = qualidentList(true);
}
JCBlock body = null;
JCExpression defaultValue;
@@ -3672,11 +3672,11 @@
/** QualidentList = [Annotations] Qualident {"," [Annotations] Qualident}
*/
- List<JCExpression> qualidentList() {
+ List<JCExpression> qualidentList(boolean allowAnnos) {
ListBuffer<JCExpression> ts = new ListBuffer<>();
- List<JCAnnotation> typeAnnos = typeAnnotationsOpt();
- JCExpression qi = qualident(true);
+ List<JCAnnotation> typeAnnos = allowAnnos ? typeAnnotationsOpt() : List.nil();
+ JCExpression qi = qualident(allowAnnos);
if (!typeAnnos.isEmpty()) {
JCExpression at = insertAnnotationsToMostInner(qi, typeAnnos, false);
ts.append(at);
@@ -3686,8 +3686,8 @@
while (token.kind == COMMA) {
nextToken();
- typeAnnos = typeAnnotationsOpt();
- qi = qualident(true);
+ typeAnnos = allowAnnos ? typeAnnotationsOpt() : List.nil();
+ qi = qualident(allowAnnos);
if (!typeAnnos.isEmpty()) {
JCExpression at = insertAnnotationsToMostInner(qi, typeAnnos, false);
ts.append(at);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Tue Jun 14 10:22:07 2016 -0700
@@ -31,6 +31,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Path;
@@ -282,9 +283,7 @@
if (options.isSet(XPRINT)) {
try {
- @SuppressWarnings("deprecation")
- Processor processor = PrintingProcessor.class.newInstance();
- processorIterator = List.of(processor).iterator();
+ processorIterator = List.of(new PrintingProcessor()).iterator();
} catch (Throwable t) {
AssertionError assertError =
new AssertionError("Problem instantiating PrintingProcessor.");
@@ -540,38 +539,40 @@
if (nextProc != null)
return true;
else {
- if (!names.hasNext())
+ if (!names.hasNext()) {
return false;
- else {
- String processorName = names.next();
+ } else {
+ Processor processor = getNextProcessor(names.next());
+ if (processor == null) {
+ return false;
+ } else {
+ nextProc = processor;
+ return true;
+ }
+ }
+ }
+ }
- Processor processor;
- try {
- try {
- Class<?> processorClass = processorCL.loadClass(processorName);
- ensureReadable(processorClass);
- @SuppressWarnings("deprecation")
- Object tmp = processorClass.newInstance();
- processor = (Processor) tmp;
- } catch (ClassNotFoundException cnfe) {
- log.error("proc.processor.not.found", processorName);
- return false;
- } catch (ClassCastException cce) {
- log.error("proc.processor.wrong.type", processorName);
- return false;
- } catch (Exception e ) {
- log.error("proc.processor.cant.instantiate", processorName);
- return false;
- }
- } catch(ClientCodeException e) {
- throw e;
- } catch(Throwable t) {
- throw new AnnotationProcessingError(t);
- }
- nextProc = processor;
- return true;
+ private Processor getNextProcessor(String processorName) {
+ try {
+ try {
+ Class<?> processorClass = processorCL.loadClass(processorName);
+ ensureReadable(processorClass);
+ return (Processor) processorClass.getConstructor().newInstance();
+ } catch (ClassNotFoundException cnfe) {
+ log.error("proc.processor.not.found", processorName);
+ return null;
+ } catch (ClassCastException cce) {
+ log.error("proc.processor.wrong.type", processorName);
+ return null;
+ } catch (Exception e ) {
+ log.error("proc.processor.cant.instantiate", processorName);
+ return null;
}
-
+ } catch (ClientCodeException e) {
+ throw e;
+ } catch (Throwable t) {
+ throw new AnnotationProcessingError(t);
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Option.java Tue Jun 14 10:22:07 2016 -0700
@@ -151,8 +151,8 @@
// Construct transformer
try {
Class<?> trCls = Class.forName(classname);
- @SuppressWarnings("deprecation")
- Transformer transformer = (Transformer) trCls.newInstance();
+ Transformer transformer =
+ (Transformer) trCls.getConstructor().newInstance();
transformer.setExtra(extra);
helper.addTransformer(suffix, transformer);
} catch (Exception e) {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/Taglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/taglet/Taglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -87,6 +87,8 @@
public static enum Location {
/** In an Overview document. */
OVERVIEW,
+ /** In the documentation for a module. */
+ MODULE,
/** In the documentation for a package. */
PACKAGE,
/** In the documentation for a class, interface or enum. */
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java Tue Jun 14 10:22:07 2016 -0700
@@ -183,6 +183,19 @@
}
/**
+ * {@inheritDoc}
+ */
+ public void addModuleTags(Content moduleContentTree) {
+ Content tree = (configuration.allowTag(HtmlTag.SECTION))
+ ? HtmlTree.SECTION()
+ : moduleContentTree;
+ addTagsInfo(mdle, tree);
+ if (configuration.allowTag(HtmlTag.SECTION)) {
+ moduleContentTree.addContent(tree);
+ }
+ }
+
+ /**
* Adds list of packages in the package summary table. Generate link to each package.
*
* @param packages Packages to which link is to be generated
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/ModuleSummaryWriter.java Tue Jun 14 10:22:07 2016 -0700
@@ -82,6 +82,15 @@
public abstract void addModuleDescription(Content moduleContentTree);
/**
+ * Adds the tag information from the "module-info.java" file to the documentation
+ * tree.
+ *
+ * @param moduleContentTree the content tree to which the module tags will
+ * be added
+ */
+ public abstract void addModuleTags(Content moduleContentTree);
+
+ /**
* Adds the table of packages to the documentation tree.
*
* @param packages the set of packages that should be added.
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ModuleSummaryBuilder.java Tue Jun 14 10:22:07 2016 -0700
@@ -198,4 +198,16 @@
moduleWriter.addModuleDescription(moduleContentTree);
}
}
+
+ /**
+ * Build the tags of the summary.
+ *
+ * @param node the XML element that specifies which components to document
+ * @param moduleContentTree the tree to which the module tags will be added
+ */
+ public void buildModuleTags(XMLNode node, Content moduleContentTree) {
+ if (!configuration.nocomment) {
+ moduleWriter.addModuleTags(moduleContentTree);
+ }
+ }
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclet.xml Tue Jun 14 10:22:07 2016 -0700
@@ -31,6 +31,7 @@
<ModuleDoc>
<Content>
<ModuleDescription/>
+ <ModuleTags/>
<Summary>
<PackageSummary/>
</Summary>
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BaseExecutableMemberTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BaseExecutableMemberTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -62,6 +62,17 @@
/**
* Return true if this <code>Taglet</code>
+ * is used in module documentation.
+ * @return true if this <code>Taglet</code>
+ * is used in module documentation and false
+ * otherwise.
+ */
+ public boolean inModule() {
+ return false;
+ }
+
+ /**
+ * Return true if this <code>Taglet</code>
* is used in package documentation.
* @return true if this <code>Taglet</code>
* is used in package documentation and false
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BasePropertyTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BasePropertyTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -90,6 +90,15 @@
* only appear in Methods.
* @return false since this is not a method.
*/
+ public boolean inModule() {
+ return false;
+ }
+
+ /**
+ * Will return false because this tag may
+ * only appear in Methods.
+ * @return false since this is not a method.
+ */
public boolean inPackage() {
return false;
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BaseTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/BaseTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -90,6 +90,17 @@
/**
* Return true if this <code>Taglet</code>
+ * is used in module documentation.
+ * @return true if this <code>Taglet</code>
+ * is used in module documentation and false
+ * otherwise.
+ */
+ public boolean inModule() {
+ return true;
+ }
+
+ /**
+ * Return true if this <code>Taglet</code>
* is used in package documentation.
* @return true if this <code>Taglet</code>
* is used in package documentation and false
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/InheritDocTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -95,6 +95,15 @@
/**
* Will return false because this inline tag may
+ * not appear in Modules.
+ * @return false
+ */
+ public boolean inModule() {
+ return false;
+ }
+
+ /**
+ * Will return false because this inline tag may
* not appear in Packages.
* @return false
*/
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -152,6 +152,13 @@
/**
* {@inheritDoc}
*/
+ public boolean inModule() {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean inPackage() {
return false;
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SimpleTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SimpleTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -56,6 +56,11 @@
public static final String EXCLUDED = "x";
/**
+ * The marker in the location string for modules.
+ */
+ public static final String MODULE = "s";
+
+ /**
* The marker in the location string for packages.
*/
public static final String PACKAGE = "p";
@@ -120,7 +125,7 @@
this.header = header;
locations = Utils.toLowerCase(locations);
if (locations.contains(ALL) && !locations.contains(EXCLUDED)) {
- this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
+ this.locations = MODULE + PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
} else {
this.locations = locations;
}
@@ -179,6 +184,17 @@
/**
* Return true if this <code>SimpleTaglet</code>
+ * is used in module documentation.
+ * @return true if this <code>SimpleTaglet</code>
+ * is used in module documentation and false
+ * otherwise.
+ */
+ public boolean inModule() {
+ return locations.contains(MODULE) && !locations.contains(EXCLUDED);
+ }
+
+ /**
+ * Return true if this <code>SimpleTaglet</code>
* is used in package documentation.
* @return true if this <code>SimpleTaglet</code>
* is used in package documentation and false
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/Taglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/Taglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -76,6 +76,15 @@
/**
* Return true if this <code>Taglet</code>
+ * is used in module documentation.
+ * @return true if this <code>Taglet</code>
+ * is used in module documentation and false
+ * otherwise.
+ */
+ public abstract boolean inModule();
+
+ /**
+ * Return true if this <code>Taglet</code>
* is used in package documentation.
* @return true if this <code>Taglet</code>
* is used in package documentation and false
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java Tue Jun 14 10:22:07 2016 -0700
@@ -31,6 +31,7 @@
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.ModuleElement;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.element.VariableElement;
@@ -81,6 +82,11 @@
private final LinkedHashMap<String,Taglet> customTags;
/**
+ * The array of custom tags that can appear in modules.
+ */
+ private List<Taglet> moduleTags;
+
+ /**
* The array of custom tags that can appear in packages.
*/
private List<Taglet> packageTags;
@@ -246,8 +252,7 @@
}
tagClassLoader = fileManager.getClassLoader(TAGLET_PATH);
Class<?> customTagClass = tagClassLoader.loadClass(classname);
- @SuppressWarnings("deprecation")
- Object instance = customTagClass.newInstance();
+ Object instance = customTagClass.getConstructor().newInstance();
Taglet newLegacy = new UserTaglet((jdk.javadoc.doclet.taglet.Taglet)instance);
String tname = newLegacy.getName();
Taglet t = customTags.get(tname);
@@ -373,6 +378,14 @@
}
new SimpleElementVisitor9<Void, Void>() {
@Override @DefinedBy(Api.LANGUAGE_MODEL)
+ public Void visitModule(ModuleElement e, Void p) {
+ if (!taglet.inModule()) {
+ printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "module");
+ }
+ return null;
+ }
+
+ @Override @DefinedBy(Api.LANGUAGE_MODEL)
public Void visitPackage(PackageElement e, Void p) {
if (!taglet.inPackage()) {
printTagMisuseWarn(utils.getCommentHelper(e), taglet, tag, "package");
@@ -435,6 +448,9 @@
if (taglet.inOverview()) {
locationsSet.add("overview");
}
+ if (taglet.inModule()) {
+ locationsSet.add("module");
+ }
if (taglet.inPackage()) {
locationsSet.add("package");
}
@@ -471,6 +487,19 @@
/**
* Return the array of <code>Taglet</code>s that can
+ * appear in modules.
+ * @return the array of <code>Taglet</code>s that can
+ * appear in modules.
+ */
+ public List<Taglet> getModuleCustomTaglets() {
+ if (moduleTags == null) {
+ initCustomTaglets();
+ }
+ return moduleTags;
+ }
+
+ /**
+ * Return the array of <code>Taglet</code>s that can
* appear in packages.
* @return the array of <code>Taglet</code>s that can
* appear in packages.
@@ -555,6 +584,8 @@
case CLASS:
case ENUM:
return getTypeCustomTaglets();
+ case MODULE:
+ return getModuleCustomTaglets();
case PACKAGE:
return getPackageCustomTaglets();
case OTHER:
@@ -608,6 +639,7 @@
*/
private void initCustomTaglets() {
+ moduleTags = new ArrayList<>();
packageTags = new ArrayList<>();
typeTags = new ArrayList<>();
fieldTags = new ArrayList<>();
@@ -617,6 +649,9 @@
overviewTags = new ArrayList<>();
for (Taglet current : customTags.values()) {
+ if (current.inModule() && !current.isInlineTag()) {
+ moduleTags.add(current);
+ }
if (current.inPackage() && !current.isInlineTag()) {
packageTags.add(current);
}
@@ -666,9 +701,9 @@
addStandardTaglet(!nosince, new SimpleTaglet(SINCE.tagName, message.getText("doclet.Since"),
SimpleTaglet.ALL));
addStandardTaglet(showversion, new SimpleTaglet(VERSION.tagName, message.getText("doclet.Version"),
- SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
+ SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
addStandardTaglet(showauthor, new SimpleTaglet(AUTHOR.tagName, message.getText("doclet.Author"),
- SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
+ SimpleTaglet.MODULE + SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
addStandardTaglet(new SimpleTaglet(SERIAL_DATA.tagName, message.getText("doclet.SerialData"),
SimpleTaglet.EXCLUDED));
addStandardTaglet(new SimpleTaglet(HIDDEN.tagName, message.getText("doclet.Hidden"),
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/UserTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -89,6 +89,14 @@
/**
* {@inheritDoc}
*/
+ public boolean inModule() {
+ return userTaglet.isInlineTag()
+ || userTaglet.getAllowedLocations().contains(MODULE);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public boolean inPackage() {
return userTaglet.isInlineTag()
|| userTaglet.getAllowedLocations().contains(PACKAGE);
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java Tue Jun 14 10:22:07 2016 -0700
@@ -95,6 +95,15 @@
/**
* Will return false because this inline tag may
* only appear in Fields.
+ * @return false since this is not a field.
+ */
+ public boolean inModule() {
+ return false;
+ }
+
+ /**
+ * Will return false because this inline tag may
+ * only appear in Fields.
* @return false since this is not a method.
*/
public boolean inPackage() {
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Tue Jun 14 10:22:07 2016 -0700
@@ -273,9 +273,9 @@
initMessager();
messager.setLocale(locale);
try {
- Object o = docletClass.newInstance();
+ Object o = docletClass.getConstructor().newInstance();
doclet = (Doclet) o;
- } catch (InstantiationException | IllegalAccessException exc) {
+ } catch (ReflectiveOperationException exc) {
exc.printStackTrace();
if (!apiMode) {
error("main.could_not_instantiate_class", docletClass);
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java Tue Jun 14 10:22:07 2016 -0700
@@ -93,7 +93,7 @@
.collect(Collectors.toList());
in.setHistory(history = new EditingHistory(in, persistenHistory) {
@Override protected boolean isComplete(CharSequence input) {
- return repl.analysis.analyzeCompletion(input.toString()).completeness.isComplete;
+ return repl.analysis.analyzeCompletion(input.toString()).completeness().isComplete();
}
});
in.setBellEnabled(true);
@@ -117,24 +117,24 @@
boolean smart = allowSmart &&
suggestions.stream()
- .anyMatch(s -> s.isSmart);
+ .anyMatch(s -> s.matchesType());
lastTest = test;
lastCursor = cursor;
allowSmart = !allowSmart;
suggestions.stream()
- .filter(s -> !smart || s.isSmart)
- .map(s -> s.continuation)
+ .filter(s -> !smart || s.matchesType())
+ .map(s -> s.continuation())
.forEach(result::add);
boolean onlySmart = suggestions.stream()
- .allMatch(s -> s.isSmart);
+ .allMatch(s -> s.matchesType());
if (smart && !onlySmart) {
Optional<String> prefix =
suggestions.stream()
- .map(s -> s.continuation)
+ .map(s -> s.continuation())
.reduce(ConsoleIOContext::commonPrefix);
String prefixStr = prefix.orElse("").substring(cursor - anchor[0]);
@@ -215,6 +215,7 @@
} catch (Exception ex) {
throw new IOException(ex);
}
+ input.shutdown();
}
private void bind(String shortcut, Object action) {
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java Tue Jun 14 10:22:07 2016 -0700
@@ -637,7 +637,7 @@
.out(userout)
.err(usererr)
.tempVariableNameGenerator(()-> "$" + currentNameSpace.tidNext())
- .idGenerator((sn, i) -> (currentNameSpace == startNamespace || state.status(sn).isActive)
+ .idGenerator((sn, i) -> (currentNameSpace == startNamespace || state.status(sn).isActive())
? currentNameSpace.tid(sn)
: errorNamespace.tid(sn))
.remoteVMOptions(remoteVMOptions.toArray(new String[remoteVMOptions.size()]))
@@ -1026,7 +1026,7 @@
List<PersistentSnippet> dropableSnippets() {
return state.snippets().stream()
- .filter(sn -> state.status(sn).isActive && sn instanceof PersistentSnippet)
+ .filter(sn -> state.status(sn).isActive() && sn instanceof PersistentSnippet)
.map(sn -> (PersistentSnippet) sn)
.collect(toList());
}
@@ -1164,7 +1164,7 @@
}
}
- return result.sorted((s1, s2) -> s1.continuation.compareTo(s2.continuation))
+ return result.sorted((s1, s2) -> s1.continuation().compareTo(s2.continuation()))
.collect(Collectors.toList());
}
@@ -1426,18 +1426,15 @@
live = false;
if (!replayableHistory.isEmpty()) {
// Prevent history overflow by calculating what will fit, starting
- // with must recent
+ // with most recent
int sepLen = RECORD_SEPARATOR.length();
int length = 0;
int first = replayableHistory.size();
while(length < Preferences.MAX_VALUE_LENGTH && --first >= 0) {
length += replayableHistory.get(first).length() + sepLen;
}
- String hist = replayableHistory
- .subList(first + 1, replayableHistory.size())
- .stream()
- .reduce( (a, b) -> a + RECORD_SEPARATOR + b)
- .get();
+ String hist = String.join(RECORD_SEPARATOR,
+ replayableHistory.subList(first + 1, replayableHistory.size()));
prefs.put(REPLAY_RESTORE_KEY, hist);
}
fluffmsg("jshell.msg.goodbye");
@@ -1530,7 +1527,7 @@
}
private boolean isActive(Snippet sn) {
- return state.status(sn).isActive;
+ return state.status(sn).isActive();
}
private boolean mainActive(Snippet sn) {
@@ -1739,18 +1736,18 @@
boolean failed = false;
while (true) {
CompletionInfo an = analysis.analyzeCompletion(s);
- if (!an.completeness.isComplete) {
+ if (!an.completeness().isComplete()) {
break;
}
- String tsrc = trimNewlines(an.source);
+ String tsrc = trimNewlines(an.source());
if (!failed && !currSrcs.contains(tsrc)) {
failed = processCompleteSource(tsrc);
}
nextSrcs.add(tsrc);
- if (an.remaining.isEmpty()) {
+ if (an.remaining().isEmpty()) {
break;
}
- s = an.remaining;
+ s = an.remaining();
}
currSrcs = nextSrcs;
} catch (IllegalStateException ex) {
@@ -2096,14 +2093,14 @@
private String processSource(String srcInput) throws IllegalStateException {
while (true) {
CompletionInfo an = analysis.analyzeCompletion(srcInput);
- if (!an.completeness.isComplete) {
- return an.remaining;
+ if (!an.completeness().isComplete()) {
+ return an.remaining();
}
- boolean failed = processCompleteSource(an.source);
- if (failed || an.remaining.isEmpty()) {
+ boolean failed = processCompleteSource(an.source());
+ if (failed || an.remaining().isEmpty()) {
return "";
}
- srcInput = an.remaining;
+ srcInput = an.remaining();
}
}
//where
@@ -2119,7 +2116,7 @@
// If any main snippet is active, this should be replayable
// also ignore var value queries
isActive |= e.causeSnippet() == null &&
- e.status().isActive &&
+ e.status().isActive() &&
e.snippet().subKind() != VAR_VALUE_SUBKIND;
}
// If this is an active snippet and it didn't cause the backend to die,
@@ -2235,7 +2232,7 @@
case VALID:
case RECOVERABLE_DEFINED:
case RECOVERABLE_NOT_DEFINED:
- if (previousStatus.isActive) {
+ if (previousStatus.isActive()) {
act = isSignatureChange
? FormatAction.REPLACED
: FormatAction.MODIFIED;
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/StopDetectingInputStream.java Tue Jun 14 10:22:07 2016 -0700
@@ -61,11 +61,14 @@
//an external editor is running. At the same time, it needs to run while the
//user's code is running (so Ctrl-C is detected). Hence waiting here until
//there is a confirmed need for input.
- waitInputNeeded();
+ StopDetectingInputStream.State currentState = waitInputNeeded();
+ if (currentState == StopDetectingInputStream.State.CLOSED) {
+ break;
+ }
if ((read = input.read()) == (-1)) {
break;
}
- if (read == 3 && state == StopDetectingInputStream.State.BUFFER) {
+ if (read == 3 && currentState == StopDetectingInputStream.State.BUFFER) {
stop.run();
} else {
write(read);
@@ -74,7 +77,9 @@
} catch (IOException ex) {
errorHandler.accept(ex);
} finally {
- state = StopDetectingInputStream.State.CLOSED;
+ synchronized (StopDetectingInputStream.this) {
+ state = StopDetectingInputStream.State.CLOSED;
+ }
}
}
};
@@ -107,6 +112,11 @@
}
}
+ public synchronized void shutdown() {
+ state = State.CLOSED;
+ notifyAll();
+ }
+
public synchronized void write(int b) {
if (state != State.BUFFER) {
state = State.WAIT;
@@ -134,7 +144,7 @@
notifyAll();
}
- private synchronized void waitInputNeeded() {
+ private synchronized State waitInputNeeded() {
while (state == State.WAIT) {
try {
wait();
@@ -142,6 +152,8 @@
//ignore
}
}
+
+ return state;
}
public enum State {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Diag.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Diag.java Tue Jun 14 10:22:07 2016 -0700
@@ -47,8 +47,10 @@
public final static long NOPOS = Diagnostic.NOPOS;
/**
- * Is this diagnostic an error (as opposed to a warning or note)
- * @return true if this diagnostic is an error
+ * Indicates whether this diagnostic is an error (as opposed to a warning or
+ * note).
+ *
+ * @return {@code true} if this diagnostic is an error; otherwise {@code false}
*/
public abstract boolean isError();
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Eval.java Tue Jun 14 10:22:07 2016 -0700
@@ -440,7 +440,7 @@
ins.add(c);
Set<Unit> outs = compileAndLoad(ins);
- if (!si.status().isDefined
+ if (!si.status().isDefined()
&& si.diagnostics().isEmpty()
&& si.unresolved().isEmpty()) {
// did not succeed, but no record of it, extract from others
@@ -452,7 +452,7 @@
// If appropriate, execute the snippet
String value = null;
JShellException exception = null;
- if (si.status().isDefined) {
+ if (si.status().isDefined()) {
if (si.isExecutable()) {
try {
value = state.executionControl().invoke(si.classFullName(), DOIT_METHOD_NAME);
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ImportSnippet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ImportSnippet.java Tue Jun 14 10:22:07 2016 -0700
@@ -31,7 +31,7 @@
* Snippet for an import declaration.
* The Kind is {@link jdk.jshell.Snippet.Kind#IMPORT}.
* <p>
- * <code>ImportSnippet</code> is immutable: an access to
+ * {@code ImportSnippet} is immutable: an access to
* any of its methods will always return the same result.
* and thus is thread-safe.
* @jls 8.3: importDeclaration.
@@ -85,8 +85,10 @@
}
/**
- * When this snippet represent static import, this method returns true.
- * @return true when this snippet represent static import, otherwise false
+ * Indicates whether this snippet represents a static import.
+ *
+ * @return {@code true} if this snippet represents a static import;
+ * otherwise {@code false}
*/
public boolean isStatic() {
return isStatic;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/JShell.java Tue Jun 14 10:22:07 2016 -0700
@@ -54,13 +54,13 @@
/**
* The JShell evaluation state engine. This is the central class in the JShell
- * API. A <code>JShell</code> instance holds the evolving compilation and
+ * API. A {@code JShell} instance holds the evolving compilation and
* execution state. The state is changed with the instance methods
* {@link jdk.jshell.JShell#eval(java.lang.String) eval(String)},
* {@link jdk.jshell.JShell#drop(jdk.jshell.PersistentSnippet) drop(PersistentSnippet)} and
* {@link jdk.jshell.JShell#addToClasspath(java.lang.String) addToClasspath(String)}.
* The majority of methods query the state.
- * A <code>JShell</code> instance also allows registering for events with
+ * A {@code JShell} instance also allows registering for events with
* {@link jdk.jshell.JShell#onSnippetEvent(java.util.function.Consumer) onSnippetEvent(Consumer)}
* and {@link jdk.jshell.JShell#onShutdown(java.util.function.Consumer) onShutdown(Consumer)}, which
* are unregistered with
@@ -70,8 +70,8 @@
* When complete the instance should be closed to free resources --
* {@link jdk.jshell.JShell#close()}.
* <p>
- * An instance of <code>JShell</code> is created with
- * <code>JShell.create()</code>.
+ * An instance of {@code JShell} is created with
+ * {@code JShell.create()}.
* <p>
* This class is not thread safe, except as noted, all access should be through
* a single thread.
@@ -126,22 +126,22 @@
}
/**
- * Builder for <code>JShell</code> instances.
- * Create custom instances of <code>JShell</code> by using the setter
+ * Builder for {@code JShell} instances.
+ * Create custom instances of {@code JShell} by using the setter
* methods on this class. After zero or more of these, use the
- * {@link #build()} method to create a <code>JShell</code> instance.
+ * {@link #build()} method to create a {@code JShell} instance.
* These can all be chained. For example, setting the remote output and
* error streams:
* <pre>
- * <code>
+ * {@code
* JShell myShell =
* JShell.builder()
* .out(myOutStream)
* .err(myErrStream)
- * .build(); </code> </pre>
+ * .build(); } </pre>
* If no special set-up is needed, just use
- * <code>JShell.builder().build()</code> or the short-cut equivalent
- * <code>JShell.create()</code>.
+ * {@code JShell.builder().build()} or the short-cut equivalent
+ * {@code JShell.create()}.
*/
public static class Builder {
@@ -221,16 +221,16 @@
* <p>
* The callback is sent during the processing of the snippet, the
* JShell state is not stable. No calls whatsoever on the
- * <code>JShell</code> instance may be made from the callback.
+ * {@code JShell} instance may be made from the callback.
* <p>
* The generated name must be unique within active snippets.
* <p>
- * The default behavior (if this is not set or <code>generator</code>
+ * The default behavior (if this is not set or {@code generator}
* is null) is to generate the name as a sequential number with a
* prefixing dollar sign ("$").
*
- * @param generator the <code>Supplier</code> to generate the temporary
- * variable name string or <code>null</code>
+ * @param generator the {@code Supplier} to generate the temporary
+ * variable name string or {@code null}
* @return the {@code Builder} instance (for use in chained
* initialization)
*/
@@ -247,7 +247,7 @@
* The generator will be used for newly created Snippet instances. The
* identifying name (id) is accessed with
* {@link jdk.jshell.Snippet#id()} and can be seen in the
- * <code>StackTraceElement.getFileName()</code> for a
+ * {@code StackTraceElement.getFileName()} for a
* {@link jdk.jshell.EvalException} and
* {@link jdk.jshell.UnresolvedReferenceException}.
* <p>
@@ -259,15 +259,15 @@
* Snippet and the state as a whole are not stable. No calls to change
* system state (including Snippet state) should be made. Queries of
* Snippet may be made except to {@link jdk.jshell.Snippet#id()}. No
- * calls on the <code>JShell</code> instance may be made from the
+ * calls on the {@code JShell} instance may be made from the
* callback, except to
* {@link #status(jdk.jshell.Snippet) status(Snippet)}.
* <p>
- * The default behavior (if this is not set or <code>generator</code>
+ * The default behavior (if this is not set or {@code generator}
* is null) is to generate the id as the integer converted to a string.
*
- * @param generator the <code>BiFunction</code> to generate the id
- * string or <code>null</code>
+ * @param generator the {@code BiFunction} to generate the id
+ * string or {@code null}
* @return the {@code Builder} instance (for use in chained
* initialization)
*/
@@ -317,22 +317,22 @@
/**
* Create a new JShell state engine.
- * That is, create an instance of <code>JShell</code>.
+ * That is, create an instance of {@code JShell}.
* <p>
* Equivalent to {@link JShell#builder() JShell.builder()}{@link JShell.Builder#build() .build()}.
- * @return an instance of <code>JShell</code>.
+ * @return an instance of {@code JShell}.
*/
public static JShell create() {
return builder().build();
}
/**
- * Factory method for <code>JShell.Builder</code> which, in-turn, is used
- * for creating instances of <code>JShell</code>.
- * Create a default instance of <code>JShell</code> with
- * <code>JShell.builder().build()</code>. For more construction options
+ * Factory method for {@code JShell.Builder} which, in-turn, is used
+ * for creating instances of {@code JShell}.
+ * Create a default instance of {@code JShell} with
+ * {@code JShell.builder().build()}. For more construction options
* see {@link jdk.jshell.JShell.Builder}.
- * @return an instance of <code>Builder</code>.
+ * @return an instance of {@code Builder}.
* @see jdk.jshell.JShell.Builder
*/
public static Builder builder() {
@@ -341,9 +341,9 @@
/**
* Access to source code analysis functionality.
- * An instance of <code>JShell</code> will always return the same
- * <code>SourceCodeAnalysis</code> instance from
- * <code>sourceCodeAnalysis()</code>.
+ * An instance of {@code JShell} will always return the same
+ * {@code SourceCodeAnalysis} instance from
+ * {@code sourceCodeAnalysis()}.
* @return an instance of {@link SourceCodeAnalysis SourceCodeAnalysis}
* which can be used for source analysis such as completion detection and
* completion suggestions.
@@ -378,11 +378,11 @@
* occur for dropped, rejected, or already overwritten declarations.
* <p>
* The execution environment is out of process. If the evaluated code
- * causes the execution environment to terminate, this <code>JShell</code>
+ * causes the execution environment to terminate, this {@code JShell}
* instance will be closed but the calling process and VM remain valid.
* @param input The input String to evaluate
* @return the list of events directly or indirectly caused by this evaluation.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @see SourceCodeAnalysis#analyzeCompletion(String)
* @see JShell#onShutdown(java.util.function.Consumer)
*/
@@ -408,9 +408,9 @@
* @param snippet The snippet to remove
* @return The list of events from updating declarations dependent on the
* dropped snippet.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @throws IllegalArgumentException if the snippet is not associated with
- * this <code>JShell</code> instance.
+ * this {@code JShell} instance.
*/
public List<SnippetEvent> drop(PersistentSnippet snippet) throws IllegalStateException {
checkIfAlive();
@@ -476,77 +476,77 @@
/**
* Returns the active variable snippets.
- * This convenience method is equivalent to <code>snippets()</code> filtered for
- * {@link jdk.jshell.Snippet.Status#isActive status(snippet).isActive}
- * <code>&& snippet.kind() == Kind.VARIABLE</code>
- * and cast to <code>VarSnippet</code>.
+ * This convenience method is equivalent to {@code snippets()} filtered for
+ * {@link jdk.jshell.Snippet.Status#isActive() status(snippet).isActive()}
+ * {@code && snippet.kind() == Kind.VARIABLE}
+ * and cast to {@code VarSnippet}.
* @return the active declared variables.
* @throws IllegalStateException if this JShell instance is closed.
*/
public List<VarSnippet> variables() throws IllegalStateException {
return snippets().stream()
- .filter(sn -> status(sn).isActive && sn.kind() == Snippet.Kind.VAR)
+ .filter(sn -> status(sn).isActive() && sn.kind() == Snippet.Kind.VAR)
.map(sn -> (VarSnippet) sn)
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
}
/**
* Returns the active method snippets.
- * This convenience method is equivalent to <code>snippets()</code> filtered for
- * {@link jdk.jshell.Snippet.Status#isActive status(snippet).isActive}
- * <code>&& snippet.kind() == Kind.METHOD</code>
+ * This convenience method is equivalent to {@code snippets()} filtered for
+ * {@link jdk.jshell.Snippet.Status#isActive() status(snippet).isActive()}
+ * {@code && snippet.kind() == Kind.METHOD}
* and cast to MethodSnippet.
* @return the active declared methods.
* @throws IllegalStateException if this JShell instance is closed.
*/
public List<MethodSnippet> methods() throws IllegalStateException {
return snippets().stream()
- .filter(sn -> status(sn).isActive && sn.kind() == Snippet.Kind.METHOD)
+ .filter(sn -> status(sn).isActive() && sn.kind() == Snippet.Kind.METHOD)
.map(sn -> (MethodSnippet)sn)
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
}
/**
* Returns the active type declaration (class, interface, annotation type, and enum) snippets.
- * This convenience method is equivalent to <code>snippets()</code> filtered for
- * {@link jdk.jshell.Snippet.Status#isActive status(snippet).isActive}
- * <code>&& snippet.kind() == Kind.TYPE_DECL</code>
+ * This convenience method is equivalent to {@code snippets()} filtered for
+ * {@link jdk.jshell.Snippet.Status#isActive() status(snippet).isActive()}
+ * {@code && snippet.kind() == Kind.TYPE_DECL}
* and cast to TypeDeclSnippet.
* @return the active declared type declarations.
* @throws IllegalStateException if this JShell instance is closed.
*/
public List<TypeDeclSnippet> types() throws IllegalStateException {
return snippets().stream()
- .filter(sn -> status(sn).isActive && sn.kind() == Snippet.Kind.TYPE_DECL)
+ .filter(sn -> status(sn).isActive() && sn.kind() == Snippet.Kind.TYPE_DECL)
.map(sn -> (TypeDeclSnippet) sn)
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
}
/**
* Returns the active import snippets.
- * This convenience method is equivalent to <code>snippets()</code> filtered for
- * {@link jdk.jshell.Snippet.Status#isActive status(snippet).isActive}
- * <code>&& snippet.kind() == Kind.IMPORT</code>
+ * This convenience method is equivalent to {@code snippets()} filtered for
+ * {@link jdk.jshell.Snippet.Status#isActive() status(snippet).isActive()}
+ * {@code && snippet.kind() == Kind.IMPORT}
* and cast to ImportSnippet.
* @return the active declared import declarations.
* @throws IllegalStateException if this JShell instance is closed.
*/
public List<ImportSnippet> imports() throws IllegalStateException {
return snippets().stream()
- .filter(sn -> status(sn).isActive && sn.kind() == Snippet.Kind.IMPORT)
+ .filter(sn -> status(sn).isActive() && sn.kind() == Snippet.Kind.IMPORT)
.map(sn -> (ImportSnippet) sn)
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
}
/**
* Return the status of the snippet.
- * This is updated either because of an explicit <code>eval()</code> call or
+ * This is updated either because of an explicit {@code eval()} call or
* an automatic update triggered by a dependency.
- * @param snippet the <code>Snippet</code> to look up
+ * @param snippet the {@code Snippet} to look up
* @return the status corresponding to this snippet
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @throws IllegalArgumentException if the snippet is not associated with
- * this <code>JShell</code> instance.
+ * this {@code JShell} instance.
*/
public Status status(Snippet snippet) {
return checkValidSnippet(snippet).status();
@@ -554,14 +554,14 @@
/**
* Return the diagnostics of the most recent evaluation of the snippet.
- * The evaluation can either because of an explicit <code>eval()</code> call or
+ * The evaluation can either because of an explicit {@code eval()} call or
* an automatic update triggered by a dependency.
- * @param snippet the <code>Snippet</code> to look up
+ * @param snippet the {@code Snippet} to look up
* @return the diagnostics corresponding to this snippet. This does not
- * include unresolvedDependencies references reported in <code>unresolvedDependencies()</code>.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * include unresolvedDependencies references reported in {@code unresolvedDependencies()}.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @throws IllegalArgumentException if the snippet is not associated with
- * this <code>JShell</code> instance.
+ * this {@code JShell} instance.
*/
public List<Diag> diagnostics(Snippet snippet) {
return Collections.unmodifiableList(checkValidSnippet(snippet).diagnostics());
@@ -573,13 +573,13 @@
* declarations, the names of current unresolved dependencies for
* the snippet.
* The returned value of this method, for a given method may change when an
- * <code>eval()</code> or <code>drop()</code> of another snippet causes
+ * {@code eval()} or {@code drop()} of another snippet causes
* an update of a dependency.
- * @param snippet the declaration <code>Snippet</code> to look up
+ * @param snippet the declaration {@code Snippet} to look up
* @return the list of symbol names that are currently unresolvedDependencies.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @throws IllegalArgumentException if the snippet is not associated with
- * this <code>JShell</code> instance.
+ * this {@code JShell} instance.
*/
public List<String> unresolvedDependencies(DeclarationSnippet snippet) {
return Collections.unmodifiableList(checkValidSnippet(snippet).unresolved());
@@ -589,9 +589,9 @@
* Get the current value of a variable.
* @param snippet the variable Snippet whose value is queried.
* @return the current value of the variable referenced by snippet.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
* @throws IllegalArgumentException if the snippet is not associated with
- * this <code>JShell</code> instance.
+ * this {@code JShell} instance.
* @throws IllegalArgumentException if the variable's status is anything but
* {@link jdk.jshell.Snippet.Status#VALID}.
*/
@@ -611,7 +611,7 @@
* Each call adds a new subscription.
* @param listener Action to perform when the Status changes.
* @return A token which can be used to {@linkplain JShell#unsubscribe unsubscribe} this subscription.
- * @throws IllegalStateException if this <code>JShell</code> instance is closed.
+ * @throws IllegalStateException if this {@code JShell} instance is closed.
*/
public Subscription onSnippetEvent(Consumer<SnippetEvent> listener)
throws IllegalStateException {
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Snippet.java Tue Jun 14 10:22:07 2016 -0700
@@ -36,9 +36,9 @@
* An instance of Snippet (including its subclasses) is immutable: an access to
* any of its methods will always return the same result.
* For information about the current state of the snippet within the JShell
- * state engine, query <code>JShell</code> passing the Snippet.
+ * state engine, query {@code JShell} passing the Snippet.
* <p>
- * Because it is immutable, <code>Snippet</code> (and subclasses) is thread-safe.
+ * Because it is immutable, {@code Snippet} (and subclasses) is thread-safe.
* @author Robert Field
* @see jdk.jshell.JShell#status
*/
@@ -46,20 +46,21 @@
/**
* Describes the general kind of snippet.
- * The <code>Kind</code> is an immutable property of a Snippet.
+ * The {@code Kind} is an immutable property of a Snippet.
* It is accessed with {@link jdk.jshell.Snippet#kind()}.
- * The <code>Kind</code> can be used to determine which
+ * The {@code Kind} can be used to determine which
* subclass of Snippet it is. For example,
* {@link jdk.jshell.JShell#eval eval("int three() { return 3; }")} will
- * return a snippet creation event. The <code>Kind</code> of that Snippet
- * will be <code>METHOD</code>, from which you know that the subclass
- * of <code>Snippet</code> is <code>MethodSnippet</code> and it can be
+ * return a snippet creation event. The {@code Kind} of that Snippet
+ * will be {@code METHOD}, from which you know that the subclass
+ * of {@code Snippet} is {@code MethodSnippet} and it can be
* cast as such.
*/
public enum Kind {
/**
- * An import declaration: <code>import</code> ...
+ * An import declaration: {@code import} ...
* The snippet is an instance of {@link jdk.jshell.ImportSnippet}.
+ * <P>
* An import can be a single type import
* ({@link jdk.jshell.Snippet.SubKind#SINGLE_TYPE_IMPORT_SUBKIND}),
* a static single import
@@ -69,7 +70,10 @@
* or a static on-demand type import
* ({@link jdk.jshell.Snippet.SubKind#SINGLE_STATIC_IMPORT_SUBKIND}) --
* use {@link jdk.jshell.Snippet#subKind()} to distinguish.
+ * <P>
* @jls 8.3: importDeclaration.
+ * <P>
+ * An import declaration is {@linkplain Kind#isPersistent() persistent}.
*/
IMPORT(true),
@@ -78,19 +82,26 @@
* Which includes: NormalClassDeclaration, EnumDeclaration,
* NormalInterfaceDeclaration, and AnnotationTypeDeclaration.
* The snippet is an instance of {@link jdk.jshell.TypeDeclSnippet}.
+ * <P>
* A type declaration may be an interface
* {@link jdk.jshell.Snippet.SubKind#INTERFACE_SUBKIND},
* classes {@link jdk.jshell.Snippet.SubKind#CLASS_SUBKIND}, enums, and
* annotation interfaces -- see {@link jdk.jshell.Snippet.SubKind} to
* differentiate.
+ * <P>
* @jls 7.6: TypeDeclaration.
+ * <P>
+ * A type declaration is {@linkplain Kind#isPersistent() persistent}.
*/
TYPE_DECL(true),
/**
* A method declaration.
* The snippet is an instance of {@link jdk.jshell.MethodSnippet}.
+ * <P>
* @jls 8.4: MethodDeclaration.
+ * <P>
+ * A method declaration is {@linkplain Kind#isPersistent() persistent}.
*/
METHOD(true),
@@ -98,20 +109,28 @@
* One variable declaration.
* Corresponding to one <i>VariableDeclarator</i>.
* The snippet is an instance of {@link jdk.jshell.VarSnippet}.
+ * <P>
* The variable may be with or without initializer, or be a temporary
* variable representing an expression -- see
* {@link jdk.jshell.Snippet.SubKind}to differentiate.
+ * <P>
* @jls 8.3: FieldDeclaration.
+ * <P>
+ * A variable declaration is {@linkplain Kind#isPersistent() persistent}.
*/
VAR(true),
/**
* An expression, with or without side-effects.
* The snippet is an instance of {@link jdk.jshell.ExpressionSnippet}.
+ * <P>
* The expression is currently either a simple named reference to a
* variable ({@link jdk.jshell.Snippet.SubKind#VAR_VALUE_SUBKIND}) or an
* assignment (both of which have natural referencing
* names) -- see {@link jdk.jshell.Snippet.SubKind} to differentiate.
+ * All other expression forms (operators, method calls, ...) generate a
+ * scratch variable and so are instead of the VAR Kind.
+ * <P>
* @jls 15: Expression.
*/
EXPRESSION(false),
@@ -119,6 +138,7 @@
/**
* A statement.
* The snippet is an instance of {@link jdk.jshell.StatementSnippet}.
+ * <P>
* @jls 14.5: Statement.
*/
STATEMENT(false),
@@ -130,15 +150,27 @@
*/
ERRONEOUS(false);
- /**
- * True if this kind of snippet adds a declaration or declarations
- * which are visible to subsequent evaluations.
- */
- public final boolean isPersistent;
+ private final boolean isPersistent;
Kind(boolean isPersistent) {
this.isPersistent = isPersistent;
}
+
+ /**
+ * Indicates whether this {@code Kind} of Snippet is persistent. Only
+ * declarations are persistent because they influence future Snippets.
+ * <p>
+ * Note that though the {@code Kind} of
+ * a Snippet may be persistent, that does not mean that the Snippet will
+ * persist; For example it may be invalid or have been dropped. See:
+ * {@link jdk.jshell.Snippet.Status#isDefined()}.
+ *
+ * @return {@code true} if this {@code Kind} of {@code Snippet} is
+ * visible to subsequent evaluations; otherwise {@code false}
+ */
+ public boolean isPersistent() {
+ return isPersistent;
+ }
}
/**
@@ -178,41 +210,41 @@
/**
* A class declaration.
- * A <code>SubKind</code> of {@link Kind#TYPE_DECL}.
+ * A {@code SubKind} of {@link Kind#TYPE_DECL}.
* @jls 8.1. NormalClassDeclaration.
*/
CLASS_SUBKIND(Kind.TYPE_DECL),
/**
* An interface declaration.
- * A <code>SubKind</code> of {@link Kind#TYPE_DECL}.
+ * A {@code SubKind} of {@link Kind#TYPE_DECL}.
* @jls 9.1. NormalInterfaceDeclaration.
*/
INTERFACE_SUBKIND(Kind.TYPE_DECL),
/**
* An enum declaration.
- * A <code>SubKind</code> of {@link Kind#TYPE_DECL}.
+ * A {@code SubKind} of {@link Kind#TYPE_DECL}.
* @jls 8.9. EnumDeclaration.
*/
ENUM_SUBKIND(Kind.TYPE_DECL),
/**
- * An annotation interface declaration. A <code>SubKind</code> of
+ * An annotation interface declaration. A {@code SubKind} of
* {@link Kind#TYPE_DECL}.
* @jls 9.6. AnnotationTypeDeclaration.
*/
ANNOTATION_TYPE_SUBKIND(Kind.TYPE_DECL),
/**
- * A method. The only <code>SubKind</code> for {@link Kind#METHOD}.
+ * A method. The only {@code SubKind} for {@link Kind#METHOD}.
* @jls 8.4. MethodDeclaration.
*/
METHOD_SUBKIND(Kind.METHOD),
/**
* A variable declaration without initializer.
- * A <code>SubKind</code> of {@link Kind#VAR}.
+ * A {@code SubKind} of {@link Kind#VAR}.
* @jls 8.3. VariableDeclarator without VariableInitializer in
* FieldDeclaration.
*/
@@ -220,7 +252,7 @@
/**
* A variable declaration with an initializer expression. A
- * <code>SubKind</code> of {@link Kind#VAR}.
+ * {@code SubKind} of {@link Kind#VAR}.
* @jls 8.3. VariableDeclarator with VariableInitializer in
* FieldDeclaration.
*/
@@ -228,20 +260,20 @@
/**
* An expression whose value has been stored in a temporary variable. A
- * <code>SubKind</code> of {@link Kind#VAR}.
+ * {@code SubKind} of {@link Kind#VAR}.
* @jls 15. Primary.
*/
TEMP_VAR_EXPRESSION_SUBKIND(Kind.VAR, true, true),
/**
- * A simple variable reference expression. A <code>SubKind</code> of
+ * A simple variable reference expression. A {@code SubKind} of
* {@link Kind#EXPRESSION}.
* @jls 15.11. Field Access as 3.8. Identifier.
*/
VAR_VALUE_SUBKIND(Kind.EXPRESSION, true, true),
/**
- * An assignment expression. A <code>SubKind</code> of
+ * An assignment expression. A {@code SubKind} of
* {@link Kind#EXPRESSION}.
* @jls 15.26. Assignment.
*/
@@ -249,18 +281,18 @@
/**
* An expression which has not been wrapped in a temporary variable
- * (reserved). A <code>SubKind</code> of {@link Kind#EXPRESSION}.
+ * (reserved). A {@code SubKind} of {@link Kind#EXPRESSION}.
*/
OTHER_EXPRESSION_SUBKIND(Kind.EXPRESSION, true, true),
/**
- * A statement. The only <code>SubKind</code> for {@link Kind#STATEMENT}.
+ * A statement. The only {@code SubKind} for {@link Kind#STATEMENT}.
* @jls 14.5. Statement.
*/
STATEMENT_SUBKIND(Kind.STATEMENT, true, false),
/**
- * An unknown snippet. The only <code>SubKind</code> for
+ * An unknown snippet. The only {@code SubKind} for
* {@link Kind#ERRONEOUS}.
*/
UNKNOWN_SUBKIND(Kind.ERRONEOUS, false, false);
@@ -282,27 +314,30 @@
}
/**
- * Is this <code>SubKind</code> executable?
+ * Indicates whether this {@code SubKind} is executable.
*
- * @return true if this <code>SubKind</code> can be executed.
+ * @return {@code true} if this {@code SubKind} can
+ * be executed; otherwise {@code false}
*/
public boolean isExecutable() {
return isExecutable;
}
/**
- * Is this <code>SubKind</code> executable and is non-<code>void</code>.
+ * Indicates whether this {@code SubKind} is executable and
+ * is non-{@code void}.
*
- * @return true if this <code>SubKind</code> has a value.
+ * @return {@code true} if this {@code SubKind} has
+ * a value; otherwise {@code false}
*/
public boolean hasValue() {
return hasValue;
}
/**
- * The {@link Snippet.Kind} that corresponds to this <code>SubKind</code>.
+ * The {@link Snippet.Kind} that corresponds to this {@code SubKind}.
*
- * @return the fixed <code>Kind</code> for this <code>SubKind</code>
+ * @return the fixed {@code Kind} for this {@code SubKind}
*/
public Kind kind() {
return kind;
@@ -313,104 +348,112 @@
* Describes the current state of a Snippet.
* This is a dynamic property of a Snippet within the JShell state --
* thus is retrieved with a {@linkplain
- * jdk.jshell.JShell#status(jdk.jshell.Snippet) query on <code>JShell</code>}.
+ * jdk.jshell.JShell#status(jdk.jshell.Snippet) query on {@code JShell}}.
* <p>
- * The <code>Status</code> changes as the state changes.
+ * The {@code Status} changes as the state changes.
* For example, creation of another snippet with
* {@link jdk.jshell.JShell#eval(java.lang.String) eval}
* may resolve dependencies of this Snippet (or invalidate those dependencies), or
* {@linkplain jdk.jshell.Snippet.Status#OVERWRITTEN overwrite}
* this Snippet changing its
- * <code>Status</code>.
+ * {@code Status}.
* <p>
- * Important properties associated with <code>Status</code> are:
- * {@link jdk.jshell.Snippet.Status#isDefined}, if it is visible to other
+ * Important properties associated with {@code Status} are:
+ * {@link jdk.jshell.Snippet.Status#isDefined()}, if it is visible to other
* existing and new snippets; and
- * {@link jdk.jshell.Snippet.Status#isActive}, if, as the
+ * {@link jdk.jshell.Snippet.Status#isActive()}, if, as the
* JShell state changes, the snippet will update, possibly
- * changing <code>Status</code>.
+ * changing {@code Status}.
* An executable Snippet can only be executed if it is in the the
- * {@link jdk.jshell.Snippet.Status#VALID} <code>Status</code>.
+ * {@link jdk.jshell.Snippet.Status#VALID} {@code Status}.
* @see JShell#status(jdk.jshell.Snippet)
*/
public enum Status {
/**
* The snippet is a valid snippet
- * (in the context of current <code>JShell</code> state).
- * Only snippets with <code>VALID</code>
- * <code>Status</code> can be executed (though not all
- * <code>VALID</code> snippets have executable code).
- * If the snippet is a declaration or import, it is visible to other
- * snippets ({@link Status#isDefined isDefined} <code> == true</code>).
+ * (in the context of current {@code JShell} state).
+ * Only snippets with {@code VALID}
+ * {@code Status} can be executed (though not all
+ * {@code VALID} snippets have executable code).
+ * <p>
+ * The snippet is defined
+ * ({@link Status#isDefined() isDefined() == true}).
+ * If the snippet is a declaration or import
+ * ({@link Snippet.Kind#isPersistent()}),
+ * it is visible to other snippets
* <p>
* The snippet will update as dependents change
- * ({@link Status#isActive isActive} <code> == true</code>), its
- * status could become <code>RECOVERABLE_DEFINED</code>, <code>RECOVERABLE_NOT_DEFINED</code>,
- * <code>DROPPED</code>, or <code>OVERWRITTEN</code>.
+ * ({@link Status#isActive() isActive() == true}), its
+ * status could become {@code RECOVERABLE_DEFINED}, {@code RECOVERABLE_NOT_DEFINED},
+ * {@code DROPPED}, or {@code OVERWRITTEN}.
*/
VALID(true, true),
/**
* The snippet is a declaration snippet with potentially recoverable
* unresolved references or other issues in its body
- * (in the context of current <code>JShell</code> state).
+ * (in the context of current {@code JShell} state).
* Only a {@link jdk.jshell.DeclarationSnippet} can have this
- * <code>Status</code>.
+ * {@code Status}.
+ * <p>
* The snippet has a valid signature and it is visible to other
- * snippets ({@link Status#isDefined isDefined} <code> == true</code>)
+ * snippets
+ * ({@link Status#isDefined() isDefined() == true})
* and thus can be referenced in existing or new snippets
* but the snippet cannot be executed.
* An {@link UnresolvedReferenceException} will be thrown on an attempt
* to execute it.
* <p>
* The snippet will update as dependents change
- * ({@link Status#isActive isActive} <code> == true</code>), its
- * status could become <code>VALID</code>, <code>RECOVERABLE_NOT_DEFINED</code>,
- * <code>DROPPED</code>, or <code>OVERWRITTEN</code>.
+ * ({@link Status#isActive() isActive() == true}), its
+ * status could become {@code VALID}, {@code RECOVERABLE_NOT_DEFINED},
+ * {@code DROPPED}, or {@code OVERWRITTEN}.
* <p>
- * Note: both <code>RECOVERABLE_DEFINED</code> and <code>RECOVERABLE_NOT_DEFINED</code>
+ * Note: both {@code RECOVERABLE_DEFINED} and {@code RECOVERABLE_NOT_DEFINED}
* indicate potentially recoverable errors, they differ in that, for
- * <code>RECOVERABLE_DEFINED</code>, the snippet is
- * {@linkplain Status#isDefined defined}.
+ * {@code RECOVERABLE_DEFINED}, the snippet is
+ * {@linkplain Status#isDefined() defined}.
*/
RECOVERABLE_DEFINED(true, true),
/**
* The snippet is a declaration snippet with potentially recoverable
* unresolved references or other issues
- * (in the context of current <code>JShell</code> state).
+ * (in the context of current {@code JShell} state).
* Only a {@link jdk.jshell.DeclarationSnippet} can have this
- * <code>Status</code>.
+ * {@code Status}.
+ * <p>
* The snippet has an invalid signature or the implementation is
* otherwise unable to define it.
* The snippet it is not visible to other snippets
- * ({@link Status#isDefined isDefined} <code> == false</code>)
+ * ({@link Status#isDefined() isDefined() == false})
* and thus cannot be referenced or executed.
* <p>
* The snippet will update as dependents change
- * ({@link Status#isActive isActive} <code> == true</code>), its
- * status could become <code>VALID</code>, <code>RECOVERABLE_DEFINED</code>,
- * <code>DROPPED</code>, or <code>OVERWRITTEN</code>.
+ * ({@link Status#isActive() isActive() == true}), its
+ * status could become {@code VALID}, {@code RECOVERABLE_DEFINED},
+ * {@code DROPPED}, or {@code OVERWRITTEN}.
* <p>
- * Note: both <code>RECOVERABLE_DEFINED</code> and <code>RECOVERABLE_NOT_DEFINED</code>
+ * Note: both {@code RECOVERABLE_DEFINED} and {@code RECOVERABLE_NOT_DEFINED}
* indicate potentially recoverable errors, they differ in that, for
- * <code>RECOVERABLE_DEFINED</code>, the snippet is
- * {@linkplain Status#isDefined defined}.
+ * {@code RECOVERABLE_DEFINED}, the snippet is
+ * {@linkplain Status#isDefined() defined}.
*/
RECOVERABLE_NOT_DEFINED(true, false),
/**
* The snippet is inactive because of an explicit call to
- * the {@link JShell#drop(jdk.jshell.PersistentSnippet)}.
+ * the {@link JShell#drop(PersistentSnippet)}.
* Only a {@link jdk.jshell.PersistentSnippet} can have this
- * <code>Status</code>.
+ * {@code Status}.
+ * <p>
* The snippet is not visible to other snippets
- * ({@link Status#isDefined isDefined} <code> == false</code>)
+ * ({@link Status#isDefined() isDefined() == false})
* and thus cannot be referenced or executed.
* <p>
* The snippet will not update as dependents change
- * ({@link Status#isActive isActive} <code> == false</code>), its
- * <code>Status</code> will never change again.
+ * ({@link Status#isActive() isActive() == false}), its
+ * {@code Status} will never change again.
*/
DROPPED(false, false),
@@ -418,29 +461,30 @@
* The snippet is inactive because it has been replaced by a new
* snippet. This occurs when the new snippet added with
* {@link jdk.jshell.JShell#eval} matches a previous snippet.
- * A <code>TypeDeclSnippet</code> will match another
- * <code>TypeDeclSnippet</code> if the names match.
- * For example <code>class X { }</code> will overwrite
- * <code>class X { int ii; }</code> or
- * <code>interface X { }</code>.
- * A <code>MethodSnippet</code> will match another
- * <code>MethodSnippet</code> if the names and parameter types
+ * A {@code TypeDeclSnippet} will match another
+ * {@code TypeDeclSnippet} if the names match.
+ * For example {@code class X { }} will overwrite
+ * {@code class X { int ii; }} or
+ * {@code interface X { }}.
+ * A {@code MethodSnippet} will match another
+ * {@code MethodSnippet} if the names and parameter types
* match.
- * For example <code>void m(int a) { }</code> will overwrite
- * <code>int m(int a) { return a+a; }</code>.
- * A <code>VarSnippet</code> will match another
- * <code>VarSnippet</code> if the names match.
- * For example <code>double z;</code> will overwrite
- * <code>long z = 2L;</code>.
+ * For example {@code void m(int a) { }} will overwrite
+ * {@code int m(int a) { return a+a; }}.
+ * A {@code VarSnippet} will match another
+ * {@code VarSnippet} if the names match.
+ * For example {@code double z;} will overwrite
+ * {@code long z = 2L;}.
* Only a {@link jdk.jshell.PersistentSnippet} can have this
- * <code>Status</code>.
+ * {@code Status}.
+ * <p>
* The snippet is not visible to other snippets
- * ({@link Status#isDefined isDefined} <code> == false</code>)
+ * ({@link Status#isDefined() isDefined() == false})
* and thus cannot be referenced or executed.
* <p>
* The snippet will not update as dependents change
- * ({@link Status#isActive isActive} <code> == false</code>), its
- * <code>Status</code> will never change again.
+ * ({@link Status#isActive() isActive() == false}), its
+ * {@code Status} will never change again.
*/
OVERWRITTEN(false, false),
@@ -448,13 +492,14 @@
* The snippet is inactive because it failed compilation on initial
* evaluation and it is not capable of becoming valid with further
* changes to the JShell state.
+ * <p>
* The snippet is not visible to other snippets
- * ({@link Status#isDefined isDefined} <code> == false</code>)
+ * ({@link Status#isDefined() isDefined() == false})
* and thus cannot be referenced or executed.
* <p>
* The snippet will not update as dependents change
- * ({@link Status#isActive isActive} <code> == false</code>), its
- * <code>Status</code> will never change again.
+ * ({@link Status#isActive() isActive() == false}), its
+ * {@code Status} will never change again.
*/
REJECTED(false, false),
@@ -463,35 +508,47 @@
* Used only in {@link SnippetEvent#previousStatus} for new
* snippets.
* {@link jdk.jshell.JShell#status(jdk.jshell.Snippet) JShell.status(Snippet)}
- * will never return this <code>Status</code>.
- * Vacuously, {@link Status#isDefined isDefined} and
- * {@link Status#isActive isActive} are both defined <code>false</code>.
+ * will never return this {@code Status}.
+ * <p>
+ * Vacuously, {@link Status#isDefined() isDefined()} and
+ * {@link Status#isActive() isActive()} are both defined {@code false}.
*/
NONEXISTENT(false, false);
- /**
- * Is the Snippet active, that is, will the snippet
- * be re-evaluated when a new
- * {@link JShell#eval(java.lang.String) JShell.eval(String)} or
- * {@link JShell#drop(jdk.jshell.PersistentSnippet)
- * JShell.drop(PersistentSnippet)} that could change
- * its status is invoked? This is more broad than
- * {@link Status#isDefined} since a Snippet which is
- * {@link Status#RECOVERABLE_NOT_DEFINED}
- * will be updated.
- */
- public final boolean isActive;
-
- /**
- * Is the snippet currently part of the defined state of the JShell?
- * Is it visible to compilation of other snippets?
- */
- public final boolean isDefined;
+ private final boolean isActive;
+ private final boolean isDefined;
Status(boolean isActive, boolean isDefined) {
this.isActive = isActive;
this.isDefined = isDefined;
}
+
+ /**
+ * Indicates whether the Snippet is active, that is,
+ * will the snippet be re-evaluated when a new
+ * {@link JShell#eval(java.lang.String) JShell.eval(String)} or
+ * {@link JShell#drop(jdk.jshell.PersistentSnippet)
+ * JShell.drop(PersistentSnippet)} that could change
+ * its status is invoked. This is more broad than
+ * {@link Status#isDefined()} since a Snippet which is
+ * {@link Status#RECOVERABLE_NOT_DEFINED}
+ * will be updated.
+ *
+ * @return {@code true} if the Snippet is active; otherwise {@code false}
+ */
+ public boolean isActive() {
+ return isActive;
+ }
+
+ /**
+ * Indicates whether the snippet is currently part of the defined state
+ * of the JShell. Is it visible to compilation of other snippets?
+ * @return {@code true} if the Snippet is defined; otherwise
+ * {@code false}
+ */
+ public boolean isDefined() {
+ return isDefined;
+ }
}
private final Key key;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetEvent.java Tue Jun 14 10:22:07 2016 -0700
@@ -33,9 +33,9 @@
* {@link JShell#drop(jdk.jshell.PersistentSnippet) JShell.drop(PersistentSnippet)},
* or indirectly by these same methods as
* dependencies change or Snippets are overwritten. For direct changes, the
- * {@link SnippetEvent#causeSnippet()} is <code>null</code>.
+ * {@link SnippetEvent#causeSnippet()} is {@code null}.
* <p>
- * <code>SnippetEvent</code> is immutable: an access to
+ * {@code SnippetEvent} is immutable: an access to
* any of its methods will always return the same result.
* and thus is thread-safe.
* @author Robert Field
@@ -64,7 +64,7 @@
/**
* The Snippet which has changed
- * @return the return the Snippet whose <code>Status</code> has changed.
+ * @return the return the Snippet whose {@code Status} has changed.
*/
public Snippet snippet() {
return snippet;
@@ -81,7 +81,7 @@
/**
* The after status. Note: this may be the same as the previous status (not
- * all changes cause a <code>Status</code> change.
+ * all changes cause a {@code Status} change.
* @return the status
*/
public Status status() {
@@ -89,12 +89,14 @@
}
/**
- * Has the signature changed? Coming in or out of definition
- * (status.isDefined) is always a signature change. An overwritten Snippet
+ * Indicates whether the signature has changed. Coming in or out of
+ * {@linkplain Status#isDefined() definition} is always a signature change.
+ * An overwritten Snippet
* {@link jdk.jshell.Snippet.Status#OVERWRITTEN (status == OVERWRITTEN)}
- * is always <code>false</code> as responsibility for the
+ * is always {@code false} as responsibility for the
* definition has passed to the overwriting definition.
- * @return <code>true</code> if the signature changed.
+ *
+ * @return {@code true} if the signature changed; otherwise {@code false}
*/
public boolean isSignatureChange() {
return isSignatureChange;
@@ -102,13 +104,13 @@
/**
* Either the snippet whose change caused this update or
- * <code>null</code>. This returns <code>null</code> if this change is the
+ * {@code null}. This returns {@code null} if this change is the
* creation of a new Snippet via
* {@link jdk.jshell.JShell#eval(java.lang.String) eval} or it is the
* explicit drop of a Snippet with
* {@link jdk.jshell.JShell#drop(jdk.jshell.PersistentSnippet) drop}.
*
- * @return the Snippet which caused this change or <code>null</code> if
+ * @return the Snippet which caused this change or {@code null} if
* directly caused by an API action.
*/
public Snippet causeSnippet() {
@@ -118,8 +120,8 @@
/**
* An instance of {@link jdk.jshell.UnresolvedReferenceException}, if an unresolved reference was
* encountered, or an instance of {@link jdk.jshell.EvalException} if an exception was thrown
- * during execution, otherwise <code>null</code>.
- * @return the exception or <code>null</code>.
+ * during execution, otherwise {@code null}.
+ * @return the exception or {@code null}.
*/
public JShellException exception() {
return exception;
@@ -128,7 +130,7 @@
/**
* The result value of successful run. The value is null if not executed
* or an exception was thrown.
- * @return the value or <code>null</code>.
+ * @return the value or {@code null}.
*/
public String value() {
return value;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SnippetMaps.java Tue Jun 14 10:22:07 2016 -0700
@@ -82,7 +82,7 @@
Snippet getSnippet(int ki) {
Snippet sn = getSnippetDeadOrAlive(ki);
- return (sn != null && !sn.status().isActive)
+ return (sn != null && !sn.status().isActive())
? null
: sn;
}
@@ -102,7 +102,7 @@
StringBuilder sb = new StringBuilder();
sb.append("package ").append(REPL_PACKAGE).append(";\n");
for (Snippet si : keyIndexToSnippet) {
- if (si != null && si.status().isDefined && (except == null || !except.contains(si.key()))) {
+ if (si != null && si.status().isDefined() && (except == null || !except.contains(si.key()))) {
sb.append(si.importLine(state));
}
}
@@ -114,7 +114,7 @@
}
List<Snippet> getDependents(Snippet snip) {
- if (!snip.kind().isPersistent) {
+ if (!snip.kind().isPersistent()) {
return Collections.emptyList();
}
Set<Integer> depset;
@@ -190,6 +190,6 @@
private Stream<ImportSnippet> importSnippets() {
return state.keyMap.importKeys()
.map(key -> (ImportSnippet)getSnippet(key))
- .filter(sn -> sn != null && state.status(sn).isDefined);
+ .filter(sn -> sn != null && state.status(sn).isDefined());
}
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysis.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysis.java Tue Jun 14 10:22:07 2016 -0700
@@ -51,7 +51,7 @@
/**
* Compute possible follow-ups for the given input.
- * Uses information from the current <code>JShell</code> state, including
+ * Uses information from the current {@code JShell} state, including
* type information, to filter the suggestions.
* @param input the user input, so far
* @param cursor the current position of the cursors in the given {@code input} text
@@ -97,11 +97,16 @@
SourceCodeAnalysis() {}
/**
- * The result of <code>analyzeCompletion(String input)</code>.
+ * The result of {@code analyzeCompletion(String input)}.
* Describes the completeness and position of the first snippet in the given input.
*/
public static class CompletionInfo {
+ private final Completeness completeness;
+ private final int unitEndPos;
+ private final String source;
+ private final String remaining;
+
CompletionInfo(Completeness completeness, int unitEndPos, String source, String remaining) {
this.completeness = completeness;
this.unitEndPos = unitEndPos;
@@ -111,25 +116,42 @@
/**
* The analyzed completeness of the input.
+ *
+ * @return an enum describing the completeness of the input string.
*/
- public final Completeness completeness;
+ public Completeness completeness() {
+ return completeness;
+ }
/**
- * The end of the first unit of source.
+ * Input remaining after the complete part of the source.
+ *
+ * @return the portion of the input string that remains after the
+ * complete Snippet
*/
- public final int unitEndPos;
+ public String remaining() {
+ return remaining;
+ }
/**
- * Source code for the first unit of code input. For example, first
- * statement, or first method declaration. Trailing semicolons will
- * be added, as needed
+ * Source code for the first Snippet of code input. For example, first
+ * statement, or first method declaration. Trailing semicolons will be
+ * added, as needed.
+ *
+ * @return the source of the first encountered Snippet
*/
- public final String source;
+ public String source() {
+ return source;
+ }
/**
- * Input remaining after the source
+ * The end of the first Snippet of source.
+ *
+ * @return the position of the end of the first Snippet in the input.
*/
- public final String remaining;
+ public int unitEndPos() {
+ return unitEndPos;
+ }
}
/**
@@ -181,16 +203,24 @@
*/
UNKNOWN(true);
- /**
- * Is the first snippet of source complete. For example, "x=" is not
- * complete, but "x=2" is complete, even though a subsequent line could
- * make it "x=2+2". Already erroneous code is marked complete.
- */
- public final boolean isComplete;
+ private final boolean isComplete;
Completeness(boolean isComplete) {
this.isComplete = isComplete;
}
+
+ /**
+ * Indicates whether the first snippet of source is complete.
+ * For example, "{@code x=}" is not
+ * complete, but "{@code x=2}" is complete, even though a subsequent line could
+ * make it "{@code x=2+2}". Already erroneous code is marked complete.
+ *
+ * @return {@code true} if the input is or begins a complete Snippet;
+ * otherwise {@code false}
+ */
+ public boolean isComplete() {
+ return isComplete;
+ }
}
/**
@@ -198,27 +228,40 @@
*/
public static class Suggestion {
+ private final String continuation;
+ private final boolean matchesType;
+
/**
* Create a {@code Suggestion} instance.
+ *
* @param continuation a candidate continuation of the user's input
- * @param isSmart is the candidate "smart"
+ * @param matchesType does the candidate match the target type
*/
- public Suggestion(String continuation, boolean isSmart) {
+ public Suggestion(String continuation, boolean matchesType) {
this.continuation = continuation;
- this.isSmart = isSmart;
+ this.matchesType = matchesType;
}
/**
* The candidate continuation of the given user's input.
+ *
+ * @return the continuation string
*/
- public final String continuation;
+ public String continuation() {
+ return continuation;
+ }
/**
- * Is it an input continuation that matches the target type and is thus more
- * likely to be the desired continuation. A smart continuation
- * is preferred.
+ * Indicates whether input continuation matches the target type and is thus
+ * more likely to be the desired continuation. A matching continuation is
+ * preferred.
+ *
+ * @return {@code true} if this suggested continuation matches the
+ * target type; otherwise {@code false}
*/
- public final boolean isSmart;
+ public boolean matchesType() {
+ return matchesType;
+ }
}
/**
@@ -259,22 +302,25 @@
}
/**
- * Whether the result is based on up to date data. The
+ * Indicates whether the result is based on up to date data. The
* {@link SourceCodeAnalysis#listQualifiedNames(java.lang.String, int) listQualifiedNames}
* method may return before the classpath is fully inspected, in which case this method will
* return {@code false}. If the result is based on a fully inspected classpath, this method
* will return {@code true}.
*
- * @return true iff the results is based on up-to-date data
+ * @return {@code true} if the result is based on up-to-date data;
+ * otherwise {@code false}
*/
public boolean isUpToDate() {
return upToDate;
}
/**
- * Whether the given simple name in the original code refers to a resolvable element.
+ * Indicates whether the given simple name in the original code refers
+ * to a resolvable element.
*
- * @return true iff the given simple name in the original code refers to a resolvable element
+ * @return {@code true} if the given simple name in the original code
+ * refers to a resolvable element; otherwise {@code false}
*/
public boolean isResolvable() {
return resolvable;
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java Tue Jun 14 10:22:07 2016 -0700
@@ -276,8 +276,8 @@
}
String requiredPrefix = identifier;
return computeSuggestions(codeWrap, cursor, anchor).stream()
- .filter(s -> s.continuation.startsWith(requiredPrefix) && !s.continuation.equals(REPL_DOESNOTMATTER_CLASS_NAME))
- .sorted(Comparator.comparing(s -> s.continuation))
+ .filter(s -> s.continuation().startsWith(requiredPrefix) && !s.continuation().equals(REPL_DOESNOTMATTER_CLASS_NAME))
+ .sorted(Comparator.comparing(s -> s.continuation()))
.collect(collectingAndThen(toList(), Collections::unmodifiableList));
}
@@ -1223,9 +1223,9 @@
public String analyzeType(String code, int cursor) {
code = code.substring(0, cursor);
CompletionInfo completionInfo = analyzeCompletion(code);
- if (!completionInfo.completeness.isComplete)
+ if (!completionInfo.completeness().isComplete())
return null;
- if (completionInfo.completeness == Completeness.COMPLETE_WITH_SEMI) {
+ if (completionInfo.completeness() == Completeness.COMPLETE_WITH_SEMI) {
code += ";";
}
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/Unit.java Tue Jun 14 10:22:07 2016 -0700
@@ -257,7 +257,7 @@
}
boolean isDefined() {
- return status.isDefined;
+ return status.isDefined();
}
/**
@@ -268,7 +268,7 @@
Stream<String> classesToLoad(List<String> classnames) {
toRedefine = new ArrayList<>();
List<String> toLoad = new ArrayList<>();
- if (status.isDefined && !isImport()) {
+ if (status.isDefined() && !isImport()) {
// Classes should only be loaded/redefined if the compile left them
// in a defined state. Imports do not have code and are not loaded.
for (String cn : classnames) {
@@ -312,8 +312,8 @@
}
private boolean sigChanged() {
- return (status.isDefined != prevStatus.isDefined)
- || (status.isDefined && !si.className().equals(classNameInitial))
+ return (status.isDefined() != prevStatus.isDefined())
+ || (status.isDefined() && !si.className().equals(classNameInitial))
|| signatureChanged;
}
@@ -328,7 +328,7 @@
Stream<Unit> dependents() {
return state.maps.getDependents(si)
.stream()
- .filter(xsi -> xsi != si && xsi.status().isActive)
+ .filter(xsi -> xsi != si && xsi.status().isActive())
.map(xsi -> new Unit(state, xsi, si, new DiagList()));
}
@@ -338,7 +338,7 @@
}
private void markOldDeclarationOverwritten() {
- if (si != siOld && siOld != null && siOld.status().isActive) {
+ if (si != siOld && siOld != null && siOld.status().isActive()) {
// Mark the old declaraion as replaced
replaceOldEvent = new SnippetEvent(siOld,
siOld.status(), OVERWRITTEN,
@@ -374,7 +374,7 @@
if (replaceOldEvent != null) secondaryEvents.add(replaceOldEvent);
// Defined methods can overwrite methods of other (equivalent) snippets
- if (isNew && si.kind() == Kind.METHOD && status.isDefined) {
+ if (isNew && si.kind() == Kind.METHOD && status.isDefined()) {
MethodSnippet msi = (MethodSnippet)si;
String oqpt = msi.qualifiedParameterTypes();
String nqpt = computeQualifiedParameterTypes(at, msi);
@@ -399,7 +399,7 @@
// same computed qualified parameter types
Status overwrittenStatus = null;
for (MethodSnippet sn : state.methods()) {
- if (sn != null && sn != msi && sn.status().isActive && sn.name().equals(msi.name())) {
+ if (sn != null && sn != msi && sn.status().isActive() && sn.name().equals(msi.name())) {
if (qpt.equals(sn.qualifiedParameterTypes())) {
overwrittenStatus = sn.status();
SnippetEvent se = new SnippetEvent(
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java Tue Jun 14 10:22:07 2016 -0700
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8154119 8154262
+ * @bug 8154119 8154262 8156077
* @summary Test modules support in javadoc.
* @author bpatel
* @library ../lib
@@ -87,7 +87,7 @@
testModuleLink();
}
- @Test
+ @Test
void test5() {
javadoc("-d", "out-nomodule", "-use",
"-sourcepath", testSrc,
@@ -95,6 +95,18 @@
checkExit(Exit.OK);
}
+ @Test
+ void test6() {
+ javadoc("-d", "out-mdltags", "-author", "-version",
+ "-tag", "regular:a:Regular Tag:",
+ "-tag", "moduletag:s:Module Tag:",
+ "-modulesourcepath", testSrc,
+ "-addmods", "moduletags,module2",
+ "testpkgmdltags", "testpkgmdl2");
+ checkExit(Exit.OK);
+ testModuleTags();
+ }
+
void testDescription(boolean found) {
checkOutput("module1-summary.html", found,
"<!-- ============ MODULE DESCRIPTION =========== -->\n"
@@ -187,4 +199,38 @@
"<ul class=\"navList\" title=\"Navigation\">\n"
+ "<li><a href=\"../../testpkgnomodule/package-summary.html\">Package</a></li>");
}
+
+ void testModuleTags() {
+ checkOutput("moduletags-summary.html", true,
+ "Type Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in "
+ + "testpkgmdltags\"><code>TestClassInModuleTags</code></a>.");
+ checkOutput("moduletags-summary.html", true,
+ "Member Link: <a href=\"testpkgmdltags/TestClassInModuleTags.html#"
+ + "testMethod-java.lang.String-\"><code>testMethod(String)</code></a>.");
+ checkOutput("moduletags-summary.html", true,
+ "Package Link: <a href=\"testpkgmdltags/package-summary.html\"><code>testpkgmdltags</code></a>.");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n"
+ + "<dd>JDK 9</dd>");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"seeLabel\">See Also:</span></dt>\n"
+ + "<dd>\"Test see tag\", \n"
+ + "<a href=\"testpkgmdltags/TestClassInModuleTags.html\" title=\"class in testpkgmdltags\"><code>"
+ + "TestClassInModuleTags</code></a></dd>");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"simpleTagLabel\">Regular Tag:</span></dt>\n"
+ + "<dd>Just a regular simple tag.</dd>");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"simpleTagLabel\">Module Tag:</span></dt>\n"
+ + "<dd>Just a simple module tag.</dd>");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"simpleTagLabel\">Version:</span></dt>\n"
+ + "<dd>1.0</dd>");
+ checkOutput("moduletags-summary.html", true,
+ "<dt><span class=\"simpleTagLabel\">Author:</span></dt>\n"
+ + "<dd>Bhavesh Patel</dd>");
+ checkOutput("testpkgmdltags/TestClassInModuleTags.html", false,
+ "<dt><span class=\"simpleTagLabel\">Module Tag:</span></dt>\n"
+ + "<dd>Just a simple module tag.</dd>");
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/module-info.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * This is a test description for the module1 module.<br>
+ * Type Link: {@link testpkgmdltags.TestClassInModuleTags}.<br>
+ * Member Link: {@link testpkgmdltags.TestClassInModuleTags#testMethod(String)}.<br>
+ * Package Link: {@link testpkgmdltags}.<br>
+ *
+ * @author Bhavesh Patel
+ * @since JDK 9
+ * @see "Test see tag"
+ * @see testpkgmdltags.TestClassInModuleTags
+ * @regular Just a regular simple tag.
+ * @moduletag Just a simple module tag.
+ * @version 1.0
+ */
+module moduletags {
+ requires module2;
+
+ exports testpkgmdltags;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/jdk/javadoc/doclet/testModules/moduletags/testpkgmdltags/TestClassInModuleTags.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package testpkgmdltags;
+
+/**
+ * Simple tag test
+ * @regular Just a regular simple tag.
+ * @moduletag Just a simple module tag.
+ */
+
+public class TestClassInModuleTags {
+ public void testMethod(String str){}
+}
--- a/langtools/test/jdk/jshell/ClassMembersTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/jshell/ClassMembersTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8139829
* @summary Test access to members of user defined class.
* @build KullaTesting TestingInputStream ExpectedDiagnostic
* @run testng/timeout=600 ClassMembersTest
@@ -61,8 +62,8 @@
String source = input;
while (!source.trim().isEmpty()) {
SourceCodeAnalysis.CompletionInfo info = codeAnalysis.analyzeCompletion(source);
- list.add(info.source);
- source = info.remaining;
+ list.add(info.source());
+ source = info.remaining();
}
return list;
}
--- a/langtools/test/jdk/jshell/CompletenessStressTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/jshell/CompletenessStressTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -248,15 +248,15 @@
}
String unit = text.substring(start, end);
SourceCodeAnalysis.CompletionInfo ci = getAnalysis().analyzeCompletion(unit);
- if (ci.completeness != expected) {
- if (expected == COMPLETE_WITH_SEMI && (ci.completeness == CONSIDERED_INCOMPLETE || ci.completeness == EMPTY)) {
+ if (ci.completeness() != expected) {
+ if (expected == COMPLETE_WITH_SEMI && (ci.completeness() == CONSIDERED_INCOMPLETE || ci.completeness() == EMPTY)) {
writer.write(String.format("Empty statement: row %d, column %d: -- %s\n",
start, end, unit));
} else {
- String oops = unit.substring(max(0, ci.unitEndPos - 10), ci.unitEndPos) + "|||" +
- unit.substring(ci.unitEndPos, min(unit.length(), ci.unitEndPos + 10));
+ String oops = unit.substring(max(0, ci.unitEndPos() - 10), ci.unitEndPos()) + "|||" +
+ unit.substring(ci.unitEndPos(), min(unit.length(), ci.unitEndPos() + 10));
writer.write(String.format("Expected %s got %s: '%s' row %d, column %d: -- %s\n",
- expected, ci.completeness, oops, row, column, unit));
+ expected, ci.completeness(), oops, row, column, unit));
return false;
}
}
--- a/langtools/test/jdk/jshell/KullaTesting.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/jshell/KullaTesting.java Tue Jun 14 10:22:07 2016 -0700
@@ -139,7 +139,7 @@
public List<Snippet> getActiveKeys() {
return allSnippets.stream()
- .filter(k -> getState().status(k).isActive)
+ .filter(k -> getState().status(k).isActive())
.collect(Collectors.toList());
}
@@ -615,7 +615,7 @@
return (ImportSnippet) key;
}
- private Snippet key(List<SnippetEvent> events) {
+ public Snippet key(List<SnippetEvent> events) {
assertTrue(events.size() >= 1, "Expected at least one event, got none.");
return events.get(0).snippet();
}
@@ -757,12 +757,12 @@
public void assertAnalyze(String input, Completeness status, String source, String remaining, Boolean isComplete) {
CompletionInfo ci = getAnalysis().analyzeCompletion(input);
- if (status != null) assertEquals(ci.completeness, status, "Input : " + input + ", status: ");
- if (source != null) assertEquals(ci.source, source, "Input : " + input + ", source: ");
- if (remaining != null) assertEquals(ci.remaining, remaining, "Input : " + input + ", remaining: ");
+ if (status != null) assertEquals(ci.completeness(), status, "Input : " + input + ", status: ");
+ if (source != null) assertEquals(ci.source(), source, "Input : " + input + ", source: ");
+ if (remaining != null) assertEquals(ci.remaining(), remaining, "Input : " + input + ", remaining: ");
if (isComplete != null) {
boolean isExpectedComplete = isComplete;
- assertEquals(ci.completeness.isComplete, isExpectedComplete, "Input : " + input + ", isComplete: ");
+ assertEquals(ci.completeness().isComplete(), isExpectedComplete, "Input : " + input + ", isComplete: ");
}
}
@@ -794,7 +794,7 @@
List<Snippet> snippets = getState().snippets();
assertEquals(allSnippets.size(), snippets.size());
for (Snippet sn : snippets) {
- if (sn.kind().isPersistent && getState().status(sn).isActive) {
+ if (sn.kind().isPersistent() && getState().status(sn).isActive()) {
MemberInfo actual = getMemberInfo(sn);
MemberInfo exp = expected[index];
assertEquals(actual, exp, String.format("Difference in #%d. Expected: %s, actual: %s",
@@ -812,7 +812,7 @@
public void assertActiveKeys(Snippet... expected) {
int index = 0;
for (Snippet key : getState().snippets()) {
- if (state.status(key).isActive) {
+ if (state.status(key).isActive()) {
assertEquals(expected[index], key, String.format("Difference in #%d. Expected: %s, actual: %s", index, key, expected[index]));
++index;
}
@@ -888,8 +888,8 @@
List<Suggestion> completions =
getAnalysis().completionSuggestions(code, cursor, new int[1]); //XXX: ignoring anchor for now
return completions.stream()
- .filter(s -> isSmart == null || isSmart == s.isSmart)
- .map(s -> s.continuation)
+ .filter(s -> isSmart == null || isSmart == s.matchesType())
+ .map(s -> s.continuation())
.distinct()
.collect(Collectors.toList());
}
@@ -1071,7 +1071,7 @@
}
public static STEInfo added(Status status) {
- return new STEInfo(MAIN_SNIPPET, NONEXISTENT, status, status.isDefined, null);
+ return new STEInfo(MAIN_SNIPPET, NONEXISTENT, status, status.isDefined(), null);
}
public static class EventChain {
--- a/langtools/test/jdk/jshell/ReplToolTesting.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/jshell/ReplToolTesting.java Tue Jun 14 10:22:07 2016 -0700
@@ -470,8 +470,8 @@
List<Suggestion> completions =
js.commandCompletionSuggestions(code, cursor, new int[1]); //XXX: ignoring anchor for now
return completions.stream()
- .filter(s -> isSmart == s.isSmart)
- .map(s -> s.continuation)
+ .filter(s -> isSmart == s.matchesType())
+ .map(s -> s.continuation())
.distinct()
.collect(Collectors.toList());
}
--- a/langtools/test/jdk/jshell/SnippetTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/jdk/jshell/SnippetTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8139829
* @summary test accessors of Snippet
* @build KullaTesting TestingInputStream
* @run testng SnippetTest
@@ -32,9 +33,14 @@
import jdk.jshell.DeclarationSnippet;
import org.testng.annotations.Test;
+import jdk.jshell.MethodSnippet;
+import jdk.jshell.Snippet.Status;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
import static jdk.jshell.Snippet.Status.VALID;
import static jdk.jshell.Snippet.Status.RECOVERABLE_DEFINED;
import static jdk.jshell.Snippet.Status.OVERWRITTEN;
+import static jdk.jshell.Snippet.Status.RECOVERABLE_NOT_DEFINED;
import static jdk.jshell.Snippet.SubKind.*;
@Test
@@ -147,4 +153,27 @@
method("()double", "f"));
assertActiveKeys();
}
+
+ public void testBooleanSnippetQueries() {
+ Snippet nd = varKey(assertEval("blort x;", added(RECOVERABLE_NOT_DEFINED)));
+ assertTrue(nd.kind().isPersistent(), "nd.isPersistent");
+ Status ndstat = getState().status(nd);
+ assertTrue(ndstat.isActive(), "nd.isActive");
+ assertFalse(ndstat.isDefined(), "nd.isDefined");
+ MethodSnippet g = methodKey(assertEval("void g() { f(); }", added(RECOVERABLE_DEFINED)));
+ assertTrue(g.kind().isPersistent(), "g.isPersistent");
+ Status gstat = getState().status(g);
+ assertTrue(gstat.isActive(), "g.isActive");
+ assertTrue(gstat.isDefined(), "g.isDefined");
+ getState().drop(g);
+ assertTrue(g.kind().isPersistent(), "drop isPersistent");
+ gstat = getState().status(g);
+ assertFalse(gstat.isActive(), "drop isActive");
+ assertFalse(gstat.isDefined(), "drop isDefined");
+ Snippet stmt = key(assertEval("if (true) {}", added(VALID)));
+ assertFalse(stmt.kind().isPersistent(), "stmt isPersistent");
+ Status stmtstat = getState().status(stmt);
+ assertTrue(stmtstat.isActive(), "stmt isActive");
+ assertTrue(stmtstat.isDefined(), "stmt isDefined");
+ }
}
--- a/langtools/test/tools/javac/lambda/MostSpecific28.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/tools/javac/lambda/MostSpecific28.java Tue Jun 14 10:22:07 2016 -0700
@@ -12,8 +12,6 @@
static void m1(Pred<? super Integer> f) {}
static void m1(Fun<Number, Boolean> f) {}
- static String foo(Object in) { return "a"; }
-
void test() {
m1((Number n) -> true);
}
--- a/langtools/test/tools/javac/lambda/MostSpecific28.out Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/tools/javac/lambda/MostSpecific28.out Tue Jun 14 10:22:07 2016 -0700
@@ -1,2 +1,2 @@
-MostSpecific28.java:18:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific28.Pred<? super java.lang.Integer>), MostSpecific28, kindname.method, m1(MostSpecific28.Fun<java.lang.Number,java.lang.Boolean>), MostSpecific28
+MostSpecific28.java:16:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific28.Pred<? super java.lang.Integer>), MostSpecific28, kindname.method, m1(MostSpecific28.Fun<java.lang.Number,java.lang.Boolean>), MostSpecific28
1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific29.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8144767
+ * @summary Correct most-specific test when wildcards appear in functional interface type
+ * @compile MostSpecific29.java
+ */
+class MostSpecific29 {
+
+ interface Pred<T> { boolean test(T arg); }
+ interface Fun<T,R> { R apply(T arg); }
+
+ static void m1(Pred<? super Integer> f) {}
+ static void m1(Fun<Integer, Boolean> f) {}
+
+ void test() {
+ m1((Integer n) -> true);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific30.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8144767
+ * @summary Correct most-specific test when wildcards appear in functional interface type
+ * @compile/fail/ref=MostSpecific30.out -XDrawDiagnostics MostSpecific30.java
+ */
+class MostSpecific30 {
+
+ interface Pred<T> { boolean test(T arg); }
+ interface Fun<T,R> { R apply(T arg); }
+
+ static void m1(Pred<? extends Integer> f) {}
+ static void m1(Fun<Integer, Boolean> f) {}
+
+ void test() {
+ m1((Integer n) -> true);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific30.out Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,2 @@
+MostSpecific30.java:16:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific30.Pred<? extends java.lang.Integer>), MostSpecific30, kindname.method, m1(MostSpecific30.Fun<java.lang.Integer,java.lang.Boolean>), MostSpecific30
+1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific31.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8144767
+ * @summary Correct most-specific test when wildcards appear in functional interface type
+ * @compile/fail/ref=MostSpecific31.out -XDrawDiagnostics MostSpecific31.java
+ */
+class MostSpecific31 {
+
+ interface Pred<T> { boolean test(T arg); }
+ interface Fun<T,R> { R apply(T arg); }
+
+ static void m1(Pred<? super Number> f) {}
+ static void m1(Fun<Integer, Boolean> f) {}
+
+ static boolean foo(Object arg) { return false; }
+
+ void test() {
+ m1(MostSpecific31::foo);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific31.out Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,2 @@
+MostSpecific31.java:18:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific31.Pred<? super java.lang.Number>), MostSpecific31, kindname.method, m1(MostSpecific31.Fun<java.lang.Integer,java.lang.Boolean>), MostSpecific31
+1 error
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific32.java Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8144767
+ * @summary Correct most-specific test when wildcards appear in functional interface type
+ * @compile/fail/ref=MostSpecific32.out -XDrawDiagnostics MostSpecific32.java
+ */
+class MostSpecific32 {
+
+ interface A<T> {}
+ interface B<T> extends A<T> {}
+
+ interface F1<S> { A<S> apply(); }
+ interface F2<S> { B<S> apply(); }
+
+ static void m1(F1<? extends Number> f1) {}
+ static void m1(F2<? extends Number> f2) {}
+
+ void test() {
+ m1(() -> null); // B<CAP ext Number> </: A<Number>
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/MostSpecific32.out Tue Jun 14 10:22:07 2016 -0700
@@ -0,0 +1,2 @@
+MostSpecific32.java:19:9: compiler.err.ref.ambiguous: m1, kindname.method, m1(MostSpecific32.F1<? extends java.lang.Number>), MostSpecific32, kindname.method, m1(MostSpecific32.F2<? extends java.lang.Number>), MostSpecific32
+1 error
--- a/langtools/test/tools/javac/modules/ModuleInfoTest.java Fri Jun 10 15:13:40 2016 -0700
+++ b/langtools/test/tools/javac/modules/ModuleInfoTest.java Tue Jun 14 10:22:07 2016 -0700
@@ -23,6 +23,7 @@
/*
* @test
+ * @bug 8158123
* @summary tests for module declarations
* @library /tools/lib
* @modules
@@ -35,6 +36,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Arrays;
import toolbox.JavacTask;
import toolbox.Task;
@@ -323,4 +325,46 @@
if (!log.contains("module-info.java:1:30: compiler.err.duplicate.exports: m1"))
throw new Exception("expected output not found");
}
+
+ /**
+ * Verify that annotations are not permitted at
+ * any of the module names or the package names.
+ */
+ @Test
+ public void testAnnotations(Path base) throws Exception {
+ Path src = base.resolve("src");
+ Path src_m1 = src.resolve("m1.sub");
+ Path classes = base.resolve("classes");
+ Files.createDirectories(classes);
+
+ String code = "module @m1.@sub { " +
+ "requires @p1.@p2; " +
+ "exports @p1.@p2; " +
+ "exports @p1.@p2 to @m2.@sub; " +
+ "exports @p1.@p2 to @m2.@sub, @m3.@sub; " +
+ "uses @p1.@Interface; " +
+ "provides @p1.@Interface with @p2.@Concrete; " +
+ "}";
+ String[] splittedCode = code.split("@");
+ int length = splittedCode.length;
+ String anno = "@Anno ";
+
+ for (int i = 1; i < length; i++) {
+ String preAnno = String.join("", Arrays.copyOfRange(splittedCode, 0, i));
+ String postAnno = String.join("", Arrays.copyOfRange(splittedCode, i, length));
+ String moduleInfo = preAnno + anno + postAnno;
+ tb.writeFile(src_m1.resolve("module-info.java"), moduleInfo);
+
+ String log = new JavacTask(tb)
+ .options("-XDrawDiagnostics", "-modulesourcepath", src.toString())
+ .outdir(classes)
+ .files(findJavaFiles(src))
+ .run(Task.Expect.FAIL)
+ .writeAll()
+ .getOutput(Task.OutputKind.DIRECT);
+
+ if (!log.matches("(?s)^module\\-info\\.java:\\d+:\\d+: compiler\\.err\\.expected: token\\.identifier.*"))
+ throw new Exception("expected output not found");
+ }
+ }
}
--- a/make/CompileJavaModules.gmk Fri Jun 10 15:13:40 2016 -0700
+++ b/make/CompileJavaModules.gmk Tue Jun 14 10:22:07 2016 -0700
@@ -477,6 +477,13 @@
# be recompiled. If multiple paths are separated by comma, convert that into a
# space separated list.
JDK_USER_DEFINED_FILTER := $(strip $(subst $(COMMA),$(SPACE), $(JDK_FILTER)))
+ifeq ($(JDK_FILTER), )
+ FAIL_NO_SRC := true
+else
+ # When using JDK_FILTER, most module java compilations will end up finding
+ # no source files. Don't let that fail the build.
+ FAIL_NO_SRC := false
+endif
# Get the complete module source path.
MODULESOURCEPATH := $(call GetModuleSrcPath)
@@ -496,7 +503,8 @@
SETUP := $(if $($(MODULE)_SETUP), $($(MODULE)_SETUP), GENERATE_JDKBYTECODE), \
MODULE := $(MODULE), \
SRC := $(wildcard $(MODULE_SRC_DIRS)), \
- INCLUDES := $(JDK_USER_DEFINED_FILTER),\
+ INCLUDES := $(JDK_USER_DEFINED_FILTER), \
+ FAIL_NO_SRC := $(FAIL_NO_SRC), \
BIN := $(if $($(MODULE)_BIN), $($(MODULE)_BIN), $(JDK_OUTPUTDIR)/modules), \
HEADERS := $(SUPPORT_OUTPUTDIR)/headers, \
ADD_JAVAC_FLAGS := \
--- a/make/CreateJmods.gmk Fri Jun 10 15:13:40 2016 -0700
+++ b/make/CreateJmods.gmk Tue Jun 14 10:22:07 2016 -0700
@@ -82,6 +82,12 @@
endif
endif
+# Changes to the jmod tool itself should also trigger a rebuild of all jmods
+DEPS += $(JMOD_CMD)
+ifeq ($(EXTERNAL_BUILDJDK), false)
+ DEPS += $(call CacheFind, $(JDK_OUTPUTDIR)/modules/jdk.jlink/jdk/tools/jmod)
+endif
+
# TODO: What about headers?
# Create jmods in a temp dir and then move them into place to keep the
# module path in $(IMAGES_OUTPUTDIR)/jmods valid at all times.
--- a/make/Images.gmk Fri Jun 10 15:13:40 2016 -0700
+++ b/make/Images.gmk Tue Jun 14 10:22:07 2016 -0700
@@ -115,16 +115,16 @@
# Use this file inside the image as target for make rule
JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
-JLINK_ORDER_RESOURCES := *module-info.class*
+JLINK_ORDER_RESOURCES := **module-info.class
ifeq ($(ENABLE_GENERATE_CLASSLIST), true)
JLINK_ORDER_RESOURCES += @$(SUPPORT_OUTPUTDIR)/classlist/classlist
endif
JLINK_ORDER_RESOURCES += \
- /java.base/java/* \
- /java.base/jdk/* \
- /java.base/sun/* \
- /java.base/com/* \
- /jdk.localedata/* \
+ /java.base/java/** \
+ /java.base/jdk/** \
+ /java.base/sun/** \
+ /java.base/com/** \
+ /jdk.localedata/** \
#
JLINK_TOOL := $(JLINK) --modulepath $(IMAGES_OUTPUTDIR)/jmods \
--- a/make/Main.gmk Fri Jun 10 15:13:40 2016 -0700
+++ b/make/Main.gmk Tue Jun 14 10:22:07 2016 -0700
@@ -65,20 +65,24 @@
################################################################################
# Interim/build tools targets, compiling tools used during the build
-buildtools-langtools:
+# When creating a BUILDJDK, the buildtools and interim targets have already
+# been built and should not be built again.
+ifneq ($(CREATING_BUILDJDK), true)
+ buildtools-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
-interim-langtools:
+ interim-langtools:
+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
-interim-rmic:
+ interim-rmic:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
-interim-cldrconverter:
+ interim-cldrconverter:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CopyInterimCLDRConverter.gmk)
-buildtools-jdk:
+ buildtools-jdk:
+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileTools.gmk)
+endif
ALL_TARGETS += buildtools-langtools interim-langtools \
interim-rmic interim-cldrconverter buildtools-jdk
@@ -99,35 +103,40 @@
################################################################################
# Gensrc targets, generating source before java compilation can be done
-$(eval $(call DeclareRecipesForPhase, GENSRC, \
- TARGET_SUFFIX := gensrc, \
- FILE_PREFIX := Gensrc, \
- MAKE_SUBDIR := gensrc, \
- CHECK_MODULES := $(ALL_MODULES), \
- MULTIPLE_MAKEFILES := true))
+#
+# When creating a BUILDJDK, the java targets have already been built and copied
+# into the buildjdk so no need to generate sources.
+ifneq ($(CREATING_BUILDJDK), true)
+ $(eval $(call DeclareRecipesForPhase, GENSRC, \
+ TARGET_SUFFIX := gensrc, \
+ FILE_PREFIX := Gensrc, \
+ MAKE_SUBDIR := gensrc, \
+ CHECK_MODULES := $(ALL_MODULES), \
+ MULTIPLE_MAKEFILES := true))
-JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
-LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
-CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
-HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
+ JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
+ LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
+ CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
+ HOTSPOT_GENSRC_TARGETS := $(filter %-gensrc-hotspot, $(GENSRC_TARGETS))
-GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
-GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
- $(GENSRC_MODULEINFO_MODULES))
+ GENSRC_MODULEINFO_MODULES := $(ALL_MODULES)
+ GENSRC_MODULEINFO_TARGETS := $(addsuffix -gensrc-moduleinfo, \
+ $(GENSRC_MODULEINFO_MODULES))
-GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
-GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
- $(addsuffix -gensrc, $(GENSRC_MODULES)))
+ GENSRC_MODULES := $(GENSRC_MODULEINFO_MODULES)
+ GENSRC_TARGETS += $(sort $(GENSRC_MODULEINFO_TARGETS) \
+ $(addsuffix -gensrc, $(GENSRC_MODULES)))
-define DeclareModuleInfoRecipe
- $1-gensrc-moduleinfo:
+ define DeclareModuleInfoRecipe
+ $1-gensrc-moduleinfo:
+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
-f GensrcModuleInfo.gmk MODULE=$1)
- $1-gensrc: $1-gensrc-moduleinfo
-endef
+ $1-gensrc: $1-gensrc-moduleinfo
+ endef
-$(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+ $(foreach m, $(GENSRC_MODULEINFO_MODULES), $(eval $(call DeclareModuleInfoRecipe,$m)))
+endif
ALL_TARGETS += $(GENSRC_TARGETS)
--- a/make/common/JavaCompilation.gmk Fri Jun 10 15:13:40 2016 -0700
+++ b/make/common/JavaCompilation.gmk Tue Jun 14 10:22:07 2016 -0700
@@ -170,6 +170,8 @@
# DEPENDS:=Extra dependecy
# DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
# KEEP_DUPS:=Do not remove duplicate file names from different source roots.
+# FAIL_NO_SRC:=Set to false to not fail the build if no source files are found,
+# default is true.
SetupJavaCompilation = $(NamedParamsMacroTemplate)
define SetupJavaCompilationBody
@@ -191,7 +193,7 @@
$1_SJAVAC_PORTFILE := $$($$($1_SETUP)_SJAVAC_PORTFILE)
$1_SERVER_JVM := $$($$($1_SETUP)_SERVER_JVM)
$1_DISABLE_SJAVAC := $$($$($1_SETUP)_DISABLE_SJAVAC)
-
+
ifneq ($$($1_MODULE), )
$1_MODULE_SUBDIR := /$$($1_MODULE)
endif
@@ -246,146 +248,148 @@
endif
ifeq ($$(strip $$($1_SRCS)), )
- $$(error No source files found for $1)
- endif
+ ifneq ($$($1_FAIL_NO_SRC), false)
+ $$(error No source files found for $1)
+ endif
+ else
- $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
+ $1_SAFE_NAME := $$(strip $$(subst /,_, $1))
- # All files below META-INF are always copied.
- $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
- # Find all files to be copied from source to bin.
- ifneq (,$$($1_COPY)$$($1_COPY_FILES))
- # Search for all files to be copied.
- $1_ALL_COPIES += $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
- # Copy these explicitly
- $1_ALL_COPIES += $$($1_COPY_FILES)
- endif
- # Copy must also respect filters.
- ifneq (,$$($1_INCLUDE_PATTERN))
- $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
- endif
- ifneq (,$$($1_EXCLUDE_PATTERN))
- $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
- endif
- ifneq (,$$($1_ALL_COPIES))
- # Yep, there are files to be copied!
- $1_ALL_COPY_TARGETS:=
- $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
- # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
- endif
-
- # Find all property files to be copied and cleaned from source to bin.
- ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
- # Search for all files to be copied.
- $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
- # Clean these explicitly
- $1_ALL_CLEANS += $$($1_CLEAN_FILES)
- # Copy and clean must also respect filters.
+ # All files below META-INF are always copied.
+ $1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
+ # Find all files to be copied from source to bin.
+ ifneq (,$$($1_COPY)$$($1_COPY_FILES))
+ # Search for all files to be copied.
+ $1_ALL_COPIES += $$(filter $$(addprefix %,$$($1_COPY)),$$($1_ALL_SRCS))
+ # Copy these explicitly
+ $1_ALL_COPIES += $$($1_COPY_FILES)
+ endif
+ # Copy must also respect filters.
ifneq (,$$($1_INCLUDE_PATTERN))
- $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
+ $1_ALL_COPIES := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_COPIES))
endif
ifneq (,$$($1_EXCLUDE_PATTERN))
- $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
+ $1_ALL_COPIES := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_COPIES))
endif
- ifneq (,$$($1_ALL_CLEANS))
- # Yep, there are files to be copied and cleaned!
- $1_ALL_COPY_CLEAN_TARGETS:=
- $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_clean,$1,$$i)))
- # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+ ifneq (,$$($1_ALL_COPIES))
+ # Yep, there are files to be copied!
+ $1_ALL_COPY_TARGETS:=
+ $$(foreach i,$$($1_ALL_COPIES),$$(eval $$(call add_file_to_copy,$1,$$i)))
+ # Now we can depend on $$($1_ALL_COPY_TARGETS) to copy all files!
endif
- endif
- # Create a sed expression to remove the source roots and to replace / with .
- # and remove .java at the end.
- $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
+ # Find all property files to be copied and cleaned from source to bin.
+ ifneq (,$$($1_CLEAN)$$($1_CLEAN_FILES))
+ # Search for all files to be copied.
+ $1_ALL_CLEANS := $$(filter $$(addprefix %,$$($1_CLEAN)),$$($1_ALL_SRCS))
+ # Clean these explicitly
+ $1_ALL_CLEANS += $$($1_CLEAN_FILES)
+ # Copy and clean must also respect filters.
+ ifneq (,$$($1_INCLUDE_PATTERN))
+ $1_ALL_CLEANS := $$(filter $$($1_INCLUDE_PATTERN),$$($1_ALL_CLEANS))
+ endif
+ ifneq (,$$($1_EXCLUDE_PATTERN))
+ $1_ALL_CLEANS := $$(filter-out $$($1_EXCLUDE_PATTERN),$$($1_ALL_CLEANS))
+ endif
+ ifneq (,$$($1_ALL_CLEANS))
+ # Yep, there are files to be copied and cleaned!
+ $1_ALL_COPY_CLEAN_TARGETS:=
+ $$(foreach i,$$($1_ALL_CLEANS),$$(eval $$(call add_file_to_clean,$1,$$i)))
+ # Now we can depend on $$($1_ALL_COPY_CLEAN_TARGETS) to copy all files!
+ endif
+ endif
- # Create SJAVAC variable from JAVAC variable. Expects $1_JAVAC to be
- # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
- # and javac is simply replaced with sjavac.
- $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
-
- # Set the $1_REMOTE to spawn a background javac server.
- $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
- $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
+ # Create a sed expression to remove the source roots and to replace / with .
+ # and remove .java at the end.
+ $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
- $1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
+ # Create SJAVAC variable from JAVAC variable. Expects $1_JAVAC to be
+ # "bootclasspathprepend -cp .../javac.jar com.sun.tools.javac.Main"
+ # and javac is simply replaced with sjavac.
+ $1_SJAVAC:=$$(subst com.sun.tools.javac.Main,com.sun.tools.sjavac.Main,$$($1_JAVAC))
- ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
- # Using sjavac to compile.
+ # Set the $1_REMOTE to spawn a background javac server.
+ $1_REMOTE:=--server:portfile=$$($1_SJAVAC_PORTFILE),id=$1,sjavac=$$(subst \
+ $$(SPACE),%20,$$(subst $$(COMMA),%2C,$$(strip $$($1_SERVER_JVM) $$($1_SJAVAC))))
+
+ $1_COMPILE_TARGET := $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_batch
+
+ ifeq ($$($1_DISABLE_SJAVAC)x$$(ENABLE_SJAVAC),xyes)
+ # Using sjavac to compile.
- # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
- # match the absolute path, only the part inside each src dir. Instead -i and
- # -x flags apply only to the next -src arg on the command line.
- $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
- $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
- $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
- $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
- $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
- $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
- $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
- $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
- -src $$(s))
+ # Create the sjavac wrapper command line. Sjavac doesn't handle patterns that
+ # match the absolute path, only the part inside each src dir. Instead -i and
+ # -x flags apply only to the next -src arg on the command line.
+ $1_EXCLUDE_FILES_ABS := $$(filter /%, $$($1_EXCLUDE_FILES)) $$($1_SJAVAC_EXCLUDE_FILES)
+ $1_EXCLUDE_FILES_REL := $$(filter-out /%, $$($1_EXCLUDE_FILES))
+ $1_SJAVAC_ARGS_STRING := $$(foreach s, $$(patsubst %/, %, $$($1_SRC)), \
+ $$(addprefix -x ,$$(addsuffix /**,$$($1_EXCLUDES))) \
+ $$(addprefix -i ,$$(addsuffix /**,$$($1_INCLUDES))) \
+ $$(addprefix -x **,$$(strip $$($1_EXCLUDE_FILES_REL))) \
+ $$(addprefix -i **,$$(strip $$($1_INCLUDE_FILES))) \
+ $$(addprefix -x , $$(strip $$(patsubst $$(s)/%, %, $$(filter $$(s)/%, $$($1_EXCLUDE_FILES_ABS))))) \
+ -src $$(s))
- ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
- $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
- $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
- else
- $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
- endif
+ ifneq ($$(word 20, $$($1_SJAVAC_ARGS_STRING)), )
+ $1_SJAVAC_ARGS_FILE := $$($1_BIN)/_the.$1_args
+ $1_SJAVAC_ARGS := @$$($1_SJAVAC_ARGS_FILE)
+ else
+ $1_SJAVAC_ARGS := $$($1_SJAVAC_ARGS_STRING)
+ endif
- ifneq (,$$($1_HEADERS))
- $1_HEADERS_ARG := -h $$($1_HEADERS)
- endif
+ ifneq (,$$($1_HEADERS))
+ $1_HEADERS_ARG := -h $$($1_HEADERS)
+ endif
- $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
- $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
- $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
- $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
- $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
+ $1_VARDEPS := $$($1_JVM) $$($1_SJAVAC) $$($1_SJAVAC_ARGS_STRING) $$($1_FLAGS) \
+ $$($1_HEADERS_ARG) $$($1_BIN) $$($1_EXCLUDES) $$($1_INCLUDES) \
+ $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
+ $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+ $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
- $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
- $$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
- $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
- ifneq ($$($1_SJAVAC_ARGS_FILE), )
- $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
- endif
- $$(call LogWarn, Compiling $1)
- $$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
- $$($1_JVM) $$($1_SJAVAC) \
- $$($1_REMOTE) \
- -j 1 \
- --permit-unidentified-artifacts \
- --permit-sources-without-package \
- --compare-found-sources $$@.tmp \
- --log=$(LOG_LEVEL) \
- --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
- $$($1_SJAVAC_ARGS) \
- $$($1_FLAGS) \
- $$($1_HEADERS_ARG) \
- -d $$($1_BIN)) && \
- $(MV) $$@.tmp $$@
- # Create a pubapi file that only changes when the pubapi changes. Dependent
- # compilations can use this file to only get recompiled when pubapi has changed.
- # Grep returns 1 if no matching lines are found. Do not fail for this.
- $(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state > $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
- || test "$$$$?" = "1"
- if [ ! -f $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi ] \
- || [ "`$(DIFF) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi \
- $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp`" != "" ]; then \
- $(MV) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
- $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi; \
- fi
+ $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
+ $$(call MakeDir, $$(@D) $$(dir $$($1_SJAVAC_PORTFILE)))
+ $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+ ifneq ($$($1_SJAVAC_ARGS_FILE), )
+ $$(eval $$(call ListPathsSafely,$1_SJAVAC_ARGS_STRING, $$($1_SJAVAC_ARGS_FILE)))
+ endif
+ $$(call LogWarn, Compiling $1)
+ $$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
+ $$($1_JVM) $$($1_SJAVAC) \
+ $$($1_REMOTE) \
+ -j 1 \
+ --permit-unidentified-artifacts \
+ --permit-sources-without-package \
+ --compare-found-sources $$@.tmp \
+ --log=$(LOG_LEVEL) \
+ --state-dir=$$($1_BIN)$$($1_MODULE_SUBDIR) \
+ $$($1_SJAVAC_ARGS) \
+ $$($1_FLAGS) \
+ $$($1_HEADERS_ARG) \
+ -d $$($1_BIN)) && \
+ $(MV) $$@.tmp $$@
+ # Create a pubapi file that only changes when the pubapi changes. Dependent
+ # compilations can use this file to only get recompiled when pubapi has changed.
+ # Grep returns 1 if no matching lines are found. Do not fail for this.
+ $(GREP) -e "^I" $$($1_BIN)$$($1_MODULE_SUBDIR)/javac_state > $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
+ || test "$$$$?" = "1"
+ if [ ! -f $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi ] \
+ || [ "`$(DIFF) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi \
+ $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp`" != "" ]; then \
+ $(MV) $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi.tmp \
+ $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1_pubapi; \
+ fi
- else
- # Using plain javac to batch compile everything.
+ else
+ # Using plain javac to batch compile everything.
- # When building in batch, put headers in a temp dir to filter out those that actually
- # changed before copying them to the real header dir.
- ifneq (,$$($1_HEADERS))
- $1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
+ # When building in batch, put headers in a temp dir to filter out those that actually
+ # changed before copying them to the real header dir.
+ ifneq (,$$($1_HEADERS))
+ $1_HEADERS_ARG := -h $$($1_HEADERS).$1.tmp
- $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
+ $$($1_HEADERS)/_the.$1_headers: $$($1_COMPILE_TARGET)
$(MKDIR) -p $$(@D)
if [ -d "$$($1_HEADERS).$1.tmp" ]; then \
for f in `$(CD) $$($1_HEADERS).$1.tmp && $(FIND) . -type f`; do \
@@ -399,78 +403,79 @@
$(RM) -r $$($1_HEADERS).$1.tmp
$(TOUCH) $$@
- $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
- endif
+ $1_HEADER_TARGETS := $$($1_HEADERS)/_the.$1_headers
+ endif
+
+ $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
+ $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
+ $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
+ $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
+ $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
- $1_VARDEPS := $$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) $$($1_BIN) \
- $$($1_HEADERS_ARG) $$($1_EXCLUDES) $$($1_INCLUDES) \
- $$($1_EXCLUDE_FILES) $$($1_INCLUDE_FILES)
- $1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
- $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$1.vardeps)
+ ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
+ $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
+ else
+ $1_JAVAC_CMD := $$($1_JAVAC)
+ endif
- ifeq ($$($1_DISABLE_SJAVAC)x$(ENABLE_JAVAC_SERVER), xyes)
- $1_JAVAC_CMD := $$($1_SJAVAC) $$($1_REMOTE)
- else
- $1_JAVAC_CMD := $$($1_JAVAC)
+ # When not using sjavac, pass along all sources to javac using an @file.
+ $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
+ $$(call MakeDir, $$(@D))
+ $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
+ $$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
+ $$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
+ $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
+ -implicit:none \
+ -d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
+ $(MV) $$@.tmp $$@
endif
- # When not using sjavac, pass along all sources to javac using an @file.
- $$($1_COMPILE_TARGET): $$($1_SRCS) $$($1_DEPENDS) $$($1_VARDEPS_FILE)
- $$(call MakeDir, $$(@D))
- $$(eval $$(call ListPathsSafely,$1_SRCS, $$@.tmp))
- $$(call LogWarn, Compiling $$(words $$($1_SRCS)) files for $1)
- $$(call ExecuteWithLog, $$($1_BIN)$$($1_MODULE_SUBDIR)/_the.$$($1_SAFE_NAME)_batch, \
- $$($1_JVM) $$($1_JAVAC_CMD) $$($1_FLAGS) \
- -implicit:none \
- -d $$($1_BIN) $$($1_HEADERS_ARG) @$$@.tmp) && \
- $(MV) $$@.tmp $$@
- endif
+ # Add all targets to main variable
+ $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
+ $$($1_HEADER_TARGETS)
+
+ # Check if a jar file was specified, then setup the rules for the jar.
+ ifneq (,$$($1_JAR))
+ # If no suffixes was explicitly set for this jar file.
+ # Use class and the cleaned/copied properties file suffixes as the default
+ # for the types of files to be put into the jar.
+ ifeq (,$$($1_SUFFIXES))
+ $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
+ endif
- # Add all targets to main variable
- $1 := $$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS) $$($1_COMPILE_TARGET) \
- $$($1_HEADER_TARGETS)
+ $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
+ DEPENDENCIES:=$$($1), \
+ SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
+ SUFFIXES:=$$($1_SUFFIXES), \
+ EXCLUDE:=$$($1_EXCLUDES), \
+ INCLUDES:=$$($1_INCLUDES), \
+ EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS), \
+ JAR:=$$($1_JAR), \
+ JARMAIN:=$$($1_JARMAIN), \
+ MANIFEST:=$$($1_MANIFEST), \
+ EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR), \
+ JARINDEX:=$$($1_JARINDEX), \
+ HEADERS:=$$($1_HEADERS), \
+ SETUP:=$$($1_SETUP), \
+ ))
- # Check if a jar file was specified, then setup the rules for the jar.
- ifneq (,$$($1_JAR))
- # If no suffixes was explicitly set for this jar file.
- # Use class and the cleaned/copied properties file suffixes as the default
- # for the types of files to be put into the jar.
- ifeq (,$$($1_SUFFIXES))
- $1_SUFFIXES:=.class $$($1_CLEAN) $$($1_COPY)
+ # Add jar to target list
+ $1 += $$($1_JAR)
endif
- $$(eval $$(call SetupJarArchive, ARCHIVE_$1, \
- DEPENDENCIES:=$$($1), \
- SRCS:=$$($1_BIN)$$($1_MODULE_SUBDIR), \
- SUFFIXES:=$$($1_SUFFIXES), \
- EXCLUDE:=$$($1_EXCLUDES), \
- INCLUDES:=$$($1_INCLUDES), \
- EXTRA_FILES:=$$($1_ALL_COPY_TARGETS) $$($1_ALL_COPY_CLEAN_TARGETS), \
- JAR:=$$($1_JAR), \
- JARMAIN:=$$($1_JARMAIN), \
- MANIFEST:=$$($1_MANIFEST), \
- EXTRA_MANIFEST_ATTR:=$$($1_EXTRA_MANIFEST_ATTR), \
- JARINDEX:=$$($1_JARINDEX), \
- HEADERS:=$$($1_HEADERS), \
- SETUP:=$$($1_SETUP), \
- ))
+ # Check if a srczip was specified, then setup the rules for the srczip.
+ ifneq (,$$($1_SRCZIP))
+ $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \
+ SRC:=$$($1_SRC), \
+ ZIP:=$$($1_SRCZIP), \
+ INCLUDES:=$$($1_INCLUDES), \
+ EXCLUDES:=$$($1_EXCLUDES), \
+ EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
- # Add jar to target list
- $1 += $$($1_JAR)
- endif
-
- # Check if a srczip was specified, then setup the rules for the srczip.
- ifneq (,$$($1_SRCZIP))
- $$(eval $$(call SetupZipArchive, ZIP_ARCHIVE_$1, \
- SRC:=$$($1_SRC), \
- ZIP:=$$($1_SRCZIP), \
- INCLUDES:=$$($1_INCLUDES), \
- EXCLUDES:=$$($1_EXCLUDES), \
- EXCLUDE_FILES:=$$($1_EXCLUDE_FILES)))
-
- # Add zip to target list
- $1 += $$($1_SRCZIP)
- endif
+ # Add zip to target list
+ $1 += $$($1_SRCZIP)
+ endif
+ endif # Source files found
endef
# Use this macro to find the correct target to depend on when the original
--- a/nashorn/.hgtags Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/.hgtags Tue Jun 14 10:22:07 2016 -0700
@@ -355,3 +355,4 @@
621ad507bf9b07e7c6da2150aa619fe7e78ec5a0 jdk-9+119
7ab7fc00b147e5b50d6bd5516147680f11c0b165 jdk-9+120
5992041b0794fa5f25518673d63e8f35bcc89360 jdk-9+121
+b1de131a3fed6845c78bdda358ee127532f16a3f jdk-9+122
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Tue Jun 14 10:22:07 2016 -0700
@@ -59,7 +59,8 @@
in.setHandleUserInterrupt(true);
in.setBellEnabled(true);
in.setCopyPasteDetection(true);
- in.setHistory(new EditingHistory(in, Files.readAllLines(historyFile.toPath())) {
+ final Iterable<String> existingHistory = historyFile.exists() ? Files.readAllLines(historyFile.toPath()) : null;
+ in.setHistory(new EditingHistory(in, existingHistory) {
@Override protected boolean isComplete(CharSequence input) {
return completer.isComplete(input.toString());
}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Tue Jun 14 10:22:07 2016 -0700
@@ -117,7 +117,7 @@
final PrintWriter err = context.getErr();
final Global oldGlobal = Context.getGlobal();
final boolean globalChanged = (oldGlobal != global);
- final PropertiesHelper propsHelper = new PropertiesHelper(env._classpath);
+ final PropertiesHelper propsHelper = new PropertiesHelper(context);
final NashornCompleter completer = new NashornCompleter(context, global, this, propsHelper);
try (final Console in = new Console(System.in, System.out, HIST_FILE, completer,
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PackagesHelper.java Tue Jun 14 10:22:07 2016 -0700
@@ -25,6 +25,7 @@
package jdk.nashorn.tools.jjs;
+import java.lang.reflect.Modifier;
import java.io.IOException;
import java.io.File;
import java.net.URI;
@@ -49,6 +50,7 @@
import javax.tools.StandardJavaFileManager;
import javax.tools.StandardLocation;
import javax.tools.ToolProvider;
+import jdk.nashorn.internal.runtime.Context;
/**
* A helper class to compute properties of a Java package object. Properties of
@@ -72,6 +74,7 @@
return compiler != null;
}
+ private final Context context;
private final StandardJavaFileManager fm;
private final Set<JavaFileObject.Kind> fileKinds;
private final FileSystem jrtfs;
@@ -79,9 +82,11 @@
/**
* Construct a new PackagesHelper.
*
- * @param classPath Class path to compute properties of java package objects
+ * @param context the current Nashorn Context
*/
- PackagesHelper(final String classPath) throws IOException {
+ PackagesHelper(final Context context) throws IOException {
+ this.context = context;
+ final String classPath = context.getEnv()._classpath;
if (isJavacAvailable()) {
fm = compiler.getStandardFileManager(null, null, null);
fileKinds = EnumSet.of(JavaFileObject.Kind.CLASS);
@@ -166,8 +171,11 @@
String str = p.getFileName().toString();
// get rid of ".class", if any
if (str.endsWith(".class")) {
- props.add(str.substring(0, str.length() - ".class".length()));
- } else {
+ final String clsName = str.substring(0, str.length() - ".class".length());
+ if (clsName.indexOf('$') == -1 && isClassAccessible(pkg + "." + clsName)) {
+ props.add(str);
+ }
+ } else if (isPackageAccessible(pkg + "." + str)) {
props.add(str);
}
}
@@ -193,7 +201,10 @@
if (nextDot != -1) {
// subpackage - eg. "regex" for "java.util"
- props.add(binaryName.substring(start, nextDot));
+ final String pkgName = binaryName.substring(start, nextDot);
+ if (isPackageAccessible(binaryName.substring(0, nextDot))) {
+ props.add(binaryName.substring(start, nextDot));
+ }
} else {
// class - filter out nested, inner, anonymous, local classes.
// Dynalink supported public nested classes as properties of
@@ -201,7 +212,7 @@
// "$" internal names as properties of package object.
final String clsName = binaryName.substring(start);
- if (clsName.indexOf('$') == -1) {
+ if (clsName.indexOf('$') == -1 && isClassAccessible(binaryName)) {
props.add(clsName);
}
}
@@ -214,4 +225,22 @@
.map(File::new)
.collect(Collectors.toList());
}
+
+ private boolean isClassAccessible(final String className) {
+ try {
+ final Class<?> clz = context.findClass(className);
+ return Modifier.isPublic(clz.getModifiers());
+ } catch (final ClassNotFoundException cnfe) {
+ }
+ return false;
+ }
+
+ private boolean isPackageAccessible(final String pkgName) {
+ try {
+ Context.checkPackageAccess(pkgName);
+ return true;
+ } catch (final SecurityException se) {
+ return false;
+ }
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PropertiesHelper.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/PropertiesHelper.java Tue Jun 14 10:22:07 2016 -0700
@@ -33,6 +33,7 @@
import java.util.WeakHashMap;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.NativeJavaPackage;
import jdk.nashorn.internal.runtime.PropertyMap;
@@ -52,11 +53,11 @@
/**
* Construct a new PropertiesHelper.
*
- * @param classPath Class path to compute properties of java package objects
+ * @param context the current nashorn Context
*/
- PropertiesHelper(final String classPath) {
+ PropertiesHelper(final Context context) {
try {
- this.pkgsHelper = new PackagesHelper(classPath);
+ this.pkgsHelper = new PackagesHelper(context);
} catch (final IOException exp) {
if (Main.DEBUG) {
exp.printStackTrace();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Module.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Module.java Tue Jun 14 10:22:07 2016 -0700
@@ -47,45 +47,48 @@
* @see <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-source-text-module-records">es6 modules</a>
*/
public static final class ExportEntry {
- private final String exportName;
- private final String moduleRequest;
- private final String importName;
- private final String localName;
+ private final IdentNode exportName;
+ private final IdentNode moduleRequest;
+ private final IdentNode importName;
+ private final IdentNode localName;
- private ExportEntry(final String exportName, final String moduleRequest, final String importName, final String localName) {
+ private final int startPosition;
+ private final int endPosition;
+
+ private ExportEntry(final IdentNode exportName, final IdentNode moduleRequest, final IdentNode importName,
+ final IdentNode localName, final int startPosition, final int endPosition) {
this.exportName = exportName;
this.moduleRequest = moduleRequest;
this.importName = importName;
this.localName = localName;
+ this.startPosition = startPosition;
+ this.endPosition = endPosition;
}
/**
* Creates a {@code export *} export entry.
*
+ * @param starName the star name
* @param moduleRequest the module request
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the export entry
*/
- public static ExportEntry exportStarFrom(final String moduleRequest) {
- return new ExportEntry(null, moduleRequest, STAR_NAME, null);
- }
-
- /**
- * Creates a {@code export default} export entry.
- *
- * @return the export entry
- */
- public static ExportEntry exportDefault() {
- return exportDefault(DEFAULT_EXPORT_BINDING_NAME);
+ public static ExportEntry exportStarFrom(final IdentNode starName, final IdentNode moduleRequest, final int startPosition, final int endPosition) {
+ return new ExportEntry(null, moduleRequest, starName, null, startPosition, endPosition);
}
/**
* Creates a {@code export default} export entry with a local name.
*
+ * @param defaultName the default name
* @param localName the local name
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the export entry
*/
- public static ExportEntry exportDefault(final String localName) {
- return new ExportEntry(DEFAULT_NAME, null, null, localName);
+ public static ExportEntry exportDefault(final IdentNode defaultName, final IdentNode localName, final int startPosition, final int endPosition) {
+ return new ExportEntry(defaultName, null, null, localName, startPosition, endPosition);
}
/**
@@ -93,30 +96,37 @@
*
* @param exportName the export name
* @param localName the local name
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the export entry
*/
- public static ExportEntry exportSpecifier(final String exportName, final String localName) {
- return new ExportEntry(exportName, null, null, localName);
+ public static ExportEntry exportSpecifier(final IdentNode exportName, final IdentNode localName, final int startPosition, final int endPosition) {
+ return new ExportEntry(exportName, null, null, localName, startPosition, endPosition);
}
+
/**
* Creates a export entry with an export name.
*
* @param exportName the export name
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the export entry
*/
- public static ExportEntry exportSpecifier(final String exportName) {
- return exportSpecifier(exportName, exportName);
+ public static ExportEntry exportSpecifier(final IdentNode exportName, final int startPosition, final int endPosition) {
+ return exportSpecifier(exportName, exportName, startPosition, endPosition);
}
/**
* Create a copy of this entry with the specified {@code module request} string.
*
* @param moduleRequest the module request
+ * @param endPosition the new endPosition
* @return the new export entry
*/
- public ExportEntry withFrom(@SuppressWarnings("hiding") final String moduleRequest) {
- return new ExportEntry(exportName, moduleRequest, localName, null);
+ public ExportEntry withFrom(@SuppressWarnings("hiding") final IdentNode moduleRequest, final int endPosition) {
+ // Note that "from" moves localName to inputName, and localName becomes null
+ return new ExportEntry(exportName, moduleRequest, localName, null, startPosition, endPosition);
}
/**
@@ -124,7 +134,7 @@
*
* @return the export name
*/
- public String getExportName() {
+ public IdentNode getExportName() {
return exportName;
}
@@ -133,7 +143,7 @@
*
* @return the module request
*/
- public String getModuleRequest() {
+ public IdentNode getModuleRequest() {
return moduleRequest;
}
@@ -142,7 +152,7 @@
*
* @return the import name
*/
- public String getImportName() {
+ public IdentNode getImportName() {
return importName;
}
@@ -151,10 +161,28 @@
*
* @return the local name
*/
- public String getLocalName() {
+ public IdentNode getLocalName() {
return localName;
}
+ /**
+ * Returns the entry's start position.
+ *
+ * @return the start position
+ */
+ public int getStartPosition() {
+ return startPosition;
+ }
+
+ /**
+ * Returns the entry's end position.
+ *
+ * @return the end position
+ */
+ public int getEndPosition() {
+ return endPosition;
+ }
+
@Override
public String toString() {
return "ExportEntry [exportName=" + exportName + ", moduleRequest=" + moduleRequest + ", importName=" + importName + ", localName=" + localName + "]";
@@ -167,34 +195,20 @@
* @see <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-source-text-module-records">es6 modules</a>
*/
public static final class ImportEntry {
- private final String moduleRequest;
- private final String importName;
- private final String localName;
+ private final IdentNode moduleRequest;
+ private final IdentNode importName;
+ private final IdentNode localName;
- private ImportEntry(final String moduleRequest, final String importName, final String localName) {
+ private final int startPosition;
+ private final int endPosition;
+
+ private ImportEntry(final IdentNode moduleRequest, final IdentNode importName, final IdentNode localName,
+ final int startPosition, final int endPosition) {
this.moduleRequest = moduleRequest;
this.importName = importName;
this.localName = localName;
- }
-
- /**
- * Creates an import entry with default name.
- *
- * @param localName the local name
- * @return the import entry
- */
- public static ImportEntry importDefault(final String localName) {
- return new ImportEntry(null, DEFAULT_NAME, localName);
- }
-
- /**
- * Creates an import entry with {@code *} import name.
- *
- * @param localName the local name
- * @return the import entry
- */
- public static ImportEntry importStarAsNameSpaceFrom(final String localName) {
- return new ImportEntry(null, STAR_NAME, localName);
+ this.startPosition = startPosition;
+ this.endPosition = endPosition;
}
/**
@@ -202,30 +216,35 @@
*
* @param importName the import name
* @param localName the local name
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the import entry
*/
- public static ImportEntry importSpecifier(final String importName, final String localName) {
- return new ImportEntry(null, importName, localName);
+ public static ImportEntry importSpecifier(final IdentNode importName, final IdentNode localName, final int startPosition, final int endPosition) {
+ return new ImportEntry(null, importName, localName, startPosition, endPosition);
}
/**
* Creates a new import entry with the given import name.
*
* @param importName the import name
+ * @param startPosition the start position
+ * @param endPosition the end position
* @return the import entry
*/
- public static ImportEntry importSpecifier(final String importName) {
- return importSpecifier(importName, importName);
+ public static ImportEntry importSpecifier(final IdentNode importName, final int startPosition, final int endPosition) {
+ return importSpecifier(importName, importName, startPosition, endPosition);
}
/**
- * Returns a copy of this import entry with the given module request.
+ * Returns a copy of this import entry with the given module request and end position.
*
* @param moduleRequest the module request
+ * @param endPosition the new end position
* @return the new import entry
*/
- public ImportEntry withFrom(@SuppressWarnings("hiding") final String moduleRequest) {
- return new ImportEntry(moduleRequest, importName, localName);
+ public ImportEntry withFrom(@SuppressWarnings("hiding") final IdentNode moduleRequest, final int endPosition) {
+ return new ImportEntry(moduleRequest, importName, localName, startPosition, endPosition);
}
/**
@@ -233,7 +252,7 @@
*
* @return the module request
*/
- public String getModuleRequest() {
+ public IdentNode getModuleRequest() {
return moduleRequest;
}
@@ -242,7 +261,7 @@
*
* @return the import name
*/
- public String getImportName() {
+ public IdentNode getImportName() {
return importName;
}
@@ -251,10 +270,28 @@
*
* @return the local name
*/
- public String getLocalName() {
+ public IdentNode getLocalName() {
return localName;
}
+ /**
+ * Returns the entry's start position.
+ *
+ * @return the start position
+ */
+ public int getStartPosition() {
+ return startPosition;
+ }
+
+ /**
+ * Returns the entry's end position.
+ *
+ * @return the end position
+ */
+ public int getEndPosition() {
+ return endPosition;
+ }
+
@Override
public String toString() {
return "ImportEntry [moduleRequest=" + moduleRequest + ", importName=" + importName + ", localName=" + localName + "]";
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Tue Jun 14 10:22:07 2016 -0700
@@ -5138,32 +5138,33 @@
* BindingIdentifier
*/
private void importDeclaration() {
+ final int startPosition = start;
expect(IMPORT);
final ParserContextModuleNode module = lc.getCurrentModule();
if (type == STRING || type == ESCSTRING) {
// import ModuleSpecifier ;
- final String moduleSpecifier = (String) getValue();
+ final IdentNode moduleSpecifier = createIdentNode(token, finish, (String) getValue());
next();
module.addModuleRequest(moduleSpecifier);
} else {
// import ImportClause FromClause ;
List<Module.ImportEntry> importEntries;
if (type == MUL) {
- importEntries = Collections.singletonList(nameSpaceImport());
+ importEntries = Collections.singletonList(nameSpaceImport(startPosition));
} else if (type == LBRACE) {
- importEntries = namedImports();
+ importEntries = namedImports(startPosition);
} else if (isBindingIdentifier()) {
// ImportedDefaultBinding
final IdentNode importedDefaultBinding = bindingIdentifier("ImportedBinding");
- Module.ImportEntry defaultImport = Module.ImportEntry.importDefault(importedDefaultBinding.getName());
+ Module.ImportEntry defaultImport = Module.ImportEntry.importSpecifier(importedDefaultBinding, startPosition, finish);
if (type == COMMARIGHT) {
next();
importEntries = new ArrayList<>();
if (type == MUL) {
- importEntries.add(nameSpaceImport());
+ importEntries.add(nameSpaceImport(startPosition));
} else if (type == LBRACE) {
- importEntries.addAll(namedImports());
+ importEntries.addAll(namedImports(startPosition));
} else {
throw error(AbstractParser.message("expected.named.import"));
}
@@ -5174,10 +5175,10 @@
throw error(AbstractParser.message("expected.import"));
}
- final String moduleSpecifier = fromClause();
+ final IdentNode moduleSpecifier = fromClause();
module.addModuleRequest(moduleSpecifier);
for (int i = 0; i < importEntries.size(); i++) {
- module.addImportEntry(importEntries.get(i).withFrom(moduleSpecifier));
+ module.addImportEntry(importEntries.get(i).withFrom(moduleSpecifier, finish));
}
}
expect(SEMICOLON);
@@ -5187,10 +5188,12 @@
* NameSpaceImport :
* * as ImportedBinding
*
+ * @param startPosition the start of the import declaration
* @return imported binding identifier
*/
- private Module.ImportEntry nameSpaceImport() {
+ private Module.ImportEntry nameSpaceImport(final int startPosition) {
assert type == MUL;
+ final IdentNode starName = createIdentNode(Token.recast(token, IDENT), finish, Module.STAR_NAME);
next();
final long asToken = token;
final String as = (String) expectValue(IDENT);
@@ -5198,7 +5201,7 @@
throw error(AbstractParser.message("expected.as"), asToken);
}
final IdentNode localNameSpace = bindingIdentifier("ImportedBinding");
- return Module.ImportEntry.importStarAsNameSpaceFrom(localNameSpace.getName());
+ return Module.ImportEntry.importSpecifier(starName, localNameSpace, startPosition, finish);
}
/**
@@ -5215,7 +5218,7 @@
* ImportedBinding :
* BindingIdentifier
*/
- private List<Module.ImportEntry> namedImports() {
+ private List<Module.ImportEntry> namedImports(final int startPosition) {
assert type == LBRACE;
next();
List<Module.ImportEntry> importEntries = new ArrayList<>();
@@ -5226,11 +5229,11 @@
if (type == IDENT && "as".equals(getValue())) {
next();
final IdentNode localName = bindingIdentifier("ImportedBinding");
- importEntries.add(Module.ImportEntry.importSpecifier(importName.getName(), localName.getName()));
+ importEntries.add(Module.ImportEntry.importSpecifier(importName, localName, startPosition, finish));
} else if (!bindingIdentifier) {
throw error(AbstractParser.message("expected.binding.identifier"), nameToken);
} else {
- importEntries.add(Module.ImportEntry.importSpecifier(importName.getName()));
+ importEntries.add(Module.ImportEntry.importSpecifier(importName, startPosition, finish));
}
if (type == COMMARIGHT) {
next();
@@ -5246,14 +5249,14 @@
* FromClause :
* from ModuleSpecifier
*/
- private String fromClause() {
+ private IdentNode fromClause() {
final long fromToken = token;
final String name = (String) expectValue(IDENT);
if (!"from".equals(name)) {
throw error(AbstractParser.message("expected.from"), fromToken);
}
if (type == STRING || type == ESCSTRING) {
- final String moduleSpecifier = (String) getValue();
+ final IdentNode moduleSpecifier = createIdentNode(Token.recast(token, IDENT), finish, (String) getValue());
next();
return moduleSpecifier;
} else {
@@ -5276,23 +5279,25 @@
*/
private void exportDeclaration() {
expect(EXPORT);
+ final int startPosition = start;
final ParserContextModuleNode module = lc.getCurrentModule();
switch (type) {
case MUL: {
+ final IdentNode starName = createIdentNode(Token.recast(token, IDENT), finish, Module.STAR_NAME);
next();
- final String moduleRequest = fromClause();
+ final IdentNode moduleRequest = fromClause();
expect(SEMICOLON);
module.addModuleRequest(moduleRequest);
- module.addStarExportEntry(Module.ExportEntry.exportStarFrom(moduleRequest));
+ module.addStarExportEntry(Module.ExportEntry.exportStarFrom(starName, moduleRequest, startPosition, finish));
break;
}
case LBRACE: {
- final List<Module.ExportEntry> exportEntries = exportClause();
+ final List<Module.ExportEntry> exportEntries = exportClause(startPosition);
if (type == IDENT && "from".equals(getValue())) {
- final String moduleRequest = fromClause();
+ final IdentNode moduleRequest = fromClause();
module.addModuleRequest(moduleRequest);
for (Module.ExportEntry exportEntry : exportEntries) {
- module.addIndirectExportEntry(exportEntry.withFrom(moduleRequest));
+ module.addIndirectExportEntry(exportEntry.withFrom(moduleRequest, finish));
}
} else {
for (Module.ExportEntry exportEntry : exportEntries) {
@@ -5303,6 +5308,7 @@
break;
}
case DEFAULT:
+ final IdentNode defaultName = createIdentNode(Token.recast(token, IDENT), finish, Module.DEFAULT_NAME);
next();
final Expression assignmentExpression;
IdentNode ident;
@@ -5327,14 +5333,14 @@
break;
}
if (ident != null) {
- module.addLocalExportEntry(Module.ExportEntry.exportDefault(ident.getName()));
+ module.addLocalExportEntry(Module.ExportEntry.exportDefault(defaultName, ident, startPosition, finish));
} else {
ident = createIdentNode(Token.recast(rhsToken, IDENT), finish, Module.DEFAULT_EXPORT_BINDING_NAME);
lc.appendStatementToCurrentNode(new VarNode(lineNumber, Token.recast(rhsToken, LET), finish, ident, assignmentExpression));
if (!declaration) {
expect(SEMICOLON);
}
- module.addLocalExportEntry(Module.ExportEntry.exportDefault());
+ module.addLocalExportEntry(Module.ExportEntry.exportDefault(defaultName, ident, startPosition, finish));
}
break;
case VAR:
@@ -5345,18 +5351,18 @@
variableStatement(type);
for (final Statement statement : statements.subList(previousEnd, statements.size())) {
if (statement instanceof VarNode) {
- module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(((VarNode) statement).getName().getName()));
+ module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(((VarNode) statement).getName(), startPosition, finish));
}
}
break;
case CLASS: {
final ClassNode classDeclaration = classDeclaration(false);
- module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(classDeclaration.getIdent().getName()));
+ module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(classDeclaration.getIdent(), startPosition, finish));
break;
}
case FUNCTION: {
final FunctionNode functionDeclaration = (FunctionNode) functionExpression(true, true);
- module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(functionDeclaration.getIdent().getName()));
+ module.addLocalExportEntry(Module.ExportEntry.exportSpecifier(functionDeclaration.getIdent(), startPosition, finish));
break;
}
default:
@@ -5378,7 +5384,7 @@
*
* @return a list of ExportSpecifiers
*/
- private List<Module.ExportEntry> exportClause() {
+ private List<Module.ExportEntry> exportClause(final int startPosition) {
assert type == LBRACE;
next();
List<Module.ExportEntry> exports = new ArrayList<>();
@@ -5387,9 +5393,9 @@
if (type == IDENT && "as".equals(getValue())) {
next();
final IdentNode exportName = getIdentifierName();
- exports.add(Module.ExportEntry.exportSpecifier(exportName.getName(), localName.getName()));
+ exports.add(Module.ExportEntry.exportSpecifier(exportName, localName, startPosition, finish));
} else {
- exports.add(Module.ExportEntry.exportSpecifier(localName.getName()));
+ exports.add(Module.ExportEntry.exportSpecifier(localName, startPosition, finish));
}
if (type == COMMARIGHT) {
next();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextModuleNode.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextModuleNode.java Tue Jun 14 10:22:07 2016 -0700
@@ -28,6 +28,7 @@
import java.util.ArrayList;
import java.util.List;
+import jdk.nashorn.internal.ir.IdentNode;
import jdk.nashorn.internal.ir.Module;
import jdk.nashorn.internal.ir.Module.ExportEntry;
import jdk.nashorn.internal.ir.Module.ImportEntry;
@@ -64,8 +65,8 @@
return name;
}
- public void addModuleRequest(final String moduleRequest) {
- requestedModules.add(moduleRequest);
+ public void addModuleRequest(final IdentNode moduleRequest) {
+ requestedModules.add(moduleRequest.getName());
}
public void addImportEntry(final ImportEntry importEntry) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Fri Jun 10 15:13:40 2016 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java Tue Jun 14 10:22:07 2016 -0700
@@ -286,7 +286,7 @@
superClassName = Type.getInternalName(superClass);
generatedClassName = getGeneratedClassName(superClass, interfaces);
- cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
+ cw.visit(Opcodes.V1_8, ACC_PUBLIC | ACC_SUPER, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
generateField(GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
generateField(DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
@@ -1031,7 +1031,9 @@
if (!constructor && Modifier.isInterface(owner.getModifiers())) {
// we should call default method on the immediate "super" type - not on (possibly)
// the indirectly inherited interface class!
- mv.invokespecial(Type.getInternalName(findInvokespecialOwnerFor(owner)), name, methodDesc, false);
+ final Class<?> superType = findInvokespecialOwnerFor(owner);
+ mv.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(superType), name, methodDesc,
+ Modifier.isInterface(superType.getModifiers()));
} else {
mv.invokespecial(superClassName, name, methodDesc, false);
}