This commit is contained in:
J. Duke 2017-07-05 22:53:30 +02:00
commit 034b02e7cc
899 changed files with 23585 additions and 12883 deletions

View File

@ -399,3 +399,5 @@ d7034ff7f8e257e81c9f95c7785dd4eaaa3c2afc jdk-9+153
8c70d170e62c0c58b5bc3ba666bd140399b98c9c jdk-10+0
45b751afd11e6c05991cf4913c5a0ac3304fcc4e jdk-9+154
f4aff695ffe05cfdb69d8af25a4ddc6a029754ea jdk-9+155
06bce0388880b5ff8e040e4a9d72a3ea11dac321 jdk-9+156
fa3e76b477829afc4476f0b725cfaa440a6fd917 jdk-9+157

View File

@ -398,3 +398,5 @@ ef056360ddf3977d7d2ddbeb456a4d612d19ea05 jdk-9+152
816a6d03a7c44edfbd8780110529f1bdc3964fb9 jdk-9+153
8d26916eaa21b689835ffc1c0dbf12470aa9be61 jdk-9+154
688a3863c00ebc089ab17ee1fc46272cbbd96815 jdk-9+155
783ec7542cf7154e5d2b87f55bb97d28f81e9ada jdk-9+156
4eb77fb98952dc477a4229575c81d2263a9ce711 jdk-9+157

View File

@ -1202,6 +1202,18 @@ AC_DEFUN_ONCE([BASIC_TEST_USABILITY_ISSUES],
# Check for support for specific options in bash
AC_DEFUN_ONCE([BASIC_CHECK_BASH_OPTIONS],
[
# Check bash version
# Extra [ ] to stop m4 mangling
[ BASH_VER=`$BASH --version | $SED -n -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'` ]
AC_MSG_CHECKING([bash version])
AC_MSG_RESULT([$BASH_VER])
BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1`
BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2`
if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then
AC_MSG_ERROR([bash version 3.2 or better is required])
fi
# Test if bash supports pipefail.
AC_MSG_CHECKING([if bash supports pipefail])
if ${BASH} -c 'set -o pipefail'; then

View File

@ -5170,7 +5170,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1486175373
DATE_WHEN_GENERATED=1486679715
###############################################################################
#
@ -24092,6 +24092,20 @@ $as_echo "$tool_specified" >&6; }
fi
# Check bash version
# Extra [ ] to stop m4 mangling
BASH_VER=`$BASH --version | $SED -n -e 's/^.*bash.*ersion *\([0-9.]*\).*$/\1/ p'`
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking bash version" >&5
$as_echo_n "checking bash version... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $BASH_VER" >&5
$as_echo "$BASH_VER" >&6; }
BASH_MAJOR=`$ECHO $BASH_VER | $CUT -d . -f 1`
BASH_MINOR=`$ECHO $BASH_VER | $CUT -d . -f 2`
if test $BASH_MAJOR -lt 3 || (test $BASH_MAJOR -eq 3 && test $BASH_MINOR -lt 2); then
as_fn_error $? "bash version 3.2 or better is required" "$LINENO" 5
fi
# Test if bash supports pipefail.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if bash supports pipefail" >&5
$as_echo_n "checking if bash supports pipefail... " >&6; }

View File

@ -361,8 +361,8 @@ jdk/src/java.base/share/native/libverify/check_code.c : jdk/src/share/native/com
jdk/src/java.base/share/native/libverify/check_format.c : jdk/src/share/native/common/check_format.c
jdk/src/java.base/share/native/libverify/opcodes.in_out : jdk/src/share/native/common/opcodes.in_out
jdk/src/java.base/share/native/libzip : jdk/src/share/native/java/util/zip
jdk/src/java.base/share/native/libzip/zlib-1.2.8 : jdk/src/share/native/java/util/zip/zlib-1.2.8
jdk/src/java.base/share/native/libzip/zlib-1.2.8/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib-1.2.8/patches/ChangeLog_java
jdk/src/java.base/share/native/libzip/zlib : jdk/src/share/native/java/util/zip/zlib
jdk/src/java.base/share/native/libzip/zlib/patches/ChangeLog_java : jdk/src/share/native/java/util/zip/zlib/patches/ChangeLog_java
jdk/src/java.base/unix/classes/java/io : jdk/src/solaris/classes/java/io
jdk/src/java.base/unix/classes/java/lang : jdk/src/solaris/classes/java/lang
jdk/src/java.base/unix/classes/java/net : jdk/src/solaris/classes/java/net

View File

@ -1223,7 +1223,7 @@
<in>check_format.c</in>
</df>
<df name="libzip">
<df name="zlib-1.2.8">
<df name="zlib">
<in>compress.c</in>
<in>deflate.c</in>
<in>gzclose.c</in>
@ -38283,7 +38283,7 @@
<pElem>../../jdk/src/java.base/unix/native/include</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../build/support/headers/java.base</pElem>
<pElem>../../make</pElem>
</incDir>
@ -38304,7 +38304,7 @@
<pElem>../../jdk/src/java.base/unix/native/include</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../build/support/headers/java.base</pElem>
<pElem>../../make</pElem>
</incDir>
@ -38325,7 +38325,7 @@
<pElem>../../jdk/src/java.base/unix/native/include</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../build/support/headers/java.base</pElem>
<pElem>../../make</pElem>
</incDir>
@ -38346,7 +38346,7 @@
<pElem>../../jdk/src/java.base/unix/native/include</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../build/support/headers/java.base</pElem>
<pElem>../../make</pElem>
</incDir>
@ -38367,7 +38367,7 @@
<pElem>../../jdk/src/java.base/unix/native/include</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../build/support/headers/java.base</pElem>
<pElem>../../make</pElem>
</incDir>
@ -38377,14 +38377,14 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/compress.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/compress.c"
ex="false"
tool="0"
flavor2="0">
<cTool flags="4">
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/deflate.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/deflate.c"
ex="false"
tool="0"
flavor2="0">
@ -38394,7 +38394,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzclose.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/gzclose.c"
ex="false"
tool="0"
flavor2="0">
@ -38404,7 +38404,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzlib.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/gzlib.c"
ex="false"
tool="0"
flavor2="0">
@ -38414,7 +38414,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzread.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/gzread.c"
ex="false"
tool="0"
flavor2="0">
@ -38424,7 +38424,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/gzwrite.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/gzwrite.c"
ex="false"
tool="0"
flavor2="0">
@ -38434,7 +38434,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/infback.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/infback.c"
ex="false"
tool="0"
flavor2="0">
@ -38444,7 +38444,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inffast.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/inffast.c"
ex="false"
tool="0"
flavor2="0">
@ -38454,7 +38454,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inflate.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/inflate.c"
ex="false"
tool="0"
flavor2="0">
@ -38464,7 +38464,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/inftrees.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/inftrees.c"
ex="false"
tool="0"
flavor2="0">
@ -38474,7 +38474,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/trees.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/trees.c"
ex="false"
tool="0"
flavor2="0">
@ -38484,7 +38484,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/uncompr.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/uncompr.c"
ex="false"
tool="0"
flavor2="0">
@ -38494,7 +38494,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zadler32.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/zadler32.c"
ex="false"
tool="0"
flavor2="0">
@ -38504,7 +38504,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zcrc32.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/zcrc32.c"
ex="false"
tool="0"
flavor2="0">
@ -38514,7 +38514,7 @@
</preprocessorList>
</cTool>
</item>
<item path="../../jdk/src/java.base/share/native/libzip/zlib-1.2.8/zutil.c"
<item path="../../jdk/src/java.base/share/native/libzip/zlib/zutil.c"
ex="false"
tool="0"
flavor2="0">
@ -41203,7 +41203,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41232,7 +41232,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41261,7 +41261,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41290,7 +41290,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41319,7 +41319,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41348,7 +41348,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41377,7 +41377,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41406,7 +41406,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41435,7 +41435,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41464,7 +41464,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41493,7 +41493,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41522,7 +41522,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41551,7 +41551,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41580,7 +41580,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41609,7 +41609,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41638,7 +41638,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41667,7 +41667,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41696,7 +41696,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41725,7 +41725,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41754,7 +41754,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41783,7 +41783,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41812,7 +41812,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41841,7 +41841,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41870,7 +41870,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41899,7 +41899,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41928,7 +41928,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41957,7 +41957,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -41986,7 +41986,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42015,7 +42015,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42044,7 +42044,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42073,7 +42073,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42102,7 +42102,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42131,7 +42131,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42160,7 +42160,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42189,7 +42189,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42218,7 +42218,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42247,7 +42247,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42276,7 +42276,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42305,7 +42305,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42334,7 +42334,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42363,7 +42363,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42413,7 +42413,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42442,7 +42442,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -42471,7 +42471,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -46557,7 +46557,7 @@
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjli</pElem>
<pElem>../../jdk/src/java.base/share/native/libjli</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../make</pElem>
</incDir>
<preprocessorList>
@ -46639,7 +46639,7 @@
</preprocessorList>
</cTool>
</folder>
<folder path="0/jdk/src/java.base/share/native/libzip/zlib-1.2.8">
<folder path="0/jdk/src/java.base/share/native/libzip/zlib">
<cTool>
<incDir>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/giflib</pElem>
@ -46647,7 +46647,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -46712,7 +46712,7 @@
<incDir>
<pElem>../../jdk/src/java.base/unix/native/libjli</pElem>
<pElem>../../jdk/src/java.base/share/native/libjli</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../make</pElem>
</incDir>
<preprocessorList>
@ -47250,7 +47250,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -47598,7 +47598,7 @@
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.desktop/share/native/libsplashscreen/libpng</pElem>
<pElem>../../jdk/src/java.desktop/unix/native/libsplashscreen</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/linux/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
@ -47996,7 +47996,7 @@
<pElem>../../jdk/src/jdk.pack/share/native/common-unpack</pElem>
<pElem>../../jdk/src/java.base/share/native/libjava</pElem>
<pElem>../../jdk/src/java.base/unix/native/libjava</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib-1.2.8</pElem>
<pElem>../../jdk/src/java.base/share/native/libzip/zlib</pElem>
<pElem>../../jdk/src/java.base/share/native/include</pElem>
<pElem>../../jdk/src/java.base/linux/native/include</pElem>
<pElem>../../jdk/src/java.base/unix/native/include</pElem>

View File

@ -398,3 +398,5 @@ ff8cb43c07c069b1debdee44cb88ca22db1ec757 jdk-9+152
68a8e8658511093b322a46ed04b2a321e1da2a43 jdk-9+153
078ebe23b584466dc8346e620d7821d91751e5a9 jdk-9+154
a545f54babfa31aa7eb611f36031609acd617cbc jdk-9+155
907c26240cd481579e919bfd23740797ff8ce1c8 jdk-9+156
9383da04b385cca46b7ca67f3a39ac1b673e09fe jdk-9+157

View File

@ -25,6 +25,8 @@
/**
* Defines the Java binding of the OMG CORBA APIs, and the RMI-IIOP API.
*
* @since 9
*/
@Deprecated(since="9", forRemoval=true)
module java.corba {

View File

@ -106,13 +106,13 @@ import java.security.PrivilegedAction;
*
* <LI>check in properties parameter, if any
*
* <LI>check in the System properties
* <LI>check in the System properties, if any
*
* <LI>check in the orb.properties file located in the user.home
* directory (if any)
* directory, if any
*
* <LI>check in the orb.properties file located in the java.home/lib
* directory (if any)
* <LI>check in the orb.properties file located in the run-time image,
* if any
*
* <LI>fall back on a hardcoded default behavior (use the Java&nbsp;IDL
* implementation)
@ -170,9 +170,15 @@ import java.security.PrivilegedAction;
* Thus, where appropriate, it is necessary that
* the classes for this alternative ORBSingleton are available on the application's class path.
* It should be noted that the singleton ORB is system wide.
*
* <P>
* When a per-application ORB is created via the 2-arg init methods,
* then it will be located using the thread context class loader.
* <P>
* The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location,
* in the Java run-time image, to search for orb.properties.
* This location is not intended for user editable configuration files.
* Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties,
* and thereafter the ${java.home}/lib directory.
*
* @since JDK1.2
*/
@ -271,14 +277,25 @@ abstract public class ORB {
}
String javaHome = System.getProperty("java.home");
fileName = javaHome + File.separator
+ "lib" + File.separator + "orb.properties";
props = getFileProperties( fileName ) ;
fileName = javaHome + File.separator + "conf"
+ File.separator + "orb.properties";
props = getFileProperties(fileName);
if (props != null) {
String value = props.getProperty(name);
if (value != null)
return value;
}
fileName = javaHome + File.separator + "lib"
+ File.separator + "orb.properties";
props = getFileProperties(fileName);
if (props == null)
return null ;
return null;
else
return props.getProperty( name ) ;
return props.getProperty(name);
}
}
);

View File

@ -558,3 +558,5 @@ a82cb5350cad96a0b4de496afebe3ded89f27efa jdk-9+146
217ba81b9a4ce8698200370175aa2db86a39f66c jdk-9+153
a9fdfd55835ef9dccb7f317b07249bd66653b874 jdk-9+154
f3b3d77a1751897413aae43ac340a130b6fa2ae1 jdk-9+155
43139c588ea48b6504e52b6c3dec530b17b1fdb4 jdk-9+156
b2d0a906afd73dcf27f572217eb1be0f196ec16c jdk-9+157

View File

@ -1922,12 +1922,17 @@ void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2,
}
if (opr2->is_constant()) {
bool is_32bit = false; // width of register operand
jlong imm;
switch(opr2->type()) {
case T_INT:
imm = opr2->as_constant_ptr()->as_jint();
is_32bit = true;
break;
case T_LONG:
imm = opr2->as_constant_ptr()->as_jlong();
break;
case T_INT:
case T_ADDRESS:
imm = opr2->as_constant_ptr()->as_jint();
break;
@ -1942,14 +1947,14 @@ void LIR_Assembler::comp_op(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2,
}
if (Assembler::operand_valid_for_add_sub_immediate(imm)) {
if (type2aelembytes(opr1->type()) <= 4)
if (is_32bit)
__ cmpw(reg1, imm);
else
__ cmp(reg1, imm);
return;
} else {
__ mov(rscratch1, imm);
if (type2aelembytes(opr1->type()) <= 4)
if (is_32bit)
__ cmpw(reg1, rscratch1);
else
__ cmp(reg1, rscratch1);

View File

@ -25,6 +25,7 @@ package jdk.tools.jaotc;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.core.target.Backend;
import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder;
import org.graalvm.compiler.hotspot.stubs.Stub;
import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@ -48,7 +49,7 @@ public class AOTStub implements JavaMethodInfo {
}
public HotSpotCompiledCode compiledCode(CompilationResult result) {
return stub.getCompiledCode(backend);
return HotSpotCompiledCodeBuilder.createCompiledCode(null, null, result);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,7 +50,7 @@ int pathmap_open(const char* name) {
}
if (strlen(alt_root) + strlen(name) < PATH_MAX) {
if (strlen(alt_root) + strlen(name) > PATH_MAX) {
// Buffer too small.
return -1;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -114,6 +114,8 @@ public abstract class AbstractHeapGraphWriter implements HeapGraphWriter {
}
});
writeHeapRecordPrologue();
// write JavaThreads
writeJavaThreads();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,8 +45,8 @@ import sun.jvm.hotspot.classfile.*;
* WARNING: This format is still under development, and is subject to
* change without notice.
*
* header "JAVA PROFILE 1.0.1" or "JAVA PROFILE 1.0.2" (0-terminated)
* u4 size of identifiers. Identifiers are used to represent
* header "JAVA PROFILE 1.0.2" (0-terminated)
* u4 size of identifiers. Identifiers are used to represent
* UTF8 strings, objects, stack traces, etc. They usually
* have the same size as host pointers. For example, on
* Solaris and Win32, the size is 4.
@ -294,10 +294,9 @@ import sun.jvm.hotspot.classfile.*;
* u2 stack trace depth
*
*
* When the header is "JAVA PROFILE 1.0.2" a heap dump can optionally
* be generated as a sequence of heap dump segments. This sequence is
* terminated by an end record. The additional tags allowed by format
* "JAVA PROFILE 1.0.2" are:
* A heap dump can optionally be generated as a sequence of heap dump
* segments. This sequence is terminated by an end record. The additional
* tags allowed by format "JAVA PROFILE 1.0.2" are:
*
* HPROF_HEAP_DUMP_SEGMENT denote a heap dump segment
*
@ -310,8 +309,6 @@ import sun.jvm.hotspot.classfile.*;
public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// The heap size threshold used to determine if segmented format
// ("JAVA PROFILE 1.0.2") should be used.
private static final long HPROF_SEGMENTED_HEAP_DUMP_THRESHOLD = 2L * 0x40000000;
// The approximate size of a heap segment. Used to calculate when to create
@ -319,7 +316,6 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
private static final long HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE = 1L * 0x40000000;
// hprof binary file header
private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1";
private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2";
// constants in enum HprofTag
@ -380,6 +376,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
private static final int JVM_SIGNATURE_ARRAY = '[';
private static final int JVM_SIGNATURE_CLASS = 'L';
private static final long MAX_U4_VALUE = 0xFFFFFFFFL;
int serialNum = 1;
public synchronized void write(String fileName) throws IOException {
@ -469,7 +466,6 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// length later - hprof format requires length.
out.flush();
currentSegmentStart = fos.getChannel().position();
// write dummy length of 0 and we'll fix it later.
out.writeInt(0);
}
@ -479,7 +475,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
protected void writeHeapRecordEpilogue() throws IOException {
if (useSegmentedHeapDump) {
out.flush();
if ((fos.getChannel().position() - currentSegmentStart - 4) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
if ((fos.getChannel().position() - currentSegmentStart - 4L) >= HPROF_SEGMENTED_HEAP_DUMP_SEGMENT_SIZE) {
fillInHeapRecordLength();
currentSegmentStart = 0;
}
@ -488,14 +484,14 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
private void fillInHeapRecordLength() throws IOException {
// now get current position to calculate length
// now get the current position to calculate length
long dumpEnd = fos.getChannel().position();
// calculate length of heap data
// calculate the length of heap data
long dumpLenLong = (dumpEnd - currentSegmentStart - 4L);
// Check length boundary, overflow could happen but is _very_ unlikely
if(dumpLenLong >= (4L * 0x40000000)){
if (dumpLenLong >= (4L * 0x40000000)) {
throw new RuntimeException("Heap segment size overflow.");
}
@ -517,6 +513,71 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
fos.getChannel().position(currentPosition);
}
// get the size in bytes for the requested type
private long getSizeForType(int type) throws IOException {
switch (type) {
case TypeArrayKlass.T_BOOLEAN:
return BOOLEAN_SIZE;
case TypeArrayKlass.T_INT:
return INT_SIZE;
case TypeArrayKlass.T_CHAR:
return CHAR_SIZE;
case TypeArrayKlass.T_SHORT:
return SHORT_SIZE;
case TypeArrayKlass.T_BYTE:
return BYTE_SIZE;
case TypeArrayKlass.T_LONG:
return LONG_SIZE;
case TypeArrayKlass.T_FLOAT:
return FLOAT_SIZE;
case TypeArrayKlass.T_DOUBLE:
return DOUBLE_SIZE;
default:
throw new RuntimeException(
"Should not reach here: Unknown type: " + type);
}
}
private int getArrayHeaderSize(boolean isObjectAarray) {
return isObjectAarray?
((int) BYTE_SIZE + 2 * (int) INT_SIZE + 2 * (int) OBJ_ID_SIZE):
(2 * (int) BYTE_SIZE + 2 * (int) INT_SIZE + (int) OBJ_ID_SIZE);
}
// Check if we need to truncate an array
private int calculateArrayMaxLength(long originalArrayLength,
int headerSize,
long typeSize,
String typeName) throws IOException {
long length = originalArrayLength;
// now get the current position to calculate length
long dumpEnd = fos.getChannel().position();
long originalLengthInBytes = originalArrayLength * typeSize;
// calculate the length of heap data
long currentRecordLength = (dumpEnd - currentSegmentStart - 4L);
if (currentRecordLength > 0 &&
(currentRecordLength + headerSize + originalLengthInBytes) > MAX_U4_VALUE) {
fillInHeapRecordLength();
currentSegmentStart = 0;
writeHeapRecordPrologue();
currentRecordLength = 0;
}
// Calculate the max bytes we can use.
long maxBytes = (MAX_U4_VALUE - (headerSize + currentRecordLength));
if (originalLengthInBytes > maxBytes) {
length = maxBytes/typeSize;
System.err.println("WARNING: Cannot dump array of type " + typeName
+ " with length " + originalArrayLength
+ "; truncating to length " + length);
}
return (int) length;
}
private void writeClassDumpRecords() throws IOException {
SystemDictionary sysDict = VM.getVM().getSystemDictionary();
ClassLoaderDataGraph cldGraph = VM.getVM().getClassLoaderDataGraph();
@ -694,12 +755,16 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
}
protected void writeObjectArray(ObjArray array) throws IOException {
int headerSize = getArrayHeaderSize(true);
final int length = calculateArrayMaxLength(array.getLength(),
headerSize,
OBJ_ID_SIZE,
"Object");
out.writeByte((byte) HPROF_GC_OBJ_ARRAY_DUMP);
writeObjectID(array);
out.writeInt(DUMMY_STACK_TRACE_ID);
out.writeInt((int) array.getLength());
out.writeInt(length);
writeObjectID(array.getKlass().getJavaMirror());
final int length = (int) array.getLength();
for (int index = 0; index < length; index++) {
OopHandle handle = array.getOopHandleAt(index);
writeObjectID(getAddressValue(handle));
@ -707,101 +772,101 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
}
protected void writePrimitiveArray(TypeArray array) throws IOException {
int headerSize = getArrayHeaderSize(false);
TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
final int type = (int) tak.getElementType();
final String typeName = tak.getElementTypeName();
final long typeSize = getSizeForType(type);
final int length = calculateArrayMaxLength(array.getLength(),
headerSize,
typeSize,
typeName);
out.writeByte((byte) HPROF_GC_PRIM_ARRAY_DUMP);
writeObjectID(array);
out.writeInt(DUMMY_STACK_TRACE_ID);
out.writeInt((int) array.getLength());
TypeArrayKlass tak = (TypeArrayKlass) array.getKlass();
final int type = (int) tak.getElementType();
out.writeInt(length);
out.writeByte((byte) type);
switch (type) {
case TypeArrayKlass.T_BOOLEAN:
writeBooleanArray(array);
writeBooleanArray(array, length);
break;
case TypeArrayKlass.T_CHAR:
writeCharArray(array);
writeCharArray(array, length);
break;
case TypeArrayKlass.T_FLOAT:
writeFloatArray(array);
writeFloatArray(array, length);
break;
case TypeArrayKlass.T_DOUBLE:
writeDoubleArray(array);
writeDoubleArray(array, length);
break;
case TypeArrayKlass.T_BYTE:
writeByteArray(array);
writeByteArray(array, length);
break;
case TypeArrayKlass.T_SHORT:
writeShortArray(array);
writeShortArray(array, length);
break;
case TypeArrayKlass.T_INT:
writeIntArray(array);
writeIntArray(array, length);
break;
case TypeArrayKlass.T_LONG:
writeLongArray(array);
writeLongArray(array, length);
break;
default:
throw new RuntimeException("should not reach here");
throw new RuntimeException(
"Should not reach here: Unknown type: " + type);
}
}
private void writeBooleanArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeBooleanArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = BOOLEAN_BASE_OFFSET + index * BOOLEAN_SIZE;
out.writeBoolean(array.getHandle().getJBooleanAt(offset));
}
}
private void writeByteArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeByteArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = BYTE_BASE_OFFSET + index * BYTE_SIZE;
out.writeByte(array.getHandle().getJByteAt(offset));
}
}
private void writeShortArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeShortArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = SHORT_BASE_OFFSET + index * SHORT_SIZE;
out.writeShort(array.getHandle().getJShortAt(offset));
}
}
private void writeIntArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeIntArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = INT_BASE_OFFSET + index * INT_SIZE;
out.writeInt(array.getHandle().getJIntAt(offset));
}
}
private void writeLongArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeLongArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = LONG_BASE_OFFSET + index * LONG_SIZE;
out.writeLong(array.getHandle().getJLongAt(offset));
}
}
private void writeCharArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeCharArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = CHAR_BASE_OFFSET + index * CHAR_SIZE;
out.writeChar(array.getHandle().getJCharAt(offset));
}
}
private void writeFloatArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeFloatArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = FLOAT_BASE_OFFSET + index * FLOAT_SIZE;
out.writeFloat(array.getHandle().getJFloatAt(offset));
}
}
private void writeDoubleArray(TypeArray array) throws IOException {
final int length = (int) array.getLength();
private void writeDoubleArray(TypeArray array, int length) throws IOException {
for (int index = 0; index < length; index++) {
long offset = DOUBLE_BASE_OFFSET + index * DOUBLE_SIZE;
out.writeDouble(array.getHandle().getJDoubleAt(offset));
@ -996,12 +1061,7 @@ public class HeapHprofBinWriter extends AbstractHeapGraphWriter {
// writes hprof binary file header
private void writeFileHeader() throws IOException {
// version string
if(useSegmentedHeapDump) {
out.writeBytes(HPROF_HEADER_1_0_2);
}
else {
out.writeBytes(HPROF_HEADER_1_0_1);
}
out.writeBytes(HPROF_HEADER_1_0_2);
out.writeByte((byte)'\0');
// write identifier size. we use pointers as identifiers.

View File

@ -27,8 +27,6 @@ import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.ResolvedJavaType;
@ -147,21 +145,34 @@ public class HotSpotJVMCIMetaAccessContext {
}
}
private final Map<Class<?>, WeakReference<ResolvedJavaType>> typeMap = new WeakHashMap<>();
private final ClassValue<WeakReference<ResolvedJavaType>> resolvedJavaType = new ClassValue<WeakReference<ResolvedJavaType>>() {
@Override
protected WeakReference<ResolvedJavaType> computeValue(Class<?> type) {
return new WeakReference<>(createClass(type));
}
};
/**
* Gets the JVMCI mirror for a {@link Class} object.
*
* @return the {@link ResolvedJavaType} corresponding to {@code javaClass}
*/
public synchronized ResolvedJavaType fromClass(Class<?> javaClass) {
WeakReference<ResolvedJavaType> typeRef = typeMap.get(javaClass);
ResolvedJavaType type = typeRef != null ? typeRef.get() : null;
if (type == null) {
type = createClass(javaClass);
typeMap.put(javaClass, new WeakReference<>(type));
public ResolvedJavaType fromClass(Class<?> javaClass) {
ResolvedJavaType javaType = null;
while (javaType == null) {
WeakReference<ResolvedJavaType> type = resolvedJavaType.get(javaClass);
javaType = type.get();
if (javaType == null) {
/*
* If the referent has become null, clear out the current value
* and let computeValue above create a new value. Reload the
* value in a loop because in theory the WeakReference referent
* can be reclaimed at any point.
*/
resolvedJavaType.remove(javaClass);
}
}
return type;
return javaType;
}
/**

View File

@ -89,18 +89,11 @@ public abstract class Stub {
*/
protected InstalledCode code;
/**
* Compilation result from which {@link #code} was created.
*/
protected CompilationResult compResult;
/**
* The registers destroyed by this stub (from the caller's perspective).
*/
private Set<Register> destroyedCallerRegisters;
private HotSpotCompiledCode compiledCode;
public void initDestroyedCallerRegisters(Set<Register> registers) {
assert registers != null;
assert destroyedCallerRegisters == null || registers.equals(destroyedCallerRegisters) : "cannot redefine";
@ -184,35 +177,13 @@ public abstract class Stub {
public synchronized InstalledCode getCode(final Backend backend) {
if (code == null) {
try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
final StructuredGraph graph = getGraph(getStubCompilationId());
// Stubs cannot be recompiled so they cannot be compiled with assumptions
assert graph.getAssumptions() == null;
if (!(graph.start() instanceof StubStartNode)) {
StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
newStart.setStateAfter(graph.start().stateAfter());
graph.replaceFixed(graph.start(), newStart);
}
CodeCacheProvider codeCache = providers.getCodeCache();
compResult = new CompilationResult(toString(), GeneratePIC.getValue());
try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
Suites suites = createSuites();
emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
LIRSuites lirSuites = createLIRSuites();
emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
assert checkStubInvariants();
} catch (Throwable e) {
throw Debug.handle(e);
}
assert destroyedCallerRegisters != null;
CompilationResult compResult = buildCompilationResult(backend);
try (Scope s = Debug.scope("CodeInstall", compResult)) {
assert destroyedCallerRegisters != null;
// Add a GeneratePIC check here later, we don't want to install
// code if we don't have a corresponding VM global symbol.
compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
HotSpotCompiledCode compiledCode = HotSpotCompiledCodeBuilder.createCompiledCode(null, null, compResult);
code = codeCache.installCode(null, compiledCode, null, null, false);
} catch (Throwable e) {
throw Debug.handle(e);
@ -226,6 +197,44 @@ public abstract class Stub {
return code;
}
@SuppressWarnings("try")
private CompilationResult buildCompilationResult(final Backend backend) {
CompilationResult compResult = new CompilationResult(toString(), GeneratePIC.getValue());
final StructuredGraph graph = getGraph(getStubCompilationId());
// Stubs cannot be recompiled so they cannot be compiled with assumptions
assert graph.getAssumptions() == null;
if (!(graph.start() instanceof StubStartNode)) {
StubStartNode newStart = graph.add(new StubStartNode(Stub.this));
newStart.setStateAfter(graph.start().stateAfter());
graph.replaceFixed(graph.start(), newStart);
}
try (Scope s0 = Debug.scope("StubCompilation", graph, providers.getCodeCache())) {
Suites suites = createSuites();
emitFrontEnd(providers, backend, graph, providers.getSuites().getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, DefaultProfilingInfo.get(TriState.UNKNOWN), suites);
LIRSuites lirSuites = createLIRSuites();
emitBackEnd(graph, Stub.this, getInstalledCodeOwner(), backend, compResult, CompilationResultBuilderFactory.Default, getRegisterConfig(), lirSuites);
assert checkStubInvariants(compResult);
} catch (Throwable e) {
throw Debug.handle(e);
}
return compResult;
}
/**
* Gets a {@link CompilationResult} that can be used for code generation. Required for AOT.
*/
@SuppressWarnings("try")
public CompilationResult getCompilationResult(final Backend backend) {
try (Scope d = Debug.sandbox("CompilingStub", DebugScope.getConfig(), providers.getCodeCache(), debugScopeContext())) {
return buildCompilationResult(backend);
} catch (Throwable e) {
throw Debug.handle(e);
}
}
public CompilationIdentifier getStubCompilationId() {
return new StubCompilationIdentifier(this);
}
@ -233,7 +242,7 @@ public abstract class Stub {
/**
* Checks the conditions a compilation must satisfy to be installed as a RuntimeStub.
*/
private boolean checkStubInvariants() {
private boolean checkStubInvariants(CompilationResult compResult) {
assert compResult.getExceptionHandlers().isEmpty() : this;
// Stubs cannot be recompiled so they cannot be compiled with
@ -278,24 +287,4 @@ public abstract class Stub {
}
return lirSuites;
}
/**
* Gets the HotSpotCompiledCode that was created during installation.
*/
public synchronized HotSpotCompiledCode getCompiledCode(final Backend backend) {
getCompilationResult(backend);
assert compiledCode != null;
return compiledCode;
}
/**
* Gets the compilation result for this stub, compiling it first if necessary, and installing it
* in code.
*/
public synchronized CompilationResult getCompilationResult(final Backend backend) {
if (code == null) {
getCode(backend);
}
return compResult;
}
}

View File

@ -248,7 +248,9 @@ void Canonicalizer::do_ArrayLength (ArrayLength* x) {
} else if ((lf = x->array()->as_LoadField()) != NULL) {
ciField* field = lf->field();
if (field->is_static_constant()) {
assert(PatchALot || ScavengeRootsInCode < 2, "Constant field loads are folded during parsing");
// Constant field loads are usually folded during parsing.
// But it doesn't happen with PatchALot, ScavengeRootsInCode < 2, or when
// holder class is being initialized during parsing (for static fields).
ciObject* c = field->constant_value().as_object();
if (!c->is_null_object()) {
set_constant(c->as_array()->length());

View File

@ -1413,6 +1413,17 @@ void LIR_List::store_check(LIR_Opr object, LIR_Opr array, LIR_Opr tmp1, LIR_Opr
append(c);
}
void LIR_List::null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null) {
if (deoptimize_on_null) {
// Emit an explicit null check and deoptimize if opr is null
CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_null_check, Deoptimization::Action_none);
cmp(lir_cond_equal, opr, LIR_OprFact::oopConst(NULL));
branch(lir_cond_equal, T_OBJECT, deopt);
} else {
// Emit an implicit null check
append(new LIR_Op1(lir_null_check, opr, info));
}
}
void LIR_List::cas_long(LIR_Opr addr, LIR_Opr cmp_value, LIR_Opr new_value,
LIR_Opr t1, LIR_Opr t2, LIR_Opr result) {

View File

@ -2113,7 +2113,7 @@ class LIR_List: public CompilationResourceObj {
void pack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_pack64, src, dst, T_LONG, lir_patch_none, NULL)); }
void unpack64(LIR_Opr src, LIR_Opr dst) { append(new LIR_Op1(lir_unpack64, src, dst, T_LONG, lir_patch_none, NULL)); }
void null_check(LIR_Opr opr, CodeEmitInfo* info) { append(new LIR_Op1(lir_null_check, opr, info)); }
void null_check(LIR_Opr opr, CodeEmitInfo* info, bool deoptimize_on_null = false);
void throw_exception(LIR_Opr exceptionPC, LIR_Opr exceptionOop, CodeEmitInfo* info) {
append(new LIR_Op2(lir_throw, exceptionPC, exceptionOop, LIR_OprFact::illegalOpr, info));
}

View File

@ -1752,8 +1752,10 @@ void LIRGenerator::do_StoreField(StoreField* x) {
if (x->needs_null_check() &&
(needs_patching ||
MacroAssembler::needs_explicit_null_check(x->offset()))) {
// emit an explicit null check because the offset is too large
__ null_check(object.result(), new CodeEmitInfo(info));
// Emit an explicit null check because the offset is too large.
// If the class is not loaded and the object is NULL, we need to deoptimize to throw a
// NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
__ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
}
LIR_Address* address;
@ -1838,8 +1840,10 @@ void LIRGenerator::do_LoadField(LoadField* x) {
obj = new_register(T_OBJECT);
__ move(LIR_OprFact::oopConst(NULL), obj);
}
// emit an explicit null check because the offset is too large
__ null_check(obj, new CodeEmitInfo(info));
// Emit an explicit null check because the offset is too large.
// If the class is not loaded and the object is NULL, we need to deoptimize to throw a
// NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
__ null_check(obj, new CodeEmitInfo(info), /* deoptimize */ needs_patching);
}
LIR_Opr reg = rlock_result(x, field_type);

View File

@ -101,6 +101,7 @@ ciEnv::ciEnv(CompileTask* task, int system_dictionary_modification_counter)
_debug_info = NULL;
_dependencies = NULL;
_failure_reason = NULL;
_inc_decompile_count_on_failure = true;
_compilable = MethodCompilable;
_break_at_compile = false;
_compiler_data = NULL;
@ -161,6 +162,7 @@ ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) {
_debug_info = NULL;
_dependencies = NULL;
_failure_reason = NULL;
_inc_decompile_count_on_failure = true;
_compilable = MethodCompilable_never;
_break_at_compile = false;
_compiler_data = NULL;
@ -902,7 +904,12 @@ void ciEnv::validate_compile_task_dependencies(ciMethod* target) {
if (deps.is_klass_type()) continue; // skip klass dependencies
Klass* witness = deps.check_dependency();
if (witness != NULL) {
record_failure("invalid non-klass dependency");
if (deps.type() == Dependencies::call_site_target_value) {
_inc_decompile_count_on_failure = false;
record_failure("call site target change");
} else {
record_failure("invalid non-klass dependency");
}
return;
}
}
@ -1017,7 +1024,7 @@ void ciEnv::register_method(ciMethod* target,
if (failing()) {
// While not a true deoptimization, it is a preemptive decompile.
MethodData* mdo = method()->method_data();
if (mdo != NULL) {
if (mdo != NULL && _inc_decompile_count_on_failure) {
mdo->inc_decompile_count();
}

View File

@ -55,6 +55,7 @@ private:
DebugInformationRecorder* _debug_info;
Dependencies* _dependencies;
const char* _failure_reason;
bool _inc_decompile_count_on_failure;
int _compilable;
bool _break_at_compile;
int _num_inlined_bytecodes;

View File

@ -2269,6 +2269,7 @@ void java_lang_LiveStackFrameInfo::compute_offsets() {
compute_offset(_monitors_offset, k, vmSymbols::monitors_name(), vmSymbols::object_array_signature());
compute_offset(_locals_offset, k, vmSymbols::locals_name(), vmSymbols::object_array_signature());
compute_offset(_operands_offset, k, vmSymbols::operands_name(), vmSymbols::object_array_signature());
compute_offset(_mode_offset, k, vmSymbols::mode_name(), vmSymbols::int_signature());
}
void java_lang_reflect_AccessibleObject::compute_offsets() {
@ -3658,6 +3659,7 @@ int java_lang_StackFrameInfo::_version_offset;
int java_lang_LiveStackFrameInfo::_monitors_offset;
int java_lang_LiveStackFrameInfo::_locals_offset;
int java_lang_LiveStackFrameInfo::_operands_offset;
int java_lang_LiveStackFrameInfo::_mode_offset;
int java_lang_AssertionStatusDirectives::classes_offset;
int java_lang_AssertionStatusDirectives::classEnabled_offset;
int java_lang_AssertionStatusDirectives::packages_offset;
@ -3728,6 +3730,10 @@ void java_lang_LiveStackFrameInfo::set_operands(oop element, oop value) {
element->obj_field_put(_operands_offset, value);
}
void java_lang_LiveStackFrameInfo::set_mode(oop element, int value) {
element->int_field_put(_mode_offset, value);
}
// Support for java Assertions - java_lang_AssertionStatusDirectives.
void java_lang_AssertionStatusDirectives::set_classes(oop o, oop val) {

View File

@ -1380,11 +1380,13 @@ class java_lang_LiveStackFrameInfo: AllStatic {
static int _monitors_offset;
static int _locals_offset;
static int _operands_offset;
static int _mode_offset;
public:
static void set_monitors(oop info, oop value);
static void set_locals(oop info, oop value);
static void set_operands(oop info, oop value);
static void set_mode(oop info, int value);
static void compute_offsets();

View File

@ -325,14 +325,8 @@
template(java_lang_StackStreamFactory_AbstractStackWalker, "java/lang/StackStreamFactory$AbstractStackWalker") \
template(doStackWalk_signature, "(JIIII)Ljava/lang/Object;") \
template(asPrimitive_name, "asPrimitive") \
template(asPrimitive_int_signature, "(I)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_long_signature, "(J)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_short_signature, "(S)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_byte_signature, "(B)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_char_signature, "(C)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_float_signature, "(F)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_double_signature, "(D)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_boolean_signature, "(Z)Ljava/lang/LiveStackFrame$PrimitiveValue;") \
template(asPrimitive_int_signature, "(I)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
template(asPrimitive_long_signature, "(J)Ljava/lang/LiveStackFrame$PrimitiveSlot;") \
\
/* common method and field names */ \
template(object_initializer_name, "<init>") \
@ -444,6 +438,7 @@
template(monitors_name, "monitors") \
template(locals_name, "locals") \
template(operands_name, "operands") \
template(mode_name, "mode") \
template(oop_size_name, "oop_size") \
template(static_oop_field_count_name, "static_oop_field_count") \
template(protection_domain_name, "protection_domain") \

View File

@ -1211,7 +1211,7 @@ void CodeCache::make_marked_nmethods_not_entrant() {
CompiledMethodIterator iter;
while(iter.next_alive()) {
CompiledMethod* nm = iter.method();
if (nm->is_marked_for_deoptimization()) {
if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
nm->make_not_entrant();
}
}

View File

@ -1146,6 +1146,14 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
assert(!is_zombie(), "should not already be a zombie");
if (_state == state) {
// Avoid taking the lock if already in required state.
// This is safe from races because the state is an end-state,
// which the nmethod cannot back out of once entered.
// No need for fencing either.
return false;
}
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
nmethodLocker nml(this);
methodHandle the_method(method());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -711,29 +711,6 @@ void HeapRegionRemSet::setup_remset_size() {
guarantee(G1RSetSparseRegionEntries > 0 && G1RSetRegionEntries > 0 , "Sanity");
}
#ifndef PRODUCT
void HeapRegionRemSet::print() {
HeapRegionRemSetIterator iter(this);
size_t card_index;
while (iter.has_next(card_index)) {
HeapWord* card_start = _bot->address_for_index(card_index);
tty->print_cr(" Card " PTR_FORMAT, p2i(card_start));
}
if (iter.n_yielded() != occupied()) {
tty->print_cr("Yielded disagrees with occupied:");
tty->print_cr(" " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
" coarse, " SIZE_FORMAT_W(6) " fine).",
iter.n_yielded(),
iter.n_yielded_coarse(), iter.n_yielded_fine());
tty->print_cr(" " SIZE_FORMAT_W(6) " occ (" SIZE_FORMAT_W(6)
" coarse, " SIZE_FORMAT_W(6) " fine).",
occupied(), occ_coarse(), occ_fine());
}
guarantee(iter.n_yielded() == occupied(),
"We should have yielded all the represented cards.");
}
#endif
void HeapRegionRemSet::cleanup() {
SparsePRT::cleanup_all();
}
@ -917,10 +894,6 @@ bool HeapRegionRemSetIterator::has_next(size_t& card_index) {
// Otherwise...
break;
}
assert(ParallelGCThreads > 1 ||
n_yielded() == _hrrs->occupied(),
"Should have yielded all the cards in the rem set "
"(in the non-par case).");
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -290,8 +290,6 @@ public:
// consumed by the strong code roots.
size_t strong_code_roots_mem_size();
void print() PRODUCT_RETURN;
// Called during a stop-world phase to perform any deferred cleanups.
static void cleanup();

View File

@ -373,7 +373,7 @@ const Type* Type::make_constant_from_field(ciField* field, ciInstance* holder,
if (con_type != NULL && field->is_call_site_target()) {
ciCallSite* call_site = holder->as_call_site();
if (!call_site->is_constant_call_site()) {
ciMethodHandle* target = call_site->get_target();
ciMethodHandle* target = con.as_object()->as_method_handle();
Compile::current()->dependencies()->assert_call_site_target_value(call_site, target);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1230,8 +1230,12 @@ void JvmtiExport::post_class_unload(Klass* klass) {
assert(thread->is_VM_thread(), "wrong thread");
// get JavaThread for whom we are proxy
JavaThread *real_thread =
(JavaThread *)((VMThread *)thread)->vm_operation()->calling_thread();
Thread *calling_thread = ((VMThread *)thread)->vm_operation()->calling_thread();
if (!calling_thread->is_Java_thread()) {
// cannot post an event to a non-JavaThread
return;
}
JavaThread *real_thread = (JavaThread *)calling_thread;
JvmtiEnvIterator it;
for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1208,9 +1208,10 @@ JVM_ENTRY(jobject, MHN_resolve_Mem(JNIEnv *env, jobject igcls, jobject mname_jh,
if (reference_klass != NULL && reference_klass->is_instance_klass()) {
// Emulate LinkResolver::check_klass_accessability.
Klass* caller = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(caller_jh));
if (Reflection::verify_class_access(caller,
reference_klass,
true) != Reflection::ACCESS_OK) {
if (caller != SystemDictionary::Object_klass()
&& Reflection::verify_class_access(caller,
reference_klass,
true) != Reflection::ACCESS_OK) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), reference_klass->external_name());
}
}

View File

@ -173,7 +173,11 @@ void JavaFrameStream::fill_frame(int index, objArrayHandle frames_array,
}
}
oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* values, int i, TRAPS) {
// Create and return a LiveStackFrame.PrimitiveSlot (if needed) for the
// StackValue at the given index. 'type' is expected to be T_INT, T_LONG,
// T_OBJECT, or T_CONFLICT.
oop LiveFrameStream::create_primitive_slot_instance(StackValueCollection* values,
int i, BasicType type, TRAPS) {
Klass* k = SystemDictionary::resolve_or_null(vmSymbols::java_lang_LiveStackFrameInfo(), CHECK_NULL);
instanceKlassHandle ik (THREAD, k);
@ -182,8 +186,8 @@ oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* value
Symbol* signature = NULL;
// ## TODO: type is only available in LocalVariable table, if present.
// ## StackValue type is T_INT or T_OBJECT.
switch (values->at(i)->type()) {
// ## StackValue type is T_INT or T_OBJECT (or converted to T_LONG on 64-bit)
switch (type) {
case T_INT:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_int_signature();
@ -195,42 +199,26 @@ oop LiveFrameStream::create_primitive_value_instance(StackValueCollection* value
break;
case T_FLOAT:
args.push_float(values->float_at(i));
signature = vmSymbols::asPrimitive_float_signature();
break;
case T_DOUBLE:
args.push_double(values->double_at(i));
signature = vmSymbols::asPrimitive_double_signature();
break;
case T_BYTE:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_byte_signature();
break;
case T_SHORT:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_short_signature();
break;
case T_CHAR:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_char_signature();
break;
case T_BOOLEAN:
args.push_int(values->int_at(i));
signature = vmSymbols::asPrimitive_boolean_signature();
break;
THROW_MSG_(vmSymbols::java_lang_InternalError(), "Unexpected StackValue type", NULL);
case T_OBJECT:
return values->obj_at(i)();
case T_CONFLICT:
// put a non-null slot
args.push_int(0);
signature = vmSymbols::asPrimitive_int_signature();
#ifdef _LP64
args.push_long(0);
signature = vmSymbols::asPrimitive_long_signature();
#else
args.push_int(0);
signature = vmSymbols::asPrimitive_int_signature();
#endif
break;
default: ShouldNotReachHere();
@ -252,9 +240,19 @@ objArrayHandle LiveFrameStream::values_to_object_array(StackValueCollection* val
objArrayHandle array_h(THREAD, array_oop);
for (int i = 0; i < values->size(); i++) {
StackValue* st = values->at(i);
oop obj = create_primitive_value_instance(values, i, CHECK_(empty));
if (obj != NULL)
BasicType type = st->type();
int index = i;
#ifdef _LP64
if (type != T_OBJECT && type != T_CONFLICT) {
intptr_t ret = st->get_int(); // read full 64-bit slot
type = T_LONG; // treat as long
index--; // undo +1 in StackValueCollection::long_at
}
#endif
oop obj = create_primitive_slot_instance(values, index, type, CHECK_(empty));
if (obj != NULL) {
array_h->obj_at_put(i, obj);
}
}
return array_h;
}
@ -286,6 +284,13 @@ void LiveFrameStream::fill_live_stackframe(Handle stackFrame,
StackValueCollection* expressions = _jvf->expressions();
GrowableArray<MonitorInfo*>* monitors = _jvf->monitors();
int mode = 0;
if (_jvf->is_interpreted_frame()) {
mode = MODE_INTERPRETED;
} else if (_jvf->is_compiled_frame()) {
mode = MODE_COMPILED;
}
if (!locals->is_empty()) {
objArrayHandle locals_h = values_to_object_array(locals, CHECK);
java_lang_LiveStackFrameInfo::set_locals(stackFrame(), locals_h());
@ -298,6 +303,7 @@ void LiveFrameStream::fill_live_stackframe(Handle stackFrame,
objArrayHandle monitors_h = monitors_to_object_array(monitors, CHECK);
java_lang_LiveStackFrameInfo::set_monitors(stackFrame(), monitors_h());
}
java_lang_LiveStackFrameInfo::set_mode(stackFrame(), mode);
}
}

View File

@ -92,11 +92,16 @@ public:
class LiveFrameStream : public BaseFrameStream {
private:
enum {
MODE_INTERPRETED = 0x01,
MODE_COMPILED = 0x02
};
javaVFrame* _jvf;
void fill_live_stackframe(Handle stackFrame, const methodHandle& method, TRAPS);
static oop create_primitive_value_instance(StackValueCollection* values,
int i, TRAPS);
static oop create_primitive_slot_instance(StackValueCollection* values,
int i, BasicType type, TRAPS);
static objArrayHandle monitors_to_object_array(GrowableArray<MonitorInfo*>* monitors,
TRAPS);
static objArrayHandle values_to_object_array(StackValueCollection* values, TRAPS);

View File

@ -73,6 +73,7 @@ runtime/SharedArchiveFile/DefaultUseWithClient.java 8154204 generic-all
serviceability/jdwp/AllModulesCommandTest.java 8168478 generic-all
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
serviceability/jvmti/ModuleAwareAgents/ClassFileLoadHook/MAAClassFileLoadHook.java 8173936 generic-all
#############################################################################

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.
*
*/
public class compiler/c1/TestUnresolvedField version 52:0 {
public static Method testGetField:"()V" stack 1 locals 1 {
aconst_null;
getfield Field T.f:I; // T does not exist
return;
}
public static Method testPutField:"()V" stack 2 locals 1 {
aconst_null;
iconst_0;
putfield Field T.f:I; // T does not exist
return;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,28 +23,26 @@
/*
* @test
* @bug 6843127
* @run main/othervm/timeout=300 BadKdc3
* @summary krb5 should not try to access unavailable kdc too often
* @bug 8173373
* @compile TestUnresolvedField.jasm
* @run main/othervm -XX:TieredStopAtLevel=1 -Xcomp
* -XX:CompileCommand=compileonly,compiler.c1.TestUnresolvedField::test*
* compiler.c1.TestUnresolvedFieldMain
*/
import java.io.*;
import java.security.Security;
package compiler.c1;
public class BadKdc3 {
public static void main(String[] args)
throws Exception {
Security.setProperty("krb5.kdc.bad.policy", "tryLast");
BadKdc.go(
"121212222222(32){2,4}", // 1 2
"(32){2,4}", // 1 2
// refresh
"121212222222(32){2,4}", // 1 2
// k3 off k2 on
"323232121212(22){2,4}", // 1 3
// k1 on
"(22){2,4}" // 1 3
);
public class TestUnresolvedFieldMain {
public static void main(String[] args) {
try {
TestUnresolvedField.testGetField();
} catch (java.lang.NoClassDefFoundError error) {
// Expected
}
try {
TestUnresolvedField.testPutField();
} catch (java.lang.NoClassDefFoundError error) {
// Expected
}
}
}

View File

@ -23,7 +23,6 @@
/**
* @test
* @modules java.base/jdk.internal.misc
* @library /test/lib /
*
* @run driver compiler.jsr292.ContinuousCallSiteTargetChange
@ -31,6 +30,7 @@
package compiler.jsr292;
import jdk.test.lib.Asserts;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
@ -39,15 +39,26 @@ import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ContinuousCallSiteTargetChange {
static void testServer() throws Exception {
static final int ITERATIONS = Integer.parseInt(System.getProperty("iterations", "50"));
static void runTest(Class<?> test, String... extraArgs) throws Exception {
List<String> argsList = new ArrayList<>(
List.of("-XX:+IgnoreUnrecognizedVMOptions",
"-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
"-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining"));
argsList.addAll(Arrays.asList(extraArgs));
argsList.add(test.getName());
argsList.add(Integer.toString(ITERATIONS));
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+IgnoreUnrecognizedVMOptions",
"-server", "-XX:-TieredCompilation", "-Xbatch",
"-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
"-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
Test.class.getName(), "100");
argsList.toArray(new String[argsList.size()]));
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
@ -55,30 +66,42 @@ public class ContinuousCallSiteTargetChange {
analyzer.shouldNotContain("made not compilable");
analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
}
static void testClient() throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-XX:+IgnoreUnrecognizedVMOptions",
"-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1", "-Xbatch",
"-XX:PerBytecodeRecompilationCutoff=10", "-XX:PerMethodRecompilationCutoff=10",
"-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
Test.class.getName(), "100");
static void testServer(Class<?> test, String... args) throws Exception {
List<String> extraArgsList = new ArrayList<>(
List.of("-server", "-XX:-TieredCompilation"));
extraArgsList.addAll(Arrays.asList(args));
OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
}
analyzer.shouldHaveExitValue(0);
static void testClient(Class<?> test, String... args) throws Exception {
List<String> extraArgsList = new ArrayList<>(
List.of("-client", "-XX:+TieredCompilation", "-XX:TieredStopAtLevel=1"));
extraArgsList.addAll(Arrays.asList(args));
analyzer.shouldNotContain("made not compilable");
analyzer.shouldNotContain("decompile_count > PerMethodRecompilationCutoff");
runTest(test, extraArgsList.toArray(new String[extraArgsList.size()]));
}
public static void main(String[] args) throws Exception {
testServer();
testClient();
testServer(RecompilationTest.class, "-Xbatch");
testClient(RecompilationTest.class, "-Xbatch");
testServer(PingPongTest.class);
testClient(PingPongTest.class);
}
static class Test {
static MethodHandle findStatic(Class<?> cls, String name, MethodType mt) {
try {
return MethodHandles.lookup().findStatic(cls, name, mt);
} catch (Exception e) {
throw new Error(e);
}
}
static class RecompilationTest {
static final MethodType mt = MethodType.methodType(void.class);
static final CallSite cs = new MutableCallSite(mt);
@ -96,7 +119,7 @@ public class ContinuousCallSiteTargetChange {
}
static void iteration() throws Throwable {
MethodHandle mh1 = MethodHandles.lookup().findStatic(ContinuousCallSiteTargetChange.Test.class, "f", mt);
MethodHandle mh1 = findStatic(RecompilationTest.class, "f", mt);
cs.setTarget(mh1);
for (int i = 0; i < 20_000; i++) {
test1();
@ -111,4 +134,38 @@ public class ContinuousCallSiteTargetChange {
}
}
}
static class PingPongTest {
static final MethodType mt = MethodType.methodType(void.class);
static final CallSite cs = new MutableCallSite(mt);
static final MethodHandle mh = cs.dynamicInvoker();
static final MethodHandle ping = findStatic(PingPongTest.class, "ping", mt);
static final MethodHandle pong = findStatic(PingPongTest.class, "pong", mt);
static void ping() {
Asserts.assertEQ(cs.getTarget(), ping, "wrong call site target");
cs.setTarget(pong);
}
static void pong() {
Asserts.assertEQ(cs.getTarget(), pong, "wrong call site target");
cs.setTarget(ping);
}
static void iteration() throws Throwable {
cs.setTarget(ping);
for (int i = 0; i < 20_000; i++) {
mh.invokeExact();
}
}
public static void main(String[] args) throws Throwable {
int iterations = Integer.parseInt(args[0]);
for (int i = 0; i < iterations; i++) {
iteration();
}
}
}
}

View File

@ -44,6 +44,8 @@
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
* -XX:CompileCommand=exclude,*::check
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay
* -XX:CompileCommand=dontinline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,testFrame
* -XX:CompileCommand=inline,compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest,recurse
* -Xbatch
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
@ -119,14 +121,25 @@ public class MaterializeVirtualObjectTest {
}
Asserts.assertTrue(WB.isMethodCompiled(METHOD), getName()
+ "Method unexpectedly not compiled");
Asserts.assertTrue(WB.getMethodCompilationLevel(METHOD) == 4, getName()
+ "Method not compiled at level 4");
testFrame("someString", COMPILE_THRESHOLD);
}
private void testFrame(String str, int iteration) {
Helper helper = new Helper(str);
check(iteration);
recurse(2, iteration);
Asserts.assertTrue((helper.string != null) && (this != null)
&& (helper != null), getName() + " : some locals are null");
&& (helper != null), String.format("%s : some locals are null", getName()));
}
private void recurse(int depth, int iteration) {
if (depth == 0) {
check(iteration);
} else {
Integer s = new Integer(depth);
recurse(depth - 1, iteration);
Asserts.assertEQ(s.intValue(), depth, String.format("different values: %s != %s", s.intValue(), depth));
}
}
private void check(int iteration) {

View File

@ -30,10 +30,10 @@ import java.lang.StackWalker.StackFrame;
public class LocalLongHelper {
static StackWalker sw;
static Method intValue;
static Method longValue;
static Method getLocals;
static Class<?> primitiveValueClass;
static Method primitiveType;
static Method primitiveSize;
static Method getMethodType;
static Field memberName;
static Field offset;
@ -43,27 +43,29 @@ public class LocalLongHelper {
new LocalLongHelper().longArg(0xC0FFEE, 0x1234567890ABCDEFL);
}
// locals[2] contains the high byte of the long argument.
// locals[2] contains the unused slot of the long argument.
public long longArg(int i, long l) throws Throwable {
List<StackFrame> frames = sw.walk(s -> s.collect(Collectors.toList()));
Object[] locals = (Object[]) getLocals.invoke(frames.get(0));
int locals_2 = (int) intValue.invoke(locals[2]);
if (locals_2 != 0){
throw new RuntimeException("Expected locals_2 == 0");
if (8 == (int) primitiveSize.invoke(locals[2])) { // Only test 64-bit
long locals_2 = (long) longValue.invoke(locals[2]);
if (locals_2 != 0){
throw new RuntimeException("Expected locals_2 == 0");
}
}
return l; // Don't want l to become a dead var
}
private static void setupReflectionStatics() throws Throwable {
Class<?> liveStackFrameClass = Class.forName("java.lang.LiveStackFrame");
primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveValue");
primitiveValueClass = Class.forName("java.lang.LiveStackFrame$PrimitiveSlot");
getLocals = liveStackFrameClass.getDeclaredMethod("getLocals");
getLocals.setAccessible(true);
intValue = primitiveValueClass.getDeclaredMethod("intValue");
intValue.setAccessible(true);
longValue = primitiveValueClass.getDeclaredMethod("longValue");
longValue.setAccessible(true);
Class<?> stackFrameInfoClass = Class.forName("java.lang.StackFrameInfo");
memberName = stackFrameInfoClass.getDeclaredField("memberName");
@ -80,20 +82,8 @@ public class LocalLongHelper {
f.setAccessible(true);
Object localsAndOperandsOption = f.get(null);
primitiveType = primitiveValueClass.getDeclaredMethod("type");
primitiveType.setAccessible(true);
primitiveSize = primitiveValueClass.getDeclaredMethod("size");
primitiveSize.setAccessible(true);
sw = (StackWalker) ewsNI.invoke(null, java.util.Collections.emptySet(), localsAndOperandsOption);
}
private static String type(Object o) throws Throwable {
if (primitiveValueClass.isInstance(o)) {
final char c = (char) primitiveType.invoke(o);
return String.valueOf(c);
} else if (o != null) {
return o.getClass().getName();
} else {
return "null";
}
}
}

View File

@ -68,7 +68,7 @@ public class AccessExportTwice {
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_first_mod =
ModuleDescriptor.module("first_mod")
ModuleDescriptor.newModule("first_mod")
.requires("java.base")
.requires("second_mod")
.build();
@ -78,7 +78,7 @@ public class AccessExportTwice {
// Packages: p2
// Packages exported: p2 is exported to first_mod
ModuleDescriptor descriptor_second_mod =
ModuleDescriptor.module("second_mod")
ModuleDescriptor.newModule("second_mod")
.requires("java.base")
.exports("p2", Set.of("first_mod"))
.build();
@ -89,7 +89,7 @@ public class AccessExportTwice {
// Resolves "first_mod"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod"));
.resolve(finder, ModuleFinder.of(), Set.of("first_mod"));
// Map each module to the same class loader
Map<String, ClassLoader> map = new HashMap<>();

View File

@ -66,9 +66,9 @@ public class AccessReadTwice {
// Packages: p1, p4
// Packages exported: none
ModuleDescriptor descriptor_first_mod =
ModuleDescriptor.module("first_mod")
ModuleDescriptor.newModule("first_mod")
.requires("java.base")
.contains(Set.of("p1", "p4"))
.packages(Set.of("p1", "p4"))
.build();
// Define module: second_mod
@ -76,7 +76,7 @@ public class AccessReadTwice {
// Packages: p2
// Packages exported: p2 is exported to first_mod
ModuleDescriptor descriptor_second_mod =
ModuleDescriptor.module("second_mod")
ModuleDescriptor.newModule("second_mod")
.requires("java.base")
.exports("p2", Set.of("first_mod"))
.build();
@ -87,7 +87,7 @@ public class AccessReadTwice {
// Resolves "first_mod" and "second_mod"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
.resolve(finder, ModuleFinder.of(), Set.of("first_mod", "second_mod"));
// Map each module to this class loader
Map<String, ClassLoader> map = new HashMap<>();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can not read module m2, then class p1.c1
* in module m1 can not access p2.c2 in module m2.
* @summary Test that if module m1x can not read module m2x, then class p1.c1
* in module m1x can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// defines m2 --> packages p2
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> packages p1
// defines m2x --> packages p2
// defines m3x --> packages p3
//
// m1 can not read m2
// package p2 in m2 is exported to m1
// m1x can not read m2x
// package p2 in m2x is exported to m1x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
// Access denied since m1 can not read m2.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
// Access denied since m1x can not read m2x.
//
public class CheckRead {
@ -64,65 +64,65 @@ public class CheckRead {
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m3
// Define module: m1x
// Can read: java.base, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m3")
.requires("m3x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Define module: m3
// Can read: java.base, m2
// Define module: m3x
// Can read: java.base, m2x
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.requires("m2")
.contains("p3")
.requires("m2x")
.packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m3", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
// Create Layer that contains m1, m2 and m3
// Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("cannot access")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can not read module m2, then class p1.c1
* in module m1 can not access p2.c2 in module m2.
* @summary Test that if module m1x can not read module m2x, then class p1.c1
* in module m1x can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
// defines m3x --> packages p3
//
// m1 can not read m2
// package p2 in m2 is exported to m1
// m1x can not read m2x
// package p2 in m2x is exported to m1x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
// Access denied since m1 can not read m2.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
// Access denied since m1x can not read m2x.
//
public class DiffCL_CheckRead {
@ -64,65 +64,65 @@ public class DiffCL_CheckRead {
// publicly defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m3
// Define module: m1x
// Can read: java.base, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m3")
.requires("m3x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Define module: m3
// Can read: java.base, m2
// Define module: m3x
// Can read: java.base, m2x
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.requires("m2")
.contains("p3")
.requires("m2x")
.packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m3", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
map.put("m3x", MyDiffClassLoader.loader2);
// Create Layer that contains m1, m2 and m3
// Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1 but m2 is not readable from m1)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x but m2x is not readable from m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("cannot access")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@
/*
* @test
* @summary Test that if module m1 can read module m2, but package p2 in m2
* is exported specifically to module m3, then class p1.c1 in m1 can not
* access p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, but package p2 in m2x
* is exported specifically to module m3x, then class p1.c1 in m1x can not
* access p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -48,15 +48,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
// defines m3x --> packages p3
//
// m1 can read m2
// package p2 in m2 is exported to m3
// m1x can read m2x
// package p2 in m2x is exported to m3x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access denied since although m1 can read m2, p2 is exported only to m3.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class DiffCL_ExpQualOther {
@ -65,66 +65,66 @@ public class DiffCL_ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2, m3
// Define module: m1x
// Can read: java.base, m2x, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m3")
.requires("m2x")
.requires("m3x")
.exports("p1")
.build();
// Define module: m2
// Can read: java.base, m3
// Define module: m2x
// Can read: java.base, m3x
// Packages: p2
// Packages exported: p2 is exported to m3
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported to m3x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m3"))
.exports("p2", Set.of("m3x"))
.build();
// Define module: m3
// Can read: java.base, m2
// Define module: m3x
// Can read: java.base, m2x
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.requires("m2")
.contains("p3")
.requires("m2x")
.packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m3", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
map.put("m3x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m3") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m3x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary class p1.c1 defined in m1 tries to access p2.c2 defined in m2.
* Access allowed since m1 can read m2 and package p2 is exported to m1.
* @summary class p1.c1 defined in m1x tries to access p2.c2 defined in m2x.
* Access allowed since m1x can read m2x and package p2 is exported to m1x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,14 +47,14 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported to m1
// m1x can read m2x
// package p2 in m2x is exported to m1x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access allowed since m1 can read m2 and package p2 is exported to m1.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class DiffCL_ExpQualToM1 {
@ -63,45 +63,45 @@ public class DiffCL_ExpQualToM1 {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: package p2 is exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: package p2 is exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -109,7 +109,7 @@ public class DiffCL_ExpQualToM1 {
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can read module m2, and package p2 in m2 is
* exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, and package p2 in m2x is
* exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,14 +47,14 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported to m1
// m1x can read m2x
// package p2 in m2x is exported to m1x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access allowed since m1 can read m2 and package p2 is exported
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access allowed since m1x can read m2x and package p2 is exported
// unqualifiedly.
//
public class DiffCL_ExpUnqual {
@ -64,45 +64,45 @@ public class DiffCL_ExpUnqual {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: package p2 is exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: package p2 is exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -110,7 +110,7 @@ public class DiffCL_ExpUnqual {
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can read module m2, but package p2 in m2 is not
* exported, then class p1.c1 in m1 can not read p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
* exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,13 +47,13 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is not exported
// m1x can read m2x
// package p2 in m2x is not exported
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class DiffCL_PkgNotExp {
@ -63,52 +63,52 @@ public class DiffCL_PkgNotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p2")
.packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
/*
* @test
* @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
* @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@ -50,10 +50,10 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// package p1 in m1 is exported unqualifiedly
// ClassLoader1 --> defines m1x --> packages p1
// package p1 in m1x is exported unqualifiedly
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in
// class p1.c1 defined in m1x tries to access p2.c2 defined in
// in unnamed module.
//
// Three access attempts occur in this test:
@ -62,7 +62,7 @@ import myloaders.MyDiffClassLoader;
// 2. In this scenario a strict module establishes readability
// to the particular unnamed module it is trying to access.
// Access is allowed.
// 3. Module m1 in the test_looseModuleLayer() method
// 3. Module m1x in the test_looseModuleLayer() method
// is transitioned to a loose module, access
// to all unnamed modules is allowed.
//
@ -71,41 +71,41 @@ public class DiffCL_Umod {
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1 is a strict module and has not established
// Module m1x is a strict module and has not established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m1x", MyDiffClassLoader.loader1);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -114,109 +114,109 @@ public class DiffCL_Umod {
// Attempt access
try {
p1_c1_class.newInstance();
throw new RuntimeException("Test Failed, strict module m1 should not be able " +
throw new RuntimeException("Test Failed, strict module m1x should not be able " +
"to access public type p2.c2 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
// Module m1 is a strict module and has established
// Module m1x is a strict module and has established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m1x", MyDiffClassLoader.loader1);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1ReadEdgeDiffLoader
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1ReadEdgeDiffLoader");
try {
// Read edge between m1 and the unnamed module that loads p2.c2 is established in
// Read edge between m1x and the unnamed module that loads p2.c2 is established in
// c1ReadEdgeDiffLoader's ctor before attempting access.
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, module m1 has established readability to p2/c2 loader's " +
throw new RuntimeException("Test Failed, module m1x has established readability to p2/c2 loader's " +
"unnamed module, access should be allowed: " + e.getMessage());
}
}
// Module m1 is a loose module and thus can read all unnamed modules.
// Module m1x is a loose module and thus can read all unnamed modules.
public void test_looseModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m1x", MyDiffClassLoader.loader1);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1Loose
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1Loose");
// change m1 to read all unnamed modules
Module m1 = layer.findModule("m1").get();
jdk.internal.module.Modules.addReadsAllUnnamed(m1);
// change m1x to read all unnamed modules
Module m1x = layer.findModule("m1x").get();
jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, loose module m1 should be able to access " +
throw new RuntimeException("Test Failed, loose module m1x should be able to access " +
"public type p2.c2 defined in unnamed module: " + e.getMessage());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
/*
* @test
* @summary class p3.c3 defined in module m1 tries to access c4 defined in an unnamed package
* @summary class p3.c3 defined in module m1x tries to access c4 defined in an unnamed package
* and an unnamed module.
* @modules java.base/jdk.internal.misc
* @library /test/lib
@ -48,10 +48,10 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p3
// package p3 in m1 is exported unqualifiedly
// ClassLoader1 --> defines m1x --> packages p3
// package p3 in m1x is exported unqualifiedly
//
// class p3.c3 defined in m1 tries to access c4 defined in
// class p3.c3 defined in m1x tries to access c4 defined in
// in unnamed module.
//
// Two access attempts occur in this test:
@ -66,41 +66,41 @@ public class DiffCL_UmodUpkg {
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1 is a strict module and has not established
// Module m1x is a strict module and has not established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m1x", MyDiffClassLoader.loader1);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3
@ -109,58 +109,58 @@ public class DiffCL_UmodUpkg {
// Attempt access
try {
p3_c3_class.newInstance();
throw new RuntimeException("Test Failed, strict module m1 should not be able to access " +
throw new RuntimeException("Test Failed, strict module m1x should not be able to access " +
"public type c4 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
// Module m1 is a strict module and has established
// Module m1x is a strict module and has established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MyDiffClassLoader.loader1 = new MyDiffClassLoader();
MyDiffClassLoader.loader2 = new MyDiffClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader2
// to achieve differing class loaders.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m1x", MyDiffClassLoader.loader1);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3ReadEdgeDiffLoader
Class p3_c3_class = MyDiffClassLoader.loader1.loadClass("p3.c3ReadEdgeDiffLoader");
try {
// Read edge between m1 and the unnamed module that loads c4 is established in
// Read edge between m1x and the unnamed module that loads c4 is established in
// C3ReadEdgeDiffLoader's ctor before attempting access.
p3_c3_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, module m1 has established readability to " +
throw new RuntimeException("Test Failed, module m1x has established readability to " +
"c4 loader's unnamed module, access should be allowed: " + e.getMessage());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@
/*
* @test
* @summary Test that if module m1 can read module m2, but package p2 in m2
* is exported specifically to module m3, then class p1.c1 in m1 can not
* access p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, but package p2 in m2x
* is exported specifically to module m3x, then class p1.c1 in m1x can not
* access p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -48,15 +48,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// defines m2 --> packages p2
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> packages p1
// defines m2x --> packages p2
// defines m3x --> packages p3
//
// m1 can read m2
// package p2 in m2 is exported to m3
// m1x can read m2x
// package p2 in m2x is exported to m3x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access denied since although m1 can read m2, p2 is exported only to m3.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class ExpQualOther {
@ -65,66 +65,66 @@ public class ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2, m3
// Define module: m1x
// Can read: java.base, m2x, m3x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m3")
.requires("m2x")
.requires("m3x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported to m3
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported to m3x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m3"))
.exports("p2", Set.of("m3x"))
.build();
// Define module: m3
// Can read: java.base, m2
// Define module: m3x
// Can read: java.base, m2x
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.requires("m2")
.contains("p3")
.requires("m2x")
.packages(Set.of("p3"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m3", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3 not to m1)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x not to m1x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can read module m2, AND package p2 in m2 is
* exported qualifiedly to m1, then class p1.c1 in m1 can read p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, AND package p2 in m2x is
* exported qualifiedly to m1x, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -53,52 +53,52 @@ public class ExpQualToM1 {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported qualifiedly to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported qualifiedly to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can read module m2, AND package p2 in module2 is
* exported unqualifiedly, then class p1.c1 in m1 can read p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, AND package p2 in module_two is
* exported unqualifiedly, then class p1.c1 in m1x can read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -53,45 +53,45 @@ public class ExpUnqual {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test if package p2 in module m2 is exported to all unnamed,
* then class p1.c1 in an unnamed module can read p2.c2 in module m2.
* @summary Test if package p2 in module m2x is exported to all unnamed,
* then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@ -49,15 +49,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported unqualifiedly
// m1x can read m2x
// package p2 in m2x is exported unqualifiedly
//
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
// m2 is exported to all unnamed modules.
// m2x is exported to all unnamed modules.
public class ExportAllUnnamed {
@ -66,51 +66,51 @@ public class ExportAllUnnamed {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
Class p2_c2_class = MySameClassLoader.loader1.loadClass("p2.c2");
Module m2 = p2_c2_class.getModule();
Module m2x = p2_c2_class.getModule();
// Export m2/p2 to all unnamed modules.
jdk.internal.module.Modules.addExportsToAllUnnamed(m2, "p2");
// Export m2x/p2 to all unnamed modules.
jdk.internal.module.Modules.addExportsToAllUnnamed(m2x, "p2");
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if module m1 can read module m2, but package p2 in m2 is not
* exported, then class p1.c1 in m1 can not read p2.c2 in m2.
* @summary Test that if module m1x can read module m2x, but package p2 in m2x is not
* exported, then class p1.c1 in m1x can not read p2.c2 in m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -47,13 +47,13 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> packages p1
// defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is not exported
// m1x can read m2x
// package p2 in m2x is not exported
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class PkgNotExp {
@ -63,51 +63,51 @@ public class PkgNotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p2")
.packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 and m2
// Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
/*
* @test
* @summary class p1.c1 defined in m1 tries to access p2.c2 defined in unnamed module.
* @summary class p1.c1 defined in m1x tries to access p2.c2 defined in unnamed module.
* @library /test/lib
* @modules java.base/jdk.internal.misc
* @modules java.base/jdk.internal.module
@ -50,10 +50,10 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p1
// package p1 in m1 is exported unqualifiedly
// ClassLoader1 --> defines m1x --> packages p1
// package p1 in m1x is exported unqualifiedly
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in
// class p1.c1 defined in m1x tries to access p2.c2 defined in
// in unnamed module.
//
// Three access attempts occur in this test:
@ -62,7 +62,7 @@ import myloaders.MySameClassLoader;
// 2. In this scenario a strict module establishes readability
// to the particular unnamed module it is trying to access.
// Access is allowed.
// 3. Module m1 in the test_looseModuleLayer() method
// 3. Module m1x in the test_looseModuleLayer() method
// is transitioned to a loose module, access
// to all unnamed modules is allowed.
//
@ -71,38 +71,38 @@ public class Umod {
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1 is a strict module and has not established
// Module m1x is a strict module and has not established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
MySameClassLoader loader = new MySameClassLoader();
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", loader);
map.put("m1x", loader);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == loader);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -111,103 +111,103 @@ public class Umod {
// Attempt access
try {
p1_c1_class.newInstance();
throw new RuntimeException("Test Failed, strict module m1, type p1.c1, should not be able " +
throw new RuntimeException("Test Failed, strict module m1x, type p1.c1, should not be able " +
"to access public type p2.c2 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
// Module m1 is a strict module and has established
// Module m1x is a strict module and has established
// readability to an unnamed module that p2.c2 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", loader);
map.put("m1x", loader);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == loader);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1ReadEdge
Class p1_c1_class = loader.loadClass("p1.c1ReadEdge");
try {
// Read edge between m1 and the unnamed module that loads p2.c2 is established in
// Read edge between m1x and the unnamed module that loads p2.c2 is established in
// c1ReadEdge's ctor before attempting access.
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, strict module m1, type p1.c1ReadEdge, should be able to acccess public type " +
throw new RuntimeException("Test Failed, strict module m1x, type p1.c1ReadEdge, should be able to acccess public type " +
"p2.c2 defined in unnamed module: " + e.getMessage());
}
}
// Module m1 is a loose module and thus can read all unnamed modules.
// Module m1x is a loose module and thus can read all unnamed modules.
public void test_looseModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p1
// Packages exported: p1 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p1")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c2 will be loaded in an unnamed module/loader.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", loader);
map.put("m1x", loader);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == loader);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1Loose
Class p1_c1_class = loader.loadClass("p1.c1Loose");
// change m1 to read all unnamed modules
Module m1 = layer.findModule("m1").get();
jdk.internal.module.Modules.addReadsAllUnnamed(m1);
// change m1x to read all unnamed modules
Module m1x = layer.findModule("m1x").get();
jdk.internal.module.Modules.addReadsAllUnnamed(m1x);
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, strict module m1, type p1.c1Loose, should be able to acccess public type " +
throw new RuntimeException("Test Failed, strict module m1x, type p1.c1Loose, should be able to acccess public type " +
"p2.c2 defined in unnamed module: " + e.getMessage());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@
/*
* @test
* @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
* @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
* Access is denied, since an unnamed module can read all modules but p2 in module
* m2 is exported specifically to module m1, not to all modules.
* m2x is exported specifically to module m1x, not to all modules.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -48,15 +48,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is not exported
// m1x can read m2x
// package p2 in m2x is not exported
//
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access denied, an unnamed module can read all modules but p2 in module
// m2 is exported specifically to module m1 not to all modules.
// m2x is exported specifically to module m1x not to all modules.
//
public class UmodDiffCL_ExpQualOther {
@ -65,53 +65,53 @@ public class UmodDiffCL_ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
// NOTE: module m1 does not define a package named p1.
// NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m1, not unqualifiedly");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m1x, not unqualifiedly");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2.
* Access allowed, an unnamed module can read all modules and p2 in module m2
* @summary class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x.
* Access allowed, an unnamed module can read all modules and p2 in module m2x
* which is exported unqualifiedly.
* @modules java.base/jdk.internal.misc
* @library /test/lib
@ -48,15 +48,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported unqualifiedly.
// m1x can read m2x
// package p2 in m2x is exported unqualifiedly.
//
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
// m2 which is exported unqualifiedly.
// m2x which is exported unqualifiedly.
//
public class UmodDiffCL_ExpUnqual {
@ -65,53 +65,53 @@ public class UmodDiffCL_ExpUnqual {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// NOTE: module m1 does not define a package named p1.
// NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2");
throw new RuntimeException("Test Failed, p1.c1 defined in unnamed module can access p2.c2 in module m2x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@
/*
* @test
* @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2.
* @summary class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x.
* Access is denied since even though unnamed module can read all modules, p2
* in module m2 is not exported at all.
* in module m2x is not exported at all.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// ClassLoader2 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// ClassLoader2 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is not exported
// m1x can read m2x
// package p2 in m2x is not exported
//
// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in unnamed module tries to access p2.c2 defined in m2x
// Access denied since even though unnamed module can read all modules, p2
// in module m2 is not exported at all.
// in module m2x is not exported at all.
//
public class UmodDiffCL_PkgNotExp {
@ -64,53 +64,53 @@ public class UmodDiffCL_PkgNotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p2")
.packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
// NOTE: module m1 does not define a package named p1.
// NOTE: module m1x does not define a package named p1.
// p1 will be loaded in an unnamed module.
Class p1_c1_class = MyDiffClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to an unnamed module)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to an unnamed module)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
/*
* @test
* @summary class p3.c3 defined in module m1 tries to access c4 defined in unnamed module.
* @summary class p3.c3 defined in module m1x tries to access c4 defined in unnamed module.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -48,10 +48,10 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> packages p3
// package p3 in m1 is exported unqualifiedly
// ClassLoader1 --> defines m1x --> packages p3
// package p3 in m1x is exported unqualifiedly
//
// class p3.c3 defined in m1 tries to access c4 defined in
// class p3.c3 defined in m1x tries to access c4 defined in
// in unnamed module.
//
// Two access attempts occur in this test:
@ -66,38 +66,38 @@ public class UmodUPkg {
// Create Layers over the boot layer to test different
// accessing scenarios of a named module to an unnamed module.
// Module m1 is a strict module and has not established
// Module m1x is a strict module and has not established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map module m1 to class loader.
// map module m1x to class loader.
// class c4 will be loaded in an unnamed module/loader.
MySameClassLoader loader = new MySameClassLoader();
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", loader);
map.put("m1x", loader);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == loader);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3
@ -106,55 +106,55 @@ public class UmodUPkg {
// Attempt access
try {
p3_c3_class.newInstance();
throw new RuntimeException("Test Failed, strict module m1, type p3.c3, should not be able to access " +
throw new RuntimeException("Test Failed, strict module m1x, type p3.c3, should not be able to access " +
"public type c4 defined in unnamed module");
} catch (IllegalAccessError e) {
}
}
// Module m1 is a strict module and has established
// Module m1x is a strict module and has established
// readability to an unnamed module that c4 is defined in.
public void test_strictModuleUnnamedReadableLayer() throws Throwable {
// Define module: m1
// Define module: m1x
// Can read: java.base
// Packages: p3
// Packages exported: p3 is exported unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.exports("p3")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
MySameClassLoader loader = new MySameClassLoader();
// map module m1 to class loader.
// map module m1x to class loader.
// class c4 will be loaded in an unnamed module/loader.
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", loader);
map.put("m1x", loader);
// Create Layer that contains m1
// Create Layer that contains m1x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == loader);
assertTrue(layer.findLoader("m1x") == loader);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p3.c3ReadEdge
Class p3_c3_class = loader.loadClass("p3.c3ReadEdge");
try {
// Read edge between m1 and the unnamed module that loads c4 is established in
// Read edge between m1x and the unnamed module that loads c4 is established in
// c3ReadEdge's ctor before attempting access.
p3_c3_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, module m1, type p3.c3ReadEdge, has established readability to " +
throw new RuntimeException("Test Failed, module m1x, type p3.c3ReadEdge, has established readability to " +
"c4 loader's unnamed module, access should be allowed: " + e.getMessage());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,9 +25,9 @@
/*
* @test
* @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2.
* @summary class c5 defined in an unnamed module tries to access p6.c6 defined in m2x.
* Access is denied, since an unnamed module can read all modules but p6 in module
* m2 is exported specifically to module m1, not to all modules.
* m2x is exported specifically to module m1x, not to all modules.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -48,15 +48,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// ClassLoader2 --> defines m2 --> packages p6
// ClassLoader1 --> defines m1x --> no packages
// ClassLoader2 --> defines m2x --> packages p6
//
// m1 can read m2
// package p6 in m2 is not exported
// m1x can read m2x
// package p6 in m2x is not exported
//
// class c5 defined in an unnamed module tries to access p6.c6 defined in m2
// class c5 defined in an unnamed module tries to access p6.c6 defined in m2x
// Access denied, an unnamed module can read all modules but p6 in module
// m2 is exported specifically to module m1 not to all modules.
// m2x is exported specifically to module m1x not to all modules.
//
public class UmodUpkgDiffCL_ExpQualOther {
@ -65,51 +65,51 @@ public class UmodUpkgDiffCL_ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: p6 exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p6 exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p6", Set.of("m1"))
.exports("p6", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m1, not unqualifiedly");
throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m1x, not unqualifiedly");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary class c5 in an unnamed module can read module m2, but package p6 in module m2 is not exported.
* Access denied since even though unnamed module can read all modules, p6 in module m2 is not exported at all.
* @summary class c5 in an unnamed module can read module m2x, but package p6 in module m2x is not exported.
* Access denied since even though unnamed module can read all modules, p6 in module m2x is not exported at all.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MyDiffClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MyDiffClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// ClassLoader2 --> defines m2 --> packages p6
// ClassLoader1 --> defines m1x --> no packages
// ClassLoader2 --> defines m2x --> packages p6
//
// m1 can read m2
// package p6 in m2 is not exported
// m1x can read m2x
// package p6 in m2x is not exported
//
// class c5 defined in unnamed module tries to access p6.c6 defined in m2
// class c5 defined in unnamed module tries to access p6.c6 defined in m2x
// Access denied since even though unnamed module can read all modules, p6
// in module m2 is not exported at all.
// in module m2x is not exported at all.
//
public class UmodUpkgDiffCL_NotExp {
@ -64,53 +64,53 @@ public class UmodUpkgDiffCL_NotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p6")
.packages(Set.of("p6"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MyDiffClassLoader.loader1);
map.put("m2", MyDiffClassLoader.loader2);
map.put("m1x", MyDiffClassLoader.loader1);
map.put("m2x", MyDiffClassLoader.loader2);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("m1x") == MyDiffClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MyDiffClassLoader.loader2);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
// NOTE: module m1 does not define any packages.
// NOTE: module m1x does not define any packages.
// c5 will be loaded in an unnamed module.
Class c5_class = MyDiffClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported to " +
throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported to " +
"an unnamed module that c5 is defined within)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if class c5 in an unnamed module can read package p6 in module m2, but package p6 in module m2 is
* exported qualifiedly to module m3, then class c5 in an unnamed module can not read p6.c6 in module m2.
* @summary Test that if class c5 in an unnamed module can read package p6 in module m2x, but package p6 in module m2x is
* exported qualifiedly to module m3x, then class c5 in an unnamed module can not read p6.c6 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p6
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p6
// defines m3x --> packages p3
//
// m1 can read m2
// package p6 in m2 is exported to m3
// m1x can read m2x
// package p6 in m2x is exported to m3x
//
// class c5 defined in m1 tries to access p6.c6 defined in m2
// Access denied since although m1 can read m2, p6 is exported only to m3.
// class c5 defined in m1x tries to access p6.c6 defined in m2x
// Access denied since although m1x can read m2x, p6 is exported only to m3x.
//
public class UmodUpkg_ExpQualOther {
@ -64,63 +64,63 @@ public class UmodUpkg_ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1 (need to define m1 to establish the Layer successfully)
// Can read: java.base, m2, m3
// Define module: m1x (need to define m1x to establish the Layer successfully)
// Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m3")
.requires("m2x")
.requires("m3x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: p6 is exported to m3
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p6 is exported to m3x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p6", Set.of("m3"))
.exports("p6", Set.of("m3x"))
.build();
// Define module: m3
// Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m3", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
// Create Layer that contains m1, m2 and m3
// Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MySameClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
throw new RuntimeException("Failed to get IAE (p6 in m2 is exported to m3, not unqualifiedly to everyone)");
throw new RuntimeException("Failed to get IAE (p6 in m2x is exported to m3x, not unqualifiedly to everyone)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test if package p6 in module m2 is not exported, then class c5
* in an unnamed module can not access p6.c2 in module m2.
* @summary Test if package p6 in module m2x is not exported, then class c5
* in an unnamed module can not access p6.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -46,13 +46,13 @@ import java.util.Map;
import java.util.Set;
import myloaders.MySameClassLoader;
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p6
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p6
//
// m1 can read m2
// package p6 in m2 is not exported
// m1x can read m2x
// package p6 in m2x is not exported
//
// class c5 defined in an unnamed module tries to access p6.c2 defined in m2
// class c5 defined in an unnamed module tries to access p6.c2 defined in m2x
// Access denied since p6 is not exported.
//
public class UmodUpkg_NotExp {
@ -62,51 +62,51 @@ public class UmodUpkg_NotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p6
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p6")
.packages(Set.of("p6"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 and m2
// Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class c5
Class c5_class = MySameClassLoader.loader1.loadClass("c5");
try {
c5_class.newInstance();
throw new RuntimeException("Failed to get IAE (p6 in m2 is not exported)");
throw new RuntimeException("Failed to get IAE (p6 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test that if package p2 in module m2 is exported to module m3,
* then class p1.c1 in an unnamed module can not read p2.c2 in module m2.
* @summary Test that if package p2 in module m2x is exported to module m3x,
* then class p1.c1 in an unnamed module can not read p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p2
// defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p2
// defines m3x --> packages p3
//
// m1 can read m2
// package p2 in m2 is exported to m3
// m1x can read m2x
// package p2 in m2x is exported to m3x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access denied since although m1 can read m2, p2 is exported only to m3.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access denied since although m1x can read m2x, p2 is exported only to m3x.
//
public class Umod_ExpQualOther {
@ -64,63 +64,63 @@ public class Umod_ExpQualOther {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1 (need to define m1 to establish the Layer successfully)
// Can read: java.base, m2, m3
// Define module: m1x (need to define m1x to establish the Layer successfully)
// Can read: java.base, m2x, m3x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m3")
.requires("m2x")
.requires("m3x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported to m3
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: p2 is exported to m3x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m3"))
.exports("p2", Set.of("m3x"))
.build();
// Define module: m3
// Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m3", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
map.put("m3x", MySameClassLoader.loader1);
// Create Layer that contains m1, m2 and m3
// Create Layer that contains m1x, m2x and m3x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m3x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is exported to m3, not unqualifiedly to everyone)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is exported to m3x, not unqualifiedly to everyone)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test if package p2 in module m2 is exported unqualifiedly,
* then class p1.c1 in an unnamed module can read p2.c2 in module m2.
* @summary Test if package p2 in module m2x is exported unqualifiedly,
* then class p1.c1 in an unnamed module can read p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -47,15 +47,15 @@ import java.util.Set;
import myloaders.MySameClassLoader;
//
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported unqualifiedly
// m1x can read m2x
// package p2 in m2x is exported unqualifiedly
//
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access allowed, an unnamed module can read all modules and p2 in module
// m2 which is exported unqualifiedly.
// m2x which is exported unqualifiedly.
public class Umod_ExpUnqual {
@ -64,44 +64,44 @@ public class Umod_ExpUnqual {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: p2 is exported unqualifiedly
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,8 @@
/*
* @test
* @summary Test if package p2 in module m2 is not exported, then class p1.c1
* in an unnamed module can not access p2.c2 in module m2.
* @summary Test if package p2 in module m2x is not exported, then class p1.c1
* in an unnamed module can not access p2.c2 in module m2x.
* @modules java.base/jdk.internal.misc
* @library /test/lib
* @compile myloaders/MySameClassLoader.java
@ -46,13 +46,13 @@ import java.util.Map;
import java.util.Set;
import myloaders.MySameClassLoader;
// ClassLoader1 --> defines m1 --> no packages
// defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> no packages
// defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is not exported
// m1x can read m2x
// package p2 in m2x is not exported
//
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2
// class p1.c1 defined in an unnamed module tries to access p2.c2 defined in m2x
// Access denied since p2 is not exported.
//
public class Umod_PkgNotExp {
@ -62,51 +62,51 @@ public class Umod_PkgNotExp {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: none
// Packages exported: none
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: none
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.contains("p2")
.packages(Set.of("p2"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
map.put("m1", MySameClassLoader.loader1);
map.put("m2", MySameClassLoader.loader1);
map.put("m1x", MySameClassLoader.loader1);
map.put("m2x", MySameClassLoader.loader1);
// Create Layer that contains m1 and m2
// Create Layer that contains m1x and m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m1x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("m2x") == MySameClassLoader.loader1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
Class p1_c1_class = MySameClassLoader.loader1.loadClass("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@ import p2.c2;
public class c1Loose {
public c1Loose() {
// Attempt access - access should succeed since m1 is a loose module
// Attempt access - access should succeed since m1x is a loose module
p2.c2 c2_obj = new p2.c2();
c2_obj.method2();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,12 +27,12 @@ import p2.c2;
public class c1ReadEdge {
public c1ReadEdge() {
// Establish read edge from module m1, where c1ReadEdge is defined,
// Establish read edge from module m1x, where c1ReadEdge is defined,
// to the unnamed module, where p2.c2 will be defined.
Module m1 = c1ReadEdge.class.getModule();
Module m1x = c1ReadEdge.class.getModule();
ClassLoader loader = c1ReadEdge.class.getClassLoader();
Module unnamed_module = loader.getUnnamedModule();
m1.addReads(unnamed_module);
m1x.addReads(unnamed_module);
// Attempt access - access should succeed
p2.c2 c2_obj = new p2.c2();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,32 +28,32 @@ import p2.c2;
public class c1ReadEdgeDiffLoader {
public c1ReadEdgeDiffLoader() {
// The goal is to establish a read edge between module m1
// The goal is to establish a read edge between module m1x
// which is the module where p1.c1ReadEdgeDiffLoader is defined,
// and the unnamed module that defines p2.c2. This must be
// done in 2 steps:
//
// Step #1: Establish a read edge between m1, where c1ReadEdgeDiffLoader
// Step #1: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
// is defined, and the System ClassLoader's unnamed module,
// where MyDiffClassLoader is defined. This read edge
// is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
//
// Step #2: Establish a read edge between m1, where c1ReadEdgeDiffLoader
// Step #2: Establish a read edge between m1x, where c1ReadEdgeDiffLoader
// is defined, and the MyDiffClassLoader.loader2's unnamed module,
// where p2.c2 will be defined.
// Step #1: read edge m1 -> System ClassLoader's unnamed module
Module m1 = c1ReadEdgeDiffLoader.class.getModule();
// Step #1: read edge m1x -> System ClassLoader's unnamed module
Module m1x = c1ReadEdgeDiffLoader.class.getModule();
ClassLoader system_loader = ClassLoader.getSystemClassLoader();
Module unnamed_module1 = system_loader.getUnnamedModule();
m1.addReads(unnamed_module1);
Module unnamed_module_one = system_loader.getUnnamedModule();
m1x.addReads(unnamed_module_one);
// Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
// Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
ClassLoader loader2 = MyDiffClassLoader.loader2;
Module unnamed_module2 = loader2.getUnnamedModule();
m1.addReads(unnamed_module2);
Module unnamed_module_two = loader2.getUnnamedModule();
m1x.addReads(unnamed_module_two);
// Attempt access - access should succeed since m1 can read
// Attempt access - access should succeed since m1x can read
// MyDiffClassLoader.loader2's unnamed module
p2.c2 c2_obj = new p2.c2();
c2_obj.method2();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,12 +26,12 @@
* import java.lang.reflect.*;
* public class c3ReadEdge {
* public c3ReadEdge() {
* // Establish read edge from module m1, where c3ReadEdge is defined,
* // Establish read edge from module m1x, where c3ReadEdge is defined,
* // to the unnamed module, where c4 will be defined.
* Module m1 = c3ReadEdge.class.getModule();
* Module m1x = c3ReadEdge.class.getModule();
* ClassLoader loader = c3ReadEdge.class.getClassLoader();
* Module unnamed_module = loader.getUnnamedModule();
* m1.addReads(unnamed_module);
* m1x.addReads(unnamed_module);
* // Attempt access - access should succeed
* c4 c4_obj = new c4();
* c4_obj.method4();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,32 +28,32 @@
*
* public class c3ReadEdgeDiffLoader {
* public c3ReadEdgeDiffLoader() {
* // The goal is to establish a read edge between module m1
* // The goal is to establish a read edge between module m1x
* // which is the module where p3.c3ReadEdgeDiffLoader is defined,
* // and the unnamed module that defines c4. This must be
* // done in 2 steps:
* //
* // Step #1: Establish a read edge between m1, where c3ReadEdgeDiffLoader
* // Step #1: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
* // is defined, and the System ClassLoader's unnamed module,
* // where MyDiffClassLoader is defined. This read edge
* // is needed before we can obtain MyDiffClassLoader.loader2's unnamed module.
* //
* // Step #2: Establish a read edge between m1, where c3ReadEdgeDiffLoader
* // Step #2: Establish a read edge between m1x, where c3ReadEdgeDiffLoader
* // is defined, and the MyDiffClassLoader.loader2's unnamed module,
* // where c4 will be defined.
*
* // Step #1: read edge m1 -> System ClassLoader's unnamed module
* Module m1 = c3ReadEdgeDiffLoader.class.getModule();
* // Step #1: read edge m1x -> System ClassLoader's unnamed module
* Module m1x = c3ReadEdgeDiffLoader.class.getModule();
* ClassLoader system_loader = ClassLoader.getSystemClassLoader();
* Module unnamed_module1 = system_loader.getUnnamedModule();
* m1.addReads(unnamed_module1);
* Module unnamed_module_one = system_loader.getUnnamedModule();
* m1x.addReads(unnamed_module_one);
*
* // Step #2: read edge m1 -> MyDiffClassLoader.loader2's unnamed module
* // Step #2: read edge m1x -> MyDiffClassLoader.loader2's unnamed module
* ClassLoader loader2 = MyDiffClassLoader.loader2;
* Module unnamed_module2 = loader2.getUnnamedModule();
* m1.addReads(unnamed_module2);
* Module unnamed_module_two = loader2.getUnnamedModule();
* m1x.addReads(unnamed_module_two);
*
* // Attempt access - should succeed since m1 can read
* // Attempt access - should succeed since m1x can read
* // MyDiffClassLoader.loader2's unnamed module
* c4 c4_obj = new c4();
* c4_obj.method4();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ public class AccessCheckAllUnnamed {
// and then test that a class in the unnamed module can access a package in a
// named module that has been exported to all unnamed modules.
public static void main(String args[]) throws Throwable {
Object m1, m2;
Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -55,16 +55,16 @@ public class AccessCheckAllUnnamed {
ClassLoader this_cldr = AccessCheckAllUnnamed.class.getClassLoader();
// Define a module for p3.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
ModuleHelper.AddModuleExportsToAllUnnamed((Module)null, "p2");
@ -74,7 +74,7 @@ public class AccessCheckAllUnnamed {
}
try {
ModuleHelper.AddModuleExportsToAllUnnamed(m2, null);
ModuleHelper.AddModuleExportsToAllUnnamed(m2x, null);
throw new RuntimeException("Failed to get the expected NPE for null package");
} catch(NullPointerException e) {
// Expected
@ -88,21 +88,21 @@ public class AccessCheckAllUnnamed {
}
try {
ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p3");
ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p3");
throw new RuntimeException("Failed to get the expected IAE for package in other module");
} catch(IllegalArgumentException e) {
// Expected
}
try {
ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p4");
ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p4");
throw new RuntimeException("Failed to get the expected IAE for package not in module");
} catch(IllegalArgumentException e) {
// Expected
}
// Export package p2 in m2 to allUnnamed.
ModuleHelper.AddModuleExportsToAllUnnamed(m2, "p2");
// Export package p2 in m2x to allUnnamed.
ModuleHelper.AddModuleExportsToAllUnnamed(m2x, "p2");
// p1.c1's ctor tries to call a method in p2.c2. This should succeed because
// p1 is in an unnamed module and p2.c2 is exported to all unnamed modules.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,10 +39,10 @@ import static jdk.test.lib.Asserts.*;
public class AccessCheckExp {
// Test that if module1 can read module2, but package p2 in module2 is not
// exported then class p1.c1 in module1 can not read p2.c2 in module2.
// Test that if module_one can read module_two, but package p2 in module_two is not
// exported then class p1.c1 in module_one can not read p2.c2 in module_two.
public static void main(String args[]) throws Throwable {
Object m1, m2;
Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -54,28 +54,28 @@ public class AccessCheckExp {
ClassLoader this_cldr = AccessCheckExp.class.getClassLoader();
// Define a module for p1.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// Make package p1 in m1 visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1, "p1");
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2, but p2.c2 is not
// exported. So should get IllegalAccessError.
ModuleHelper.AddReadsModule(m1, m2);
ModuleHelper.AddReadsModule(m1x, m2x);
Class p1_c1_class = Class.forName("p1.c1");
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported");
} catch (IllegalAccessError f) {
System.out.println(f.getMessage());
if (!f.getMessage().contains("does not export")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,16 +38,16 @@ import static jdk.test.lib.Asserts.*;
public class AccessCheckJavaBase {
// Test that a class defined to module2 always can read java.base.
// Test that a class defined to module_two always can read java.base.
public static void main(String args[]) throws Throwable {
// Get the class loader for AccessCheckJavaBase and assume it's also used to
// load class p2.c2.
ClassLoader this_cldr = AccessCheckJavaBase.class.getClassLoader();
// Define a module for p2.
Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
// p2.c2 can read its superclass java.lang.Object defined within java.base
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,10 +39,10 @@ import static jdk.test.lib.Asserts.*;
public class AccessCheckRead {
// Test that a class in a package in module1 cannot access a class in
// a package n module2 if module1 cannot read module2.
// Test that a class in a package in module_one cannot access a class in
// a package in module_two if module_one cannot read module_two.
public static void main(String args[]) throws Throwable {
Object m1, m2;
Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -54,19 +54,19 @@ public class AccessCheckRead {
ClassLoader this_cldr = AccessCheckRead.class.getClassLoader();
// Define a module for p1.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// Make package p1 in m1 visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1, "p1");
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
Class p1_c1_class = Class.forName("p1.c1");
@ -74,7 +74,7 @@ public class AccessCheckRead {
// cannot read p2's module. So should get IllegalAccessError.
try {
p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (m1 can't read m2)");
throw new RuntimeException("Failed to get IAE (m1x can't read m2x)");
} catch (IllegalAccessError e) {
System.out.println(e.getMessage());
if (!e.getMessage().contains("does not read") ||

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,17 +48,17 @@ public class AccessCheckSuper {
ClassLoader this_cldr = AccessCheckSuper.class.getClassLoader();
// Define a module for p2.
Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
// Define a module for p3.
Object m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
assertNotNull(m3, "Module should not be null");
ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
Object m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
assertNotNull(m3x, "Module should not be null");
ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
// Since a readability edge has not been established between module2
// and module3, p3.c3 cannot read its superclass p2.c2.
// Since a readability edge has not been established between module_two
// and module_three, p3.c3 cannot read its superclass p2.c2.
try {
Class p3_c3_class = Class.forName("p3.c3");
throw new RuntimeException("Failed to get IAE (can't read superclass)");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,7 @@ public class AccessCheckUnnamed {
// Test that a class in the unnamed module can not access a package in a
// named module that has not been unqualifiedly exported.
public static void main(String args[]) throws Throwable {
Object m1, m2;
Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -54,17 +54,17 @@ public class AccessCheckUnnamed {
ClassLoader this_cldr = AccessCheckUnnamed.class.getClassLoader();
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// p1.c1's ctor tries to call a method in p2.c2. This should fail because
// p1 is in the unnamed module and p2.c2 is not unqualifiedly exported.
Class p1_c1_class = Class.forName("p1.c1");
try {
Object c1_obj = p1_c1_class.newInstance();
throw new RuntimeException("Failed to get IAE (p2 in m2 is not exported to unnamed module)");
throw new RuntimeException("Failed to get IAE (p2 in m2x is not exported to unnamed module)");
} catch (IllegalAccessError f) {
System.out.println(f.getMessage());
if (!f.getMessage().contains("does not export p2 to unnamed module")) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,11 +39,11 @@ import static jdk.test.lib.Asserts.*;
public class AccessCheckWorks {
// Check that a class in a package in module1 can successfully access a
// class in module2 when module1 can read module2 and the class's package
// Check that a class in a package in module_one can successfully access a
// class in module_two when module_one can read module_two and the class's package
// has been exported.
public static void main(String args[]) throws Throwable {
Object m1, m2;
Object m1x, m2x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -55,24 +55,24 @@ public class AccessCheckWorks {
ClassLoader this_cldr = AccessCheckWorks.class.getClassLoader();
// Define a module for p1.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// Make package p1 in m1 visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1, "p1");
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2. This should work because
// p1's module can read p2's module and p2 is exported to p1's module.
ModuleHelper.AddReadsModule(m1, m2);
ModuleHelper.AddModuleExports(m2, "p2", m1);
ModuleHelper.AddReadsModule(m1x, m2x);
ModuleHelper.AddModuleExports(m2x, "p2", m1x);
Class p1_c1_class = Class.forName("p1.c1");
p1_c1_class.newInstance();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -83,21 +83,21 @@ public class CCE_module_msg {
ClassLoader this_cldr = CCE_module_msg.class.getClassLoader();
// Define a module for p2.
Object m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
Object m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
ModuleHelper.AddModuleExportsToAll(m2, "p2");
ModuleHelper.AddModuleExportsToAll(m2x, "p2");
Object p2Obj = new p2.c2();
System.out.println((String)p2Obj);
throw new RuntimeException("ClassCastException wasn't thrown, test failed.");
} catch (ClassCastException cce) {
String exception = cce.getMessage();
System.out.println(exception);
if (exception.contains("module2/p2.c2") ||
!(exception.contains("module2@") &&
if (exception.contains("module_two/p2.c2") ||
!(exception.contains("module_two@") &&
exception.contains("/p2.c2 cannot be cast to java.base/java.lang.String"))) {
throw new RuntimeException("Wrong message: " + exception);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -44,7 +44,7 @@ public class ExportTwice {
// Also, check that a package can be exported to a specific package and then
// exported unqualifiedly.
public static void main(String args[]) throws Throwable {
Object m1, m2, m3;
Object m1x, m2x, m3x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -56,37 +56,37 @@ public class ExportTwice {
ClassLoader this_cldr = ExportTwice.class.getClassLoader();
// Define a module for p1.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
// Define a module for p3.
m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p3" });
assertNotNull(m3, "Module should not be null");
ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m3, jlObject_jlrM);
m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p3" });
assertNotNull(m3x, "Module should not be null");
ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m3x, jlObject_jlrM);
// Make package p1 in m1 visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1, "p1");
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// Try to export p1 only to m2 after it was exported unqualifiedly. It
// Try to export p1 only to m2x after it was exported unqualifiedly. It
// should silently succeed.
ModuleHelper.AddModuleExports(m1, "p1", m2);
ModuleHelper.AddModuleExports(m1x, "p1", m2x);
// Export p2 to m3 then export it again unqualifiedly.
ModuleHelper.AddModuleExports(m2, "p2", m3);
ModuleHelper.AddModuleExportsToAll(m2, "p2");
// Export p2 to m3x then export it again unqualifiedly.
ModuleHelper.AddModuleExports(m2x, "p2", m3x);
ModuleHelper.AddModuleExportsToAll(m2x, "p2");
// p1.c1's ctor tries to call a method in p2.c2. This should work because
// p1's module can read p2's module and p2 is now exported unqualifiedly.
ModuleHelper.AddReadsModule(m1, m2);
ModuleHelper.AddReadsModule(m1x, m2x);
Class p1_c1_class = Class.forName("p1.c1");
p1_c1_class.newInstance();
}

View File

@ -67,8 +67,8 @@ public class IgnoreModulePropertiesTest {
}
public static void main(String[] args) throws Exception {
testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.ResolutionException");
testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.ResolutionException");
testOption("--add-modules", "java.sqlx", "jdk.module.addmods.0", "java.lang.module.FindException");
testOption("--limit-modules", "java.sqlx", "jdk.module.limitmods", "java.lang.module.FindException");
testOption("--add-reads", "xyzz=yyzd", "jdk.module.addreads.0", "WARNING: Unknown module: xyzz");
testOption("--add-exports", "java.base/xyzz=yyzd", "jdk.module.addexports.0",
"WARNING: package xyzz not in java.base");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,10 +39,10 @@ import static jdk.test.lib.Asserts.*;
public class JVMAddModuleExportToAllUnnamed {
// Check that a class in a package in module1 cannot access a class
// Check that a class in a package in module_one cannot access a class
// that is in the unnamed module if the accessing package is strict.
public static void main(String args[]) throws Throwable {
Object m1;
Object m1x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -54,13 +54,13 @@ public class JVMAddModuleExportToAllUnnamed {
ClassLoader this_cldr = JVMAddModuleExportToAllUnnamed.class.getClassLoader();
// Define a module for p1.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p1" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p1" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/here", new String[] { "p1" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Make package p1 in m1 visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1, "p1");
// Make package p1 in m1x visible to everyone.
ModuleHelper.AddModuleExportsToAll(m1x, "p1");
// p1.c1's ctor tries to call a method in p2.c2. This should not work
// because p2 is in the unnamed module and p1.c1 is strict.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ public class JVMAddModuleExportsToAll {
// and then test that a class in the unnamed module can access a package in
// a named module that has been exported unqualifiedly.
public static void main(String args[]) throws Throwable {
Object m1, m2, m3;
Object m1x, m2x, m3x;
// Get the java.lang.reflect.Module object for module java.base.
Class jlObject = Class.forName("java.lang.Object");
@ -55,16 +55,16 @@ public class JVMAddModuleExportsToAll {
ClassLoader this_cldr = JVMAddModuleExportsToAll.class.getClassLoader();
// Define a module for p3.
m1 = ModuleHelper.ModuleObject("module1", this_cldr, new String[] { "p3" });
assertNotNull(m1, "Module should not be null");
ModuleHelper.DefineModule(m1, "9.0", "m1/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m1, jlObject_jlrM);
m1x = ModuleHelper.ModuleObject("module_one", this_cldr, new String[] { "p3" });
assertNotNull(m1x, "Module should not be null");
ModuleHelper.DefineModule(m1x, "9.0", "m1x/there", new String[] { "p3" });
ModuleHelper.AddReadsModule(m1x, jlObject_jlrM);
// Define a module for p2.
m2 = ModuleHelper.ModuleObject("module2", this_cldr, new String[] { "p2" });
assertNotNull(m2, "Module should not be null");
ModuleHelper.DefineModule(m2, "9.0", "m2/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2, jlObject_jlrM);
m2x = ModuleHelper.ModuleObject("module_two", this_cldr, new String[] { "p2" });
assertNotNull(m2x, "Module should not be null");
ModuleHelper.DefineModule(m2x, "9.0", "m2x/there", new String[] { "p2" });
ModuleHelper.AddReadsModule(m2x, jlObject_jlrM);
try {
ModuleHelper.AddModuleExportsToAll((Module)null, "p2");
@ -74,7 +74,7 @@ public class JVMAddModuleExportsToAll {
}
try {
ModuleHelper.AddModuleExportsToAll(m2, null);
ModuleHelper.AddModuleExportsToAll(m2x, null);
throw new RuntimeException("Failed to get the expected NPE for null package");
} catch(NullPointerException e) {
// Expected
@ -88,26 +88,26 @@ public class JVMAddModuleExportsToAll {
}
try {
ModuleHelper.AddModuleExportsToAll(m2, "p3");
ModuleHelper.AddModuleExportsToAll(m2x, "p3");
throw new RuntimeException("Failed to get the expected IAE for package that is in another module");
} catch(IllegalArgumentException e) {
// Expected
}
try {
ModuleHelper.AddModuleExportsToAll(m2, "p4");
ModuleHelper.AddModuleExportsToAll(m2x, "p4");
throw new RuntimeException("Failed to get the expected IAE for package not in any module");
} catch(IllegalArgumentException e) {
// Expected
}
// Export package p2 in m2 unqualifiedly. Then, do a qualified export
// of p2 in m2 to m3. This should not affect the unqualified export.
m3 = ModuleHelper.ModuleObject("module3", this_cldr, new String[] { "p4" });
assertNotNull(m3, "Module m3 should not be null");
ModuleHelper.DefineModule(m3, "9.0", "m3/there", new String[] { "p4" });
ModuleHelper.AddModuleExportsToAll(m2, "p2");
ModuleHelper.AddModuleExports(m2, "p2", m3);
// Export package p2 in m2x unqualifiedly. Then, do a qualified export
// of p2 in m2x to m3x. This should not affect the unqualified export.
m3x = ModuleHelper.ModuleObject("module_three", this_cldr, new String[] { "p4" });
assertNotNull(m3x, "Module m3x should not be null");
ModuleHelper.DefineModule(m3x, "9.0", "m3x/there", new String[] { "p4" });
ModuleHelper.AddModuleExportsToAll(m2x, "p2");
ModuleHelper.AddModuleExports(m2x, "p2", m3x);
// p1.c1's ctor tries to call a method in p2.c2. This should succeed because
// p1 is in an unnamed module and p2.c2 is exported unqualifiedly.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,25 +40,25 @@ public class JVMAddModulePackage {
public static void main(String args[]) throws Throwable {
MyClassLoader cl1 = new MyClassLoader();
MyClassLoader cl3 = new MyClassLoader();
Object module1, module2, module3;
Object module_one, module_two, module_three;
boolean result;
module1 = ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
assertNotNull(module1, "Module should not be null");
ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
module2 = ModuleHelper.ModuleObject("module2", cl1, new String[] { "yourpackage" });
assertNotNull(module2, "Module should not be null");
ModuleHelper.DefineModule(module2, "9.0", "module2/here", new String[] { "yourpackage" });
module3 = ModuleHelper.ModuleObject("module3", cl3, new String[] { "package/num3" });
assertNotNull(module3, "Module should not be null");
ModuleHelper.DefineModule(module3, "9.0", "module3/here", new String[] { "package/num3" });
module_one = ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
assertNotNull(module_one, "Module should not be null");
ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" });
assertNotNull(module_two, "Module should not be null");
ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" });
module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" });
assertNotNull(module_three, "Module should not be null");
ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" });
// Simple call
ModuleHelper.AddModulePackage(module1, "new_package");
ModuleHelper.AddModulePackage(module_one, "new_package");
// Add a package and export it
ModuleHelper.AddModulePackage(module1, "package/num3");
ModuleHelper.AddModuleExportsToAll(module1, "package/num3");
ModuleHelper.AddModulePackage(module_one, "package/num3");
ModuleHelper.AddModuleExportsToAll(module_one, "package/num3");
// Null module argument, expect an NPE
try {
@ -78,7 +78,7 @@ public class JVMAddModulePackage {
// Null package argument, expect an NPE
try {
ModuleHelper.AddModulePackage(module1, null);
ModuleHelper.AddModulePackage(module_one, null);
throw new RuntimeException("Failed to get the expected NPE");
} catch(NullPointerException e) {
// Expected
@ -86,7 +86,7 @@ public class JVMAddModulePackage {
// Existing package, expect an ISE
try {
ModuleHelper.AddModulePackage(module1, "yourpackage");
ModuleHelper.AddModulePackage(module_one, "yourpackage");
throw new RuntimeException("Failed to get the expected ISE");
} catch(IllegalStateException e) {
// Expected
@ -94,7 +94,7 @@ public class JVMAddModulePackage {
// Invalid package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module1, "your.package");
ModuleHelper.AddModulePackage(module_one, "your.package");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -102,7 +102,7 @@ public class JVMAddModulePackage {
// Invalid package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module1, ";your/package");
ModuleHelper.AddModulePackage(module_one, ";your/package");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -110,7 +110,7 @@ public class JVMAddModulePackage {
// Invalid package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module1, "7[743");
ModuleHelper.AddModulePackage(module_one, "7[743");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -118,7 +118,7 @@ public class JVMAddModulePackage {
// Empty package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module1, "");
ModuleHelper.AddModulePackage(module_one, "");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -126,8 +126,8 @@ public class JVMAddModulePackage {
// Add package named "java" to an module defined to a class loader other than the boot or platform loader.
try {
// module1 is defined to a MyClassLoader class loader.
ModuleHelper.AddModulePackage(module1, "java/foo");
// module_one is defined to a MyClassLoader class loader.
ModuleHelper.AddModulePackage(module_one, "java/foo");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
if (!e.getMessage().contains("prohibited package name")) {
@ -136,10 +136,10 @@ public class JVMAddModulePackage {
}
// Package "javabar" should be ok
ModuleHelper.AddModulePackage(module1, "javabar");
ModuleHelper.AddModulePackage(module_one, "javabar");
// Package named "java" defined to the boot class loader, should be ok
Object module_javabase = module1.getClass().getModule();
Object module_javabase = module_one.getClass().getModule();
ModuleHelper.AddModulePackage(module_javabase, "java/foo");
// Package named "java" defined to the platform class loader, should be ok

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ public class JVMDefineModule {
/* Invalid test, won't compile.
// Invalid classloader argument, expect an IAE
try {
m = ModuleHelper.ModuleObject("mymodule1", new Object(), new String[] { "mypackage1" });
m = ModuleHelper.ModuleObject("mymodule_one", new Object(), new String[] { "mypackage1" });
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage1" });
throw new RuntimeException("Failed to get expected IAE for bad loader");
} catch(IllegalArgumentException e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -79,10 +79,10 @@ public class JVMGetModuleByPkgName {
}
MyClassLoader cl1 = new MyClassLoader();
Module module1 = (Module)ModuleHelper.ModuleObject("module1", cl1, new String[] { "mypackage" });
assertNotNull(module1, "Module should not be null");
ModuleHelper.DefineModule(module1, "9.0", "module1/here", new String[] { "mypackage" });
if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module1) {
Module module_one = (Module)ModuleHelper.ModuleObject("module_one", cl1, new String[] { "mypackage" });
assertNotNull(module_one, "Module should not be null");
ModuleHelper.DefineModule(module_one, "9.0", "module_one/here", new String[] { "mypackage" });
if (ModuleHelper.GetModuleByPackageName(cl1, "mypackage") != module_one) {
throw new RuntimeException("Wrong module returned for cl1 mypackage");
}
}

View File

@ -84,7 +84,7 @@ public class ModuleHelper {
}
ModuleDescriptor descriptor =
ModuleDescriptor.module(name).contains(pkg_set).build();
ModuleDescriptor.newModule(name).packages(pkg_set).build();
URI uri = URI.create("module:/" + name);
return java.lang.reflect.ModuleHelper.newModule(loader, descriptor);

View File

@ -43,7 +43,7 @@ public class ModuleOptionsTest {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"--add-modules=i_dont_exist", "--add-modules=java.base", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("ResolutionException");
output.shouldContain("FindException");
output.shouldContain("i_dont_exist");
output.shouldHaveExitValue(1);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,7 @@
*/
/**
* A custom system ClassLoader to define the module "m2" to during iterations of
* A custom system ClassLoader to define the module "m2x" to during iterations of
* differing test runs within the test ModuleStress.java
*/
public class CustomSystemClassLoader extends ClassLoader {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,15 +35,15 @@ import java.util.Map;
import java.util.Set;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader2 --> defines m2 --> packages p2
// Java System Class Loader --> defines m3 --> packages p3
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader2 --> defines m2x --> packages p2
// Java System Class Loader --> defines m3x --> packages p3
//
// m1 can read m2
// package p2 in m2 is exported to m1 and m3
// m1x can read m2x
// package p2 in m2x is exported to m1x and m3x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access allowed since m1 can read m2 and package p2 is exported to m1.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class ModuleNonBuiltinCLMain {
@ -52,62 +52,62 @@ public class ModuleNonBuiltinCLMain {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Can read: java.base, m3
// Define module: m2x
// Can read: java.base, m3x
// Packages: p2
// Packages exported: package p2 is exported to m1 and m3
// Packages exported: package p2 is exported to m1x and m3x
Set<String> targets = new HashSet<>();
targets.add("m1");
targets.add("m3");
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
targets.add("m1x");
targets.add("m3x");
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.requires("m3")
.requires("m3x")
.exports("p2", targets)
.build();
// Define module: m3
// Define module: m3x
// Can read: java.base
// Packages: p3
// Packages exported: none
ModuleDescriptor descriptor_m3 =
ModuleDescriptor.module("m3")
ModuleDescriptor descriptor_m3x =
ModuleDescriptor.newModule("m3x")
.requires("java.base")
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2, descriptor_m3);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x, descriptor_m3x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to differing user defined class loaders for this test
Map<String, ClassLoader> map = new HashMap<>();
Loader1 cl1 = new Loader1();
Loader2 cl2 = new Loader2();
ClassLoader cl3 = ClassLoader.getSystemClassLoader();
map.put("m1", cl1);
map.put("m2", cl2);
map.put("m3", cl3);
map.put("m1x", cl1);
map.put("m2x", cl2);
map.put("m3x", cl3);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == cl1);
assertTrue(layer.findLoader("m2") == cl2);
assertTrue(layer.findLoader("m3") == cl3);
assertTrue(layer.findLoader("m1x") == cl1);
assertTrue(layer.findLoader("m2x") == cl2);
assertTrue(layer.findLoader("m3x") == cl3);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -115,7 +115,7 @@ public class ModuleNonBuiltinCLMain {
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,14 +34,14 @@ import java.util.Map;
import java.util.Set;
//
// ClassLoader1 --> defines m1 --> packages p1
// ClassLoader1 --> defines m2 --> packages p2
// ClassLoader1 --> defines m1x --> packages p1
// ClassLoader1 --> defines m2x --> packages p2
//
// m1 can read m2
// package p2 in m2 is exported to m1
// m1x can read m2x
// package p2 in m2x is exported to m1x
//
// class p1.c1 defined in m1 tries to access p2.c2 defined in m2
// Access allowed since m1 can read m2 and package p2 is exported to m1.
// class p1.c1 defined in m1x tries to access p2.c2 defined in m2x
// Access allowed since m1x can read m2x and package p2 is exported to m1x.
//
public class ModuleSameCLMain {
@ -50,45 +50,45 @@ public class ModuleSameCLMain {
// publically defined classes within packages of those modules.
public void createLayerOnBoot() throws Throwable {
// Define module: m1
// Can read: java.base, m2
// Define module: m1x
// Can read: java.base, m2x
// Packages: p1
// Packages exported: p1 is exported to unqualifiedly
ModuleDescriptor descriptor_m1 =
ModuleDescriptor.module("m1")
ModuleDescriptor descriptor_m1x =
ModuleDescriptor.newModule("m1x")
.requires("java.base")
.requires("m2")
.requires("m2x")
.exports("p1")
.build();
// Define module: m2
// Define module: m2x
// Can read: java.base
// Packages: p2
// Packages exported: package p2 is exported to m1
ModuleDescriptor descriptor_m2 =
ModuleDescriptor.module("m2")
// Packages exported: package p2 is exported to m1x
ModuleDescriptor descriptor_m2x =
ModuleDescriptor.newModule("m2x")
.requires("java.base")
.exports("p2", Set.of("m1"))
.exports("p2", Set.of("m1x"))
.build();
// Set up a ModuleFinder containing all modules for this layer.
ModuleFinder finder = ModuleLibrary.of(descriptor_m1, descriptor_m2);
ModuleFinder finder = ModuleLibrary.of(descriptor_m1x, descriptor_m2x);
// Resolves "m1"
// Resolves "m1x"
Configuration cf = Layer.boot()
.configuration()
.resolveRequires(finder, ModuleFinder.of(), Set.of("m1"));
.resolve(finder, ModuleFinder.of(), Set.of("m1x"));
// map each module to the same class loader for this test
Map<String, ClassLoader> map = new HashMap<>();
Loader1 cl1 = new Loader1();
map.put("m1", cl1);
map.put("m2", cl1);
map.put("m1x", cl1);
map.put("m2x", cl1);
// Create Layer that contains m1 & m2
// Create Layer that contains m1x & m2x
Layer layer = Layer.boot().defineModules(cf, map::get);
assertTrue(layer.findLoader("m1") == cl1);
assertTrue(layer.findLoader("m2") == cl1);
assertTrue(layer.findLoader("m1x") == cl1);
assertTrue(layer.findLoader("m2x") == cl1);
assertTrue(layer.findLoader("java.base") == null);
// now use the same loader to load class p1.c1
@ -96,7 +96,7 @@ public class ModuleSameCLMain {
try {
p1_c1_class.newInstance();
} catch (IllegalAccessError e) {
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1");
throw new RuntimeException("Test Failed, an IAE should not be thrown since p2 is exported qualifiedly to m1x");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -83,7 +83,7 @@ public class ModuleStress {
InMemoryJavaCompiler.compile("p1.c1", source1), System.getProperty("test.classes"));
// Test #2: Load two modules defined to the same customer class loader.
// m1's module readability list and package p2's exportability should
// m1x's module readability list and package p2's exportability should
// not be walked at a GC safepoint since both modules are defined to
// the same loader and thus have the exact same life cycle.
pb = ProcessTools.createJavaProcessBuilder(
@ -97,7 +97,7 @@ public class ModuleStress {
.shouldHaveExitValue(0);
// Test #3: Load two modules in differing custom class loaders.
// m1's module readability list and package p2's exportability list must
// m1x's module readability list and package p2's exportability list must
// be walked at a GC safepoint since both modules are defined to non-builtin
// class loaders which could die and thus be unloaded.
pb = ProcessTools.createJavaProcessBuilder(
@ -106,15 +106,15 @@ public class ModuleStress {
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());
oa.shouldContain("module m1 reads list must be walked")
.shouldContain("package p2 defined in module m2, exports list must be walked")
.shouldNotContain("module m2 reads list must be walked")
oa.shouldContain("module m1x reads list must be walked")
.shouldContain("package p2 defined in module m2x, exports list must be walked")
.shouldNotContain("module m2x reads list must be walked")
.shouldHaveExitValue(0);
// Test #4: Load two modules in differing custom class loaders,
// of which one has been designated as the custom system class loader
// via -Djava.system.class.loader=CustomSystemClassLoader. Since
// m3 is defined to the system class loader, m2's module readability
// m3x is defined to the system class loader, m2x's module readability
// list does not have to be walked at a GC safepoint, but package p2's
// exportability list does.
pb = ProcessTools.createJavaProcessBuilder(
@ -124,8 +124,8 @@ public class ModuleStress {
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());
oa.shouldContain("package p2 defined in module m2, exports list must be walked")
.shouldNotContain("module m2 reads list must be walked")
oa.shouldContain("package p2 defined in module m2x, exports list must be walked")
.shouldNotContain("module m2x reads list must be walked")
.shouldHaveExitValue(0);
}

View File

@ -48,7 +48,7 @@ public class Main {
Configuration cf = layerBoot
.configuration()
.resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
.resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
Module testModule = Main.class.getModule();
ClassLoader scl = ClassLoader.getSystemClassLoader();

View File

@ -48,7 +48,7 @@ public class MainGC {
Configuration cf = layerBoot
.configuration()
.resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
.resolve(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
Module testModule = MainGC.class.getModule();
ClassLoader scl = ClassLoader.getSystemClassLoader();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,8 +38,8 @@ public class PatchModuleDupModule {
public static void main(String args[]) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"--patch-module=module1=module1_dir",
"--patch-module=module1=module1_dir",
"--patch-module=module_one=module_one_dir",
"--patch-module=module_one=module_one_dir",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldContain("java.lang.ExceptionInInitializerError");

View File

@ -82,12 +82,11 @@ public class JvmtiGetAllModulesTest {
Asserts.assertEquals(Layer.boot().modules(), getModulesJVMTI());
// Load a new named module
ModuleDescriptor descriptor
= ModuleDescriptor.module(MY_MODULE_NAME).build();
ModuleDescriptor descriptor = ModuleDescriptor.newModule(MY_MODULE_NAME).build();
ModuleFinder finder = finderOf(descriptor);
ClassLoader loader = new ClassLoader() {};
Configuration parent = Layer.boot().configuration();
Configuration cf = parent.resolveRequires(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
Configuration cf = parent.resolve(finder, ModuleFinder.of(), Set.of(MY_MODULE_NAME));
Layer my = Layer.boot().defineModules(cf, m -> loader);
// Verify that the loaded module is indeed reported by JVMTI

View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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 jdk.test.lib.apps.LingeredApp;
public class LingeredAppWithLargeArray extends LingeredApp {
public static void main(String args[]) {
int[] hugeArray = new int[Integer.MAX_VALUE/2];
LingeredApp.main(args);
}
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.util.ArrayList;
import java.util.List;
import java.io.File;
import java.nio.file.Files;
import java.io.IOException;
import java.io.BufferedInputStream;
import java.util.stream.Collectors;
import java.io.FileInputStream;
import sun.jvm.hotspot.HotSpotAgent;
import sun.jvm.hotspot.debugger.*;
import jdk.test.lib.apps.LingeredApp;
import jdk.test.lib.JDKToolLauncher;
import jdk.test.lib.JDKToolFinder;
import jdk.test.lib.Platform;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.Utils;
import jdk.test.lib.Asserts;
/*
* @test
* @library /test/lib
* @bug 8171084
* @requires (vm.bits == "64" & os.maxMemory > 8g)
* @modules java.base/jdk.internal.misc
* jdk.hotspot.agent/sun.jvm.hotspot
* jdk.hotspot.agent/sun.jvm.hotspot.utilities
* jdk.hotspot.agent/sun.jvm.hotspot.oops
* jdk.hotspot.agent/sun.jvm.hotspot.debugger
* @run main/timeout=1800/othervm -Xmx8g TestHeapDumpForLargeArray
*/
public class TestHeapDumpForLargeArray {
private static LingeredAppWithLargeArray theApp = null;
private static void attachAndDump(String heapDumpFileName,
long lingeredAppPid) throws Exception {
JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jhsdb");
launcher.addToolArg("jmap");
launcher.addToolArg("--binaryheap");
launcher.addToolArg("--dumpfile");
launcher.addToolArg(heapDumpFileName);
launcher.addToolArg("--pid");
launcher.addToolArg(Long.toString(lingeredAppPid));
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(launcher.getCommand());
System.out.println(
processBuilder.command().stream().collect(Collectors.joining(" ")));
OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
SAOutput.shouldHaveExitValue(0);
SAOutput.shouldNotContain("Heap segment size overflow");
SAOutput.shouldContain("truncating to");
SAOutput.shouldContain("heap written to");
SAOutput.shouldContain(heapDumpFileName);
System.out.println(SAOutput.getOutput());
}
public static void main (String... args) throws Exception {
String heapDumpFileName = "LargeArrayHeapDump.bin";
if (!Platform.shouldSAAttach()) {
System.out.println(
"SA attach not expected to work - test skipped.");
return;
}
File heapDumpFile = new File(heapDumpFileName);
if (heapDumpFile.exists()) {
heapDumpFile.delete();
}
try {
List<String> vmArgs = new ArrayList<String>();
vmArgs.add("-XX:+UsePerfData");
vmArgs.add("-Xmx8g");
vmArgs.addAll(Utils.getVmOptions());
theApp = new LingeredAppWithLargeArray();
LingeredApp.startApp(vmArgs, theApp);
attachAndDump(heapDumpFileName, theApp.getPid());
} finally {
LingeredApp.stopApp(theApp);
heapDumpFile.delete();
}
}
}

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